forked from Cervidellus/GameOfLife
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
126 lines (108 loc) · 3.98 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
cmake_minimum_required(VERSION 3.8 FATAL_ERROR)
project(gameoflife LANGUAGES CXX)
include(CheckCXXCompilerFlag)
check_cxx_compiler_flag("-std=c++20" COMPILER_SUPPORTS_CXX20)
if (NOT COMPILER_SUPPORTS_CXX20)
message(FATAL_ERROR "Compiler does not support C++20")
endif()
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Add submodules
set(SDL_EXAMPLES ON)
add_subdirectory(submodules/sdl3)
#imgui does not provide a CMakeLists.txt file, so we need to add it manually
add_subdirectory(cmake/imgui)
cmake_policy(SET CMP0072 NEW)
find_package(OpenGL REQUIRED)
find_package(GLEW REQUIRED)
# Add the executable
add_executable(gameoflife
src/main.cpp
src/core.cpp
src/core.hpp
src/model/abstract_model.hpp
src/model/modelparameters.hpp
src/model/ColorMapper.hpp
src/model/ColorMapper.cpp
src/model/CpuModel.cpp
src/model/CpuModel.hpp
src/model/GlRenderer.cpp
src/model/GlRenderer.hpp
src/model/LifeQuadTree.hpp
src/model/LifeQuadTree.cpp
src/model/LifeQuadTreeModel.hpp
src/model/LifeQuadTreeModel.cpp
src/presets/modelpresets.hpp
src/sdl_manager.cpp
src/sdl_manager.hpp
src/gui/gui.cpp
src/gui/gui.hpp
src/gui/interface.cpp
src/gui/interface.hpp
src/gui/mainwindow.cpp
src/gui/mainwindow.hpp
src/gui/WidgetFunctions.hpp
src/gui/WidgetFunctions.cpp
submodules/ImGuiScope/ImGuiScope.hpp
submodules/ImGuiScope/ImGuiScope.cpp
submodules/ImGuiScope/TimerResultBuffer.hpp
submodules/ImGuiScope/TimerResultBuffer.cpp
)
# Include directories for gameoflife
target_include_directories(gameoflife PRIVATE src submodules submodules/sdl3/include submodules/imgui)
# Link against SDL3 and ImGui libraries
target_link_libraries(gameoflife PRIVATE SDL3::SDL3 imgui
${OPENGL_LIBRARIES} ${GLEW_LIBRARIES})
# Set output directories for ImGui library
set_target_properties(imgui PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/Debug"
ARCHIVE_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/Release"
)
# Copy resources
add_custom_command(
TARGET gameoflife POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_SOURCE_DIR}/resources
$<TARGET_FILE_DIR:gameoflife>/resources
)
#copy SDL3.dll
#add_custom_command(
# TARGET gameoflife
# POST_BUILD
#
# COMMAND ${CMAKE_COMMAND} -E echo "Copying SDL3.dll from: $<IF:$<CONFIG:Debug>,${CMAKE_SOURCE_DIR}/build/submodules/sdl3/Debug/SDL3.dll,${CMAKE_SOURCE_DIR}/build/submodules/sdl3/Release/SDL3.dll>"
#
# COMMAND ${CMAKE_COMMAND} -E copy
# $<IF:$<CONFIG:Debug>,${CMAKE_SOURCE_DIR}/build/submodules/sdl3/Debug/SDL3.dll,${CMAKE_SOURCE_DIR}/build/submodules/sdl3/Release/SDL3.dll>
# $<TARGET_FILE_DIR:gameoflife>
#
# # COMMAND ${CMAKE_COMMAND} -E copy
# # $<IF:$<CONFIG:Release>, ${CMAKE_SOURCE_DIR}/build/submodules/sdl3/Debug/SDL3.dll, ${CMAKE_SOURCE_DIR}/build/submodules/sdl3/Release/SDL3.dll>
# # ${CMAKE_SOURCE_DIR}/build/submodules/sdl3/Release/SDL3.dll
# # $<TARGET_FILE_DIR:gameoflife>
#)
#copy imgui
#add_custom_command(
# TARGET gameoflife
# POST_BUILD
#
# COMMAND ${CMAKE_COMMAND} -E echo "Copying imgui.dll from: $<IF:$<CONFIG:Debug>,${CMAKE_SOURCE_DIR}/build/cmake/imgui/Debug/imgui.dll,${CMAKE_SOURCE_DIR}/build/cmake/imgui/Release/imgui.dll>"
#
# COMMAND ${CMAKE_COMMAND} -E copy
# $<IF:$<CONFIG:Debug>,${CMAKE_SOURCE_DIR}/build/cmake/imgui/Debug/imgui.dll,${CMAKE_SOURCE_DIR}/build/cmake/imgui/Release/imgui.dll>
# $<TARGET_FILE_DIR:gameoflife>
#)
#if(CMAKE_BUILD_TYPE STREQUAL "Debug")
# message(STATUS "Debug: YES")
#else()
# message(STATUS "Debug: NO")
#endif()
# Uncomment if you need to add another executable
# add_executable(quadtreetest
# QuadTreeTest/QuadTreeTest.cpp
# src/model/LifeQuadTree.hpp
# src/model/LifeQuadTree.cpp
# src/model/LifeQuadTreeModel.hpp
# src/model/LifeQuadTreeModel.cpp
# )
# target_include_directories(quadtreetest PRIVATE src submodules/sdl3/include)