From e3d68233b7e2550d388321e5636be26c280a9606 Mon Sep 17 00:00:00 2001 From: Philippe Canal Date: Tue, 1 Apr 2025 18:13:58 +0000 Subject: [PATCH 1/3] Adapt to CudaRdcUtils --- CMakeLists.txt | 21 ++++++++++---------- examples/AsyncExample/CMakeLists.txt | 2 +- examples/Example1/CMakeLists.txt | 2 +- examples/IntegrationBenchmark/CMakeLists.txt | 4 ++-- test/CMakeLists.txt | 4 ++-- test/testField/CMakeLists.txt | 18 ++++++++--------- 6 files changed, 24 insertions(+), 27 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 264f9ba06..4948d705d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -247,20 +247,19 @@ target_include_directories(CopCore $ ) -add_library(AdePT_G4_integration SHARED +cuda_rdc_add_library(AdePT_G4_integration SHARED ${ADEPT_G4_INTEGRATION_SRCS} ) -target_include_directories(AdePT_G4_integration +cuda_rdc_target_include_directories(AdePT_G4_integration PUBLIC $ $ ) -target_link_libraries(AdePT_G4_integration +cuda_rdc_target_link_libraries(AdePT_G4_integration PUBLIC CopCore VecGeom::vecgeom - VecGeom::vecgeomcuda_static VecGeom::vgdml ${Geant4_LIBRARIES} G4HepEm::g4HepEm @@ -272,18 +271,18 @@ target_link_libraries(AdePT_G4_integration ) if(ADEPT_USE_EXT_BFIELD) # link covfie if external magnetic field usage is enabled - target_link_libraries(AdePT_G4_integration + cuda_rdc_target_link_libraries(AdePT_G4_integration PUBLIC covfie::core covfie::cuda ) endif() -set_target_properties(AdePT_G4_integration - PROPERTIES - CUDA_SEPARABLE_COMPILATION ON - CUDA_RESOLVE_DEVICE_SYMBOLS ON -) +#set_target_properties(AdePT_G4_integration +# PROPERTIES +# CUDA_SEPARABLE_COMPILATION ON +# CUDA_RESOLVE_DEVICE_SYMBOLS ON +#) option(ASYNC_MODE OFF "Enable the async transport backend") if(ASYNC_MODE) @@ -318,7 +317,7 @@ configure_package_config_file(cmake/${PROJECT_NAME}Config.cmake.in ) #Install the libraries -install(TARGETS CopCore AdePT_G4_integration +cuda_rdc_install(TARGETS CopCore AdePT_G4_integration EXPORT ${PROJECT_NAME}Targets ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" diff --git a/examples/AsyncExample/CMakeLists.txt b/examples/AsyncExample/CMakeLists.txt index 699c11715..c93c340ce 100644 --- a/examples/AsyncExample/CMakeLists.txt +++ b/examples/AsyncExample/CMakeLists.txt @@ -58,7 +58,7 @@ add_library(ExamplesCommon OBJECT ) target_include_directories(ExamplesCommon PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../common/include) -target_link_libraries(ExamplesCommon PUBLIC AdePT_G4_integration) +cuda_rdc_target_link_libraries(ExamplesCommon PUBLIC AdePT_G4_integration) target_compile_options(ExamplesCommon PRIVATE -Wall -Wextra) if(HepMC3_FOUND) diff --git a/examples/Example1/CMakeLists.txt b/examples/Example1/CMakeLists.txt index 9bb8872b1..a616a018c 100644 --- a/examples/Example1/CMakeLists.txt +++ b/examples/Example1/CMakeLists.txt @@ -57,7 +57,7 @@ target_include_directories(example1 ${PROJECT_SOURCE_DIR}/examples/common/include ${HEPMC3_INCLUDE_DIR} ) -target_link_libraries(example1 +cuda_rdc_target_link_libraries(example1 PRIVATE ${HEPMC3_LIBRARIES} ${HEPMC3_FIO_LIBRARIES} diff --git a/examples/IntegrationBenchmark/CMakeLists.txt b/examples/IntegrationBenchmark/CMakeLists.txt index e00f91171..f6a5e1e69 100644 --- a/examples/IntegrationBenchmark/CMakeLists.txt +++ b/examples/IntegrationBenchmark/CMakeLists.txt @@ -58,7 +58,7 @@ target_include_directories(integrationBenchmark ${PROJECT_SOURCE_DIR}/examples/common/include ${HEPMC3_INCLUDE_DIR} ) -target_link_libraries(integrationBenchmark +cuda_rdc_target_link_libraries(integrationBenchmark PRIVATE AdePT_G4_integration ${HEPMC3_LIBRARIES} @@ -81,4 +81,4 @@ add_test(NAME testEm3_validation COMMAND bash ${PROJECT_SOURCE_DIR}/examples/IntegrationBenchmark/ci_tests/validation_testem3.sh "$" "${PROJECT_BINARY_DIR}" "${PROJECT_SOURCE_DIR}" WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} -) \ No newline at end of file +) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index e0d675d17..7bfc7f29c 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -8,8 +8,8 @@ macro(build_tests TESTS) foreach(TEST ${TESTS}) get_filename_component(TARGET_NAME ${TEST} NAME_WE) add_executable(${TARGET_NAME} ${TEST}) - set_target_properties(${TARGET_NAME} PROPERTIES CUDA_SEPARABLE_COMPILATION ON) - target_link_libraries(${TARGET_NAME} AdePT_G4_integration) + #set_target_properties(${TARGET_NAME} PROPERTIES CUDA_SEPARABLE_COMPILATION ON) + cuda_rdc_target_link_libraries(${TARGET_NAME} AdePT_G4_integration) endforeach() endmacro() diff --git a/test/testField/CMakeLists.txt b/test/testField/CMakeLists.txt index 1b3bf4424..76b38019b 100644 --- a/test/testField/CMakeLists.txt +++ b/test/testField/CMakeLists.txt @@ -1,7 +1,7 @@ # SPDX-FileCopyrightText: 2021 CERN # SPDX-License-Identifier: Apache-2.0 -SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--disable-new-dtags") +set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--disable-new-dtags") if(NOT TARGET G4HepEm::g4HepEm) message(STATUS "Disabling testField (needs G4HepEm)") @@ -31,15 +31,13 @@ target_include_directories(testField $ $ ) -target_link_libraries(testField - PRIVATE +cuda_rdc_target_link_libraries(testField + #PRIVATE CopCore VecGeom::vecgeom - VecGeom::vecgeomcuda_static VecGeom::vgdml ${Geant4_LIBRARIES} ${G4HepEm_LIBRARIES} - CUDA::cudart ) if(ADEPT_USE_EXT_BFIELD) # link covfie if external magnetic field usage is enabled @@ -50,11 +48,11 @@ if(ADEPT_USE_EXT_BFIELD) ) endif() -set_target_properties(testField - PROPERTIES - CUDA_SEPARABLE_COMPILATION ON - CUDA_RESOLVE_DEVICE_SYMBOLS ON -) +#set_target_properties(testField +# PROPERTIES +# CUDA_SEPARABLE_COMPILATION ON +# CUDA_RESOLVE_DEVICE_SYMBOLS ON +#) # Tests add_test(NAME testField From ca5d1af4e7fac8e24382319b4c0be7c679fed232 Mon Sep 17 00:00:00 2001 From: Philippe Canal Date: Wed, 2 Apr 2025 16:11:23 +0000 Subject: [PATCH 2/3] Additional CudaRdcUtils changes --- test/testField/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/testField/CMakeLists.txt b/test/testField/CMakeLists.txt index 76b38019b..86843842d 100644 --- a/test/testField/CMakeLists.txt +++ b/test/testField/CMakeLists.txt @@ -32,7 +32,7 @@ target_include_directories(testField $ ) cuda_rdc_target_link_libraries(testField - #PRIVATE + PRIVATE CopCore VecGeom::vecgeom VecGeom::vgdml @@ -41,7 +41,7 @@ cuda_rdc_target_link_libraries(testField ) if(ADEPT_USE_EXT_BFIELD) # link covfie if external magnetic field usage is enabled - target_link_libraries(testField + cuda_rdc_target_link_libraries(testField PRIVATE covfie::core covfie::cuda From 63f21832b80f5a6206a4267603f8f80227bc6c55 Mon Sep 17 00:00:00 2001 From: Philippe Canal Date: Wed, 2 Apr 2025 16:26:16 +0000 Subject: [PATCH 3/3] Advertize the long library name --- CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4948d705d..0e755d8a8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -255,6 +255,9 @@ cuda_rdc_target_include_directories(AdePT_G4_integration $ $ ) +# This needs to be after the cuda_rdc_target_include_directories when +# using v10 of CudaRdcUtils.cmake +cuda_rdc_add_library(AdePT::AdePT_G4_integration ALIAS AdePT_G4_integration) cuda_rdc_target_link_libraries(AdePT_G4_integration PUBLIC