-
Notifications
You must be signed in to change notification settings - Fork 22
/
CMakeLists.txt
96 lines (71 loc) · 2.78 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
cmake_minimum_required(VERSION 3.16...3.30)
include(cmake/RecordCmdLine.cmake)
project(VecCore LANGUAGES C CXX VERSION 0.8.2
DESCRIPTION "C++ Library for Portable SIMD Vectorization")
set(CMAKE_CXX_STANDARD 17 CACHE STRING "C++ ISO Standard")
set(CMAKE_CXX_STANDARD_REQUIRED True)
list(INSERT CMAKE_MODULE_PATH 0 ${PROJECT_SOURCE_DIR}/cmake)
option(CUDA "Enable support for CUDA")
option(UMESIMD "Enable UME::SIMD backend")
option(VC "Enable Vc backend")
option(BUILD_DOCS "Build doxygen documentation")
option(BUILD_BENCHMARKS "Build binaries for performance benchmarking")
option(BUILD_TESTING "Build test binaries and create test target")
option(BUILD_GOOGLETEST "Build GoogleTest from source")
option(BUILD_GOOGLEBENCH "Build Google benchmark from source")
option(BUILD_UMESIMD "Build UME::SIMD library from source")
option(BUILD_VC "Build Vc library from source")
include(CompilerSetup)
if (CUDA)
enable_language(CUDA)
endif()
add_library(VecCore INTERFACE)
include(Builtins)
if (VC)
find_package(Vc 1.3.3 REQUIRED)
# Vc does not come with an imported target, add our own
if(NOT TARGET Vc::Vc)
add_library(Vc::Vc INTERFACE IMPORTED)
set_property(TARGET Vc::Vc PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${Vc_INCLUDE_DIRS})
set_property(TARGET Vc::Vc PROPERTY INTERFACE_LINK_LIBRARIES ${Vc_LIBRARIES})
endif()
target_compile_definitions(VecCore INTERFACE VECCORE_ENABLE_VC)
target_link_libraries(VecCore INTERFACE Vc::Vc)
endif()
if (UMESIMD)
find_package(UMESIMD 0.8.1 REQUIRED)
target_compile_definitions(VecCore INTERFACE VECCORE_ENABLE_UMESIMD)
target_link_libraries(VecCore INTERFACE UMESIMD::UMESIMD)
endif()
if (CUDA)
target_compile_definitions(VecCore INTERFACE VECCORE_ENABLE_CUDA)
target_include_directories(VecCore INTERFACE ${CUDA_INCLUDE_DIRS})
target_link_libraries(VecCore INTERFACE ${CUDA_LIBRARIES})
endif()
include_directories(include)
include(GNUInstallDirs)
include(CMakePackageConfigHelpers)
write_basic_package_version_file(cmake/VecCoreConfigVersion.cmake
VERSION ${VecCore_VERSION} COMPATIBILITY SameMajorVersion)
configure_package_config_file(cmake/VecCoreConfig.cmake.in cmake/VecCoreConfig.cmake
INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}
PATH_VARS CMAKE_INSTALL_INCLUDEDIR
)
install(DIRECTORY include/${PROJECT_NAME}
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
install(FILES cmake/FindUMESIMD.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME})
install(DIRECTORY ${PROJECT_BINARY_DIR}/cmake/
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME})
if (BUILD_DOCS)
add_subdirectory(doc)
endif()
include(CTest)
enable_testing()
if (BUILD_TESTING)
add_subdirectory(test)
endif()
if (BUILD_BENCHMARKS)
add_subdirectory(bench)
endif()