-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
59 lines (54 loc) · 2.72 KB
/
Copy pathCMakeLists.txt
File metadata and controls
59 lines (54 loc) · 2.72 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
#==========================================================================
#
# Copyright NumFOCUS
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0.txt
#
# 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.22.1...3.29.0 FATAL_ERROR)
project(Impact)
# LibTorch's headers emit MSVC-only C4267 (size_t -> int narrowing, e.g. in
# torch/csrc/dynamo/compiled_autograd.h) when its templates are instantiated in our
# translation units. The ITK dashboard treats any build warning as a failure, so silence
# this benign third-party warning on MSVC (gcc/clang do not emit it; ITK already suppresses
# the related C4251). Set at the module root so every target -- library, tests, header test
# and wrapping -- inherits it, on both the standalone and in-ITK-tree build paths below.
if(MSVC)
add_compile_options(/wd4267)
endif()
# Impact is a header-only module; the libraries clients must link (LibTorch) are
# set in itk-module-init.cmake once find_package(Torch) has run.
if(NOT ITK_SOURCE_DIR)
include(itk-module-init.cmake)
# Unlike LibTorch, ITK cannot be provisioned from its Python package: the itk wheels ship
# the built modules only, with no CMake configuration and no wrapping infrastructure. A
# source build therefore needs an ITK build tree (configured with ITK_WRAP_PYTHON=ON if
# the Python bindings are wanted), which the bare "ITKConfig.cmake not found" below does
# not tell you.
# find_package() also accepts ITK_DIR from the environment, so only advise when neither
# the CMake variable nor the environment names a build tree.
if(NOT ITK_DIR AND NOT DEFINED ITK_ROOT AND NOT DEFINED ENV{ITK_DIR})
message(STATUS
"IMPACT: ITK_DIR is not set. If the configuration fails below, point it at an ITK "
"build tree -- as a CMake option (-DITK_DIR=/path/to/ITK-build, or through pip "
"--config-settings=cmake.define.ITK_DIR=...) or simply by exporting ITK_DIR. "
"`pip install itk` does not provide one -- those wheels carry no CMake files.")
endif()
find_package(ITK REQUIRED)
list(APPEND CMAKE_MODULE_PATH ${ITK_CMAKE_DIR})
include(ITKModuleExternal)
else()
set(ITK_DIR ${CMAKE_BINARY_DIR})
itk_module_impl()
endif()
itk_module_examples()