@@ -148,6 +148,8 @@ if(UMF_DEVELOPER_MODE)
148
148
UMF_DEVELOPER_MODE=1 )
149
149
endif ()
150
150
151
+ message (STATUS "CMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} " )
152
+
151
153
if (NOT UMF_BUILD_LIBUMF_POOL_JEMALLOC )
152
154
set (UMF_POOL_JEMALLOC_ENABLED FALSE )
153
155
set (JEMALLOC_FOUND FALSE )
@@ -293,6 +295,10 @@ else()
293
295
SOURCE_SUBDIR contrib/windows-cmake/ )
294
296
FetchContent_MakeAvailable (hwloc_targ )
295
297
298
+ # Disable installation of hwloc files
299
+ set_target_properties (hwloc PROPERTIES EXCLUDE_FROM_ALL TRUE
300
+ EXCLUDE_FROM_INSTALL TRUE )
301
+
296
302
set (HWLOC_LIB_PATH "" )
297
303
if (CMAKE_GENERATOR STREQUAL "NMake Makefiles" )
298
304
set (HWLOC_LIB_PATH "${hwloc_targ_BINARY_DIR} /hwloc.lib" )
@@ -429,24 +435,86 @@ elseif(UMF_BUILD_CUDA_PROVIDER)
429
435
endif ()
430
436
431
437
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
-
438
+ # Build the umfd target in a separate directory with Debug configuration
439
+ string (JOIN "\; " UMFD_CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} )
436
440
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" )
441
+ build_umfd ALL
442
+ COMMAND
443
+ ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR} " -S ${UMF_CMAKE_SOURCE_DIR}
444
+ -B ${CMAKE_BINARY_DIR} /umfd_build -DCMAKE_BUILD_TYPE=Debug
445
+ -DCMAKE_DEBUG_POSTFIX=d
446
+ -DCMAKE_PREFIX_PATH= "${UMFD_CMAKE_PREFIX_PATH} "
447
+ -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
448
+ -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
449
+ -DUMF_USE_DEBUG_POSTFIX=OFF
450
+ -DUMF_BUILD_SHARED_LIBRARY=${UMF_BUILD_SHARED_LIBRARY}
451
+ -DUMF_BUILD_LEVEL_ZERO_PROVIDER=${UMF_BUILD_LEVEL_ZERO_PROVIDER}
452
+ -DUMF_BUILD_CUDA_PROVIDER=${UMF_BUILD_CUDA_PROVIDER}
453
+ -DUMF_BUILD_LIBUMF_POOL_JEMALLOC=${UMF_BUILD_LIBUMF_POOL_JEMALLOC}
454
+ -DUMF_BUILD_TESTS=OFF -DUMF_BUILD_GPU_TESTS=OFF
455
+ -DUMF_BUILD_BENCHMARKS=OFF -DUMF_BUILD_BENCHMARKS_MT=OFF
456
+ -DUMF_BUILD_EXAMPLES=OFF -DUMF_BUILD_GPU_EXAMPLES=OFF
457
+ -DUMF_BUILD_FUZZTESTS=OFF -DUMF_DISABLE_HWLOC=${UMF_DISABLE_HWLOC}
458
+ -DUMF_LINK_HWLOC_STATICALLY=${UMF_LINK_HWLOC_STATICALLY}
459
+ -DUMF_HWLOC_NAME=${UMF_HWLOC_NAME}
460
+ -DUMF_INSTALL_RPATH=${UMF_INSTALL_RPATH} -DUMF_DEVELOPER_MODE=OFF
461
+ -DUMF_FORMAT_CODE_STYLE=OFF -DUMF_TESTS_FAIL_ON_SKIP=OFF
462
+ -DUMF_USE_ASAN=OFF -DUMF_USE_UBSAN=OFF -DUMF_USE_TSAN=OFF
463
+ -DUMF_USE_MSAN=OFF -DUMF_USE_VALGRIND=OFF -DUMF_USE_COVERAGE=OFF
464
+ -DUMF_PROXY_LIB_BASED_ON_POOL=${UMF_PROXY_LIB_BASED_ON_POOL}
465
+ COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} /umfd_build --target
466
+ umf --config Debug
467
+ COMMENT
468
+ "Configuring and building umfd.dll in a separate directory with Debug configuration"
469
+ )
441
470
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
472
+ # umfd_build
473
+ if (CMAKE_CONFIGURATION_TYPES )
474
+ # Multi-config generator (e.g., Visual Studio)
475
+ if (UMF_BUILD_SHARED_LIBRARY )
476
+ add_custom_command (
477
+ TARGET build_umfd
478
+ COMMAND
479
+ ${CMAKE_COMMAND} -E copy_if_different
480
+ ${CMAKE_BINARY_DIR} /umfd_build/bin/Debug/umfd.dll
481
+ ${CMAKE_BINARY_DIR} /bin/$<CONFIG>/umfd.dll
482
+ COMMENT "Copying umfd.dll to the main binary directory" )
483
+ endif ()
484
+ add_custom_command (
485
+ TARGET build_umfd
486
+ COMMAND
487
+ ${CMAKE_COMMAND} -E copy_if_different
488
+ ${CMAKE_BINARY_DIR} /umfd_build/lib/Debug/umfd.lib
489
+ ${CMAKE_BINARY_DIR} /lib/$<CONFIG>/umfd.lib
490
+ COMMAND
491
+ ${CMAKE_COMMAND} -E remove_directory
492
+ ${CMAKE_BINARY_DIR} /umfd_build DEPENDS
493
+ ${CMAKE_BINARY_DIR} /bin/$<CONFIG>/umfd.dll
494
+ COMMENT "Copying umfd.lib to the main library directory" )
495
+ else ()
496
+ # Single-config generator (e.g., Ninja)
497
+ if (UMF_BUILD_SHARED_LIBRARY )
498
+ add_custom_command (
499
+ TARGET build_umfd
500
+ COMMAND
501
+ ${CMAKE_COMMAND} -E copy_if_different
502
+ ${CMAKE_BINARY_DIR} /umfd_build/bin/umfd.dll
503
+ ${CMAKE_BINARY_DIR} /bin/umfd.dll
504
+ COMMENT "Copying umfd.dll file to the main binary directory" )
505
+ endif ()
506
+ add_custom_command (
507
+ TARGET build_umfd
508
+ COMMAND
509
+ ${CMAKE_COMMAND} -E copy_if_different
510
+ ${CMAKE_BINARY_DIR} /umfd_build/lib/umfd.lib
511
+ ${CMAKE_BINARY_DIR} /lib/umfd.lib
512
+ COMMAND
513
+ ${CMAKE_COMMAND} -E remove_directory
514
+ ${CMAKE_BINARY_DIR} /umfd_build DEPENDS
515
+ ${CMAKE_BINARY_DIR} /bin/umfd.dll
516
+ COMMENT "Copying umfd.lib file to the main library directory" )
517
+ endif ()
450
518
endif ()
451
519
452
520
# This build type check is not possible on Windows when CMAKE_BUILD_TYPE is not
@@ -841,12 +909,26 @@ endif()
841
909
# --------------------------------------------------------------------------- #
842
910
# Configure make install/uninstall and packages
843
911
# --------------------------------------------------------------------------- #
844
- # Install umfd target
912
+ # Install the umfd library files as part of the umfd component
845
913
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} )
914
+ if (CMAKE_CONFIGURATION_TYPES )
915
+ set (UMFD_DLL "${CMAKE_BINARY_DIR} /bin/$<CONFIG>/umfd.dll" )
916
+ set (UMFD_LIB "${CMAKE_BINARY_DIR} /lib/$<CONFIG>/umfd.lib" )
917
+ else ()
918
+ set (UMFD_DLL "${CMAKE_BINARY_DIR} /bin/umfd.dll" )
919
+ set (UMFD_LIB "${CMAKE_BINARY_DIR} /lib/umfd.lib" )
920
+ endif ()
921
+
922
+ if (UMF_BUILD_SHARED_LIBRARY )
923
+ install (
924
+ FILES ${UMFD_DLL}
925
+ DESTINATION ${CMAKE_INSTALL_BINDIR}
926
+ COMPONENT umfd )
927
+ endif ()
928
+ install (
929
+ FILES ${UMFD_LIB}
930
+ DESTINATION ${CMAKE_INSTALL_LIBDIR}
931
+ COMPONENT umfd )
850
932
endif ()
851
933
852
934
install (FILES ${PROJECT_SOURCE_DIR} /LICENSE.TXT
0 commit comments