-
Notifications
You must be signed in to change notification settings - Fork 165
Expand file tree
/
Copy pathDependencies.cmake
More file actions
172 lines (145 loc) · 5.32 KB
/
Copy pathDependencies.cmake
File metadata and controls
172 lines (145 loc) · 5.32 KB
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
################################################################################
# Copyright 1998-2020 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.
################################################################################
include(FindPkgMacros)
getenv_path(LuxRays_DEPENDENCIES_DIR)
################################################################################
#
# Core dependencies
#
################################################################################
# Find threading library
find_package(Threads REQUIRED)
find_package(OpenImageIO REQUIRED)
include_directories(BEFORE SYSTEM ${OPENIMAGEIO_INCLUDE_DIR})
find_package(OpenEXR REQUIRED)
if(NOT APPLE)
# Apple has these available hardcoded and matched in macos repo, see Config_OSX.cmake
include_directories(BEFORE SYSTEM ${OPENEXR_INCLUDE_DIRS})
find_package(TIFF REQUIRED)
include_directories(BEFORE SYSTEM ${TIFF_INCLUDE_DIR})
find_package(JPEG REQUIRED)
include_directories(BEFORE SYSTEM ${JPEG_INCLUDE_DIR})
find_package(PNG REQUIRED)
include_directories(BEFORE SYSTEM ${PNG_PNG_INCLUDE_DIR})
# Find Python Libraries
if("${PYTHON_V}" EQUAL "27")
find_package(PythonLibs 2.7)
else()
find_package(PythonLibs 3.4)
endif()
endif()
find_program(PYSIDE_UIC NAMES pyside-uic pyside2-uic pyside6-uic
HINTS "${PYTHON_INCLUDE_DIRS}/../Scripts"
PATHS "c:/Program Files/Python${PYTHON_V}/Scripts")
include_directories(${PYTHON_INCLUDE_DIRS})
# Find Boost
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME OFF)
set(BOOST_ROOT "${BOOST_SEARCH_PATH}")
#set(Boost_DEBUG ON)
set(Boost_MINIMUM_VERSION "1.56.0")
# For Windows builds, PYTHON_V must be defined as "3x" (x=Python minor version, e.g. "35")
# For other platforms, specifying python minor version is not needed
set(LUXRAYS_BOOST_COMPONENTS thread program_options filesystem serialization iostreams regex system python${PYTHON_V} chrono serialization numpy${PYTHON_V})
find_package(Boost ${Boost_MINIMUM_VERSION} COMPONENTS ${LUXRAYS_BOOST_COMPONENTS})
if (NOT Boost_FOUND)
# Try again with the other type of libs
if(Boost_USE_STATIC_LIBS)
set(Boost_USE_STATIC_LIBS OFF)
else()
set(Boost_USE_STATIC_LIBS ON)
endif()
# The following line is necessary with CMake 3.18.0 to find static libs on Windows
unset(Boost_LIB_PREFIX)
message(STATUS "Re-trying with link static = ${Boost_USE_STATIC_LIBS}")
find_package(Boost ${Boost_MINIMUM_VERSION} COMPONENTS ${LUXRAYS_BOOST_COMPONENTS})
endif()
if (Boost_FOUND)
include_directories(BEFORE SYSTEM ${Boost_INCLUDE_DIRS})
link_directories(${Boost_LIBRARY_DIRS})
# Don't use old boost versions interfaces
ADD_DEFINITIONS(-DBOOST_FILESYSTEM_NO_DEPRECATED)
if (Boost_USE_STATIC_LIBS)
ADD_DEFINITIONS(-DBOOST_STATIC_LIB)
ADD_DEFINITIONS(-DBOOST_PYTHON_STATIC_LIB)
endif()
endif ()
# OpenGL
find_package(OpenGL)
if (OPENGL_FOUND)
include_directories(BEFORE SYSTEM ${OPENGL_INCLUDE_PATH})
endif ()
# Intel Embree
set(EMBREE_ROOT "${EMBREE_SEARCH_PATH}")
find_package(Embree REQUIRED)
if (EMBREE_FOUND)
include_directories(BEFORE SYSTEM ${EMBREE_INCLUDE_PATH})
endif ()
# Intel Oidn
set(OIDN_ROOT "${OIDN_SEARCH_PATH}")
find_package(Oidn REQUIRED)
if (OIDN_FOUND)
include_directories(BEFORE SYSTEM ${OIDN_INCLUDE_PATH})
endif ()
# Intel TBB
set(TBB_ROOT "${TBB_SEARCH_PATH}")
find_package(TBB REQUIRED)
if (TBB_FOUND)
include_directories(BEFORE SYSTEM ${TBB_INCLUDE_PATH})
endif ()
# Blosc
set(BLOSC_ROOT "${BLOSC_SEARCH_PATH}")
find_package(Blosc REQUIRED)
if (BLOSC_FOUND)
include_directories(BEFORE SYSTEM ${BLOSC_INCLUDE_PATH})
endif ()
# OpenMP
if(NOT APPLE)
find_package(OpenMP)
if (OPENMP_FOUND)
MESSAGE(STATUS "OpenMP found - compiling with")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
else()
MESSAGE(WARNING "OpenMP not found - compiling without")
endif()
endif()
# Find GTK 3.0 for Linux only (required by luxcoreui NFD)
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
find_package(PkgConfig REQUIRED)
pkg_check_modules(GTK3 REQUIRED gtk+-3.0)
include_directories(${GTK3_INCLUDE_DIRS})
endif()
# Find BISON
IF (NOT BISON_NOT_AVAILABLE)
find_package(BISON)
ENDIF (NOT BISON_NOT_AVAILABLE)
# Find FLEX
IF (NOT FLEX_NOT_AVAILABLE)
find_package(FLEX)
ENDIF (NOT FLEX_NOT_AVAILABLE)
# Find OpenVDB
if(NOT USE_BUNDLE_OPENVDB)
set(CMAKE_FIND_PACKAGE_PREFER_CONFIG TRUE)
# preserve Boost_LIBRARIES
set(save_Boost_LIBRARIES ${Boost_LIBRARIES})
find_package(OpenVDB REQUIRED)
set(Boost_LIBRARIES ${save_Boost_LIBRARIES})
set(CMAKE_FIND_PACKAGE_PREFER_CONFIG FALSE)
endif()