Skip to content

Commit 82c4095

Browse files
committed
Fix building umfd.dll on single-config generators
- add installation tests step to Windows generators nightly tests
1 parent 25d9074 commit 82c4095

File tree

2 files changed

+99
-24
lines changed

2 files changed

+99
-24
lines changed

.github/workflows/nightly.yml

+18-3
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,12 @@ jobs:
9696
strategy:
9797
matrix:
9898
os: ['windows-2019', 'windows-2022']
99-
build_type: [Release]
99+
build_type: [Debug, Release]
100100
compiler: [{c: cl, cxx: cl}]
101101
shared_library: ['ON', 'OFF']
102102
static_hwloc: ['ON', 'OFF']
103103
generator: ['Ninja', 'NMake Makefiles']
104+
umfd_lib: ['ON', 'OFF']
104105

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

@@ -112,11 +113,11 @@ jobs:
112113

113114
- name: Set VCPKG_PATH with hwloc
114115
if: matrix.static_hwloc == 'OFF'
115-
run: echo "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'" >> $env:GITHUB_ENV
116+
run: echo "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" >> $env:GITHUB_ENV
116117

117118
- name: Set VCPKG_PATH without hwloc
118119
if: matrix.static_hwloc == 'ON'
119-
run: echo "VCPKG_PATH='${{github.workspace}}/build/vcpkg/packages/tbb_x64-windows;${{github.workspace}}/build/vcpkg/packages/jemalloc_x64-windows'" >> $env:GITHUB_ENV
120+
run: echo "VCPKG_PATH=${{github.workspace}}/build/vcpkg/packages/tbb_x64-windows;${{github.workspace}}/build/vcpkg/packages/jemalloc_x64-windows" >> $env:GITHUB_ENV
120121

121122
- name: Initialize vcpkg
122123
uses: lukka/run-vcpkg@5e0cab206a5ea620130caf672fce3e4a6b5666a1 # v11.5
@@ -153,6 +154,7 @@ jobs:
153154
-DUMF_BUILD_LEVEL_ZERO_PROVIDER=ON
154155
-DUMF_BUILD_CUDA_PROVIDER=ON
155156
-DUMF_TESTS_FAIL_ON_SKIP=ON
157+
${{ matrix.umfd_lib == 'ON' && '-DUMF_USE_DEBUG_POSTFIX=ON' || '' }}
156158
157159
- name: Build UMF
158160
shell: cmd
@@ -163,6 +165,19 @@ jobs:
163165
working-directory: ${{env.BUILD_DIR}}
164166
run: ctest -C ${{matrix.build_type}} --output-on-failure --test-dir test
165167

168+
- name: Test UMF installation and uninstallation
169+
# The '--shared-library' parameter is added to the installation test when the UMF is built as a shared library
170+
# The '--umfd-lib' parameter is added when the UMF is built with the umfd library
171+
run: >
172+
python3 ${{github.workspace}}/test/test_installation.py
173+
--build-dir ${{env.BUILD_DIR}}
174+
--install-dir ${{env.INSTL_DIR}}
175+
--build-type ${{matrix.build_type}}
176+
${{matrix.shared_library == 'ON' && '--proxy' || '' }}
177+
--umf-version ${{env.UMF_VERSION}}
178+
${{ matrix.shared_library == 'ON' && '--shared-library' || ''}}
179+
${{ matrix.umfd_lib == 'ON' && '--umfd-lib' || ''}}
180+
166181
icx:
167182
name: ICX
168183
env:

CMakeLists.txt

+81-21
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,8 @@ if(UMF_DEVELOPER_MODE)
148148
UMF_DEVELOPER_MODE=1)
149149
endif()
150150

151+
message(STATUS "CMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}")
152+
151153
if(NOT UMF_BUILD_LIBUMF_POOL_JEMALLOC)
152154
set(UMF_POOL_JEMALLOC_ENABLED FALSE)
153155
set(JEMALLOC_FOUND FALSE)
@@ -429,24 +431,70 @@ elseif(UMF_BUILD_CUDA_PROVIDER)
429431
endif()
430432

431433
if(WINDOWS AND UMF_USE_DEBUG_POSTFIX)
432-
# Build debug umf library with the d suffix that is compiled with /MDd so
433-
# users can link against it in debug builds.
434-
set(CMAKE_DEBUG_POSTFIX d)
435-
434+
# Build the umfd target in a separate directory with Debug configuration
436435
add_custom_target(
437-
umfd ALL
438-
COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target umf
439-
--config Debug
440-
COMMENT "Building debug umf library with the d suffix")
436+
build_umfd ALL
437+
COMMAND
438+
${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" -S ${UMF_CMAKE_SOURCE_DIR}
439+
-B ${CMAKE_BINARY_DIR}/umfd_build -DCMAKE_BUILD_TYPE=Debug
440+
-DCMAKE_DEBUG_POSTFIX=d -DCMAKE_PREFIX_PATH="${CMAKE_PREFIX_PATH}"
441+
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
442+
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
443+
-DUMF_USE_DEBUG_POSTFIX=OFF
444+
-DUMF_BUILD_SHARED_LIBRARY=${UMF_BUILD_SHARED_LIBRARY}
445+
-DUMF_BUILD_LEVEL_ZERO_PROVIDER=${UMF_BUILD_LEVEL_ZERO_PROVIDER}
446+
-DUMF_BUILD_CUDA_PROVIDER=${UMF_BUILD_CUDA_PROVIDER}
447+
-DUMF_BUILD_LIBUMF_POOL_JEMALLOC=${UMF_BUILD_LIBUMF_POOL_JEMALLOC}
448+
-DUMF_BUILD_TESTS=OFF -DUMF_BUILD_GPU_TESTS=OFF
449+
-DUMF_BUILD_BENCHMARKS=OFF -DUMF_BUILD_BENCHMARKS_MT=OFF
450+
-DUMF_BUILD_EXAMPLES=OFF -DUMF_BUILD_GPU_EXAMPLES=OFF
451+
-DUMF_BUILD_FUZZTESTS=OFF -DUMF_DISABLE_HWLOC=${UMF_DISABLE_HWLOC}
452+
-DUMF_LINK_HWLOC_STATICALLY=${UMF_LINK_HWLOC_STATICALLY}
453+
-DUMF_HWLOC_NAME=${UMF_HWLOC_NAME}
454+
-DUMF_INSTALL_RPATH=${UMF_INSTALL_RPATH} -DUMF_DEVELOPER_MODE=OFF
455+
-DUMF_FORMAT_CODE_STYLE=OFF -DUMF_TESTS_FAIL_ON_SKIP=OFF
456+
-DUMF_USE_ASAN=OFF -DUMF_USE_UBSAN=OFF -DUMF_USE_TSAN=OFF
457+
-DUMF_USE_MSAN=OFF -DUMF_USE_VALGRIND=OFF -DUMF_USE_COVERAGE=OFF
458+
-DUMF_PROXY_LIB_BASED_ON_POOL=${UMF_PROXY_LIB_BASED_ON_POOL}
459+
COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR}/umfd_build --target
460+
umf --config Debug
461+
COMMENT
462+
"Configuring and building umfd.dll in a separate directory with Debug configuration"
463+
)
441464

442-
# Copy built UMF libraries to the Release build subdirectory
443-
add_custom_command(
444-
TARGET umfd
445-
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/bin/Debug/umfd.dll
446-
${CMAKE_BINARY_DIR}/bin/Release/umfd.dll
447-
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/lib/Debug/umfd.lib
448-
${CMAKE_BINARY_DIR}/lib/Release/umfd.lib
449-
COMMENT "Copying debug libraries to the Release build directory")
465+
# Copy built UMF libraries to the main binary directory and remove
466+
# umfd_build
467+
if(CMAKE_CONFIGURATION_TYPES)
468+
# Multi-config generator (e.g., Visual Studio)
469+
add_custom_command(
470+
TARGET build_umfd
471+
COMMAND
472+
${CMAKE_COMMAND} -E copy_if_different
473+
${CMAKE_BINARY_DIR}/umfd_build/bin/Debug/umfd.dll
474+
${CMAKE_BINARY_DIR}/bin/$<CONFIG>/umfd.dll
475+
COMMAND
476+
${CMAKE_COMMAND} -E copy_if_different
477+
${CMAKE_BINARY_DIR}/umfd_build/lib/Debug/umfd.lib
478+
${CMAKE_BINARY_DIR}/lib/$<CONFIG>/umfd.lib
479+
COMMAND ${CMAKE_COMMAND} -E remove_directory
480+
${CMAKE_BINARY_DIR}/umfd_build
481+
COMMENT "Copying debug libraries to the main binary directory")
482+
else()
483+
# Single-config generator (e.g., Ninja)
484+
add_custom_command(
485+
TARGET build_umfd
486+
COMMAND
487+
${CMAKE_COMMAND} -E copy_if_different
488+
${CMAKE_BINARY_DIR}/umfd_build/bin/umfd.dll
489+
${CMAKE_BINARY_DIR}/bin/umfd.dll
490+
COMMAND
491+
${CMAKE_COMMAND} -E copy_if_different
492+
${CMAKE_BINARY_DIR}/umfd_build/lib/umfd.lib
493+
${CMAKE_BINARY_DIR}/lib/umfd.lib
494+
COMMAND ${CMAKE_COMMAND} -E remove_directory
495+
${CMAKE_BINARY_DIR}/umfd_build
496+
COMMENT "Copying debug libraries to the main binary directory")
497+
endif()
450498
endif()
451499

452500
# This build type check is not possible on Windows when CMAKE_BUILD_TYPE is not
@@ -841,12 +889,24 @@ endif()
841889
# --------------------------------------------------------------------------- #
842890
# Configure make install/uninstall and packages
843891
# --------------------------------------------------------------------------- #
844-
# Install umfd target
892+
# Install the umfd library files as part of the umfd component
845893
if(WINDOWS AND UMF_USE_DEBUG_POSTFIX)
846-
install(FILES ${CMAKE_BINARY_DIR}/bin/Debug/umfd.dll
847-
DESTINATION ${CMAKE_INSTALL_BINDIR})
848-
install(FILES ${CMAKE_BINARY_DIR}/lib/Debug/umfd.lib
849-
DESTINATION ${CMAKE_INSTALL_LIBDIR})
894+
if(CMAKE_CONFIGURATION_TYPES)
895+
set(UMFD_DLL "${CMAKE_BINARY_DIR}/bin/$<CONFIG>/umfd.dll")
896+
set(UMFD_LIB "${CMAKE_BINARY_DIR}/lib/$<CONFIG>/umfd.lib")
897+
else()
898+
set(UMFD_DLL "${CMAKE_BINARY_DIR}/bin/umfd.dll")
899+
set(UMFD_LIB "${CMAKE_BINARY_DIR}/lib/umfd.lib")
900+
endif()
901+
902+
install(
903+
FILES ${UMFD_DLL}
904+
DESTINATION ${CMAKE_INSTALL_BINDIR}
905+
COMPONENT umfd)
906+
install(
907+
FILES ${UMFD_LIB}
908+
DESTINATION ${CMAKE_INSTALL_LIBDIR}
909+
COMPONENT umfd)
850910
endif()
851911

852912
install(FILES ${PROJECT_SOURCE_DIR}/LICENSE.TXT

0 commit comments

Comments
 (0)