Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
12 changes: 8 additions & 4 deletions CMakeLists.txt
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I forgot how the CMake install mechanism works in detail, but do we need to keep the alias target declarations?

add_library(DDC::core ALIAS ddc_core)
# ...
add_library(DDC::fft ALIAS ddc_fft)
# etc

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is meant for evil users that want to mix add_subdirectory(ddc) and find_package(DDC) :). The alias makes it transparent to use both. If it were not present, doing add_subdirectory(ddc), they could only access ddc_core.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I see

Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ endif()

add_library(ddc_core INTERFACE)
add_library(DDC::core ALIAS ddc_core)
set_target_properties(ddc_core PROPERTIES EXPORT_NAME core)
configure_file(cmake/config.hpp.in generated/ddc/config.hpp NO_SOURCE_PERMISSIONS @ONLY)
target_sources(
ddc_core
Expand Down Expand Up @@ -204,6 +205,7 @@ if("${DDC_BUILD_KERNELS_FFT}")

add_library(ddc_fft INTERFACE)
add_library(DDC::fft ALIAS ddc_fft)
set_target_properties(ddc_fft PROPERTIES EXPORT_NAME fft)
target_link_libraries(ddc_fft INTERFACE DDC::core Kokkos::kokkos KokkosFFT::fft)
target_sources(
ddc_fft
Expand All @@ -214,7 +216,7 @@ if("${DDC_BUILD_KERNELS_FFT}")
)

install(TARGETS ddc_fft EXPORT DDCFftTargets FILE_SET HEADERS)
install(EXPORT DDCFftTargets NAMESPACE DDC::impl:: DESTINATION ${DDC_INSTALL_CMAKEDIR})
install(EXPORT DDCFftTargets NAMESPACE DDC:: DESTINATION ${DDC_INSTALL_CMAKEDIR})
endif()

if("${DDC_BUILD_KERNELS_SPLINES}")
Expand Down Expand Up @@ -249,6 +251,7 @@ if("${DDC_BUILD_KERNELS_SPLINES}")

add_library(ddc_splines INTERFACE)
add_library(DDC::splines ALIAS ddc_splines)
set_target_properties(ddc_splines PROPERTIES EXPORT_NAME splines)
target_include_directories(ddc_splines SYSTEM INTERFACE ${LAPACKE_INCLUDE_DIRS})
target_link_libraries(
ddc_splines
Expand Down Expand Up @@ -296,7 +299,7 @@ if("${DDC_BUILD_KERNELS_SPLINES}")

install(FILES cmake/FindLAPACKE.cmake DESTINATION ${DDC_INSTALL_CMAKEDIR})
install(TARGETS ddc_splines EXPORT DDCSplinesTargets FILE_SET HEADERS)
install(EXPORT DDCSplinesTargets NAMESPACE DDC::impl:: DESTINATION ${DDC_INSTALL_CMAKEDIR})
install(EXPORT DDCSplinesTargets NAMESPACE DDC:: DESTINATION ${DDC_INSTALL_CMAKEDIR})
endif()

## The PDI wrapper
Expand All @@ -308,12 +311,13 @@ if("${DDC_BUILD_PDI_WRAPPER}")

add_library(ddc_pdi INTERFACE)
add_library(DDC::pdi ALIAS ddc_pdi)
set_target_properties(ddc_pdi PROPERTIES EXPORT_NAME pdi)
target_compile_features(ddc_pdi INTERFACE cxx_std_17)
target_link_libraries(ddc_pdi INTERFACE DDC::core PDI::PDI_C)
target_sources(ddc_pdi INTERFACE FILE_SET HEADERS BASE_DIRS include FILES include/ddc/pdi.hpp)

install(TARGETS ddc_pdi EXPORT DDCPdiTargets FILE_SET HEADERS)
install(EXPORT DDCPdiTargets NAMESPACE DDC::impl:: DESTINATION ${DDC_INSTALL_CMAKEDIR})
install(EXPORT DDCPdiTargets NAMESPACE DDC:: DESTINATION ${DDC_INSTALL_CMAKEDIR})
endif()

## if examples are enabled, build them
Expand Down Expand Up @@ -342,7 +346,7 @@ endif()

## installation

install(EXPORT DDCTargets NAMESPACE DDC::impl:: DESTINATION ${DDC_INSTALL_CMAKEDIR})
install(EXPORT DDCTargets NAMESPACE DDC:: DESTINATION ${DDC_INSTALL_CMAKEDIR})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will it be better to call DDCTargets as DDCCoreTargets and first modify install(TARGETS ddc_core EXPORT DDCTargets FILE_SET HEADERS) as install(TARGETS ddc_core EXPORT DDCCoreTargets FILE_SET HEADERS)?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes seems reasonable, let me try.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done in edd99b4


configure_package_config_file(
cmake/DDCConfig.cmake.in
Expand Down
12 changes: 0 additions & 12 deletions cmake/DDCConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,11 @@ set(DDC_BUILD_DOUBLE_PRECISION @DDC_BUILD_DOUBLE_PRECISION@)
ddc_find_dependency(Kokkos 4.4...<5)

include(${CMAKE_CURRENT_LIST_DIR}/DDCTargets.cmake)
if(NOT TARGET DDC::core)
add_library(DDC::core ALIAS DDC::impl::ddc_core)
endif()

if(@DDC_BUILD_KERNELS_FFT@ AND ("fft" IN_LIST DDC_FIND_COMPONENTS))
ddc_find_dependency(KokkosFFT 0.3.0...<1)

include(${CMAKE_CURRENT_LIST_DIR}/DDCFftTargets.cmake)
if(NOT TARGET DDC::fft)
add_library(DDC::fft ALIAS DDC::impl::ddc_fft)
endif()
set(DDC_fft_FOUND TRUE)
endif()

Expand All @@ -62,19 +56,13 @@ if(@DDC_BUILD_KERNELS_SPLINES@ AND ("splines" IN_LIST DDC_FIND_COMPONENTS))
ddc_find_dependency(KokkosKernels 4.5.1...<5)

include(${CMAKE_CURRENT_LIST_DIR}/DDCSplinesTargets.cmake)
if(NOT TARGET DDC::splines)
add_library(DDC::splines ALIAS DDC::impl::ddc_splines)
endif()
set(DDC_splines_FOUND TRUE)
endif()

if(@DDC_BUILD_PDI_WRAPPER@ AND ("pdi" IN_LIST DDC_FIND_COMPONENTS))
ddc_find_dependency(PDI 1.6...<2 COMPONENTS C)

include(${CMAKE_CURRENT_LIST_DIR}/DDCPdiTargets.cmake)
if(NOT TARGET DDC::pdi)
add_library(DDC::pdi ALIAS DDC::impl::ddc_pdi)
endif()
set(DDC_pdi_FOUND TRUE)
endif()

Expand Down