Skip to content

Commit

Permalink
Merge pull request #47 from stephenswat/build/rename_lib_targets
Browse files Browse the repository at this point in the history
Add `covfie_` prefix to library targets
  • Loading branch information
stephenswat authored Nov 15, 2024
2 parents 934889a + 967519a commit 4cb1f81
Show file tree
Hide file tree
Showing 13 changed files with 78 additions and 51 deletions.
2 changes: 1 addition & 1 deletion benchmarks/common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ add_library(benchmark test_field.cpp)

target_include_directories(benchmark PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})

target_link_libraries(benchmark PUBLIC core)
target_link_libraries(benchmark PUBLIC covfie_core)

target_compile_definitions(benchmark PRIVATE _CRT_SECURE_NO_WARNINGS)
4 changes: 2 additions & 2 deletions benchmarks/cpu/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ add_executable(benchmark_cpu benchmark_cpu.cpp)
target_link_libraries(
benchmark_cpu
PUBLIC
core
cpu
covfie_core
covfie_cpu
benchmark
benchmark::benchmark
Boost::headers
Expand Down
4 changes: 2 additions & 2 deletions benchmarks/cuda/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ add_executable(benchmark_cuda benchmark_cuda.cu)
target_link_libraries(
benchmark_cuda
PUBLIC
core
cuda
covfie_core
covfie_cuda
benchmark
benchmark::benchmark
Boost::headers
Expand Down
4 changes: 2 additions & 2 deletions benchmarks/openmp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ add_executable(benchmark_openmp benchmark_openmp.cpp)
target_link_libraries(
benchmark_openmp
PUBLIC
core
cpu
covfie_core
covfie_cpu
benchmark
OpenMP::OpenMP_CXX
benchmark::benchmark
Expand Down
18 changes: 9 additions & 9 deletions examples/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ add_executable(convert_bfield convert_bfield.cpp)
target_link_libraries(
convert_bfield
PRIVATE
core
covfie_core
Boost::log
Boost::log_setup
Boost::program_options
Expand All @@ -24,7 +24,7 @@ add_executable(convert_bfield_csv convert_bfield_csv.cpp)
target_link_libraries(
convert_bfield_csv
PRIVATE
core
covfie_core
Boost::log
Boost::log_setup
Boost::program_options
Expand All @@ -33,20 +33,20 @@ target_link_libraries(
# Add the first example that can be found in the README.
add_executable(readme_example_1 readme_example_1.cpp)

target_link_libraries(readme_example_1 PRIVATE core)
target_link_libraries(readme_example_1 PRIVATE covfie_core)

# Add the second example that can be found in the README.
add_executable(readme_example_2 readme_example_2.cpp)

target_link_libraries(readme_example_2 PRIVATE core)
target_link_libraries(readme_example_2 PRIVATE covfie_core)

# Add the an executable to create 2D slices from 3D fields.
add_executable(slice3dto2d slice3dto2d.cpp)

target_link_libraries(
slice3dto2d
PRIVATE
core
covfie_core
Boost::log
Boost::log_setup
Boost::program_options
Expand All @@ -58,26 +58,26 @@ add_executable(scaleup_bfield scaleup_bfield.cpp)
target_link_libraries(
scaleup_bfield
PRIVATE
core
covfie_core
Boost::log
Boost::log_setup
Boost::program_options
)

add_library(asm asm.cpp)
target_link_libraries(asm PRIVATE core)
target_link_libraries(asm PRIVATE covfie_core)

# Some libraries which are designed to inspected by the user.
add_library(shuffle_asm shuffle_asm.cpp)
target_link_libraries(shuffle_asm PRIVATE core)
target_link_libraries(shuffle_asm PRIVATE covfie_core)

# Executable for generating an testable field.
add_executable(generate_test_field generate_test_field.cpp)

target_link_libraries(
generate_test_field
PRIVATE
core
covfie_core
Boost::log
Boost::log_setup
Boost::program_options
Expand Down
8 changes: 4 additions & 4 deletions examples/cpu/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ add_executable(render_slice_cpu render_slice.cpp)
target_link_libraries(
render_slice_cpu
PRIVATE
core
cpu
covfie_core
covfie_cpu
bitmap
Boost::log
Boost::log_setup
Expand All @@ -25,8 +25,8 @@ add_executable(render_image_cpu render_image.cpp)
target_link_libraries(
render_image_cpu
PRIVATE
core
cpu
covfie_core
covfie_cpu
bitmap
Boost::log
Boost::log_setup
Expand Down
8 changes: 4 additions & 4 deletions examples/cuda/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ add_executable(render_slice_cuda render_slice.cu)
target_link_libraries(
render_slice_cuda
PRIVATE
core
cuda
covfie_core
covfie_cuda
bitmap
Boost::log
Boost::log_setup
Expand All @@ -33,8 +33,8 @@ add_executable(render_slice_texture_cuda render_slice_texture.cu)
target_link_libraries(
render_slice_texture_cuda
PRIVATE
core
cuda
covfie_core
covfie_cuda
bitmap
Boost::log
Boost::log_setup
Expand Down
23 changes: 16 additions & 7 deletions lib/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,30 @@
# v. 2.0. If a copy of the MPL was not distributed with this file, You can
# obtain one at http://mozilla.org/MPL/2.0/.

add_library(core INTERFACE)
add_library(covfie_core INTERFACE)

target_include_directories(
core
covfie_core
INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)

target_compile_features(core INTERFACE cxx_std_20)
target_compile_features(covfie_core INTERFACE cxx_std_20)

if(COVFIE_QUIET)
target_compile_definitions(core INTERFACE COVFIE_QUIET)
target_compile_definitions(covfie_core INTERFACE COVFIE_QUIET)
endif()

# Logic to ensure that the core module can be installed properly.
install(TARGETS core EXPORT ${PROJECT_NAME}Targets)
set_target_properties(
covfie_core
PROPERTIES
EXPORT_NAME
core
)

install(TARGETS covfie_core EXPORT ${PROJECT_NAME}Targets)

install(
DIRECTORY
Expand All @@ -32,7 +39,9 @@ install(

# Hack for people using the disgusting mal-practice of pullling in external
# projects via "add_subdirectory"...
add_library(covfie::core ALIAS core)
if(NOT PROJECT_IS_TOP_LEVEL)
add_library(covfie::core ALIAS covfie_core)
endif()

# Test the public headers of covfie::core.
if(COVFIE_TEST_HEADERS)
Expand All @@ -45,7 +54,7 @@ if(COVFIE_TEST_HEADERS)
)

covfie_test_public_headers(
core
covfie_core
"${public_headers}"
)
endif()
23 changes: 16 additions & 7 deletions lib/cpu/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,39 @@
# v. 2.0. If a copy of the MPL was not distributed with this file, You can
# obtain one at http://mozilla.org/MPL/2.0/.

add_library(cpu INTERFACE)
add_library(covfie_cpu INTERFACE)

target_include_directories(
cpu
covfie_cpu
INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)

target_compile_features(cpu INTERFACE cxx_std_20)
target_compile_features(covfie_cpu INTERFACE cxx_std_20)

# Logic to ensure that the CPU module can be installed properly.
install(TARGETS cpu EXPORT ${PROJECT_NAME}Targets)
set_target_properties(
covfie_cpu
PROPERTIES
EXPORT_NAME
cpu
)

install(TARGETS covfie_cpu EXPORT ${PROJECT_NAME}Targets)

install(
DIRECTORY
${CMAKE_CURRENT_SOURCE_DIR}/covfie
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)

target_link_libraries(cpu INTERFACE covfie::core)
target_link_libraries(covfie_cpu INTERFACE covfie_core)

# Hack for compatibility
add_library(covfie::cpu ALIAS cpu)
if(NOT PROJECT_IS_TOP_LEVEL)
add_library(covfie::cpu ALIAS covfie_cpu)
endif()

# Test the public headers of covfie::cpu.
if(COVFIE_TEST_HEADERS)
Expand All @@ -42,7 +51,7 @@ if(COVFIE_TEST_HEADERS)
)

covfie_test_public_headers(
cpu
covfie_cpu
"${public_headers}"
)
endif()
25 changes: 17 additions & 8 deletions lib/cuda/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,33 @@

find_package(CUDAToolkit REQUIRED)

add_library(cuda INTERFACE)
add_library(covfie_cuda INTERFACE)

target_include_directories(
cuda
covfie_cuda
INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)

target_compile_features(cuda INTERFACE cxx_std_20)
target_compile_features(covfie_cuda INTERFACE cxx_std_20)

target_link_libraries(
cuda
covfie_cuda
INTERFACE
CUDA::cudart
covfie::core
covfie_core
)

# Logic to ensure that the CUDA module can be installed properly.
install(TARGETS cuda EXPORT ${PROJECT_NAME}Targets)
set_target_properties(
covfie_cuda
PROPERTIES
EXPORT_NAME
cuda
)

install(TARGETS covfie_cuda EXPORT ${PROJECT_NAME}Targets)

install(
DIRECTORY
Expand All @@ -36,7 +43,9 @@ install(
)

# Hack for compatibility
add_library(covfie::cuda ALIAS cuda)
if(NOT PROJECT_IS_TOP_LEVEL)
add_library(covfie::cuda ALIAS covfie_cuda)
endif()

# Test the public headers of covfie::cuda.
if(COVFIE_TEST_HEADERS)
Expand All @@ -49,7 +58,7 @@ if(COVFIE_TEST_HEADERS)
)

covfie_test_public_headers(
cuda
covfie_cuda
"${public_headers}"
)
endif()
2 changes: 1 addition & 1 deletion tests/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ add_executable(
target_link_libraries(
test_core
PUBLIC
core
covfie_core
GTest::gtest
GTest::gtest_main
Boost::filesystem
Expand Down
4 changes: 2 additions & 2 deletions tests/cpu/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ add_executable(test_cpu test_cpu_array_backend.cpp)
target_link_libraries(
test_cpu
PUBLIC
core
cpu
covfie_core
covfie_cpu
GTest::gtest
GTest::gtest_main
)
4 changes: 2 additions & 2 deletions tests/cuda/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ add_executable(test_cuda test_cuda_array.cu)
target_link_libraries(
test_cuda
PUBLIC
core
cuda
covfie_core
covfie_cuda
GTest::gtest
GTest::gtest_main
)

0 comments on commit 4cb1f81

Please sign in to comment.