-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
71 lines (60 loc) · 1.49 KB
/
CMakeLists.txt
File metadata and controls
71 lines (60 loc) · 1.49 KB
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
cmake_minimum_required(VERSION 3.16)
project(Lenia)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Platform-specific settings
if(MSVC)
add_compile_options(/W4)
else()
add_compile_options(-Wall -Wextra -Wpedantic)
endif()
# Find dependencies
find_package(glfw3 3.3 REQUIRED)
find_package(glm REQUIRED)
find_package(imgui REQUIRED)
find_package(OpenGL REQUIRED)
# Add source files
file(GLOB_RECURSE SOURCES
"src/*.cpp"
)
file(GLOB_RECURSE HEADERS
"src/*.hpp"
"src/*.h"
)
# Create executable
add_executable(Lenia ${SOURCES} ${HEADERS})
# Link libraries
target_link_libraries(Lenia PRIVATE
glfw
glm::glm
imgui::imgui
OpenGL::GL
)
# Include directories
target_include_directories(Lenia PRIVATE
${PROJECT_SOURCE_DIR}/src
${PROJECT_SOURCE_DIR}/libs
)
# Platform-specific configurations
if(WIN32)
set_target_properties(Lenia PROPERTIES
WIN32_EXECUTABLE ON
)
if(MSVC)
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT Lenia)
endif()
endif()
# Copy assets to build directory
add_custom_command(TARGET Lenia POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_SOURCE_DIR}/assets
$<TARGET_FILE_DIR:Lenia>/assets
COMMENT "Copying assets..."
)
# Copy initial colormap data
add_custom_command(TARGET Lenia POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_SOURCE_DIR}/bin/colormap
$<TARGET_FILE_DIR:Lenia>/colormap
COMMENT "Copying colormaps..."
)