-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
111 lines (91 loc) · 3.63 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
cmake_minimum_required(VERSION 3.8 FATAL_ERROR)
project(gameoflife LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Add submodules
add_subdirectory(submodules/sdl3)
#imgui does not provide a CMakeLists.txt file, so we need to add it manually
add_subdirectory(cmake/imgui)
# 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/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/sdl3/include submodules/imgui)
# Link against SDL3 and ImGui libraries
target_link_libraries(gameoflife PRIVATE SDL3::SDL3 imgui)
# 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)