-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
92 lines (79 loc) · 3.22 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
IF (WIN32)
CMAKE_MINIMUM_REQUIRED(VERSION 3.11)
ELSE()
CMAKE_MINIMUM_REQUIRED(VERSION 3.2)
ENDIF()
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
include(OpenEXRVersion)
project(OpenEXR VERSION ${OPENEXR_VERSION})
include(OpenEXRSettings)
# Packages
find_package(ZLIB)
if(OPENEXR_BUILD_OPENEXR AND NOT ZLIB_FOUND)
message(WARNING "Make Zlib available to CMake's search path, and re-run configuration")
message(FATAL_ERROR "Zlib is a required dependency when OPENEXR_BUILD_OPENEXR is set")
endif()
if (OPENEXR_BUILD_PYTHON_LIBS)
find_package(PythonLibs ${OPENEXR_PYTHON_MAJOR}.${OPENEXR_PYTHON_MINOR})
if(NOT PythonLibs_FOUND)
message(WARNING "Make Python ${OPENEXR_PYTHON_MAJOR}.${OPENEXR_PYTHON_MINOR} available to CMake's search path, and re-run configuration")
message(FATAL_ERROR "Python is a required dependency when OPENEXR_BUILD_PYTHON_LIBS is set")
endif()
find_package(Boost COMPONENTS python${OPENEXR_PYTHON_MAJOR}${OPENEXR_PYTHON_MINOR})
if(NOT Boost_PYTHON${OPENEXR_PYTHON_MAJOR}${OPENEXR_PYTHON_MINOR}_FOUND)
message(WARNING "user provided Boost Python${OPENEXR_PYTHON_MAJOR}${OPENEXR_PYTHON_MINOR} was not found. Trying default path...")
find_package(Boost COMPONENTS python)
if(NOT Boost_PYTHON_FOUND)
message(WARNING "Make boost Python available to CMake's search path, and re-run configuration")
message(FATAL_ERROR "boost Python is a required dependency when OPENEXR_BUILD_PYTHON_LIBS is set")
endif()
endif()
find_package(NumPy)
endif()
if(OPENEXR_BUILD_VIEWERS)
message(WARNING "Viewers are currently out of order. Building anyway")
SET (FLTK_SKIP_FLUID 1)
find_package(FLTK)
if(NOT FLTK_FOUND)
message(WARNING "FLTK not found, exrdisplay will not be built")
endif()
find_package(OpenGL)
if(NOT OpenGL_FOUND)
message(WARNING "OpenGL not found, exrdisplay will not be built")
endif()
endif()
if ((OPENEXR_BUILD_OPENEXR OR OPENEXR_BUILD_UTILS OR OPENEXR_BUILD_TESTS OR OPENEXR_BUILD_PYTHON_LIBS OR OPENEXR_BUILD_VIEWERS) AND NOT(OPENEXR_BUILD_ILMBASE))
message(INFO "OPENEXR_BUILD_ILMBASE not requested, searching for installed IlmBase instead")
find_package(IlmBase)
if (NOT IlmBase_FOUND)
message(ERROR "Could not find IlmBase, cannot build dependent libraries.")
message(INFO, "Set ILMBASE_LOCATION to location of IlmBase.")
endif()
endif()
if ((OPENEXR_BUILD_UTILS OR OPENEXR_BUILD_TESTS OR OPENEXR_BUILD_VIEWERS) AND NOT(OPENEXR_BUILD_OPENEXR))
message(INFO "OPENEXR_BUILD_OPENEXR not requested, searching for installed OpenEXR instead")
find_package(OpenEXR)
if (NOT OpenEXR_FOUND)
message(ERROR "Could not find OpenEXR, cannot build dependent libraries.")
message(INFO, "Set OPENEXR_LOCATION to location of OpenEXR.")
endif()
endif()
# Perform the build
if(OPENEXR_BUILD_ILMBASE)
add_subdirectory(IlmBase)
endif()
if(OPENEXR_BUILD_OPENEXR)
add_subdirectory(OpenEXR)
else()
message(INFO, "Skipping OpenEXR build")
endif()
if(OPENEXR_BUILD_PYTHON_LIBS)
add_subdirectory(PyIlmBase)
else()
message(INFO, "Skipping Python bindings")
endif()
if(OPENEXR_BUILD_VIEWERS AND FLTK_FOUND AND OpenGL_FOUND)
add_subdirectory(OpenEXR_Viewers)
else()
message(INFO, "Skipping OpenEXR Viewers")
endif()