-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
109 lines (92 loc) · 2.74 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
cmake_minimum_required(VERSION 3.28)
project(based-engine LANGUAGES CXX)
add_compile_definitions(_DEBUG)
# source files
set(SRC_DIR ${PROJECT_SOURCE_DIR}/src)
file(GLOB_RECURSE HEADER_FILES CONFIGURE_DEPENDS "${SRC_DIR}/*.hpp")
file(GLOB_RECURSE SOURCE_FILES CONFIGURE_DEPENDS "${SRC_DIR}/*.cpp")
# use CPM
include(cmake/CPM.cmake)
# GLFW & IMGUI
CPMAddPackage(
NAME imgui_cmake_wrapper
GITHUB_REPOSITORY matekdev/imgui_cmake_wrapper
GIT_TAG main
)
# GLOG
CPMAddPackage(
NAME glog
GITHUB_REPOSITORY google/glog
GIT_TAG v0.5.0
)
option(BUILD_TESTS "Build tests" OFF)
# ENTT
CPMAddPackage(
NAME EnTT
VERSION 3.13.2
GITHUB_REPOSITORY skypjack/entt
DOWNLOAD_ONLY True
)
if(EnTT_ADDED)
add_library(EnTT INTERFACE)
target_include_directories(EnTT SYSTEM INTERFACE ${EnTT_SOURCE_DIR}/src)
endif()
# GLM
CPMAddPackage(
NAME glm
GITHUB_REPOSITORY g-truc/glm
GIT_TAG 0.9.9.8
)
# ASSIMP
CPMAddPackage(
NAME assimp
GITHUB_REPOSITORY assimp/assimp
GIT_TAG v5.3.1
)
option(ASSIMP_BUILD_TESTS "ASSIMP_BUILD_TESTS" OFF)
# PHYSX
include_directories(physx/include)
set(PHYSX_DIR ${PROJECT_SOURCE_DIR}/physx)
set(PHYSX_LIB ${PROJECT_SOURCE_DIR}/physx/libs)
add_executable(${PROJECT_NAME} ${SOURCE_FILES} ${HEADER_FILES})
target_include_directories(${PROJECT_NAME} PUBLIC src)
set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 23)
target_link_libraries(${PROJECT_NAME} PRIVATE
glm
imgui_cmake_wrapper
glog
EnTT
assimp
# physx
${PHYSX_LIB}/PhysXExtensions_static_64.lib
${PHYSX_LIB}/PhysX_64.lib
${PHYSX_LIB}/PhysXPvdSDK_static_64.lib
${PHYSX_LIB}/PhysXCommon_64.lib
${PHYSX_LIB}/PhysXFoundation_64.lib
)
# Copy shader files
add_custom_target(copy_shaders ALL
COMMAND ${CMAKE_COMMAND} -E copy_directory
${PROJECT_SOURCE_DIR}/shaders
${PROJECT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/shaders
COMMENT "Copying shaders into binary directory")
# Copy model/texture files
add_custom_target(copy_models ALL
COMMAND ${CMAKE_COMMAND} -E copy_directory
${PROJECT_SOURCE_DIR}/models
${PROJECT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/models
COMMENT "Copying models/textures into binary directory")
# Copy font files
add_custom_target(copy_font ALL
COMMAND ${CMAKE_COMMAND} -E copy_directory
${PROJECT_SOURCE_DIR}/font
${PROJECT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/font
COMMENT "Copying fonts into binary directory")
# Copy physx dll
file(GLOB PHYSX_DLLS "${PHYSX_DIR}/dll/*")
add_custom_target(copy_physx_dll ALL
COMMAND ${CMAKE_COMMAND} -E copy
${PHYSX_DLLS}
${PROJECT_BINARY_DIR}/${CMAKE_CFG_INTDIR}
COMMENT "Copying all physx dlls into binary directory")
add_dependencies(${PROJECT_NAME} copy_shaders copy_models copy_font copy_physx_dll)