Skip to content

Commit

Permalink
Merge pull request #348 from dalg24/target_alias
Browse files Browse the repository at this point in the history
  • Loading branch information
aprokop authored Jul 30, 2020
2 parents 5d53ad6 + d7b8deb commit 60a9232
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 12 deletions.
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ set_target_properties(ArborX PROPERTIES INTERFACE_COMPILE_FEATURES cxx_std_14)
# within a subdirectory.
add_dependencies(ArborX record_hash)

# Refer to the alias target in examples and benchmarks so they can be built
# against an installed ArborX
add_library(ArborX::ArborX ALIAS ArborX)

option(ARBORX_ENABLE_MPI "Enable MPI support" OFF)
if(ARBORX_ENABLE_MPI)
find_package(MPI REQUIRED)
Expand Down
3 changes: 1 addition & 2 deletions benchmarks/bvh_driver/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
set(ArborX_TARGET ArborX)
set(POINT_CLOUDS_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/benchmarks/point_clouds)
set(UNIT_TESTS_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/test)

Expand All @@ -9,7 +8,7 @@ find_package(benchmark REQUIRED)
find_package(Threads REQUIRED)

add_executable(ArborX_BoundingVolumeHierarchy.exe bvh_driver.cpp)
target_link_libraries(ArborX_BoundingVolumeHierarchy.exe ${ArborX_TARGET} benchmark::benchmark Boost::program_options Threads::Threads)
target_link_libraries(ArborX_BoundingVolumeHierarchy.exe ArborX::ArborX benchmark::benchmark Boost::program_options Threads::Threads)
target_include_directories(ArborX_BoundingVolumeHierarchy.exe PRIVATE ${POINT_CLOUDS_INCLUDE_DIR} ${UNIT_TESTS_INCLUDE_DIR})
add_test(NAME ArborX_BoundingVolumeHierarchy_Benchmark COMMAND ./ArborX_BoundingVolumeHierarchy.exe --buffer=0 --benchmark_color=true)
if(ARBORX_PERFORMANCE_TESTING)
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/distributed_tree_driver/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
add_executable(ArborX_DistributedTree.exe distributed_tree_driver.cpp)
target_link_libraries(ArborX_DistributedTree.exe ArborX Boost::program_options)
target_link_libraries(ArborX_DistributedTree.exe ArborX::ArborX Boost::program_options)
target_include_directories(ArborX_DistributedTree.exe PRIVATE ${CMAKE_SOURCE_DIR}/benchmarks/point_clouds)
add_test(NAME ArborX_DistributedTree_Benchmark COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} ./ArborX_DistributedTree.exe ${MPIEXEC_POSTFLAGS})
4 changes: 0 additions & 4 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
set(ArborX_TARGET ArborX)
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
cmake_minimum_required(VERSION 3.12)
project(ArborXExamples CXX)
find_package(ArborX REQUIRED)
enable_testing()
set(ArborX_TARGET ArborX::ArborX)
elseif()
set(ArborX_TARGET ArborX)
endif()

add_subdirectory(access_traits)
Expand Down
4 changes: 2 additions & 2 deletions examples/access_traits/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
if(Kokkos_ENABLE_CUDA)
add_executable(ArborX_CudaAccessTraits.exe example_cuda_access_traits.cpp)
target_link_libraries(ArborX_CudaAccessTraits.exe ${ArborX_TARGET})
target_link_libraries(ArborX_CudaAccessTraits.exe ArborX::ArborX)
add_test(NAME ArborX_CudaAccessTraits_Example COMMAND ./ArborX_CudaAccessTraits.exe)
endif()
add_executable(ArborX_HostAccessTraits.exe example_host_access_traits.cpp)
target_link_libraries(ArborX_HostAccessTraits.exe ${ArborX_TARGET})
target_link_libraries(ArborX_HostAccessTraits.exe ArborX::ArborX)
add_test(NAME ArborX_HostAccessTraits_Example COMMAND ./ArborX_HostAccessTraits.exe)
2 changes: 1 addition & 1 deletion examples/callback/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
add_executable(ArborX_Callback.exe example_callback.cpp)
target_link_libraries(ArborX_Callback.exe ${ArborX_TARGET})
target_link_libraries(ArborX_Callback.exe ArborX::ArborX)
add_test(NAME ArborX_Callback_Example COMMAND ./ArborX_Callback.exe)
2 changes: 1 addition & 1 deletion examples/halo_finder/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
add_executable(ArborX_HaloFinder.exe halo_finder.cpp)
target_include_directories(ArborX_HaloFinder.exe PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(ArborX_HaloFinder.exe ${ArborX_TARGET} Boost::program_options)
target_link_libraries(ArborX_HaloFinder.exe ArborX::ArborX Boost::program_options)

set(input_file "input.txt")
add_test(NAME ArborX_HaloFinder COMMAND ./ArborX_HaloFinder.exe --filename=${input_file} --linking-length=1.4 --verify)
Expand Down
2 changes: 1 addition & 1 deletion examples/viz/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
if(Kokkos_ENABLE_SERIAL)
add_executable(ArborX_TreeViz.exe tree_visualization.cpp)
target_link_libraries(ArborX_TreeViz.exe ${ArborX_TARGET} Boost::program_options)
target_link_libraries(ArborX_TreeViz.exe ArborX::ArborX Boost::program_options)
add_test(NAME ArborX_TreeViz_Example COMMAND ./ArborX_TreeViz.exe)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/leaf_cloud.txt ${CMAKE_CURRENT_BINARY_DIR}/leaf_cloud.txt COPYONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/arborx_query_sort.py ${CMAKE_CURRENT_BINARY_DIR}/arborx_query_sort.py COPYONLY)
Expand Down

0 comments on commit 60a9232

Please # to comment.