@@ -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 )
@@ -285,6 +287,7 @@ else()
285
287
set (HWLOC_ENABLE_TESTING OFF )
286
288
set (HWLOC_SKIP_LSTOPO ON )
287
289
set (HWLOC_SKIP_TOOLS ON )
290
+ set (HWLOC_SKIP_INCLUDES ON )
288
291
289
292
FetchContent_Declare(
290
293
hwloc_targ
@@ -429,24 +432,69 @@ elseif(UMF_BUILD_CUDA_PROVIDER)
429
432
endif ()
430
433
431
434
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
-
435
+ # Build the umfd target in a separate directory with Debug configuration
436
+ string (JOIN "\; " UMFD_CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} )
436
437
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" )
438
+ build_umfd ALL
439
+ COMMAND
440
+ ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR} " -S ${UMF_CMAKE_SOURCE_DIR}
441
+ -B ${CMAKE_BINARY_DIR} /umfd_build -DCMAKE_BUILD_TYPE=Debug
442
+ -DCMAKE_DEBUG_POSTFIX =d
443
+ -DCMAKE_PREFIX_PATH="${UMFD_CMAKE_PREFIX_PATH} "
444
+ -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
445
+ -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
446
+ -DUMF_USE_DEBUG_POSTFIX =OFF
447
+ -DUMF_BUILD_SHARED_LIBRARY=${UMF_BUILD_SHARED_LIBRARY}
448
+ -DUMF_BUILD_LEVEL_ZERO_PROVIDER=${UMF_BUILD_LEVEL_ZERO_PROVIDER}
449
+ -DUMF_BUILD_CUDA_PROVIDER=${UMF_BUILD_CUDA_PROVIDER}
450
+ -DUMF_BUILD_LIBUMF_POOL_JEMALLOC=${UMF_BUILD_LIBUMF_POOL_JEMALLOC}
451
+ -DUMF_BUILD_TESTS=OFF -DUMF_BUILD_GPU_TESTS=OFF
452
+ -DUMF_BUILD_BENCHMARKS=OFF -DUMF_BUILD_BENCHMARKS_MT=OFF
453
+ -DUMF_BUILD_EXAMPLES=OFF -DUMF_BUILD_GPU_EXAMPLES=OFF
454
+ -DUMF_BUILD_FUZZTESTS=OFF -DUMF_DISABLE_HWLOC=${UMF_DISABLE_HWLOC}
455
+ -DUMF_LINK_HWLOC_STATICALLY=${UMF_LINK_HWLOC_STATICALLY}
456
+ -DUMF_HWLOC_NAME=${UMF_HWLOC_NAME}
457
+ -DUMF_INSTALL_RPATH=${UMF_INSTALL_RPATH} -DUMF_DEVELOPER_MODE=OFF
458
+ -DUMF_FORMAT_CODE_STYLE=OFF -DUMF_TESTS_FAIL_ON_SKIP=OFF
459
+ -DUMF_USE_ASAN=OFF -DUMF_USE_UBSAN=OFF -DUMF_USE_TSAN=OFF
460
+ -DUMF_USE_MSAN=OFF -DUMF_USE_VALGRIND=OFF -DUMF_USE_COVERAGE=OFF
461
+ -DUMF_PROXY_LIB_BASED_ON_POOL=${UMF_PROXY_LIB_BASED_ON_POOL}
462
+ COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} /umfd_build --target
463
+ umf --config Debug
464
+ COMMENT
465
+ "Configuring and building umfd.dll in a separate directory with Debug configuration"
466
+ )
441
467
442
- # Copy built UMF libraries to the Release build subdirectory
468
+ # Copy built UMF libraries to the main binary directory and remove
469
+ # umfd_build
470
+ if (CMAKE_CONFIGURATION_TYPES )
471
+ # Multi-config generator (e.g., Visual Studio)
472
+ set (UMFD_DLL_SRC "${CMAKE_BINARY_DIR} /umfd_build/bin/Debug/umfd.dll" )
473
+ set (UMFD_LIB_SRC "${CMAKE_BINARY_DIR} /umfd_build/lib/Debug/umfd.lib" )
474
+ set (UMFD_DLL "${CMAKE_BINARY_DIR} /bin/$<CONFIG>/umfd.dll" )
475
+ set (UMFD_LIB "${CMAKE_BINARY_DIR} /lib/$<CONFIG>/umfd.lib" )
476
+ else ()
477
+ # Single-config generator (e.g., Ninja)
478
+ set (UMFD_DLL_SRC "${CMAKE_BINARY_DIR} /umfd_build/bin/umfd.dll" )
479
+ set (UMFD_LIB_SRC "${CMAKE_BINARY_DIR} /umfd_build/lib/umfd.lib" )
480
+ set (UMFD_DLL "${CMAKE_BINARY_DIR} /bin/umfd.dll" )
481
+ set (UMFD_LIB "${CMAKE_BINARY_DIR} /lib/umfd.lib" )
482
+ endif ()
483
+
484
+ if (UMF_BUILD_SHARED_LIBRARY)
485
+ add_custom_command (
486
+ TARGET build_umfd
487
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different ${UMFD_DLL_SRC}
488
+ ${UMFD_DLL}
489
+ COMMENT "Copying umfd.dll to the main binary directory" )
490
+ endif ()
443
491
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" )
492
+ TARGET build_umfd
493
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different ${UMFD_LIB_SRC}
494
+ ${UMFD_LIB}
495
+ COMMAND ${CMAKE_COMMAND} -E remove_directory
496
+ ${CMAKE_BINARY_DIR} /umfd_build DEPENDS ${UMFD_DLL}
497
+ COMMENT "Copying umfd.lib to the main library directory" )
450
498
endif ()
451
499
452
500
# This build type check is not possible on Windows when CMAKE_BUILD_TYPE is not
@@ -841,12 +889,18 @@ endif()
841
889
# --------------------------------------------------------------------------- #
842
890
# Configure make install/uninstall and packages
843
891
# --------------------------------------------------------------------------- #
844
- # Install umfd target
892
+ # Install the umfd library files as part of the umfd component
845
893
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 (UMF_BUILD_SHARED_LIBRARY)
895
+ install (
896
+ FILES ${UMFD_DLL}
897
+ DESTINATION ${CMAKE_INSTALL_BINDIR}
898
+ COMPONENT umfd)
899
+ endif ()
900
+ install (
901
+ FILES ${UMFD_LIB}
902
+ DESTINATION ${CMAKE_INSTALL_LIBDIR}
903
+ COMPONENT umfd)
850
904
endif ()
851
905
852
906
install (FILES ${PROJECT_SOURCE_DIR} /LICENSE.TXT
0 commit comments