-
-
Notifications
You must be signed in to change notification settings - Fork 548
Expand file tree
/
Copy pathHPX_SetupLCI.cmake
More file actions
130 lines (119 loc) · 3.85 KB
/
Copy pathHPX_SetupLCI.cmake
File metadata and controls
130 lines (119 loc) · 3.85 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
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
# Copyright (c) 2021-2023 Ste||ar Group
#
# SPDX-License-Identifier: BSL-1.0
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
# FIXME : in the future put it directly inside the cmake directory of the
# corresponding plugin
macro(hpx_setup_lci)
if(NOT TARGET LCI::LCI)
# compatibility with older CMake versions
if(LCI_ROOT AND NOT Lci_ROOT)
set(Lci_ROOT
${LCI_ROOT}
CACHE PATH "LCI base directory"
)
unset(LCI_ROOT CACHE)
endif()
if(NOT HPX_WITH_FETCH_LCI)
find_package(
LCI
CONFIG
REQUIRED
HINTS
${Lci_ROOT}
$ENV{LCI_ROOT}
PATH_SUFFIXES
lib/cmake
lib64/cmake
)
elseif(NOT HPX_FIND_PACKAGE)
if(FETCHCONTENT_SOURCE_DIR_LCI)
hpx_info(
"HPX_WITH_FETCH_LCI=${HPX_WITH_FETCH_LCI}, LCI will be used through CMake's FetchContent and installed alongside HPX (FETCHCONTENT_SOURCE_DIR_LCI=${FETCHCONTENT_SOURCE_DIR_LCI})"
)
else()
hpx_info(
"HPX_WITH_FETCH_LCI=${HPX_WITH_FETCH_LCI}, LCI will be fetched using CMake's FetchContent and installed alongside HPX (HPX_WITH_LCI_TAG=${HPX_WITH_LCI_TAG})"
)
endif()
include(FetchContent)
fetchcontent_declare(
lci
GIT_REPOSITORY https://github.com/uiuc-hpc/lci.git
GIT_TAG ${HPX_WITH_LCI_TAG}
)
fetchcontent_getproperties(lci)
if(NOT lci_POPULATED)
fetchcontent_populate(lci)
if(NOT LCT_PMI_BACKEND_ENABLE_MPI AND HPX_WITH_LCI_BOOTSTRAP_MPI)
# Configure LCI with MPI bootstrap support
set(LCT_PMI_BACKEND_ENABLE_MPI
ON
CACHE INTERNAL ""
)
# Set MPI as the first PMI backend to try
set(LCI_PMI_BACKEND_DEFAULT
"mpi;pmix;pmi2;pmi1;file;local"
CACHE INTERNAL ""
)
endif()
set(LCI_FETCHCONTENT_INSTALL
OFF
CACHE INTERNAL ""
)
enable_language(C)
add_subdirectory(${lci_SOURCE_DIR} ${lci_BINARY_DIR})
if(NOT LCI_VERSION OR LCI_VERSION VERSION_LESS 2.0.0)
message(
FATAL_ERROR
"LCI version ${LCI_VERSION} found, but version 2.0.0 or higher is required"
)
endif()
# Move LCI target into its own FOLDER
set_target_properties(LCI PROPERTIES FOLDER "Core/Dependencies")
set(HPX_CMAKE_ADDITIONAL_MODULE_PATH_BUILD
"${lci_SOURCE_DIR}/cmake_modules"
CACHE INTERNAL ""
)
endif()
install(
TARGETS LCI LCT
EXPORT HPXLCITarget
COMPONENT core
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
install(
DIRECTORY ${lci_SOURCE_DIR}/lci/src/api/ ${lci_BINARY_DIR}/lci/src/api/
${lci_SOURCE_DIR}/lct/api/ ${lci_BINARY_DIR}/lct/api/
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
COMPONENT core
FILES_MATCHING
PATTERN "*.h"
)
export(
TARGETS LCI LCT
NAMESPACE LCI::
FILE "${CMAKE_CURRENT_BINARY_DIR}/lib/cmake/${HPX_PACKAGE_NAME}/HPXLCITarget.cmake"
)
install(
EXPORT HPXLCITarget
NAMESPACE LCI::
FILE HPXLCITarget.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${HPX_PACKAGE_NAME}
COMPONENT cmake
)
install(
FILES "${lci_SOURCE_DIR}/cmake_modules/FindIBV.cmake"
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${HPX_PACKAGE_NAME}
COMPONENT cmake
)
install(
FILES "${lci_SOURCE_DIR}/cmake_modules/FindOFI.cmake"
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${HPX_PACKAGE_NAME}
COMPONENT cmake
)
endif()
endif()
endmacro()