-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
70 lines (53 loc) · 1.85 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
cmake_minimum_required(VERSION 3.5)
project(Jerboa)
option(RELEASE On)
set(CMAKE_CXX_STANDARD 17)
if (RELEASE)
set(CMAKE_BUILD_TYPE Release)
else()
set(CMAKE_BUILD_TYPE Debug)
endif()
string(TIMESTAMP TODAY "%Y-%m-%d:%H:%M:%S")
add_compile_definitions(TIMESTAMP="${TODAY}")
if (RELEASE)
add_compile_definitions(BUILD_TYPE="Release")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-trapping-math -fno-rounding-math -fno-signaling-nans -fno-signed-zeros")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread -O3 -Wall")
else ()
add_compile_definitions(BUILD_TYPE="Debug")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread -g -Wall")
endif ()
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}")
set(CMAKE_BUILD_RPATH ".")
find_package(Vulkan REQUIRED)
include_directories(${Vulkan_INCLUDE_DIR})
SET(CMAKE_FIND_LIBRARY_SUFFIXES ".so")
add_subdirectory(include/vendored/glm)
add_subdirectory(include/vendored/glfw)
include_directories(include/vendored/glfw/include)
include_directories(include include/vendored)
include_directories(include include/vendored/VulkanSDK/Include)
include_directories(src)
file(GLOB SRC
"src/*.cpp"
"src/Renderer/*.cpp"
"src/Shader/*.cpp"
)
if (WINDOWS)
add_compile_definitions(WINDOWS)
set(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++ -static")
if (RELEASE)
# launch as windows, not console app - so cmd does not open as well
add_link_options(-mwindows)
endif ()
link_directories(include/vendored/VulkanSDK/Windows/Lib)
else()
# so nautilus etc recognise target as executable rather than .so
add_link_options(-no-pie)
link_directories(include/vendored/VulkanSDK/Linux/Lib)
endif()
if (VALIDATION)
add_compile_definitions(VALIDATION)
endif()
add_executable(HelloVK ${SRC})
target_link_libraries(HelloVK glm ${Vulkan_LIBRARIES} glfw shaderc_combined)