-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
102 lines (80 loc) · 3.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
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
cmake_minimum_required(VERSION 3.29)
project(kmp C CXX)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
message(STATUS "${CMAKE_MODULE_PATH}")
set(_source_dir "${CMAKE_CURRENT_SOURCE_DIR}/src")
set(_lib_name ${PROJECT_NAME})
set( project_TARGETS
${_lib_name}
standalone
)
find_package(SDL3 REQUIRED CONFIG REQUIRED COMPONENTS SDL3)
find_package(EASTL MODULE REQUIRED)
find_package(GLM MODULE REQUIRED)
find_package(BGFX REQUIRED)
include(cmake/utils.cmake)
# message(STATUS "${EASTL_INCLUDE_DIR}")
# message(STATUS "${CMAKE_PREFIX_PATH}/lib")
# message(STATUS "${EASTL_LIB}")
# message(STATUS "${GLM_INCLUDE_DIR}")
message(STATUS "compiler options \"${_lib_name}\" with args:")
foreach(_opt ${CMAKE_CXX_FLAGS})
message(STATUS "-- ${_opt}")
endforeach()
add_library(${_lib_name})
target_sources(${_lib_name}
PRIVATE
${_source_dir}/defs.h
${_source_dir}/base/application/app.h
${_source_dir}/base/application/app.cpp
${_source_dir}/base/memory/rpmalloc/rpmalloc.h
${_source_dir}/base/memory/rpmalloc/rpmalloc.c
${_source_dir}/base/memory/memory.h
${_source_dir}/base/memory/memory.cpp
${_source_dir}/base/memory/ptrs.h
${_source_dir}/base/types/eastl_defs.h
${_source_dir}/base/types/eastl_defs.cpp
${_source_dir}/base/types/array.h
${_source_dir}/base/types/string.h
${_source_dir}/base/logging/log.h
${_source_dir}/base/logging/log.cpp
${_source_dir}/base/time/time.h
${_source_dir}/base/time/time.cpp
${_source_dir}/base/time/timers.h
${_source_dir}/base/time/time_stamp.h
${_source_dir}/base/time/time_stamp.cpp
${_source_dir}/base/math/math.h
${_source_dir}/base/input/input_state.h
${_source_dir}/base/input/input_states/input_state_mouse.h
${_source_dir}/base/input/input_states/input_state_keyboard.h
${_source_dir}/base/input/input_system.h
${_source_dir}/base/input/input_system.cpp
${_source_dir}/base/input/input_device.h
${_source_dir}/base/input/input_devices/input_device_keyboard_mouse.h
${_source_dir}/base/input/input_devices/input_device_keyboard_mouse.cpp
${_source_dir}/base/render/renderer.h
${_source_dir}/base/render/renderer.cpp
${_source_dir}/base/filesystem/filesystem.h
${_source_dir}/base/filesystem/filesystem.cpp
${_source_dir}/thirdparty/stb_image.h
${_source_dir}/thirdparty/stb.cpp
${_source_dir}/engine/engine.cpp
${_source_dir}/engine/engine.h
${_source_dir}/engine/update_context.h
)
add_shaders_directory(shaders engine SHADERS_TARGET_NAME)
target_link_libraries(${_lib_name} PUBLIC SDL3::SDL3-static EASTL::EASTL GLM::GLM bgfx::bgfx bgfx::bimg bgfx::bx)
target_link_libraries(${_lib_name} PUBLIC ${SHADERS_TARGET_NAME})
target_include_directories(${_lib_name} PUBLIC "${_source_dir}")
add_executable(standalone "${CMAKE_CURRENT_SOURCE_DIR}/src/standalone/main.cpp")
target_link_libraries(standalone PUBLIC ${_lib_name})
foreach( _target ${project_TARGETS} )
target_compile_features(${_target} PRIVATE cxx_std_20)
set_property(TARGET ${_target} PROPERTY
MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
target_compile_options(${_target} PUBLIC "-DEASTL_USER_DEFINED_ALLOCATOR")
endforeach()
# cmake -DCMAKE_INSTALL_PREFIX=thirdparty/install -DCMAKE_PREFIX_PATH=%cd%/thirdparty/install -B thirdparty/build -S thirdparty
# cmake --build thirdparty/build
# cmake -DCMAKE_PREFIX_PATH=%cd%/thirdparty/install -B build -S.
# cmake --build build