Skip to content

Revert changes for building hwloc on Windows using Ninja generator #1071

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,70 @@ jobs:
- name: Run tests under valgrind
run: ${{github.workspace}}/test/test_valgrind.sh ${{github.workspace}} ${{github.workspace}}/build ${{matrix.tool}}

Windows-Ninja-cl:
name: Windows-Ninja-cl
env:
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"
BUILD_DIR : "${{github.workspace}}/build"
strategy:
matrix:
os: ['windows-2019', 'windows-2022']
build_type: [Debug, Release]
compiler: [{c: cl, cxx: cl}]
shared_library: ['ON', 'OFF']
static_hwloc: ['ON', 'OFF']

runs-on: ${{matrix.os}}

steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-depth: 0

- name: Initialize vcpkg
uses: lukka/run-vcpkg@5e0cab206a5ea620130caf672fce3e4a6b5666a1 # v11.5
with:
vcpkgGitCommitId: 3dd44b931481d7a8e9ba412621fa810232b66289
vcpkgDirectory: ${{env.BUILD_DIR}}/vcpkg
vcpkgJsonGlob: '**/vcpkg.json'

- name: Install dependencies
run: vcpkg install

- name: Install Ninja
uses: seanmiddleditch/gha-setup-ninja@96bed6edff20d1dd61ecff9b75cc519d516e6401 # v5

- name: Configure MSVC environment
uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0

- name: Configure build
run: >
cmake
-B ${{env.BUILD_DIR}}
-DCMAKE_PREFIX_PATH="${{env.VCPKG_PATH}}"
-DCMAKE_C_COMPILER=${{matrix.compiler.c}}
-DCMAKE_CXX_COMPILER=${{matrix.compiler.cxx}}
-G Ninja
-DUMF_BUILD_SHARED_LIBRARY=${{matrix.shared_library}}
-DUMF_LINK_HWLOC_STATICALLY=${{matrix.static_hwloc}}
-DUMF_FORMAT_CODE_STYLE=OFF
-DUMF_DEVELOPER_MODE=ON
-DUMF_BUILD_LIBUMF_POOL_DISJOINT=ON
-DUMF_BUILD_LIBUMF_POOL_JEMALLOC=ON
-DUMF_BUILD_LEVEL_ZERO_PROVIDER=ON
-DUMF_BUILD_CUDA_PROVIDER=ON
-DUMF_TESTS_FAIL_ON_SKIP=ON

- name: Build UMF
shell: cmd
run: cmake --build ${{env.BUILD_DIR}} --config ${{matrix.build_type}} -j %NUMBER_OF_PROCESSORS%

- name: Run tests
shell: cmd
working-directory: ${{env.BUILD_DIR}}
run: ctest -C ${{matrix.build_type}} --output-on-failure --test-dir test

# TODO fix #843
#icx:
# name: ICX
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/reusable_basic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ jobs:
-B ${{env.BUILD_DIR}}
-DCMAKE_INSTALL_PREFIX="${{env.INSTL_DIR}}"
-DUMF_BUILD_SHARED_LIBRARY=ON
-DUMF_BUILD_EXAMPLES=OFF
-DUMF_BUILD_EXAMPLES=ON
-DUMF_FORMAT_CODE_STYLE=OFF
-DUMF_DEVELOPER_MODE=ON
-DUMF_BUILD_LIBUMF_POOL_DISJOINT=ON
Expand Down Expand Up @@ -381,7 +381,7 @@ jobs:
-B ${{env.BUILD_DIR}}
-DCMAKE_INSTALL_PREFIX="${{env.INSTL_DIR}}"
-DUMF_BUILD_SHARED_LIBRARY=OFF
-DUMF_BUILD_EXAMPLES=OFF
-DUMF_BUILD_EXAMPLES=ON
-DUMF_FORMAT_CODE_STYLE=OFF
-DUMF_DEVELOPER_MODE=ON
-DUMF_BUILD_LIBUMF_POOL_DISJOINT=ON
Expand Down
46 changes: 44 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -282,10 +282,52 @@ else()
SOURCE_SUBDIR contrib/windows-cmake/ FIND_PACKAGE_ARGS)
FetchContent_MakeAvailable(hwloc_targ)

message(STATUS "hwloc CMAKE_GENERATOR: ${CMAKE_GENERATOR}")

if(CMAKE_GENERATOR STREQUAL "Ninja")
add_custom_command(
COMMAND ${CMAKE_COMMAND}
-DCMAKE_INSTALL_PREFIX=${hwloc_targ_BINARY_DIR} -B build
WORKING_DIRECTORY
${hwloc_targ_SOURCE_DIR}/contrib/windows-cmake/
OUTPUT
${hwloc_targ_SOURCE_DIR}/contrib/windows-cmake/CMakeCache.txt
)
add_custom_command(
COMMAND ${CMAKE_COMMAND} --build build
WORKING_DIRECTORY
${hwloc_targ_SOURCE_DIR}/contrib/windows-cmake/
OUTPUT
${hwloc_targ_SOURCE_DIR}/contrib/windows-cmake/build/lib/hwloc.lib
DEPENDS
${hwloc_targ_SOURCE_DIR}/contrib/windows-cmake/CMakeCache.txt
)
add_custom_command(
COMMAND ${CMAKE_COMMAND} --build build --target INSTALL
WORKING_DIRECTORY
${hwloc_targ_SOURCE_DIR}/contrib/windows-cmake/
OUTPUT ${hwloc_targ_BINARY_DIR}/lib/hwloc.lib
DEPENDS
${hwloc_targ_SOURCE_DIR}/contrib/windows-cmake/build/lib/hwloc.lib
)
add_custom_target(hwloc_prod
DEPENDS ${hwloc_targ_BINARY_DIR}/lib/hwloc.lib)
target_link_libraries(
hwloc INTERFACE ${hwloc_targ_BINARY_DIR}/lib/hwloc.lib)
add_dependencies(hwloc hwloc_prod)

set(LIBHWLOC_LIBRARY_DIRS ${hwloc_targ_BINARY_DIR}/lib)
set(LIBHWLOC_LIBRARIES ${hwloc_targ_BINARY_DIR}/lib/hwloc.lib)
elseif(CMAKE_GENERATOR STREQUAL "NMake Makefiles")
set(LIBHWLOC_LIBRARY_DIRS ${hwloc_targ_BINARY_DIR}/)
set(LIBHWLOC_LIBRARIES ${hwloc_targ_BINARY_DIR}/hwloc.lib)
else()
set(LIBHWLOC_LIBRARY_DIRS ${hwloc_targ_BINARY_DIR}/$<CONFIG>)
set(LIBHWLOC_LIBRARIES ${hwloc_targ_BINARY_DIR}/$<CONFIG>/hwloc.lib)
endif()

set(LIBHWLOC_INCLUDE_DIRS
${hwloc_targ_SOURCE_DIR}/include;${hwloc_targ_BINARY_DIR}/include)
set(LIBHWLOC_LIBRARY_DIRS
${hwloc_targ_BINARY_DIR}/Release;${hwloc_targ_BINARY_DIR}/Debug)
else()
include(FetchContent)
message(
Expand Down
5 changes: 5 additions & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,11 @@ function(add_umf_test)
set_tests_properties(${TEST_NAME} PROPERTIES LABELS "umf")

if(WINDOWS)
# add PATH to DLL on Windows
set(DLL_PATH_LIST
"${DLL_PATH_LIST};PATH=path_list_append:${CMAKE_BINARY_DIR}/bin/;PATH=path_list_append:${CMAKE_BINARY_DIR}/bin/$<CONFIG>/"
)

# append PATH to DLLs
set_property(TEST ${TEST_NAME} PROPERTY ENVIRONMENT_MODIFICATION
"${DLL_PATH_LIST}")
Expand Down
Loading