-
-
Notifications
You must be signed in to change notification settings - Fork 142
/
CMakeLists.txt
197 lines (146 loc) · 5.82 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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
################################################################################
# Copyright 1998-2018 by authors (see AUTHORS.txt)
#
# This file is part of LuxCoreRender.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
################################################################################
MESSAGE(STATUS "CMake version " ${CMAKE_VERSION} " detected")
################################################################################
#
# Check and configure cmake
#
################################################################################
cmake_minimum_required(VERSION 3.0)
cmake_policy(VERSION 3.0)
# Remove the following when the version check is at least 2.8.4
SET(CMAKE_LEGACY_CYGWIN_WIN32 0)
set(supported_build_variants "Debug" "Release")
# Detect whether we're using a single config or multi config generator and
# configure it:
unset(CMAKE_CONFIGURATION_TYPES CACHE)
# This boots up the generator:
enable_language(C)
enable_language(CXX)
if (CMAKE_CONFIGURATION_TYPES)
message(STATUS "Multi-config generator detected")
# Hard-wire supported configurations:
set(CMAKE_CONFIGURATION_TYPES
${supported_build_variants} CACHE INTERNAL "-" FORCE)
else()
message(STATUS "Single-config generator detected")
# For generators like make, cmake needs to know which variant to use
# so let's have a drop-down selector for it in the GUI:
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Build configuration")
set_property(
CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS ${supported_build_variants})
message(STATUS "Using build variant: " ${CMAKE_BUILD_TYPE})
endif()
# The following implicitly boots up the generator, so don't move it up:
project(LuxRays)
################################################################################
#
# Include necessary submodules
#
################################################################################
set(CMAKE_MODULE_PATH
"${LuxRays_SOURCE_DIR}"
"${LuxRays_SOURCE_DIR}/cmake"
"${LuxRays_SOURCE_DIR}/cmake/Utils"
"${LuxRays_SOURCE_DIR}/cmake/Packages"
"${LuxRays_SOURCE_DIR}/cmake/SpecializedConfig"
)
INCLUDE(PlatformSpecific)
INCLUDE(Configuration)
INCLUDE(KernelPreprocess)
# Install CMake modules
#add_subdirectory(CMake)
SET(LuxRays_INCLUDE_DIR "${LuxRays_SOURCE_DIR}/include")
include_directories("${LuxRays_INCLUDE_DIR}")
include_directories("${LuxRays_SOURCE_DIR}/deps/eos_portable_archive-v5.1")
# Find dependencies
include(Dependencies)
if (NOT Boost_FOUND)
MESSAGE(FATAL_ERROR "--> Could not locate required Boost files - Please check ${BOOST_SEARCH_PATH}")
endif()
if (NOT OPENIMAGEIO_FOUND)
MESSAGE(FATAL_ERROR "--> Could not locate required OpenImageIO files - Please check ${OPENIMAGEIO_SEARCH_PATH}")
endif()
if (NOT OPENCL_FOUND AND NOT LUXRAYS_DISABLE_OPENCL)
MESSAGE(ERROR "--> Could not locate required OpenCL files, disabling OpenCL support - Please check ${OPENCL_SEARCH_PATH}")
SET(LUXRAYS_DISABLE_OPENCL 1)
endif()
if (NOT OPENGL_FOUND AND NOT LUXRAYS_DISABLE_OPENCL)
MESSAGE(ERROR "--> Could not locate required OpenGL files, disabling OpenCL support, disabling samples build")
SET(LUXRAYS_DISABLE_OPENCL 1)
endif()
if (NOT EMBREE_FOUND)
MESSAGE(FATAL_ERROR "--> Could not locate required Intel Embree files - Please check ${EMBREE_SEARCH_PATH}")
endif()
################################################################################
#
# Build options
#
################################################################################
if (LUXRAYS_DISABLE_OPENCL)
ADD_DEFINITIONS("-DLUXRAYS_DISABLE_OPENCL")
endif()
if (BUILD_LUXCORE_DLL)
set(LUXCORE_LIBRARY luxcore)
ADD_DEFINITIONS("-DLUXCORE_DLL")
else()
set(LUXCORE_LIBRARY luxcore slg-core slg-film slg-kernels luxrays ${EMBREE_LIBRARY} ${TIFF_LIBRARIES} ${OPENEXR_LIBRARIES} ${PNG_LIBRARIES} ${JPEG_LIBRARIES})
endif()
################################################################################
#
# LuxRays, SLG, LuxCore and PyLuxCoreTools libraries
#
################################################################################
set(GENERATED_DIR "${CMAKE_BINARY_DIR}/generated")
set(GENERATED_INCLUDE_DIR "${GENERATED_DIR}/include")
file(MAKE_DIRECTORY ${GENERATED_INCLUDE_DIR})
include_directories(${GENERATED_INCLUDE_DIR})
add_subdirectory(src/luxrays)
add_subdirectory(src/slg)
add_subdirectory(src/luxcore)
add_subdirectory(src/pyluxcoretools)
################################################################################
#
# Samples
#
################################################################################
if(NOT APPLE OR OSX_BUILD_DEMOS)
add_subdirectory(samples/luxcoredemo)
add_subdirectory(samples/luxcorescenedemo)
if (NOT WIN32 OR NOT BUILD_LUXCORE_DLL)
# Internal tests can not be compiled on WIN32 with DLL enabled
add_subdirectory(tests/benchsimple)
add_subdirectory(tests/luxcoreimplserializationdemo)
endif()
endif()
add_subdirectory(samples/luxcoreconsole)
if(OPENGL_FOUND)
add_subdirectory(samples/luxcoreui)
endif(OPENGL_FOUND)
################################################################################
#
# Tests
#
################################################################################
add_subdirectory(pyunittests)
################################################################################
#
# For non win32 we'll have to copy everything to a single dir
#
################################################################################
INCLUDE(AssembleBinDirs)