-
Notifications
You must be signed in to change notification settings - Fork 10
/
CMakeLists.txt
98 lines (87 loc) · 3.16 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
#@HEADER
# ************************************************************************
#
# Kokkos v. 4.0
# Copyright (2022) National Technology & Engineering
# Solutions of Sandia, LLC (NTESS).
#
# Under the terms of Contract DE-NA0003525 with NTESS,
# the U.S. Government retains certain rights in this software.
#
# Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
# See https://kokkos.org/LICENSE for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
#@HEADER
# 3.9: MPI::MPI_CXX
# 3.12: CMAKE_PROJECT_VERSION_MAJOR
# 3.15: PUBLIC_HEADER files for interface libraries
# 3.23: FILE_SETs for easy export of header-only libraries
cmake_minimum_required(VERSION 3.23)
project(
KokkosComm
LANGUAGES
CXX
VERSION 0.2.0
DESCRIPTION "Experimental MPI interfaces (and more!) for the Kokkos C++ Performance Portability Programming ecosystem"
HOMEPAGE_URL "https://kokkos.org/kokkos-comm/"
)
option(KokkosComm_ENABLE_PERFTESTS "Build KokkosComm perf tests" OFF)
option(KokkosComm_ENABLE_TESTS "Build KokkosComm tests" OFF)
option(KokkosComm_ENABLE_MPI "Build KokkosComm with MPI transport" ON)
# Resolve options
set(KOKKOSCOMM_ENABLE_PERFTESTS ${KokkosComm_ENABLE_PERFTESTS} CACHE BOOL "" FORCE)
set(KOKKOSCOMM_ENABLE_TESTS ${KokkosComm_ENABLE_TESTS} CACHE BOOL "" FORCE)
set(KOKKOSCOMM_ENABLE_MPI ${KokkosComm_ENABLE_MPI} CACHE BOOL "" FORCE)
find_package(Kokkos REQUIRED)
if(KOKKOSCOMM_ENABLE_MPI)
find_package(MPI REQUIRED)
endif()
add_subdirectory(src)
if(KOKKOSCOMM_ENABLE_TESTS)
enable_testing() # so we can run ctest at the top-level build dir
add_subdirectory(unit_tests)
endif()
if(KOKKOSCOMM_ENABLE_PERFTESTS)
enable_testing() # so we can run ctest at the top-level build dir
add_subdirectory(perf_tests)
endif()
# -- PACKAGING -- #
include(CMakePackageConfigHelpers)
include(GNUInstallDirs)
# Generate version config header
set(KOKKOSCOMM_VERSION_MAJOR ${CMAKE_PROJECT_VERSION_MAJOR} CACHE STRING "" FORCE)
set(KOKKOSCOMM_VERSION_MINOR ${CMAKE_PROJECT_VERSION_MINOR} CACHE STRING "" FORCE)
set(KOKKOSCOMM_VERSION_PATCH ${CMAKE_PROJECT_VERSION_PATCH} CACHE STRING "" FORCE)
configure_file(
${PROJECT_SOURCE_DIR}/cmake/KokkosComm_config.hpp.in
${PROJECT_BINARY_DIR}/src/KokkosComm/config.hpp
@ONLY
)
# Generate package config file
configure_package_config_file(
${PROJECT_SOURCE_DIR}/cmake/Config.cmake.in
${PROJECT_BINARY_DIR}/cmake/KokkosComm/KokkosCommConfig.cmake
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/KokkosComm
NO_SET_AND_CHECK_MACRO
NO_CHECK_REQUIRED_COMPONENTS_MACRO
)
# Generate package version file
write_basic_package_version_file(
${PROJECT_BINARY_DIR}/cmake/KokkosComm/KokkosCommVersion.cmake
COMPATIBILITY SameMajorVersion
ARCH_INDEPENDENT # KokkosComm is a header-only library
)
# Install CMake package files
install(
FILES
${PROJECT_BINARY_DIR}/cmake/KokkosComm/KokkosCommConfig.cmake
${PROJECT_BINARY_DIR}/cmake/KokkosComm/KokkosCommVersion.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/KokkosComm
)
install(
EXPORT KokkosCommTargets
FILE KokkosCommTargets.cmake
NAMESPACE KokkosComm::
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/KokkosComm
)