Skip to content

Commit

Permalink
Put a covfie_ prefix on all libraries and executables.
Browse files Browse the repository at this point in the history
This is to ensure that common names like "core" and "cpu" would
not clash with target names used in client projects.
  • Loading branch information
krasznaa committed Nov 10, 2024
1 parent 3ae1776 commit d387f02
Show file tree
Hide file tree
Showing 15 changed files with 127 additions and 106 deletions.
10 changes: 5 additions & 5 deletions benchmarks/common/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# This file is part of covfie, a part of the ACTS project
#
# Copyright (c) 2022 CERN
# Copyright (c) 2022-2024 CERN
#
# This Source Code Form is subject to the terms of the Mozilla Public License,
# 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(benchmark test_field.cpp)
add_library(covfie_benchmark test_field.cpp)

target_include_directories(benchmark PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_include_directories(covfie_benchmark PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})

target_link_libraries(benchmark PUBLIC core)
target_link_libraries(covfie_benchmark PUBLIC covfie::core)

target_compile_definitions(benchmark PRIVATE _CRT_SECURE_NO_WARNINGS)
target_compile_definitions(covfie_benchmark PRIVATE _CRT_SECURE_NO_WARNINGS)
12 changes: 6 additions & 6 deletions benchmarks/cpu/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
# This file is part of covfie, a part of the ACTS project
#
# Copyright (c) 2022 CERN
# Copyright (c) 2022-2024 CERN
#
# This Source Code Form is subject to the terms of the Mozilla Public License,
# 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/.

# Create the benchmark executable from the individual files.
add_executable(benchmark_cpu benchmark_cpu.cpp)
add_executable(covfie_benchmark_cpu benchmark_cpu.cpp)

# Ensure that the tests are linked against the required libraries.
target_link_libraries(
benchmark_cpu
covfie_benchmark_cpu
PUBLIC
core
cpu
benchmark
covfie::core
covfie::cpu
covfie_benchmark
benchmark::benchmark
Boost::headers
)
12 changes: 6 additions & 6 deletions benchmarks/cuda/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This file is part of covfie, a part of the ACTS project
#
# Copyright (c) 2022-2023 CERN
# Copyright (c) 2022-2024 CERN
#
# This Source Code Form is subject to the terms of the Mozilla Public License,
# v. 2.0. If a copy of the MPL was not distributed with this file, You can
Expand All @@ -12,15 +12,15 @@ enable_language(CUDA)
include(covfie-compiler-options-cuda)

# Create the benchmark executable from the individual files.
add_executable(benchmark_cuda benchmark_cuda.cu)
add_executable(covfie_benchmark_cuda benchmark_cuda.cu)

# Ensure that the tests are linked against the required libraries.
target_link_libraries(
benchmark_cuda
covfie_benchmark_cuda
PUBLIC
core
cuda
benchmark
covfie::core
covfie::cuda
covfie_benchmark
benchmark::benchmark
Boost::headers
)
12 changes: 6 additions & 6 deletions benchmarks/openmp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This file is part of covfie, a part of the ACTS project
#
# Copyright (c) 2022 CERN
# Copyright (c) 2022-2024 CERN
#
# This Source Code Form is subject to the terms of the Mozilla Public License,
# v. 2.0. If a copy of the MPL was not distributed with this file, You can
Expand All @@ -10,15 +10,15 @@
find_package(OpenMP COMPONENTS CXX REQUIRED)

# Create the benchmark executable from the individual files.
add_executable(benchmark_openmp benchmark_openmp.cpp)
add_executable(covfie_benchmark_openmp benchmark_openmp.cpp)

# Ensure that the tests are linked against the required libraries.
target_link_libraries(
benchmark_openmp
covfie_benchmark_openmp
PUBLIC
core
cpu
benchmark
covfie::core
covfie::cpu
covfie_benchmark
OpenMP::OpenMP_CXX
benchmark::benchmark
Boost::headers
Expand Down
6 changes: 3 additions & 3 deletions examples/common/bitmap/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# This file is part of covfie, a part of the ACTS project
#
# Copyright (c) 2022 CERN
# Copyright (c) 2022-2024 CERN
#
# This Source Code Form is subject to the terms of the Mozilla Public License,
# 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(bitmap bitmap.cpp)
add_library(covfie_bitmap bitmap.cpp)

target_include_directories(bitmap PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_include_directories(covfie_bitmap PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
48 changes: 24 additions & 24 deletions examples/core/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,83 +1,83 @@
# This file is part of covfie, a part of the ACTS project
#
# Copyright (c) 2022 CERN
# Copyright (c) 2022-2024 CERN
#
# This Source Code Form is subject to the terms of the Mozilla Public License,
# 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 the conversion of B-fields to our native format.
add_executable(convert_bfield convert_bfield.cpp)
add_executable(covfie_convert_bfield convert_bfield.cpp)

target_link_libraries(
convert_bfield
covfie_convert_bfield
PRIVATE
core
covfie::core
Boost::log
Boost::log_setup
Boost::program_options
)

# Add the conversion of B-fields from CSV to our native format.
add_executable(convert_bfield_csv convert_bfield_csv.cpp)
add_executable(covfie_convert_bfield_csv convert_bfield_csv.cpp)

target_link_libraries(
convert_bfield_csv
covfie_convert_bfield_csv
PRIVATE
core
covfie::core
Boost::log
Boost::log_setup
Boost::program_options
)

# Add the first example that can be found in the README.
add_executable(readme_example_1 readme_example_1.cpp)
add_executable(covfie_readme_example_1 readme_example_1.cpp)

target_link_libraries(readme_example_1 PRIVATE core)
target_link_libraries(covfie_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)
add_executable(covfie_readme_example_2 readme_example_2.cpp)

target_link_libraries(readme_example_2 PRIVATE core)
target_link_libraries(covfie_readme_example_2 PRIVATE covfie::core)

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

target_link_libraries(
slice3dto2d
covfie_slice3dto2d
PRIVATE
core
covfie::core
Boost::log
Boost::log_setup
Boost::program_options
)

# Add the an executable to scale up B-fields.
add_executable(scaleup_bfield scaleup_bfield.cpp)
add_executable(covfie_scaleup_bfield scaleup_bfield.cpp)

target_link_libraries(
scaleup_bfield
covfie_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)
add_library(covfie_asm asm.cpp)
target_link_libraries(covfie_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)
add_library(covfie_shuffle_asm shuffle_asm.cpp)
target_link_libraries(covfie_shuffle_asm PRIVATE covfie::core)

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

target_link_libraries(
generate_test_field
covfie_generate_test_field
PRIVATE
core
covfie::core
Boost::log
Boost::log_setup
Boost::program_options
Expand Down
22 changes: 11 additions & 11 deletions examples/cpu/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
# This file is part of covfie, a part of the ACTS project
#
# Copyright (c) 2022 CERN
# Copyright (c) 2022-2024 CERN
#
# This Source Code Form is subject to the terms of the Mozilla Public License,
# 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 the 3D field slice rendering tool.
add_executable(render_slice_cpu render_slice.cpp)
add_executable(covfie_render_slice_cpu render_slice.cpp)

target_link_libraries(
render_slice_cpu
covfie_render_slice_cpu
PRIVATE
core
cpu
bitmap
covfie::core
covfie::cpu
covfie_bitmap
Boost::log
Boost::log_setup
Boost::program_options
)

add_executable(render_image_cpu render_image.cpp)
add_executable(covfie_render_image_cpu render_image.cpp)

target_link_libraries(
render_image_cpu
covfie_render_image_cpu
PRIVATE
core
cpu
bitmap
covfie::core
covfie::cpu
covfie_bitmap
Boost::log
Boost::log_setup
Boost::program_options
Expand Down
20 changes: 10 additions & 10 deletions examples/cuda/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,28 @@ enable_language(CUDA)
include(covfie-compiler-options-cuda)

# Add the 3D field slice rendering tool based on CUDA.
add_executable(render_slice_cuda render_slice.cu)
add_executable(covfie_render_slice_cuda render_slice.cu)

target_link_libraries(
render_slice_cuda
covfie_render_slice_cuda
PRIVATE
core
cuda
bitmap
covfie::core
covfie::cuda
covfie_bitmap
Boost::log
Boost::log_setup
Boost::program_options
)

# Add the 3D field slice rendering tool based on CUDA textures.
add_executable(render_slice_texture_cuda render_slice_texture.cu)
add_executable(covfie_render_slice_texture_cuda render_slice_texture.cu)

target_link_libraries(
render_slice_texture_cuda
covfie_render_slice_texture_cuda
PRIVATE
core
cuda
bitmap
covfie::core
covfie::cuda
covfie_bitmap
Boost::log
Boost::log_setup
Boost::program_options
Expand Down
23 changes: 15 additions & 8 deletions lib/core/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,34 +1,41 @@
# This file is part of covfie, a part of the ACTS project
#
# Copyright (c) 2022-2023 CERN
# Copyright (c) 2022-2024 CERN
#
# This Source Code Form is subject to the terms of the Mozilla Public License,
# 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 ${CMAKE_CURRENT_SOURCE_DIR}/covfie DESTINATION include)

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

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

covfie_test_public_headers(
core
covfie_core
"${public_headers}"
)
endif()
Loading

0 comments on commit d387f02

Please sign in to comment.