Skip to content

Commit 807612e

Browse files
committed
Don't use ExternalProject
1 parent ad081ef commit 807612e

File tree

2 files changed

+15
-64
lines changed

2 files changed

+15
-64
lines changed

CMakeLists.txt

Lines changed: 15 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ set(UMF_PROXY_LIB_BASED_ON_POOL
113113
set_property(CACHE UMF_PROXY_LIB_BASED_ON_POOL
114114
PROPERTY STRINGS ${KNOWN_PROXY_LIB_POOLS})
115115
list(APPEND UMF_OPTIONS_LIST UMF_PROXY_LIB_BASED_ON_POOL)
116-
set(UMF_DEBUG_POSTFIX OFF CACHE BOOL "Add a 'd' postfix to Windows debug libraries")
117116

118117
# --------------------------------------------------------------------------- #
119118
# Setup required variables, definitions; fetch dependencies; include
@@ -430,57 +429,22 @@ elseif(UMF_BUILD_CUDA_PROVIDER)
430429
endif()
431430

432431
if(WINDOWS AND UMF_USE_DEBUG_POSTFIX)
433-
# Build debug libraries with the d suffix that are compiled with /MDd so
434-
# users can link against these in debug builds.
435-
include(ExternalProject)
436-
set(UMFD_BINARY_DIR ${CMAKE_BINARY_DIR}/umfd)
437-
set(UMFD_INSTALL_DIR ${UMFD_BINARY_DIR}/install)
438-
set(UMF_DEBUG_POSTFIX ON)
439-
440-
ExternalProject_Add(
441-
umfd
442-
SOURCE_DIR ${PROJECT_SOURCE_DIR}
443-
BINARY_DIR ${UMFD_BINARY_DIR}
444-
INSTALL_DIR ${UMFD_INSTALL_DIR}
445-
INSTALL_COMMAND ${CMAKE_COMMAND} --build <BINARY_DIR> --target
446-
install-umf-libraries --config Debug
447-
CMAKE_CACHE_ARGS
448-
-DCMAKE_INSTALL_PREFIX:STRING=<INSTALL_DIR>
449-
-DCMAKE_PREFIX_PATH:STRING=${CMAKE_PREFIX_PATH}
450-
# Enable d suffix on libraries
451-
-DUMF_USE_DEBUG_POSTFIX:BOOL=OFF
452-
# Don't build unnecessary targets in subbuild.
453-
-DUMF_BUILD_EXAMPLES:BOOL=OFF
454-
-DUMF_BUILD_TESTS:BOOL=OFF
455-
# Inherit settings from parent build.
456-
-DUMF_BUILD_SHARED_LIBRARY:BOOL=${UMF_BUILD_SHARED_LIBRARY}
457-
-DUMF_BUILD_LEVEL_ZERO_PROVIDER:BOOL=${UMF_BUILD_LEVEL_ZERO_PROVIDER}
458-
-DUMF_BUILD_CUDA_PROVIDER:BOOL=${UMF_BUILD_CUDA_PROVIDER}
459-
-DUMF_BUILD_LIBUMF_POOL_JEMALLOC:BOOL=${UMF_BUILD_LIBUMF_POOL_JEMALLOC}
460-
-DUMF_DISABLE_HWLOC:BOOL=${UMF_DISABLE_HWLOC}
461-
-DUMF_LINK_HWLOC_STATICALLY:BOOL=${UMF_LINK_HWLOC_STATICALLY}
462-
-DUMF_HWLOC_NAME:STRING=${UMF_HWLOC_NAME}
463-
-DUMF_INSTALL_RPATH:STRING=${UMF_INSTALL_RPATH})
464-
465-
# Copy debug runtime libraries to the parent build directory
466-
set(UMFD_FILES_TO_COPY)
467-
list(APPEND UMFD_COPY_FILES ${PROJECT_BINARY_DIR}/bin/umfd.dll
468-
${PROJECT_BINARY_DIR}/lib/umfd.lib)
469-
add_custom_command(
470-
OUTPUT ${PROJECT_BINARY_DIR}/bin/umfd.dll
471-
${PROJECT_BINARY_DIR}/lib/umfd.lib
472-
COMMAND ${CMAKE_COMMAND} -E copy ${UMFD_INSTALL_DIR}/bin/umfd.dll
473-
${PROJECT_BINARY_DIR}/bin/umfd.dll
474-
COMMAND ${CMAKE_COMMAND} -E copy ${UMFD_INSTALL_DIR}/lib/umfd.lib
475-
${PROJECT_BINARY_DIR}/lib/umfd.lib)
476-
477-
add_custom_target(copy-umfd-files DEPENDS ${UMFD_COPY_FILES})
478-
add_dependencies(copy-umfd-files umfd)
479-
endif()
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+
436+
add_custom_target(
437+
umfd ALL COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target
438+
umf --config Debug)
480439

481-
# Target with all UMF libraries added with add_umf_library()
482-
if(NOT TARGET umf-libraries)
483-
add_custom_target(umf-libraries)
440+
# Copy built UMF libraries to the Release build subdirectory
441+
add_custom_command(
442+
TARGET umfd
443+
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/bin/Debug/umfd.dll
444+
${CMAKE_BINARY_DIR}/bin/Release/umfd.dll
445+
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/lib/Debug/umfd.lib
446+
${CMAKE_BINARY_DIR}/lib/Release/umfd.lib
447+
COMMENT "Copying debug libraries to the Release build directory")
484448
endif()
485449

486450
# This build type check is not possible on Windows when CMAKE_BUILD_TYPE is not
@@ -915,14 +879,6 @@ install(FILES ${PROJECT_BINARY_DIR}/cmake/${PROJECT_NAME}-config.cmake
915879
${PROJECT_BINARY_DIR}/cmake/${PROJECT_NAME}-config-version.cmake
916880
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME})
917881

918-
# Install Windows debug libraries
919-
if(NOT TARGET install-umf-libraries)
920-
add_custom_target(
921-
install-umf-libraries
922-
COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target install
923-
DEPENDS umf-libraries)
924-
endif()
925-
926882
# Configure uninstall commands
927883
configure_file("${PROJECT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
928884
"${PROJECT_BINARY_DIR}/cmake_uninstall.cmake" IMMEDIATE @ONLY)

cmake/helpers.cmake

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -391,11 +391,6 @@ function(add_umf_library)
391391
${UMF_CMAKE_SOURCE_DIR}/src/coarse)
392392
add_umf_target_compile_options(${ARG_NAME})
393393
add_umf_target_link_options(${ARG_NAME})
394-
395-
if(WINDOWS AND UMF_USE_DEBUG_POSTFIX)
396-
set_target_properties(${ARG_NAME} PROPERTIES DEBUG_POSTFIX d)
397-
endif()
398-
add_dependencies(umf-libraries ${ARG_NAME})
399394
endfunction()
400395

401396
# Add sanitizer ${flag}, if it is supported, for both C and C++ compiler

0 commit comments

Comments
 (0)