-
Notifications
You must be signed in to change notification settings - Fork 13
/
CMakeLists.txt
105 lines (85 loc) · 3.64 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
cmake_minimum_required (VERSION 3.20)
project ("PhotoshopAPIBuild" VERSION 0.5.1 LANGUAGES CXX)
if (MSVC)
# MSVC is stupid
add_compile_definitions(NOMINMAX)
endif()
# --------------------------------------------------------------------------
# Configurable options
option(PSAPI_BUILD_STATIC "Build a static library version of the PhotoshopAPI" ON)
option(PSAPI_BUILD_TESTS "Build the tests associated with the PhotoshopAPI" ON)
option(PSAPI_BUILD_EXAMPLES "Build the examples associated with the PhotoshopAPI" ON)
option(PSAPI_BUILD_BENCHMARKS "Build the benchmarks associated with the PhotoshopAPI" ON)
option(PSAPI_BUILD_DOCS "Builds the documentation, requires some external installs which are documented in the README.md" OFF)
option(PSAPI_BUILD_PYTHON "Build the python bindings associated with the PhotoshopAPI" OFF)
if (PSAPI_BUILD_PYTHON)
# Link in the msvc runtime so that users dont need vcredist when using the python bindings
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
endif()
# Build setup
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
set (CMAKE_CXX_STANDARD 20)
# Add the cmake/ folder so the FindSphinx module is found
# --------------------------------------------------------------------------
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
# Add thirdparty libraries
# --------------------------------------------------------------------------
# Add libdeflate
add_subdirectory (thirdparty/libdeflate)
add_library(libdeflate_include INTERFACE)
target_include_directories(libdeflate_include SYSTEM INTERFACE thirdparty/libdeflate)
# Add mio for memory-mapped IO files
add_subdirectory (thirdparty/mio)
# Add c-blosc2
set(DEACTIVATE_ZLIB ON)
set(DEACTIVATE_ZSTD ON)
set(BUILD_TESTS OFF)
set(BUILD_FUZZERS OFF)
set(BUILD_BENCHMARKS OFF)
set(BUILD_EXAMPLES OFF)
add_subdirectory (thirdparty/c-blosc2 EXCLUDE_FROM_ALL)
# Add target for blosc2 headers
add_library(blosc2_include INTERFACE)
target_include_directories(blosc2_include SYSTEM INTERFACE thirdparty/c-blosc2/include)
# Add doctest
add_library(doctest INTERFACE)
target_include_directories(doctest SYSTEM INTERFACE thirdparty/doctest/doctest)
# Add simdutf for UTF conversion operations
set (SIMDUTF_TESTS OFF)
set (SIMDUTF_TOOLS OFF)
set (SIMDUTF_ICONV OFF)
add_subdirectory (thirdparty/simdutf)
# Add span from tcb for compatibility with older compilers for python bindings
add_library(tcb_span INTERFACE)
target_include_directories(tcb_span SYSTEM INTERFACE thirdparty/compatibility)
# Projects
# --------------------------------------------------------------------------
if(PSAPI_BUILD_STATIC)
add_subdirectory (PhotoshopAPI)
endif()
if(PSAPI_BUILD_TESTS)
add_subdirectory (PhotoshopTest)
endif()
if(PSAPI_BUILD_BENCHMARKS)
add_subdirectory (PhotoshopBenchmark)
endif()
if(PSAPI_BUILD_EXAMPLES)
add_subdirectory (PhotoshopExamples/AddLayerMasks)
add_subdirectory (PhotoshopExamples/CreateGroups)
add_subdirectory (PhotoshopExamples/CreateSimpleDocument)
add_subdirectory (PhotoshopExamples/ExtendedSignature)
add_subdirectory (PhotoshopExamples/ExtractImageData)
add_subdirectory (PhotoshopExamples/ModifyLayerStructure)
add_subdirectory (PhotoshopExamples/ProgressCallbacks)
add_subdirectory (PhotoshopExamples/ReplaceImageData)
endif()
if(PSAPI_BUILD_DOCS)
if(NOT PSAPI_BUILD_PYTHON)
message(WARNING "Building the documentation without the python bindings, this means the python bindings wont show up in your local copy")
endif()
add_subdirectory (docs/doxygen)
endif()
if(PSAPI_BUILD_PYTHON)
add_subdirectory (thirdparty/pybind11)
add_subdirectory (python)
endif()