From d387f024007ffedec94bc8886dbb62049d4301c6 Mon Sep 17 00:00:00 2001 From: Attila Krasznahorkay Date: Sun, 10 Nov 2024 08:53:25 +0100 Subject: [PATCH] Put a covfie_ prefix on all libraries and executables. This is to ensure that common names like "core" and "cpu" would not clash with target names used in client projects. --- benchmarks/common/CMakeLists.txt | 10 +++--- benchmarks/cpu/CMakeLists.txt | 12 +++---- benchmarks/cuda/CMakeLists.txt | 12 +++---- benchmarks/openmp/CMakeLists.txt | 12 +++---- examples/common/bitmap/CMakeLists.txt | 6 ++-- examples/core/CMakeLists.txt | 48 +++++++++++++-------------- examples/cpu/CMakeLists.txt | 22 ++++++------ examples/cuda/CMakeLists.txt | 20 +++++------ lib/core/CMakeLists.txt | 23 ++++++++----- lib/cpu/CMakeLists.txt | 23 ++++++++----- lib/cuda/CMakeLists.txt | 21 ++++++++---- tests/core/CMakeLists.txt | 6 ++-- tests/cpu/CMakeLists.txt | 6 ++-- tests/cuda/CMakeLists.txt | 4 +-- tests/utils/CMakeLists.txt | 8 ++--- 15 files changed, 127 insertions(+), 106 deletions(-) diff --git a/benchmarks/common/CMakeLists.txt b/benchmarks/common/CMakeLists.txt index 8ce4c61..f6fe1a3 100644 --- a/benchmarks/common/CMakeLists.txt +++ b/benchmarks/common/CMakeLists.txt @@ -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) diff --git a/benchmarks/cpu/CMakeLists.txt b/benchmarks/cpu/CMakeLists.txt index 482a4c3..5a02762 100644 --- a/benchmarks/cpu/CMakeLists.txt +++ b/benchmarks/cpu/CMakeLists.txt @@ -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 ) diff --git a/benchmarks/cuda/CMakeLists.txt b/benchmarks/cuda/CMakeLists.txt index b1265df..75a605d 100644 --- a/benchmarks/cuda/CMakeLists.txt +++ b/benchmarks/cuda/CMakeLists.txt @@ -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 @@ -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 ) diff --git a/benchmarks/openmp/CMakeLists.txt b/benchmarks/openmp/CMakeLists.txt index 215be12..8733ecd 100644 --- a/benchmarks/openmp/CMakeLists.txt +++ b/benchmarks/openmp/CMakeLists.txt @@ -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 @@ -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 diff --git a/examples/common/bitmap/CMakeLists.txt b/examples/common/bitmap/CMakeLists.txt index f7dc0b7..300d910 100644 --- a/examples/common/bitmap/CMakeLists.txt +++ b/examples/common/bitmap/CMakeLists.txt @@ -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}) diff --git a/examples/core/CMakeLists.txt b/examples/core/CMakeLists.txt index 03520b1..474de9d 100644 --- a/examples/core/CMakeLists.txt +++ b/examples/core/CMakeLists.txt @@ -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 diff --git a/examples/cpu/CMakeLists.txt b/examples/cpu/CMakeLists.txt index a51a1fc..4641892 100644 --- a/examples/cpu/CMakeLists.txt +++ b/examples/cpu/CMakeLists.txt @@ -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 diff --git a/examples/cuda/CMakeLists.txt b/examples/cuda/CMakeLists.txt index cb09928..61315bc 100644 --- a/examples/cuda/CMakeLists.txt +++ b/examples/cuda/CMakeLists.txt @@ -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 diff --git a/lib/core/CMakeLists.txt b/lib/core/CMakeLists.txt index 20046b0..a2f3e46 100644 --- a/lib/core/CMakeLists.txt +++ b/lib/core/CMakeLists.txt @@ -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 $ $ ) -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) @@ -41,7 +48,7 @@ if(COVFIE_TEST_HEADERS) ) covfie_test_public_headers( - core + covfie_core "${public_headers}" ) endif() diff --git a/lib/cpu/CMakeLists.txt b/lib/cpu/CMakeLists.txt index e7aed59..1adfb84 100644 --- a/lib/cpu/CMakeLists.txt +++ b/lib/cpu/CMakeLists.txt @@ -1,31 +1,38 @@ # 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(cpu INTERFACE) +add_library(covfie_cpu INTERFACE) target_include_directories( - cpu + covfie_cpu INTERFACE $ $ ) -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 include) -target_link_libraries(cpu INTERFACE covfie::core) +target_link_libraries(covfie_cpu INTERFACE covfie::core) # Hack for compatibility -add_library(covfie::cpu ALIAS cpu) +add_library(covfie::cpu ALIAS covfie_cpu) # Test the public headers of covfie::cpu. if(COVFIE_TEST_HEADERS) @@ -38,7 +45,7 @@ if(COVFIE_TEST_HEADERS) ) covfie_test_public_headers( - cpu + covfie_cpu "${public_headers}" ) endif() diff --git a/lib/cuda/CMakeLists.txt b/lib/cuda/CMakeLists.txt index 515f71f..3fe5497 100644 --- a/lib/cuda/CMakeLists.txt +++ b/lib/cuda/CMakeLists.txt @@ -8,31 +8,38 @@ find_package(CUDAToolkit REQUIRED) -add_library(cuda INTERFACE) +add_library(covfie_cuda INTERFACE) target_include_directories( - cuda + covfie_cuda INTERFACE $ $ ) -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 ) # 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 ${CMAKE_CURRENT_SOURCE_DIR}/covfie DESTINATION include) # Hack for compatibility -add_library(covfie::cuda ALIAS cuda) +add_library(covfie::cuda ALIAS covfie_cuda) # Test the public headers of covfie::cuda. if(COVFIE_TEST_HEADERS) @@ -45,7 +52,7 @@ if(COVFIE_TEST_HEADERS) ) covfie_test_public_headers( - cuda + covfie_cuda "${public_headers}" ) endif() diff --git a/tests/core/CMakeLists.txt b/tests/core/CMakeLists.txt index bb4b07b..0dab099 100644 --- a/tests/core/CMakeLists.txt +++ b/tests/core/CMakeLists.txt @@ -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 @@ -35,9 +35,9 @@ add_executable( target_link_libraries( test_core PUBLIC - core + covfie::core GTest::gtest GTest::gtest_main Boost::filesystem - testing_utils + covfie_testing_utils ) diff --git a/tests/cpu/CMakeLists.txt b/tests/cpu/CMakeLists.txt index 1800c40..7cb5a02 100644 --- a/tests/cpu/CMakeLists.txt +++ b/tests/cpu/CMakeLists.txt @@ -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 @@ -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 ) diff --git a/tests/cuda/CMakeLists.txt b/tests/cuda/CMakeLists.txt index 6183744..37a0d27 100644 --- a/tests/cuda/CMakeLists.txt +++ b/tests/cuda/CMakeLists.txt @@ -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 ) diff --git a/tests/utils/CMakeLists.txt b/tests/utils/CMakeLists.txt index d0b0151..d8c199f 100644 --- a/tests/utils/CMakeLists.txt +++ b/tests/utils/CMakeLists.txt @@ -8,15 +8,15 @@ find_package(Boost 1.71.0 REQUIRED COMPONENTS filesystem) -add_library(testing_utils tmp_file.cpp) +add_library(covfie_testing_utils tmp_file.cpp) # Ensure that the utils. -target_link_libraries(testing_utils PUBLIC Boost::filesystem) +target_link_libraries(covfie_testing_utils PUBLIC Boost::filesystem) target_include_directories( - testing_utils + covfie_testing_utils PUBLIC $ ) -target_compile_definitions(testing_utils PRIVATE _CRT_SECURE_NO_WARNINGS) +target_compile_definitions(covfie_testing_utils PRIVATE _CRT_SECURE_NO_WARNINGS)