forked from AcademySoftwareFoundation/Imath
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
135 lines (110 loc) · 4.33 KB
/
CMakeLists.txt
File metadata and controls
135 lines (110 loc) · 4.33 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
# SPDX-License-Identifier: BSD-3-Clause
# Copyright Contributors to the OpenEXR Project.
cmake_minimum_required(VERSION 3.14)
# Imath version
project(Imath VERSION 3.2.0 LANGUAGES C CXX)
set(IMATH_VERSION_RELEASE_TYPE "-dev" CACHE STRING "Extra version tag string for Imath build, such as -dev, -beta1, etc.")
set(IMATH_VERSION ${Imath_VERSION})
set(IMATH_VERSION_API "${Imath_VERSION_MAJOR}_${Imath_VERSION_MINOR}")
# The SOVERSION (i.e. numerical component of SONAME) tracks the ABI
# version. Increment this number whenever, and only when, the ABI changes in
# non-backwards-compatible ways.
#
# The OpenEXR project policy is to append the library version
# "major.minor.patch" to the SONAME to form the real shared library name.
# For example, in "libImath.so.31.3.2.0", "libImath.so.31" is the SONAME
# and ".3.2.0" identifies the corresponding library release.
set(IMATH_LIB_SOVERSION 30)
set(IMATH_LIB_VERSION "${IMATH_LIB_SOVERSION}.${IMATH_VERSION}") # e.g. "30.3.2.0"
# ImathSetup.cmake declares all the configuration variables visible
# in cmake-gui or similar and the rest of the global
# project setup. Check the context to see what is configurable.
include(config/ImathSetup.cmake)
message(STATUS "Configure ${IMATH_PACKAGE_NAME}, library API version: ${IMATH_LIB_VERSION}")
option(IMATH_INSTALL "Install Imath library" ON)
if (APPLE)
option(IMATH_BUILD_APPLE_FRAMEWORKS "Build as Apple Frameworks" OFF)
endif()
# Config headers and package config files
add_subdirectory(config)
if (IMATH_BUILD_APPLE_FRAMEWORKS)
# Define resource files for Apple Framework
set(IMATH_RESOURCE_FILES
"${CMAKE_SOURCE_DIR}/README.md"
"${CMAKE_SOURCE_DIR}/LICENSE.md"
"${CMAKE_SOURCE_DIR}/SECURITY.md"
"${CMAKE_CURRENT_BINARY_DIR}/config/ImathTargets.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/config/ImathConfig.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/config/ImathConfigVersion.cmake"
)
if (PYTHON)
set(IMATH_RESOURCE_FILES ${IMATH_RESOURCE_FILES} "${CMAKE_CURRENT_BINARY_DIR}/config/PyImathTargets.cmake")
endif()
if (PYBIND11)
set(IMATH_RESOURCE_FILES ${IMATH_RESOURCE_FILES} "${CMAKE_CURRENT_BINARY_DIR}/config/PyBindImathTargets.cmake")
endif()
message(STATUS "Resource files: ${IMATH_RESOURCE_FILES}")
endif()
# uninstall target
if(NOT TARGET uninstall)
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY)
add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
endif()
# Source code is in src/Imath
add_subdirectory(src/Imath)
# Imath_DIR points to the location of ImathConfig.cmake, which tells
# downstream projects where to find Imath, via find_package(Imath).
set(Imath_DIR "${CMAKE_CURRENT_BINARY_DIR}/config" CACHE PATH "" FORCE)
option(PYTHON "Set ON to compile boost PyImath bindings")
if (PYTHON)
add_subdirectory(src/python)
endif()
option(PYBIND11 "Set ON to compile pybind11 PyImath bindings")
if (PYBIND11)
add_subdirectory(src/pybind11)
endif()
option(BUILD_WEBSITE "Set ON to build the readthedocs website source")
if (BUILD_WEBSITE AND NOT IMATH_IS_SUBPROJECT)
add_subdirectory(website)
endif()
# pkg-config is not required for Apple Frameworks
if (IMATH_BUILD_APPLE_FRAMEWORKS)
set(IMATH_INSTALL_SYM_LINK OFF)
endif()
# If you want to use ctest to configure, build and
# upload the results, cmake has builtin support for
# submitting to CDash, or any server who speaks the
# same protocol
#
# These settings will need to be set for your environment,
# and then a script such as the example in
#
# cmake/SampleCTestScript.cmake
#
# edited and placed into the CI system, then run:
#
# cmake -S cmake/SampleCTestScript.cmake
#
# [or whatever you name the file you edit]
#
#set(CTEST_PROJECT_NAME "Imath")
#set(CTEST_NIGHTLY_START_TIME "01:01:01 UTC")
#set(CTEST_DROP_METHOD "http") # there are others...
#set(CTEST_DROP_SITE "open.cdash.org")
#set(CTEST_DROP_LOCATION "/submit.php?project=MyProject")
#set(CTEST_DROP_SITE_CDASH TRUE)
include(CTest)
if(BUILD_TESTING AND NOT IMATH_IS_SUBPROJECT)
enable_testing()
add_subdirectory(src/ImathTest)
endif()
# Including this module will add a `clang-format` target to the build
# if the clang-format executable can be found. Only do this if we are
# top level.
if(NOT IMATH_IS_SUBPROJECT)
include(cmake/clang-format.cmake)
endif()