This repository has been archived by the owner on Sep 14, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathCMakeLists.txt
136 lines (114 loc) · 4.03 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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
if (${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
message(FATAL_ERROR "Prevented in-tree built. Please create a build directory outside of the source code and call cmake from there")
endif ()
cmake_minimum_required(VERSION 3.9)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
if (WIN32)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
endif ()
set(SHIVA_ROOT_REPO ${CMAKE_CURRENT_SOURCE_DIR})
message(STATUS "shiva dir -> ${SHIVA_ROOT_REPO}")
##! Project
project(shiva VERSION 1.0)
##! Prerequisites CTEST
enable_testing()
set(BUILD_TESTING false CACHE BOOL "")
##! Project options
option(SHIVA_BUILD_TESTS "Build tests of shiva C++ engine" OFF)
option(SHIVA_BUILD_EXAMPLES "Build examples of shiva C++ engine" ON)
option(SHIVA_USE_BOX2D "Build shiva with box2d plugin" OFF)
option(SHIVA_USE_IMGUI "Build shiva with imgui plugin" OFF)
option(SHIVA_USE_SFML_AS_RENDERER "Build shiva with SFML rendering" OFF)
option(SHIVA_INSTALL_PLUGINS "Build shiva with SFML rendering" OFF)
option(DISABLE_INSTALL_SHIVA_CORE "Disable install main targets" OFF)
option(USE_PROJECT_IN_AN_IDE "Workaround for install header only library option, put it to ON if u use CLION" OFF)
option(SHIVA_BUILD_EDITOR "Shiva build editor" OFF)
add_subdirectory(vendor/sol2)
add_subdirectory(vendor/spdlog)
add_subdirectory(vendor/entt)
add_subdirectory(vendor/json)
##! CMake Path
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
include(library)
##! Project modules
add_subdirectory(modules)
##! Project tests
if (SHIVA_BUILD_TESTS)
add_subdirectory(tests)
endif ()
##! Project examples
if (SHIVA_BUILD_EXAMPLES)
add_subdirectory(examples)
endif ()
if (SHIVA_BUILD_EDITOR AND SHIVA_USE_IMGUI)
add_subdirectory(editor)
endif()
##! main library
add_library(shiva INTERFACE)
add_library(shiva::shiva ALIAS shiva)
target_link_libraries(shiva INTERFACE
shiva::dll
shiva::ecs
shiva::entt
shiva::enums
shiva::error
shiva::event
shiva::filesystem
shiva::input
shiva::json
# shiva::lua
shiva::meta
shiva::pp
# shiva::pyscripting
shiva::range
shiva::reflection
shiva::shiva-spdlog
shiva::stacktrace
shiva::timer
shiva::world
)
##! Install
if (NOT DISABLE_INSTALL_SHIVA_CORE)
if (NOT USE_PROJECT_IN_AN_IDE AND NOT SHIVA_INSTALL_PLUGINS)
include(GNUInstallDirs)
include(CMakePackageConfigHelpers)
write_basic_package_version_file(
"${PROJECT_BINARY_DIR}/shiva-version-config.cmake"
VERSION 1.0
COMPATIBILITY AnyNewerVersion
)
install(TARGETS
shiva
EXPORT shiva-targets
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
install(DIRECTORY
${CMAKE_CURRENT_SOURCE_DIR}/modules
DESTINATION
${CMAKE_INSTALL_INCLUDEDIR}/shiva
FILES_MATCHING PATTERN "*.h*" PATTERN "*.lua" PATTERN "*.cpp"
)
install(DIRECTORY
${CMAKE_CURRENT_SOURCE_DIR}/tools
DESTINATION
${CMAKE_INSTALL_DATADIR}/shiva)
install(EXPORT shiva-targets
FILE shiva-targets.cmake
NAMESPACE shiva::
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/shiva
)
configure_package_config_file(
"${PROJECT_SOURCE_DIR}/cmake/shiva-config.cmake.in"
"${PROJECT_BINARY_DIR}/shiva-config.cmake"
INSTALL_DESTINATION lib/cmake/shiva
)
install(FILES
"${PROJECT_BINARY_DIR}/shiva-config.cmake"
"${PROJECT_BINARY_DIR}/shiva-version-config.cmake"
"${PROJECT_SOURCE_DIR}/cmake/x64-windows-shiva.cmake"
DESTINATION lib/cmake/shiva)
endif ()
endif ()