Repository navigation
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
79 lines (63 loc) · 2.52 KB
/
Copy pathCMakeLists.txt
File metadata and controls
79 lines (63 loc) · 2.52 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
72
73
74
75
76
77
78
79
cmake_minimum_required(VERSION 3.16)
set(PROJECT_NAME "CrossGate-Legacy")
project(${PROJECT_NAME})
#-------------------------------------------------------------------------------
# [Options]
#-------------------------------------------------------------------------------
option(CGL_WITH_TEST "Build with unit tests" ON)
option(CGL_WITH_TOOLS "Build with tools" ON)
option(CGL_WITH_BINARIES "Build with binaries" ON)
include(cmake/AddressSanitizer.cmake)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set_property(GLOBAL PROPERTY USE_FOLDERS TRUE)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "Choose the type of build." FORCE)
endif()
message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
if (MSVC)
add_compile_options(/EHsc)
# Enable UTF-8 encoding for build with spdlog
add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/utf-8>")
endif()
set(CMAKE_PREFIX_PATH "${CMAKE_CURRENT_LIST_DIR}/third_party/build/${CMAKE_BUILD_TYPE};${CMAKE_PREFIX_PATH}")
set(CGL_BIN_PATH ${CMAKE_CURRENT_BINARY_DIR}/bin)
#-------------------------------------------------------------------------------
# [Dependency check] [google-test]
#-------------------------------------------------------------------------------
if (CGL_WITH_TEST)
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
find_package(GTest REQUIRED)
enable_testing()
endif()
#-------------------------------------------------------------------------------
# [build modules]
#-------------------------------------------------------------------------------
add_subdirectory(modules/common)
add_subdirectory(modules/utils)
add_subdirectory(modules/settings)
add_subdirectory(modules/trace)
add_subdirectory(modules/assets)
add_subdirectory(modules/graphics)
add_subdirectory(engines/)
add_library(cgl_all INTERFACE)
add_library(cgl::all ALIAS cgl_all)
target_link_libraries(cgl_all INTERFACE
cgl::common
cgl::utils
cgl::settings
cgl::trace
cgl::assets
)
#-------------------------------------------------------------------------------
# [build tools]
#-------------------------------------------------------------------------------
if (CGL_WITH_TOOLS)
add_subdirectory(tools/python)
endif()
#-------------------------------------------------------------------------------
# [build bin]
#-------------------------------------------------------------------------------
if (CGL_WITH_BINARIES)
add_subdirectory(bin)
endif()