-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
145 lines (119 loc) · 4.75 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
137
138
139
140
141
142
143
144
145
cmake_minimum_required(VERSION 3.16.3)
project(theia VERSION 1.1.8 LANGUAGES C CXX)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/CMakeModules")
list(APPEND CMAKE_PREFIX_PATH "${theia_BINARY_DIR}/cmake")
list(APPEND CMAKE_MODULE_PATH "${theia_SOURCE_DIR}/carbin_cmake")
list(APPEND CMAKE_MODULE_PATH "${theia_SOURCE_DIR}/carbin_cmake/arch")
list(APPEND CMAKE_MODULE_PATH "${theia_SOURCE_DIR}/carbin_cmake/copts")
list(APPEND CMAKE_MODULE_PATH "${theia_SOURCE_DIR}/carbin_cmake/modules")
list(APPEND CMAKE_MODULE_PATH "${theia_SOURCE_DIR}/carbin_cmake/package")
list(APPEND CMAKE_MODULE_PATH "${theia_SOURCE_DIR}/carbin_cmake/recipes")
include(theia_package_config)
include(TheiaBuildType)
include(TheiaInstallDirs)
include(TheiaInternalUtils)
include(TheiaVersion)
set_policies(TYPE NEW POLICIES CMP0072 CMP0077)
option(BUILD_SHARED_LIBS "Build shared/static library" ON)
find_package(Boost REQUIRED)
find_package(FontConfig QUIET)
find_package(FreeImage QUIET)
find_package(Freetype REQUIRED)
find_package(Sphinx QUIET)
if(UNIX)
dependency_check(FontConfig_FOUND
"FontConfig is required on non-windows OS")
endif()
option(FG_BUILD_EXAMPLES
"Build Examples" OFF)
option(FG_WITH_FREEIMAGE
"Use FreeImage to add support for saving framebuffer to disk"
${FreeImage_FOUND})
option(FG_USE_STATIC_FREEIMAGE
"Use static version of freeimage" OFF)
option(FG_USE_STATIC_CPPFLAGS
"Use static libstdc++ & libgcc for generating theia library" OFF)
set(FG_USE_WINDOW_TOOLKIT "glfw3" CACHE STRING "Choose Window toolkit")
set_property(CACHE FG_USE_WINDOW_TOOLKIT PROPERTY STRINGS "glfw3" "sdl2")
set(FG_RENDERING_BACKEND "OpenGL" CACHE STRING "Choose Rendering Backend")
set_property(CACHE FG_RENDERING_BACKEND PROPERTY STRINGS "OpenGL")
mark_as_advanced(
FG_USE_STATIC_FREEIMAGE
FG_USE_STATIC_CPPFLAGS)
fg_deprecate(BUILD_DOCS FG_BUILD_DOCS)
fg_deprecate(BUILD_EXAMPLES FG_BUILD_EXAMPLES)
fg_deprecate(WITH_FREEIMAGE FG_WITH_FREEIMAGE)
fg_deprecate(USE_STATIC_FREEIMAGE FG_USE_STATIC_FREEIMAGE)
fg_deprecate(WITH_TOOLKIT FG_USE_WINDOW_TOOLKIT)
if(Boost_FOUND AND NOT TARGET Boost::boost)
add_library(Boost::boost INTERFACE IMPORTED)
set_property(TARGET Boost::boost
PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${Boost_INCLUDE_DIRS})
endif(Boost_FOUND AND NOT TARGET Boost::boost)
add_subdirectory(src/glad)
add_subdirectory(src/backend/common)
add_subdirectory(src/backend/glsl_shaders)
add_subdirectory(src/api/c)
add_subdirectory(src/api/cpp)
add_subdirectory(src/backend)
#--------------------------------------------------------------------
# Install include folder, docs, examples etc.
#--------------------------------------------------------------------
install(DIRECTORY include/
DESTINATION ${FG_INSTALL_INC_DIR}
COMPONENT theia_dev
FILES_MATCHING
PATTERN "*.h"
PATTERN "*.hpp"
PATTERN ".gitignore" EXCLUDE)
install(FILES ${theia_BINARY_DIR}/include/theia/fg/version.h
DESTINATION "${FG_INSTALL_INC_DIR}/theia/fg/"
COMPONENT theia_dev)
# install the examples irrespective of the FG_BUILD_EXAMPLES value
# only the examples source files are installed, so the installation of these
# source files does not depend on FG_BUILD_EXAMPLES
# when FG_BUILD_EXAMPLES is OFF, the examples source is installed without
# building the example executables
install(DIRECTORY examples/ #NOTE The slash at the end is important
DESTINATION ${FG_INSTALL_EXAMPLE_DIR}
COMPONENT theia_dev)
include(CMakePackageConfigHelpers)
write_basic_package_version_file(
"${theia_BINARY_DIR}/theiaConfigVersion.cmake"
COMPATIBILITY SameMajorVersion)
# export install config file
set(INCLUDE_DIRS include)
set(CMAKE_DIR ${FG_INSTALL_CMAKE_DIR})
configure_package_config_file(
"${theia_SOURCE_DIR}/CMakeModules/theiaConfig.cmake.in"
"cmake_install/theiaConfig.cmake"
INSTALL_DESTINATION "${FG_INSTALL_CMAKE_DIR}"
PATH_VARS INCLUDE_DIRS CMAKE_DIR
)
install(FILES ${theia_BINARY_DIR}/cmake_install/theiaConfig.cmake
${theia_BINARY_DIR}/theiaConfigVersion.cmake
DESTINATION ${FG_INSTALL_CMAKE_DIR}
COMPONENT theia_dev
)
install(EXPORT theiaTargets
NAMESPACE theia::
DESTINATION ${FG_INSTALL_CMAKE_DIR}
COMPONENT theia_dev
)
# export build tree targets config file
set(INCLUDE_DIRS "${theia_SOURCE_DIR}/include" "${theia_BINARY_DIR}/include")
set(CMAKE_DIR "${theia_BINARY_DIR}")
configure_package_config_file(
"${theia_SOURCE_DIR}/CMakeModules/theiaConfig.cmake.in"
"theiaConfig.cmake"
INSTALL_DESTINATION "${theia_BINARY_DIR}"
PATH_VARS INCLUDE_DIRS CMAKE_DIR
INSTALL_PREFIX "${theia_BINARY_DIR}"
)
export(EXPORT theiaTargets
NAMESPACE theia::
FILE theiaTargets.cmake
)
conditional_directory(FG_BUILD_EXAMPLES examples)
include(carbin_cpack)