Skip to content

Adapt to CudaRdcUtils #376

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 13 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -247,20 +247,22 @@ target_include_directories(CopCore
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/>
)

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
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/>
)
# 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)

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
Expand All @@ -272,18 +274,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)
Expand Down Expand Up @@ -318,7 +320,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}"
Expand Down
2 changes: 1 addition & 1 deletion examples/AsyncExample/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion examples/Example1/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
4 changes: 2 additions & 2 deletions examples/IntegrationBenchmark/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -81,4 +81,4 @@ add_test(NAME testEm3_validation
COMMAND bash ${PROJECT_SOURCE_DIR}/examples/IntegrationBenchmark/ci_tests/validation_testem3.sh
"$<TARGET_FILE:integrationBenchmark>" "${PROJECT_BINARY_DIR}" "${PROJECT_SOURCE_DIR}"
WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
)
)
4 changes: 2 additions & 2 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
18 changes: 8 additions & 10 deletions test/testField/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)")
Expand Down Expand Up @@ -31,30 +31,28 @@ target_include_directories(testField
$<BUILD_INTERFACE:${Geant4_INCLUDE_DIRS}>
$<BUILD_INTERFACE:${G4HepEm_INCLUDE_DIR}>
)
target_link_libraries(testField
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
target_link_libraries(testField
cuda_rdc_target_link_libraries(testField
PRIVATE
covfie::core
covfie::cuda
)
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
Expand Down