-
-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathCMakeLists.txt
179 lines (148 loc) · 4.85 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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
cmake_minimum_required(VERSION 3.25)
project(mrv2)
cmake_policy(SET CMP0091 NEW)
cmake_policy(SET CMP0114 NEW)
if( POLICY CMP0135 )
cmake_policy(SET CMP0135 NEW)
endif()
if(APPLE)
message( STATUS "-------------------------------------------------" )
message( STATUS "Building for macOS ${CMAKE_OSX_DEPLOYMENT_TARGET}" )
message( STATUS "-------------------------------------------------" )
endif()
#
# Sanity checks
#
if(TLRENDER_NDI)
if(NOT EXISTS "${TLRENDER_NDI_SDK}")
message(FATAL_ERROR "TLRENDER_NDI is ON but TLRENDER_NDI_SDK does not exist!\n${TLRENDER_NDI_SDK}")
endif()
endif()
include(cmake/version.cmake )
include(cmake/options.cmake )
include(cmake/functions.cmake )
if (APPLE)
message(STATUS "OLD_DYLD_LIBRARY_PATH=$ENV{OLD_DYLD_LIBRARY_PATH}")
message(STATUS "-------------------------------------------------")
message(STATUS "DYLD_LIBRARY_PATH=$ENV{DYLD_LIBRARY_PATH}")
message(STATUS "-------------------------------------------------")
elseif(UNIX)
message(STATUS "OLD_LD_LIBRARY_PATH=$ENV{OLD_LD_LIBRARY_PATH}")
message(STATUS "LD_LIBRARY_PATH=$ENV{LD_LIBRARY_PATH}")
message(STATUS "-------------------------------------------------")
else()
message(STATUS "OLD_PATH=$ENV{OLD_PATH}")
message(STATUS "PATH=$ENV{PATH}")
message(STATUS "-------------------------------------------------")
endif()
#
# Fetch the tlRender library as a submodule with git.
#
if(GIT_SUBMODULE)
find_package(Git REQUIRED)
message(STATUS "Update/init tlRender's submodules (FSeq, etc)")
execute_process(
COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/
RESULT_VARIABLE GIT_SUBMOD_RESULT)
if(NOT GIT_SUBMOD_RESULT EQUAL "0")
message(FATAL_ERROR "${GIT_EXECUTABLE} submodule update --init --recursive failed with ${GIT_SUBMOD_RESULT}, please checkout submodules")
endif()
endif()
# Omit superfluous "Up-to-date" messages.
if(NOT DEFINED CMAKE_INSTALL_MESSAGE)
set(CMAKE_INSTALL_MESSAGE "LAZY")
endif()
#
# Python cannot be built with asan dependencies
#
set(PYTHON_DEP )
if(BUILD_PYTHON )
include(cmake/Modules/BuildPython.cmake )
if(UNIX)
set(Python_EXECUTABLE ${CMAKE_INSTALL_PREFIX}/bin/python${Python_VERSION})
else()
set(Python_EXECUTABLE ${CMAKE_INSTALL_PREFIX}/bin/python.exe )
endif()
else()
set(Python_EXECUTABLE "$ENV{PYTHONEXE}")
set(Python_VERSION "$ENV{PYTHON_VERSION}")
message(STATUS "Python EXECUTABLE=${Python_EXECUTABLE}")
if (NOT Python_EXECUTABLE)
# As a last resort...
if (UNIX)
set(Python_EXECUTABLE python3)
else()
set(Python_EXECUTABLE python.exe)
endif()
endif()
endif()
set(PYTHON_EXECUTABLE ${Python_EXECUTABLE})
if(CMAKE_BUILD_TYPE MATCHES "^Debug$")
# Check for Clang or GCC compiler (@todo: add Microsoft support)
if (TLRENDER_ASAN AND
((CMAKE_CXX_COMPILER_ID MATCHES "Clang") OR
(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")))
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address -fno-omit-frame-pointer")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fno-omit-frame-pointer")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fsanitize=address")
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -fsanitize=address")
endif()
endif()
set( Gettext_DEP )
if(BUILD_GETTEXT)
include(cmake/Modules/BuildGettext.cmake )
elseif(APPLE)
if (NOT CMAKE_OSX_ARCHITECTURES OR CMAKE_OSX_ARCHITECTURES STREQUAL "")
message(WARNING
"Target architecture not specified for macOS deployment")
if(CMAKE_OSX_ARCHITECTURES MATCHES "^x86_64$")
#
# brew .dylibs are compiled only for the current version of the OS.
#
# We distribute libintl dylib compatible with v10.5 on Intel macOS
file(COPY
precompiled/macOS/v10.5/ DESTINATION ${CMAKE_INSTALL_PREFIX}/
FOLLOW_SYMLINK_CHAIN)
endif()
endif()
endif()
set(libbacktrace_DEP )
if(UNIX AND NOT APPLE)
include(cmake/Modules/Buildlibbacktrace.cmake)
endif()
set(PYBIND11_DEP )
if(MRV2_PYBIND11)
include(cmake/Modules/Buildpybind11.cmake)
endif()
add_subdirectory( tlRender/etc/SuperBuild)
set(FLTK_DEP )
if(BUILD_FLTK)
include(cmake/Modules/BuildFLTK.cmake)
endif()
if(BUILD_PYTHON AND TLRENDER_USD)
add_dependencies(USD ${PYTHON_DEP})
endif()
set(pyFLTK_DEP )
if(MRV2_PYFLTK)
include(cmake/Modules/BuildpyFLTK.cmake)
endif()
# OpenSSL must be built before Python and pyFLTK to use the right path when
# building Python's _ssl module.
if(TLRENDER_NET AND NOT WIN32)
if (BUILD_PYTHON)
add_dependencies(Python OpenSSL)
endif()
endif()
set(POCO_DEP )
if(MRV2_NETWORK)
include(cmake/Modules/BuildPoco.cmake)
endif()
set(LibHaru_DEP )
if(MRV2_PDF)
include(cmake/Modules/BuildLibHaru.cmake)
endif()
if(BUILD_MRV2)
include(cmake/Modules/Buildmrv2.cmake)
endif()