-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathCMakeLists.txt
87 lines (75 loc) · 2.94 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
cmake_minimum_required(VERSION 3.16.3)
project(CLEsperanto)
#### Organizational Utility For MSVC Users ###############################
function(OrganizeTargets dir folder)
get_all_targets_recursive(targets ${dir})
foreach(t ${targets})
get_target_property(f ${t} FOLDER)
if(NOT f)
set(f "")
endif()
set_target_properties (${t} PROPERTIES FOLDER "${folder}/${f}")
endforeach()
endfunction()
macro(get_all_targets_recursive targets dir)
get_property(subdirectories DIRECTORY ${dir} PROPERTY SUBDIRECTORIES)
foreach(subdir ${subdirectories})
get_all_targets_recursive(${targets} ${subdir})
endforeach()
get_property(current_targets DIRECTORY ${dir} PROPERTY BUILDSYSTEM_TARGETS)
list(APPEND ${targets} ${current_targets})
endmacro()
########################################################################
# Libraries to link.
# See https://github.com/InsightSoftwareConsortium/ITK/blob/master/CMake/ITKModuleAPI.cmake
set(CLEsperanto_LIBRARIES CLEsperanto)
# Set position independent code on all targets
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
message(STATUS "CMAKE_POSITION_INDEPENDENT_CODE IS ${CMAKE_POSITION_INDEPENDENT_CODE}")
# Enable/disable ITK/CLIc test suites independently.
# Note that clci inherits the value of BUILD_TESTING when clci is declared.
set(ITKCLEsperanto_BUILD_DOCUMENTATION ${BUILD_DOCUMENTATION})
set(ITKCLEsperanto_BUILD_TESTING ${BUILD_TESTING})
option(CLIc_BUILD_BENCHMARK OFF)
option(CLIc_BUILD_COVERAGE OFF)
option(CLIc_BUILD_DOCUMENTATION OFF)
option(CLIc_BUILD_SHARED_LIBS OFF)
option(CLIc_BUILD_TESTING OFF)
# Set configuration to be inherited by CLIc_prototype
set(BUILD_BENCHMARK ${CLIc_BUILD_BENCHMARK})
set(BUILD_COVERAGE ${CLIc_BUILD_COVERAGE})
set(BUILD_DOCUMENTATION ${CLIc_BUILD_DOCUMENTATION})
set(BUILD_SHARED_LIBS ${CLIc_BUILD_SHARED_LIBS})
set(BUILD_TESTING ${CLIc_BUILD_TESTING})
# Get CLIc from development branch commit tag
set(CLIc_GIT_REPOSITORY "https://github.com/clEsperanto/CLIc_prototype.git")
set(CLIc_GIT_TAG "2f3323e36504c0e14af9dcd796b24506e886cb86")
include(FetchContent)
FetchContent_Declare(
clci
GIT_REPOSITORY ${CLIc_GIT_REPOSITORY}
GIT_TAG ${CLIc_GIT_TAG}
)
FetchContent_MakeAvailable(clci)
OrganizeTargets(${clci_SOURCE_DIR} clci)
# Reset configuration for ITKCLEsperanto
unset(BUILD_BENCHMARK) # unused
unset(BUILD_COVERAGE) # unused
set(BUILD_DOCUMENTATION ${ITKCLEsperanto_BUILD_DOCUMENTATION})
unset(BUILD_SHARED_LIBS) # unset to inherit from ITK
set(BUILD_TESTING ${ITKCLEsperanto_BUILD_TESTING})
set(CLEsperanto_INCLUDE_DIRS
${clci_SOURCE_DIR}
${clci_SOURCE_DIR}/clic/include/core
${clci_BINARY_DIR}/clic/include
${clci_SOURCE_DIR}/thirdparty/OpenCL-CLHPP/include/CL
${OpenCL_INCLUDE_DIR})
if(NOT ITK_SOURCE_DIR)
find_package(ITK REQUIRED)
list(APPEND CMAKE_MODULE_PATH ${ITK_CMAKE_DIR})
# Create the module by processing itk-module.cmake
include(ITKModuleExternal)
else()
set(ITK_DIR ${CMAKE_BINARY_DIR})
itk_module_impl()
endif()