Skip to content

Commit 51e3476

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

File tree

2 files changed

+87
-21
lines changed

2 files changed

+87
-21
lines changed

.github/workflows/nightly.yml

+13
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,19 @@ jobs:
163163
working-directory: ${{env.BUILD_DIR}}
164164
run: ctest -C ${{matrix.build_type}} --output-on-failure --test-dir test
165165

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

CMakeLists.txt

+74-21
Original file line numberDiff line numberDiff line change
@@ -429,24 +429,67 @@ elseif(UMF_BUILD_CUDA_PROVIDER)
429429
endif()
430430

431431
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-
432+
# Ensure the umfd target is built in a separate directory with Debug configuration
436433
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")
434+
build_umfd ALL
435+
COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" -S ${UMF_CMAKE_SOURCE_DIR} -B ${CMAKE_BINARY_DIR}/umfd_build
436+
-DCMAKE_BUILD_TYPE=Debug
437+
-DCMAKE_DEBUG_POSTFIX=d
438+
-DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}
439+
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
440+
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
441+
-DUMF_USE_DEBUG_POSTFIX=OFF
442+
-DUMF_BUILD_SHARED_LIBRARY=${UMF_BUILD_SHARED_LIBRARY}
443+
-DUMF_BUILD_LEVEL_ZERO_PROVIDER=${UMF_BUILD_LEVEL_ZERO_PROVIDER}
444+
-DUMF_BUILD_CUDA_PROVIDER=${UMF_BUILD_CUDA_PROVIDER}
445+
-DUMF_BUILD_LIBUMF_POOL_JEMALLOC=${UMF_BUILD_LIBUMF_POOL_JEMALLOC}
446+
-DUMF_BUILD_TESTS=OFF
447+
-DUMF_BUILD_GPU_TESTS=OFF
448+
-DUMF_BUILD_BENCHMARKS=OFF
449+
-DUMF_BUILD_BENCHMARKS_MT=OFF
450+
-DUMF_BUILD_EXAMPLES=OFF
451+
-DUMF_BUILD_GPU_EXAMPLES=OFF
452+
-DUMF_BUILD_FUZZTESTS=OFF
453+
-DUMF_DISABLE_HWLOC=${UMF_DISABLE_HWLOC}
454+
-DUMF_LINK_HWLOC_STATICALLY=${UMF_LINK_HWLOC_STATICALLY}
455+
-DUMF_HWLOC_NAME=${UMF_HWLOC_NAME}
456+
-DUMF_INSTALL_RPATH=${UMF_INSTALL_RPATH}
457+
-DUMF_DEVELOPER_MODE=OFF
458+
-DUMF_FORMAT_CODE_STYLE=OFF
459+
-DUMF_TESTS_FAIL_ON_SKIP=OFF
460+
-DUMF_USE_ASAN=OFF
461+
-DUMF_USE_UBSAN=OFF
462+
-DUMF_USE_TSAN=OFF
463+
-DUMF_USE_MSAN=OFF
464+
-DUMF_USE_VALGRIND=OFF
465+
-DUMF_USE_COVERAGE=OFF
466+
-DUMF_PROXY_LIB_BASED_ON_POOL=${UMF_PROXY_LIB_BASED_ON_POOL}
467+
COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR}/umfd_build --target umf --config Debug
468+
COMMENT "Configuring and building umfd.dll in a separate directory with Debug configuration"
469+
)
441470

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")
471+
# Copy built UMF libraries to the main binary directory and remove umfd_build
472+
if(CMAKE_CONFIGURATION_TYPES)
473+
# Multi-config generator (e.g., Visual Studio)
474+
add_custom_command(
475+
TARGET build_umfd
476+
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_BINARY_DIR}/umfd_build/bin/Debug/umfd.dll
477+
${CMAKE_BINARY_DIR}/bin/$<CONFIG>/umfd.dll
478+
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_BINARY_DIR}/umfd_build/lib/Debug/umfd.lib
479+
${CMAKE_BINARY_DIR}/lib/$<CONFIG>/umfd.lib
480+
COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_BINARY_DIR}/umfd_build
481+
COMMENT "Copying debug libraries to the main binary directory for multi-config generator and removing umfd_build directory")
482+
else()
483+
# Single-config generator (e.g., Ninja)
484+
add_custom_command(
485+
TARGET build_umfd
486+
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_BINARY_DIR}/umfd_build/bin/umfd.dll
487+
${CMAKE_BINARY_DIR}/bin/umfd.dll
488+
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_BINARY_DIR}/umfd_build/lib/umfd.lib
489+
${CMAKE_BINARY_DIR}/lib/umfd.lib
490+
COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_BINARY_DIR}/umfd_build
491+
COMMENT "Copying debug libraries to the main binary directory for single-config generator and removing umfd_build directory")
492+
endif()
450493
endif()
451494

452495
# This build type check is not possible on Windows when CMAKE_BUILD_TYPE is not
@@ -841,12 +884,22 @@ endif()
841884
# --------------------------------------------------------------------------- #
842885
# Configure make install/uninstall and packages
843886
# --------------------------------------------------------------------------- #
844-
# Install umfd target
887+
# Install umfd target as part of the umfd component
845888
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})
889+
if(CMAKE_CONFIGURATION_TYPES)
890+
set(UMFD_DLL "${CMAKE_BINARY_DIR}/bin/$<CONFIG>/umfd.dll")
891+
set(UMFD_LIB "${CMAKE_BINARY_DIR}/lib/$<CONFIG>/umfd.lib")
892+
else()
893+
set(UMFD_DLL "${CMAKE_BINARY_DIR}/bin/umfd.dll")
894+
set(UMFD_LIB "${CMAKE_BINARY_DIR}/lib/umfd.lib")
895+
endif()
896+
897+
install(FILES ${UMFD_DLL}
898+
DESTINATION ${CMAKE_INSTALL_BINDIR}
899+
COMPONENT umfd)
900+
install(FILES ${UMFD_LIB}
901+
DESTINATION ${CMAKE_INSTALL_LIBDIR}
902+
COMPONENT umfd)
850903
endif()
851904

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

0 commit comments

Comments
 (0)