Skip to content

Commit 8be5147

Browse files
Merge pull request #1071 from ldorau/Revert_changes_for_Win_static_hwloc
Revert changes for building hwloc on Windows using Ninja generator
2 parents 1fa3f8a + bfcf8cf commit 8be5147

File tree

4 files changed

+115
-4
lines changed

4 files changed

+115
-4
lines changed

.github/workflows/nightly.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,70 @@ jobs:
8989
- name: Run tests under valgrind
9090
run: ${{github.workspace}}/test/test_valgrind.sh ${{github.workspace}} ${{github.workspace}}/build ${{matrix.tool}}
9191

92+
Windows-Ninja-cl:
93+
name: Windows-Ninja-cl
94+
env:
95+
VCPKG_PATH: "${{github.workspace}}/build/vcpkg/packages/hwloc_x64-windows;${{github.workspace}}/build/vcpkg/packages/tbb_x64-windows;${{github.workspace}}/build/vcpkg/packages/jemalloc_x64-windows"
96+
BUILD_DIR : "${{github.workspace}}/build"
97+
strategy:
98+
matrix:
99+
os: ['windows-2019', 'windows-2022']
100+
build_type: [Debug, Release]
101+
compiler: [{c: cl, cxx: cl}]
102+
shared_library: ['ON', 'OFF']
103+
static_hwloc: ['ON', 'OFF']
104+
105+
runs-on: ${{matrix.os}}
106+
107+
steps:
108+
- name: Checkout
109+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
110+
with:
111+
fetch-depth: 0
112+
113+
- name: Initialize vcpkg
114+
uses: lukka/run-vcpkg@5e0cab206a5ea620130caf672fce3e4a6b5666a1 # v11.5
115+
with:
116+
vcpkgGitCommitId: 3dd44b931481d7a8e9ba412621fa810232b66289
117+
vcpkgDirectory: ${{env.BUILD_DIR}}/vcpkg
118+
vcpkgJsonGlob: '**/vcpkg.json'
119+
120+
- name: Install dependencies
121+
run: vcpkg install
122+
123+
- name: Install Ninja
124+
uses: seanmiddleditch/gha-setup-ninja@96bed6edff20d1dd61ecff9b75cc519d516e6401 # v5
125+
126+
- name: Configure MSVC environment
127+
uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0
128+
129+
- name: Configure build
130+
run: >
131+
cmake
132+
-B ${{env.BUILD_DIR}}
133+
-DCMAKE_PREFIX_PATH="${{env.VCPKG_PATH}}"
134+
-DCMAKE_C_COMPILER=${{matrix.compiler.c}}
135+
-DCMAKE_CXX_COMPILER=${{matrix.compiler.cxx}}
136+
-G Ninja
137+
-DUMF_BUILD_SHARED_LIBRARY=${{matrix.shared_library}}
138+
-DUMF_LINK_HWLOC_STATICALLY=${{matrix.static_hwloc}}
139+
-DUMF_FORMAT_CODE_STYLE=OFF
140+
-DUMF_DEVELOPER_MODE=ON
141+
-DUMF_BUILD_LIBUMF_POOL_DISJOINT=ON
142+
-DUMF_BUILD_LIBUMF_POOL_JEMALLOC=ON
143+
-DUMF_BUILD_LEVEL_ZERO_PROVIDER=ON
144+
-DUMF_BUILD_CUDA_PROVIDER=ON
145+
-DUMF_TESTS_FAIL_ON_SKIP=ON
146+
147+
- name: Build UMF
148+
shell: cmd
149+
run: cmake --build ${{env.BUILD_DIR}} --config ${{matrix.build_type}} -j %NUMBER_OF_PROCESSORS%
150+
151+
- name: Run tests
152+
shell: cmd
153+
working-directory: ${{env.BUILD_DIR}}
154+
run: ctest -C ${{matrix.build_type}} --output-on-failure --test-dir test
155+
92156
# TODO fix #843
93157
#icx:
94158
# name: ICX

.github/workflows/reusable_basic.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ jobs:
338338
-B ${{env.BUILD_DIR}}
339339
-DCMAKE_INSTALL_PREFIX="${{env.INSTL_DIR}}"
340340
-DUMF_BUILD_SHARED_LIBRARY=ON
341-
-DUMF_BUILD_EXAMPLES=OFF
341+
-DUMF_BUILD_EXAMPLES=ON
342342
-DUMF_FORMAT_CODE_STYLE=OFF
343343
-DUMF_DEVELOPER_MODE=ON
344344
-DUMF_BUILD_LIBUMF_POOL_DISJOINT=ON
@@ -381,7 +381,7 @@ jobs:
381381
-B ${{env.BUILD_DIR}}
382382
-DCMAKE_INSTALL_PREFIX="${{env.INSTL_DIR}}"
383383
-DUMF_BUILD_SHARED_LIBRARY=OFF
384-
-DUMF_BUILD_EXAMPLES=OFF
384+
-DUMF_BUILD_EXAMPLES=ON
385385
-DUMF_FORMAT_CODE_STYLE=OFF
386386
-DUMF_DEVELOPER_MODE=ON
387387
-DUMF_BUILD_LIBUMF_POOL_DISJOINT=ON

CMakeLists.txt

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,10 +282,52 @@ else()
282282
SOURCE_SUBDIR contrib/windows-cmake/ FIND_PACKAGE_ARGS)
283283
FetchContent_MakeAvailable(hwloc_targ)
284284

285+
message(STATUS "hwloc CMAKE_GENERATOR: ${CMAKE_GENERATOR}")
286+
287+
if(CMAKE_GENERATOR STREQUAL "Ninja")
288+
add_custom_command(
289+
COMMAND ${CMAKE_COMMAND}
290+
-DCMAKE_INSTALL_PREFIX=${hwloc_targ_BINARY_DIR} -B build
291+
WORKING_DIRECTORY
292+
${hwloc_targ_SOURCE_DIR}/contrib/windows-cmake/
293+
OUTPUT
294+
${hwloc_targ_SOURCE_DIR}/contrib/windows-cmake/CMakeCache.txt
295+
)
296+
add_custom_command(
297+
COMMAND ${CMAKE_COMMAND} --build build
298+
WORKING_DIRECTORY
299+
${hwloc_targ_SOURCE_DIR}/contrib/windows-cmake/
300+
OUTPUT
301+
${hwloc_targ_SOURCE_DIR}/contrib/windows-cmake/build/lib/hwloc.lib
302+
DEPENDS
303+
${hwloc_targ_SOURCE_DIR}/contrib/windows-cmake/CMakeCache.txt
304+
)
305+
add_custom_command(
306+
COMMAND ${CMAKE_COMMAND} --build build --target INSTALL
307+
WORKING_DIRECTORY
308+
${hwloc_targ_SOURCE_DIR}/contrib/windows-cmake/
309+
OUTPUT ${hwloc_targ_BINARY_DIR}/lib/hwloc.lib
310+
DEPENDS
311+
${hwloc_targ_SOURCE_DIR}/contrib/windows-cmake/build/lib/hwloc.lib
312+
)
313+
add_custom_target(hwloc_prod
314+
DEPENDS ${hwloc_targ_BINARY_DIR}/lib/hwloc.lib)
315+
target_link_libraries(
316+
hwloc INTERFACE ${hwloc_targ_BINARY_DIR}/lib/hwloc.lib)
317+
add_dependencies(hwloc hwloc_prod)
318+
319+
set(LIBHWLOC_LIBRARY_DIRS ${hwloc_targ_BINARY_DIR}/lib)
320+
set(LIBHWLOC_LIBRARIES ${hwloc_targ_BINARY_DIR}/lib/hwloc.lib)
321+
elseif(CMAKE_GENERATOR STREQUAL "NMake Makefiles")
322+
set(LIBHWLOC_LIBRARY_DIRS ${hwloc_targ_BINARY_DIR}/)
323+
set(LIBHWLOC_LIBRARIES ${hwloc_targ_BINARY_DIR}/hwloc.lib)
324+
else()
325+
set(LIBHWLOC_LIBRARY_DIRS ${hwloc_targ_BINARY_DIR}/$<CONFIG>)
326+
set(LIBHWLOC_LIBRARIES ${hwloc_targ_BINARY_DIR}/$<CONFIG>/hwloc.lib)
327+
endif()
328+
285329
set(LIBHWLOC_INCLUDE_DIRS
286330
${hwloc_targ_SOURCE_DIR}/include;${hwloc_targ_BINARY_DIR}/include)
287-
set(LIBHWLOC_LIBRARY_DIRS
288-
${hwloc_targ_BINARY_DIR}/Release;${hwloc_targ_BINARY_DIR}/Debug)
289331
else()
290332
include(FetchContent)
291333
message(

test/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,11 @@ function(add_umf_test)
145145
set_tests_properties(${TEST_NAME} PROPERTIES LABELS "umf")
146146

147147
if(WINDOWS)
148+
# add PATH to DLL on Windows
149+
set(DLL_PATH_LIST
150+
"${DLL_PATH_LIST};PATH=path_list_append:${CMAKE_BINARY_DIR}/bin/;PATH=path_list_append:${CMAKE_BINARY_DIR}/bin/$<CONFIG>/"
151+
)
152+
148153
# append PATH to DLLs
149154
set_property(TEST ${TEST_NAME} PROPERTY ENVIRONMENT_MODIFICATION
150155
"${DLL_PATH_LIST}")

0 commit comments

Comments
 (0)