-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
55 lines (41 loc) · 1.61 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
cmake_minimum_required(VERSION 3.20)
project(Simulation_PR2 VERSION 0.1 LANGUAGES CXX C)
set(CMAKE_CXX_STANDARD 20)
option(PR2_EMBEDDED_SHADERS "All shaders will be embedded into program binary" ON)
option(PR2_SHOW_DEBUG_CONSOLE "If On should open only window without a console" OFF)
add_subdirectory(externals)
add_subdirectory(utils)
# ===============================
set(PR2_LINK_LIBS PRIVATE glm
PRIVATE glfw
PRIVATE glad
PRIVATE imgui)
set(PR2_EXECUTABLE_NAME SimulationPr2)
file(GLOB RP2_SOURCE_FILES source/*.cpp)
add_executable(${PR2_EXECUTABLE_NAME} ${RP2_SOURCE_FILES})
target_link_libraries(${PR2_EXECUTABLE_NAME} ${PR2_LINK_LIBS})
if (PR2_EMBEDDED_SHADERS)
message("-- RP2: PR2_EMBEDDED_SHADERS option is ON")
target_compile_definitions(${PR2_EXECUTABLE_NAME} PRIVATE "EMBEDDED_SHADERS")
shaders_to_embedded_hpp(${PR2_EXECUTABLE_NAME} ${CMAKE_SOURCE_DIR}/shaders)
else()
message("-- RP2: PR2_EMBEDDED_SHADERS option is OFF")
endif()
if (MSVC)
target_compile_options(${PR2_EXECUTABLE_NAME} PRIVATE /W4)
if (NOT PR2_SHOW_DEBUG_CONSOLE)
message("-- RP2: PR2_SHOW_DEBUG_CONSOLE option is OFF")
set_target_properties(${PR2_EXECUTABLE_NAME} PROPERTIES
LINK_FLAGS "/ENTRY:mainCRTStartup /SUBSYSTEM:WINDOWS")
else()
message("-- RP2: PR2_SHOW_DEBUG_CONSOLE option is ON")
endif()
else()
target_compile_options(${PR2_EXECUTABLE_NAME} PRIVATE -Wall -Wextra -Wpedantic)
# It is not that simple ...
if (NOT PR2_SHOW_DEBUG_CONSOLE)
message("-- RP2: PR2_SHOW_DEBUG_CONSOLE option is OFF")
else()
message("-- RP2: PR2_SHOW_DEBUG_CONSOLE option is ON")
endif()
endif()