-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
102 lines (77 loc) · 1.86 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
# BASIC SETUP
cmake_minimum_required(VERSION 3.30)
project(
loki
VERSION 0.1.0
LANGUAGES CXX
)
# CONFIG
include(cmake/LocalConfig.cmake OPTIONAL)
# todo make it work
set(BUILD_SHARED_LIBS OFF CACHE BOOL "Compile loki as a shared library. If OFF, all dependencies will be linked to statically." FORCE)
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_LINKER_TYPE LLD)
# HELPERS
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
include(MacroEnsureOutOfSourceBuild)
include(LoggingHelpers)
include(DependenciesHelpers)
include(ModulesHelpers)
# Enforce good practise
macro_ensure_out_of_source_build("You must use an out-of-source build.")
# DEPENDENCIES
set(SFML_STATIC_LIBRARIES ON)
list(APPEND LOKI_DEPS_LIST
#"nlohmann_json, 3.9"
"fmt, 10.2"
"SFML, 2.6, graphics window system audio"
"yaml-cpp, 0.8"
"box2d, 2.4"
"EnTT, 3.13")
loki_find_all_deps("${LOKI_DEPS_LIST}")
# extern
add_subdirectory(extern)
# TARGETS
# All modules (+global) target
loki_create_modules(
core
editor
graphics
gui
physics
system
tiles
)
# APP
add_subdirectory(src/loki-runtime)
# DOCS
option(LOKI_DOCS "Generate docs with Doxygen and Sphinx." ON)
if (LOKI_DOCS)
add_subdirectory(docs)
endif ()
# INSTALL
# Targets
install(
EXPORT loki_targets
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/loki"
NAMESPACE loki::
FILE lokiTargets.cmake
)
# Config
include(CMakePackageConfigHelpers)
configure_package_config_file(
cmake/lokiConfig.cmake.in lokiConfig.cmake
INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/loki"
PATH_VARS SFML_DIR
)
# Version
write_basic_package_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/lokiConfigVersion.cmake"
COMPATIBILITY SameMajorVersion
)
install(
FILES "${CMAKE_CURRENT_BINARY_DIR}/lokiConfigVersion.cmake"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/loki"
)