@@ -110,10 +110,11 @@ if(NOT UMF_LINK_HWLOC_STATICALLY)
110
110
"${DLL_PATH_LIST} ;PATH=path_list_append:${LIBHWLOC_LIBRARY_DIRS} /../bin"
111
111
)
112
112
endif ()
113
- else ()
114
- if (NOT WINDOWS )
115
- message (FATAL_ERROR "hwloc can be statically linked only on Windows" )
116
- endif ()
113
+ # add PATH to DLL on Windows
114
+ set (DLL_PATH_LIST
115
+ "${DLL_PATH_LIST} ;PATH=path_list_append:${LIBHWLOC_LIBRARY_DIRS} /../bin"
116
+ )
117
+ elseif (WINDOWS )
117
118
include (FetchContent )
118
119
set (HWLOC_ENABLE_TESTING OFF )
119
120
set (HWLOC_SKIP_LSTOPO ON )
@@ -137,6 +138,46 @@ else()
137
138
message (STATUS " LIBHWLOC_LIBRARIES = ${LIBHWLOC_LIBRARIES} " )
138
139
message (STATUS " LIBHWLOC_INCLUDE_DIRS = ${LIBHWLOC_INCLUDE_DIRS} " )
139
140
message (STATUS " LIBHWLOC_LIBRARY_DIRS = ${LIBHWLOC_LIBRARY_DIRS} " )
141
+ else ()
142
+ include (FetchContent )
143
+ FetchContent_Declare (
144
+ hwloc_targ
145
+ GIT_REPOSITORY "https://github.com/open-mpi/hwloc.git"
146
+ GIT_TAG hwloc-2.10.0 )
147
+
148
+ FetchContent_GetProperties (hwloc_targ )
149
+ if (NOT hwloc_targ_POPULATED )
150
+ FetchContent_MakeAvailable (hwloc_targ )
151
+ endif ()
152
+
153
+ add_custom_command (
154
+ COMMAND ./autogen.sh
155
+ WORKING_DIRECTORY ${hwloc_targ_SOURCE_DIR}
156
+ OUTPUT ${hwloc_targ_SOURCE_DIR} /configure )
157
+ add_custom_command (
158
+ COMMAND
159
+ ./configure --prefix=${hwloc_targ_BINARY_DIR} --enable-static=yes
160
+ --enable-shared=no --disable-libxml2 --disable-levelzero
161
+ CFLAGS=-fPIC CXXFLAGS=-fPIC
162
+ WORKING_DIRECTORY ${hwloc_targ_SOURCE_DIR}
163
+ OUTPUT ${hwloc_targ_SOURCE_DIR} /Makefile
164
+ DEPENDS ${hwloc_targ_SOURCE_DIR} /configure )
165
+ add_custom_command (
166
+ COMMAND make
167
+ WORKING_DIRECTORY ${hwloc_targ_SOURCE_DIR}
168
+ OUTPUT ${hwloc_targ_SOURCE_DIR} /lib/libhwloc.la
169
+ DEPENDS ${hwloc_targ_SOURCE_DIR} /Makefile )
170
+ add_custom_command (
171
+ COMMAND make install
172
+ WORKING_DIRECTORY ${hwloc_targ_SOURCE_DIR}
173
+ OUTPUT ${hwloc_targ_BINARY_DIR} /lib/libhwloc.a
174
+ DEPENDS ${hwloc_targ_SOURCE_DIR} /lib/libhwloc.la )
175
+
176
+ add_custom_target (hwloc DEPENDS ${hwloc_targ_BINARY_DIR} /lib/libhwloc.a )
177
+
178
+ set (LIBHWLOC_LIBRARY_DIRS ${hwloc_targ_BINARY_DIR} /lib )
179
+ set (LIBHWLOC_INCLUDE_DIRS ${hwloc_targ_BINARY_DIR} /include )
180
+ set (LIBHWLOC_LIBRARIES ${hwloc_targ_BINARY_DIR} /lib/libhwloc.a )
140
181
endif ()
141
182
142
183
# This build type check is not possible on Windows when CMAKE_BUILD_TYPE is not
0 commit comments