-
Notifications
You must be signed in to change notification settings - Fork 3
/
CMakeLists.txt
138 lines (109 loc) · 3.82 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
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
# Copyright 2024 TGS
# 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.
cmake_minimum_required(VERSION 3.24)
project(mdio LANGUAGES CXX)
# Compiler id for Apple Clang is now AppleClang.
if (POLICY CMP0025)
cmake_policy(SET CMP0025 NEW)
endif (POLICY CMP0025)
# Project version variables are the empty string if version is unspecified
if (POLICY CMP0048)
cmake_policy(SET CMP0048 NEW)
endif (POLICY CMP0048)
# if command can use IN_LIST
if (POLICY CMP0057)
cmake_policy(SET CMP0057 NEW)
endif (POLICY CMP0057)
# if command can use TEST
if (POLICY CMP0064)
cmake_policy(SET CMP0064 NEW)
endif (POLICY CMP0064)
if (POLICY CMP0077)
cmake_policy(SET CMP0077 NEW)
endif (POLICY CMP0077)
# option() honor variables
if (POLICY CMP0079)
cmake_policy(SET CMP0079 NEW)
endif (POLICY CMP0079)
# Allow the user to specify the MSVC runtime
if (POLICY CMP0091)
cmake_policy(SET CMP0091 NEW)
endif (POLICY CMP0091)
# This makes sure the FetchContent sets the timestamp to the
# time of extraction. If we change the url it will rebuild, even
# if we change to an older version of the library.
if (POLICY CMP0135)
cmake_policy(SET CMP0135 NEW)
endif (POLICY CMP0135)
SET(CMAKE_CXX_STANDARD 17)
SET(CMAKE_CXX_STANDARD_REQUIRED ON )
SET(CMAKE_POSITION_INDEPENDENT_CODE ON)
if(NOT DEFINED CMAKE_INSTALL_PREFIX)
SET(CMAKE_INSTALL_PREFIX ${CMAKE_CURRENT_SOURCE_DIR}/rel)
endif()
list(APPEND CMAKE_MODULE_PATH
${CMAKE_CURRENT_LIST_DIR}/cmake
)
# generally speaking, tests are good:
SET(BUILD_TESTING ON)
include(CTest)
include(CMakePackageConfigHelpers)
include(CMakeDependentOption)
# provides a method to download dependencies:
include(FetchContent)
include(CMakeHelpers/MdioHelpers)
list(APPEND mdio_DEFAULT_COPTS
"-Wno-deprecated-declarations"
"-Wno-sign-compare"
"-Wno-unused-but-set-parameter"
"-Wno-maybe-uninitialized"
"-Wno-unknown-warning-option")
list(APPEND mdio_TEST_COPTS
"-Wno-deprecated-declarations"
"-Wno-sign-compare"
"-Wno-unused-but-set-parameter"
"-Wno-maybe-uninitialized"
"-Wno-unknown-warning-option")
# Define an option for setting the maximum number of slices
option(MAX_NUM_SLICES "Maximum number of slices that can be generated by the sel() method" 32)
if(NOT DEFINED MAX_NUM_SLICES OR MAX_NUM_SLICES STREQUAL "OFF")
set(MAX_NUM_SLICES 32 CACHE STRING "Maximum number of slices that can be generated by the sel() method" FORCE)
endif()
# Use the value of MAX_NUM_SLICES
add_definitions(-DMAX_NUM_SLICES=${MAX_NUM_SLICES})
message(STATUS "MDIO maximum number of slices --> MAX_NUM_SLICES: ${MAX_NUM_SLICES}")
# Define the internal dependencies that should be linked
if(NOT CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
# This is not the top-level project
set(mdio_INTERNAL_DEPS
tensorstore::driver_array
tensorstore::driver_zarr
tensorstore::driver_json
tensorstore::kvstore_file
tensorstore::stack
tensorstore::tensorstore
tensorstore::index_space_dim_expression
tensorstore::index_space_index_transform
tensorstore::util_status_testutil
PARENT_SCOPE
)
# Define internal deps for cloud specific drivers
set(mdio_INTERNAL_GCS_DRIVER_DEPS
tensorstore::kvstore_gcs
PARENT_SCOPE
)
set(mdio_INTERNAL_S3_DRIVER_DEPS
tensorstore::kvstore_s3
PARENT_SCOPE
)
endif()
list(APPEND mdio_COMMON_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR})
add_subdirectory(mdio)