@@ -14,6 +14,11 @@ set(UMF_CMAKE_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
14
14
list (APPEND CMAKE_MODULE_PATH "${UMF_CMAKE_SOURCE_DIR} /cmake" )
15
15
include (${UMF_CMAKE_SOURCE_DIR} /cmake/helpers.cmake )
16
16
17
+ include (CTest )
18
+ include (CMakePackageConfigHelpers )
19
+ include (GNUInstallDirs )
20
+ find_package (PkgConfig )
21
+
17
22
# CMAKE_PROJECT_VERSION[_MAJOR|_MINOR|_PATCH] variables are set via 'project'
18
23
# command. They cannot contain any "pre-release" part, though. We use custom
19
24
# "UMF_SRC_VERSION" to store more accurate (source) version - this var should be
@@ -37,6 +42,7 @@ option(UMF_BUILD_BENCHMARKS "Build UMF benchmarks" OFF)
37
42
option (UMF_BUILD_BENCHMARKS_MT "Build UMF multithreaded benchmarks" OFF )
38
43
option (UMF_BUILD_EXAMPLES "Build UMF examples" ON )
39
44
option (UMF_BUILD_GPU_EXAMPLES "Build UMF GPU examples" OFF )
45
+ option (UMF_LINK_HWLOC_STATICALLY "Link UMF with HWLOC library statically" OFF )
40
46
option (UMF_DEVELOPER_MODE "Enable developer checks, treats warnings as errors"
41
47
OFF )
42
48
option (UMF_FORMAT_CODE_STYLE
@@ -83,6 +89,41 @@ else()
83
89
message (FATAL_ERROR "Unknown OS type" )
84
90
endif ()
85
91
92
+ if (NOT UMF_LINK_HWLOC_STATICALLY )
93
+ pkg_check_modules (LIBHWLOC hwloc>=2.3.0 )
94
+ if (NOT LIBHWLOC_FOUND )
95
+ find_package (LIBHWLOC 2.3.0 REQUIRED hwloc )
96
+ endif ()
97
+ # add PATH to DLL on Windows
98
+ set (DLL_PATH_LIST
99
+ "${DLL_PATH_LIST} ;PATH=path_list_append:${LIBHWLOC_LIBRARY_DIRS} /../bin"
100
+ )
101
+ else ()
102
+ include (FetchContent )
103
+ FetchContent_Declare (
104
+ hwloc_targ
105
+ GIT_REPOSITORY "https://github.com/open-mpi/hwloc.git"
106
+ GIT_TAG master
107
+ FIND_PACKAGE_ARGS )
108
+
109
+ FetchContent_GetProperties (hwloc_targ )
110
+ if (NOT hwloc_targ_POPULATED )
111
+ FetchContent_MakeAvailable (hwloc_targ )
112
+ endif ()
113
+
114
+ set (hwloc_cmake ${hwloc_targ_SOURCE_DIR} /contrib/windows-cmake )
115
+
116
+ add_subdirectory (${hwloc_cmake} ${hwloc_targ_SOURCE_DIR} )
117
+
118
+ set (LIBHWLOC_INCLUDE_DIRS ${hwloc_targ_SOURCE_DIR} /include )
119
+ set (LIBHWLOC_LIBRARY_DIRS ${hwloc_targ_SOURCE_DIR} /Debug )
120
+ set (LIBHWLOC_LIBRARIES ${LIBHWLOC_LIBRARY_DIRS} /hwloc.lib )
121
+
122
+ message (STATUS " LIBHWLOC_LIBRARIES = ${LIBHWLOC_LIBRARIES} " )
123
+ message (STATUS " LIBHWLOC_INCLUDE_DIRS = ${LIBHWLOC_INCLUDE_DIRS} " )
124
+ message (STATUS " LIBHWLOC_LIBRARY_DIRS = ${LIBHWLOC_LIBRARY_DIRS} " )
125
+ endif ()
126
+
86
127
# This build type check is not possible on Windows when CMAKE_BUILD_TYPE is not
87
128
# set, because in this case the build type is determined after a CMake
88
129
# configuration is done (at the build time)
@@ -130,11 +171,6 @@ foreach(option_name ${OPTIONS_REQUIRING_CXX})
130
171
endif ()
131
172
endforeach ()
132
173
133
- include (CTest )
134
- include (CMakePackageConfigHelpers )
135
- include (GNUInstallDirs )
136
- find_package (PkgConfig )
137
-
138
174
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR} /lib )
139
175
set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR} /lib )
140
176
set (CMAKE_UMF_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR} /bin )
@@ -179,7 +215,7 @@ if(WINDOWS)
179
215
add_compile_definitions (_CRT_SECURE_NO_WARNINGS )
180
216
# set PATH to DLLs on Windows
181
217
set (DLL_PATH_LIST
182
- "PATH=path_list_append:${PROJECT_BINARY_DIR} /bin/$<CONFIG>" )
218
+ "${DLL_PATH_LIST} ; PATH=path_list_append:${PROJECT_BINARY_DIR} /bin/$<CONFIG>" )
183
219
# add path to the proxy lib DLL
184
220
set (DLL_PATH_LIST
185
221
"${DLL_PATH_LIST} ;PATH=path_list_append:${PROJECT_BINARY_DIR} /src/proxy_lib"
@@ -190,14 +226,6 @@ if(WINDOWS)
190
226
)
191
227
endif ()
192
228
193
- pkg_check_modules (LIBHWLOC hwloc>=2.3.0 )
194
- if (NOT LIBHWLOC_FOUND )
195
- find_package (LIBHWLOC 2.3.0 REQUIRED hwloc )
196
- endif ()
197
- # add PATH to DLL on Windows
198
- set (DLL_PATH_LIST
199
- "${DLL_PATH_LIST} ;PATH=path_list_append:${LIBHWLOC_LIBRARY_DIRS} /../bin" )
200
-
201
229
pkg_check_modules (TBB tbb )
202
230
if (NOT TBB_FOUND )
203
231
find_package (TBB OPTIONAL_COMPONENTS tbb )
0 commit comments