Repository navigation
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
93 lines (74 loc) · 2.98 KB
/
Copy pathCMakeLists.txt
File metadata and controls
93 lines (74 loc) · 2.98 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
cmake_minimum_required (VERSION 3.19)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
set (CMAKE_CXX_STANDARD 20)
project (CryptomatteAPIBuild)
# If we are compiling as the main project we automatically turn on all the build options.
# This can be circumvented by passing "-DCRYPTOMATTE_DETERMINE_MAIN_PROJECT=OFF"
set(MAIN_PROJECT OFF)
option (
CRYPTOMATTE_DETERMINE_MAIN_PROJECT
"Whether to automatically determine if we are building this module as main project"
ON
)
if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR AND CRYPTOMATTE_DETERMINE_MAIN_PROJECT)
message("Compiling cryptomatte-api as main project")
set(MAIN_PROJECT ON)
endif()
if (MAIN_PROJECT)
set(CRYPTOMATTE_API_EXTENDED_WARNINGS ON)
set(CRYPTOMATTE_API_USE_VCPKG ON)
set(CRYPTOMATTE_API_BUILD_TESTS ON)
set(CRYPTOMATTE_API_BUILD_EXAMPLES ON)
set(CRYPTOMATTE_API_BUILD_DOCS ON)
set(CRYPTOMATTE_API_BUILD_BENCHMARKS ON)
set(CRYPTOMATTE_API_BUILD_PYTHON ON)
endif()
option(CRYPTOMATTE_API_EXTENDED_WARNINGS OFF)
option(CRYPTOMATTE_API_USE_VCPKG OFF)
option(CRYPTOMATTE_API_BUILD_TESTS OFF)
option(CRYPTOMATTE_API_BUILD_EXAMPLES OFF)
option(CRYPTOMATTE_API_BUILD_EXAMPLES OFF)
option(CRYPTOMATTE_API_BUILD_DOCS OFF)
option(CRYPTOMATTE_API_BUILD_BENCHMARKS OFF)
option(CRYPTOMATTE_API_BUILD_PYTHON OFF)
option(_CRYPTOMATTE_API_SANITIZE_FLAGS "Internal CI flag for enabling sanitizer builds" OFF)
if (CRYPTOMATTE_API_USE_VCPKG)
include("${PROJECT_SOURCE_DIR}/thirdparty/vcpkg/scripts/buildsystems/vcpkg.cmake")
message("CryptomatteAPI: Picked up toolchain at '${PROJECT_SOURCE_DIR}/thirdparty/vcpkg/scripts/buildsystems/vcpkg.cmake'")
endif()
# Add thirdparty libraries
# --------------------------------------------------------------------------
find_package(OpenImageIO CONFIG REQUIRED)
# CompressedImage for loading images into a compressed memory buffer as well as compressing the mattes in-memory
if(NOT TARGET compressed_image)
set(COMPRESSED_IMAGE_USE_VCPKG OFF)
add_subdirectory(thirdparty/compressed-image)
endif()
# spdlog for logging
set(SPDLOG_USE_STD_FORMAT ON)
add_subdirectory(thirdparty/spdlog)
# Projects
# --------------------------------------------------------------------------
add_subdirectory(cryptomatte_api)
if (CRYPTOMATTE_API_BUILD_TESTS)
add_library(doctest INTERFACE)
target_include_directories(doctest SYSTEM INTERFACE thirdparty/doctest/doctest)
add_subdirectory(test)
endif()
if (CRYPTOMATTE_API_BUILD_BENCHMARKS)
set(BENCHMARK_ENABLE_INSTALL OFF)
set(BENCHMARK_INSTALL_DOCS OFF)
set(BENCHMARK_ENABLE_TESTING OFF)
set(BENCHMARK_ENABLE_GTEST_TESTS OFF)
add_subdirectory(thirdparty/benchmark)
add_subdirectory(benchmark)
endif()
if (CRYPTOMATTE_API_BUILD_DOCS)
add_subdirectory(docs)
endif()
if (CRYPTOMATTE_API_BUILD_PYTHON)
add_subdirectory(thirdparty/pybind11)
add_subdirectory(thirdparty/pybind11_image_util)
add_subdirectory(thirdparty/pybind11_json)
add_subdirectory(python)
endif()