From 00b45da994e4f40d3856aa557f9401407c78f493 Mon Sep 17 00:00:00 2001 From: nesser <nesser@mpifr-bonn.mpg.de> Date: Thu, 14 Nov 2024 19:16:51 +0000 Subject: [PATCH] Install 'psrdada_cppTargets-release.cmake', only one big library 'psrdada_cpp', added pragma once statements --- debian/psrdadacpp-dev.install | 2 +- psrdada_cpp/CMakeLists.txt | 30 +++----------- psrdada_cpp/common/CMakeLists.txt | 11 +----- psrdada_cpp/common/test/CMakeLists.txt | 2 +- psrdada_cpp/dadaflow/AsyncDadaReadClient.hpp | 4 +- psrdada_cpp/dadaflow/CMakeLists.txt | 39 ++++++++----------- psrdada_cpp/dadaflow/MessageQueue.hpp | 1 + .../dadaflow/io/sigproc/test/CMakeLists.txt | 2 +- psrdada_cpp/dadaflow/test/CMakeLists.txt | 3 +- psrdada_cpp/fft_spectrometer/CMakeLists.txt | 26 +++++-------- .../fft_spectrometer/test/CMakeLists.txt | 2 +- psrdada_cpp/rs_spectrometer/CMakeLists.txt | 34 +++++----------- 12 files changed, 48 insertions(+), 108 deletions(-) diff --git a/debian/psrdadacpp-dev.install b/debian/psrdadacpp-dev.install index d5d3da34..3055b2a8 100644 --- a/debian/psrdadacpp-dev.install +++ b/debian/psrdadacpp-dev.install @@ -1,6 +1,6 @@ usr/include usr/lib/*.a -usr/lib/cmake/psrdada_cpp/psrdada_cppTargets-none.cmake +usr/lib/cmake/psrdada_cpp/psrdada_cppTargets-release.cmake usr/lib/cmake/psrdada_cpp/psrdada_cppTargets.cmake usr/lib/cmake/psrdada_cpp/psrdada_cppConfig.cmake usr/lib/cmake/psrdada_cpp/psrdada_cppConfigVersion.cmake diff --git a/psrdada_cpp/CMakeLists.txt b/psrdada_cpp/CMakeLists.txt index a2aa701b..03bf5ed7 100644 --- a/psrdada_cpp/CMakeLists.txt +++ b/psrdada_cpp/CMakeLists.txt @@ -3,15 +3,9 @@ include_directories(${CMAKE_SOURCE_DIR}) # Collect all include and source files from th current directory file(GLOB PSRDADA_CPP_INC "${CMAKE_CURRENT_SOURCE_DIR}/*.cuh" "${CMAKE_CURRENT_SOURCE_DIR}/*.hpp") file(GLOB PSRDADA_CPP_SRC "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cu") -add_library(${CMAKE_PROJECT_NAME}_core ${PSRDADA_CPP_SRC}) -target_link_libraries(${CMAKE_PROJECT_NAME}_core PUBLIC ${DEPENDENCY_LIBRARIES}) -install (TARGETS ${CMAKE_PROJECT_NAME}_core - EXPORT ${CMAKE_PROJECT_NAME}Targets - RUNTIME DESTINATION bin - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib) - -set(PSRDADA_CPP_LIBRARIES ${CMAKE_PROJECT_NAME}_core ${DEPENDENCY_LIBRARIES}) +add_library(${CMAKE_PROJECT_NAME} ${PSRDADA_CPP_SRC}) +target_link_libraries(${CMAKE_PROJECT_NAME} PUBLIC ${DEPENDENCY_LIBRARIES}) +set(PSRDADA_CPP_LIBRARIES ${CMAKE_PROJECT_NAME} ${DEPENDENCY_LIBRARIES}) # ----------------------------- # # -- Build DADA tools / apps -- # @@ -68,6 +62,9 @@ if (BUILD_DADAFLOW) add_subdirectory(dadaflow) endif() +# --------------------------------- # +# -- Build and install benchmark -- # +# --------------------------------- # # Add benchmark binaries here to get executed with 'make -C <path-to-build> run_benchmark' if(ENABLE_BENCHMARK AND BUILD_SUBMODULES) add_custom_target(run_benchmark @@ -79,21 +76,6 @@ endif() # --------------------------------------------------------------------- # # Install targets: lib, bin and include - Also export the cmake project # # --------------------------------------------------------------------- # -add_library(${CMAKE_PROJECT_NAME} - ${PSRDADA_CPP_SRC} - ${PSRDADA_CPP_COMMON_SRC} - ${PSRDADA_CPP_DADAFLOW_SRC}) -target_link_libraries (${CMAKE_PROJECT_NAME} PUBLIC - ${CMAKE_PROJECT_NAME}_core - ${CMAKE_PROJECT_NAME}_dadaflow - ${CMAKE_PROJECT_NAME}_common) - -target_include_directories(${CMAKE_PROJECT_NAME} PUBLIC - $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> - $<INSTALL_INTERFACE:include/${CMAKE_PROJECT_NAME}> -) - - install (TARGETS ${CMAKE_PROJECT_NAME} EXPORT ${CMAKE_PROJECT_NAME}Targets RUNTIME DESTINATION bin diff --git a/psrdada_cpp/common/CMakeLists.txt b/psrdada_cpp/common/CMakeLists.txt index f5ab4b33..18c807b9 100644 --- a/psrdada_cpp/common/CMakeLists.txt +++ b/psrdada_cpp/common/CMakeLists.txt @@ -1,18 +1,9 @@ if(ENABLE_CUDA) file(GLOB PSRDADA_CPP_COMMON_INC "${CMAKE_CURRENT_SOURCE_DIR}/*.cuh" "${CMAKE_CURRENT_SOURCE_DIR}/*.hpp") file(GLOB PSRDADA_CPP_COMMON_SRC "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cu") - add_library(${CMAKE_PROJECT_NAME}_common ${PSRDADA_CPP_COMMON_SRC}) - target_link_libraries (${CMAKE_PROJECT_NAME}_common PUBLIC ${PSRDADA_CPP_LIBRARIES}) - + target_sources(${CMAKE_PROJECT_NAME} PRIVATE ${PSRDADA_CPP_COMMON_SRC}) install(FILES ${PSRDADA_CPP_COMMON_INC} DESTINATION include/psrdada_cpp/common) install(DIRECTORY src DESTINATION include/psrdada_cpp/common) - install (TARGETS ${CMAKE_PROJECT_NAME}_common - EXPORT ${CMAKE_PROJECT_NAME}Targets - RUNTIME DESTINATION bin - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib - INCLUDES DESTINATION include/) - if (ENABLE_TESTING) add_subdirectory(test) endif() diff --git a/psrdada_cpp/common/test/CMakeLists.txt b/psrdada_cpp/common/test/CMakeLists.txt index 25e99885..9e7cdd25 100644 --- a/psrdada_cpp/common/test/CMakeLists.txt +++ b/psrdada_cpp/common/test/CMakeLists.txt @@ -9,5 +9,5 @@ set(gtest_common ) add_executable(gtest_common ${gtest_common} ) -target_link_libraries(gtest_common ${PSRDADA_CPP_LIBRARIES} ${GTEST_LIBRARIES} ${CMAKE_PROJECT_NAME}_common) +target_link_libraries(gtest_common ${PSRDADA_CPP_LIBRARIES} ${GTEST_LIBRARIES}) add_test(gtest_common gtest_common --test_data "${CMAKE_CURRENT_LIST_DIR}/data") diff --git a/psrdada_cpp/dadaflow/AsyncDadaReadClient.hpp b/psrdada_cpp/dadaflow/AsyncDadaReadClient.hpp index 00c8a1b5..2fa5007d 100644 --- a/psrdada_cpp/dadaflow/AsyncDadaReadClient.hpp +++ b/psrdada_cpp/dadaflow/AsyncDadaReadClient.hpp @@ -1,5 +1,4 @@ -#ifndef PSRDADA_CPP_DADA_READ_CLIENT_HPP -#define PSRDADA_CPP_DADA_READ_CLIENT_HPP +#pragma once #include "psrdada_cpp/common.hpp" #include "psrdada_cpp/dada_client_base.hpp" @@ -191,4 +190,3 @@ class AsyncDadaReadClient: public DadaClientBase } // namespace psrdada_cpp -#endif // PSRDADA_CPP_DADA_READ_CLIENT_HPP \ No newline at end of file diff --git a/psrdada_cpp/dadaflow/CMakeLists.txt b/psrdada_cpp/dadaflow/CMakeLists.txt index 0d31d9d0..97f339d6 100644 --- a/psrdada_cpp/dadaflow/CMakeLists.txt +++ b/psrdada_cpp/dadaflow/CMakeLists.txt @@ -1,8 +1,4 @@ if(ENABLE_CUDA) - set(PSRDADA_CPP_DADAFLOW_LIBRARIES - ${CMAKE_PROJECT_NAME}_dadaflow - ${PSRDADA_CPP_LIBRARIES} - ) set(PSRDADA_CPP_DADAFLOW_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/AsyncDadaReadClient.cpp @@ -12,15 +8,18 @@ if(ENABLE_CUDA) ${CMAKE_CURRENT_SOURCE_DIR}/io/sigproc/src/SigprocIO.cpp ) - file(GLOB PSRDADA_CPP_DADAFLOW_INC - "${CMAKE_CURRENT_SOURCE_DIR}/*.cuh" - "${CMAKE_CURRENT_SOURCE_DIR}/*.hpp") - install(FILES ${PSRDADA_CPP_DADAFLOW_INC} DESTINATION include/psrdada_cpp/dadaflow) - install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/detail DESTINATION include/psrdada_cpp/dadaflow/detail) + # Install all include files and exclude unnecessary folders + install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + DESTINATION include/psrdada_cpp + PATTERN "test" EXCLUDE + PATTERN "examples" EXCLUDE + PATTERN "cli" EXCLUDE + PATTERN "doc" EXCLUDE) + # PATTERN "src" EXCLUDE) + + # Add the sources to the psrdada_cpp library + target_sources(${CMAKE_PROJECT_NAME} PRIVATE ${PSRDADA_CPP_DADAFLOW_SRC}) - add_library(${CMAKE_PROJECT_NAME}_dadaflow ${PSRDADA_CPP_DADAFLOW_SRC}) - target_link_libraries (${CMAKE_PROJECT_NAME}_dadaflow PUBLIC ${PSRDADA_CPP_LIBRARIES}) - list(APPEND PSRDADA_CPP_LIBRARIES ${CMAKE_PROJECT_NAME}_dadaflow) # ----------------------------- # # -- Build DADAFLOW examples -- # @@ -35,30 +34,24 @@ if(ENABLE_CUDA) switch_example node_selector_example ) - # Install the DADA tools using the DADA_TOOLS_NAMES list + # Install the dadaflow examples using the DADAFLOW_EXAMPLE_CLI list foreach(EXEC_NAME ${DADAFLOW_EXAMPLE_CLI}) set(EXEC_SRC "examples/${EXEC_NAME}.cpp") add_executable(${EXEC_NAME} ${EXEC_SRC}) - target_link_libraries(${EXEC_NAME} PUBLIC ${PSRDADA_CPP_DADAFLOW_LIBRARIES}) + target_link_libraries(${EXEC_NAME} PUBLIC ${PSRDADA_CPP_LIBRARIES}) endforeach() # ----------------------------- # # -- Build DADAFLOW CLIs -- # # ----------------------------- # add_executable(rfsoc2tafp cli/rfsoc2tafp.cpp) - target_link_libraries (rfsoc2tafp PUBLIC ${PSRDADA_CPP_DADAFLOW_LIBRARIES}) + target_link_libraries (rfsoc2tafp PUBLIC ${PSRDADA_CPP_LIBRARIES}) install (TARGETS rfsoc2tafp DESTINATION bin) + # ----------------------------- # - # -- Install DADAFLOW Library-- # + # -- Add tests -- # # ----------------------------- # - install (TARGETS ${CMAKE_PROJECT_NAME}_dadaflow - EXPORT ${CMAKE_PROJECT_NAME}Targets - RUNTIME DESTINATION bin - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib - INCLUDES DESTINATION include/) - if (ENABLE_TESTING) add_subdirectory(test) add_subdirectory(io/sigproc/test) diff --git a/psrdada_cpp/dadaflow/MessageQueue.hpp b/psrdada_cpp/dadaflow/MessageQueue.hpp index 69883efa..e473ce40 100644 --- a/psrdada_cpp/dadaflow/MessageQueue.hpp +++ b/psrdada_cpp/dadaflow/MessageQueue.hpp @@ -1,3 +1,4 @@ +#pragma once #include "boost/json.hpp" #include "psrdada_cpp/common.hpp" #include "psrdada_cpp/dadaflow/utils.hpp" diff --git a/psrdada_cpp/dadaflow/io/sigproc/test/CMakeLists.txt b/psrdada_cpp/dadaflow/io/sigproc/test/CMakeLists.txt index 64b0de1c..1dd6dec5 100644 --- a/psrdada_cpp/dadaflow/io/sigproc/test/CMakeLists.txt +++ b/psrdada_cpp/dadaflow/io/sigproc/test/CMakeLists.txt @@ -11,7 +11,7 @@ set(gtest_dadaflow_io_sigproc add_executable(gtest_dadaflow_io_sigproc ${gtest_dadaflow_io_sigproc} ) target_link_libraries(gtest_dadaflow_io_sigproc - ${PSRDADA_CPP_DADAFLOW_LIBRARIES} + ${PSRDADA_CPP_LIBRARIES} ${GTEST_LIBRARIES} ) add_test(gtest_dadaflow_io_sigproc gtest_dadaflow_io_sigproc --test_data "${CMAKE_CURRENT_LIST_DIR}/data") diff --git a/psrdada_cpp/dadaflow/test/CMakeLists.txt b/psrdada_cpp/dadaflow/test/CMakeLists.txt index ffa78920..714f826d 100644 --- a/psrdada_cpp/dadaflow/test/CMakeLists.txt +++ b/psrdada_cpp/dadaflow/test/CMakeLists.txt @@ -1,5 +1,4 @@ include_directories(${GTEST_INCLUDE_DIR}) - link_directories(${GTEST_LIBRARY_DIR}) set(gtest_dadaflow @@ -19,7 +18,7 @@ set(gtest_dadaflow add_executable(gtest_dadaflow ${gtest_dadaflow} ) target_link_libraries(gtest_dadaflow - ${PSRDADA_CPP_DADAFLOW_LIBRARIES} + ${PSRDADA_CPP_LIBRARIES} ${GTEST_LIBRARIES} ) add_test(gtest_dadaflow gtest_dadaflow --test_data "${CMAKE_CURRENT_LIST_DIR}/data") diff --git a/psrdada_cpp/fft_spectrometer/CMakeLists.txt b/psrdada_cpp/fft_spectrometer/CMakeLists.txt index 79c14ede..b5dc91de 100644 --- a/psrdada_cpp/fft_spectrometer/CMakeLists.txt +++ b/psrdada_cpp/fft_spectrometer/CMakeLists.txt @@ -1,18 +1,10 @@ if(ENABLE_CUDA) - -set(PSRDADA_CPP_FS_LIBRARIES - ${PSRDADA_CPP_LIBRARIES} - ${CMAKE_PROJECT_NAME}_common - CUDA::cufft -) - -add_executable(fft_spectrometer cli/fft_spectrometer_cli.cu) -target_include_directories(fft_spectrometer PRIVATE "${CMAKE_CURRENT_LIST_DIR} ${CMAKE_CURRENT_LIST_DIR}/src") -target_link_libraries(fft_spectrometer ${PSRDADA_CPP_FS_LIBRARIES}) -install(TARGETS fft_spectrometer DESTINATION bin) - -# if (ENABLE_TESTING) -# add_subdirectory(test) -# endif() - -endif(ENABLE_CUDA) \ No newline at end of file + set(PSRDADA_CPP_FS_LIBRARIES ${PSRDADA_CPP_LIBRARIES} CUDA::cufft) + add_executable(fft_spectrometer cli/fft_spectrometer_cli.cu) + target_include_directories(fft_spectrometer PRIVATE "${CMAKE_CURRENT_LIST_DIR} ${CMAKE_CURRENT_LIST_DIR}/src") + target_link_libraries(fft_spectrometer ${PSRDADA_CPP_FS_LIBRARIES}) + install(TARGETS fft_spectrometer DESTINATION bin) + # if (ENABLE_TESTING) + # add_subdirectory(test) + # endif() +endif(ENABLE_CUDA) diff --git a/psrdada_cpp/fft_spectrometer/test/CMakeLists.txt b/psrdada_cpp/fft_spectrometer/test/CMakeLists.txt index f1571ea8..db0205ef 100644 --- a/psrdada_cpp/fft_spectrometer/test/CMakeLists.txt +++ b/psrdada_cpp/fft_spectrometer/test/CMakeLists.txt @@ -8,5 +8,5 @@ set(gtest_fftspectrometer ) add_executable(gtest_fftspectrometer ${gtest_fftspectrometer} ) -target_link_libraries(gtest_fftspectrometer ${PSRDADA_CPP_GS_LIBRARIES} ${PSRDADA_CPP_LIBRARIES} ${GTEST_LIBRARIES}) +target_link_libraries(gtest_fftspectrometer ${PSRDADA_CPP_GS_LIBRARIES} ${GTEST_LIBRARIES}) add_test(gtest_fftspectrometer gtest_fftspectrometer --test_data "${CMAKE_CURRENT_LIST_DIR}/data") diff --git a/psrdada_cpp/rs_spectrometer/CMakeLists.txt b/psrdada_cpp/rs_spectrometer/CMakeLists.txt index 6d5512c5..8e27cfc1 100644 --- a/psrdada_cpp/rs_spectrometer/CMakeLists.txt +++ b/psrdada_cpp/rs_spectrometer/CMakeLists.txt @@ -1,27 +1,11 @@ if(ENABLE_CUDA) - -set(PSRDADA_CPP_RS_LIBRARIES - ${PSRDADA_CPP_LIBRARIES} - ${CMAKE_PROJECT_NAME}_common - ${CMAKE_PROJECT_NAME}_rs_spectrometer - CUDA::cufft -) - -set(psrdada_cpp_rs_spectrometer_src - src/pipeline.cu -) - -set(psrdada_cpp_rs_spectrometer_inc - pipeline.cuh - kernels.cuh -) - -add_library(${CMAKE_PROJECT_NAME}_rs_spectrometer ${psrdada_cpp_rs_spectrometer_src}) -add_executable(rs_spectrometer cli/rs_spectrometer_cli.cu) -target_link_libraries(rs_spectrometer ${PSRDADA_CPP_RS_LIBRARIES}) -install(TARGETS rs_spectrometer DESTINATION bin) - -if (ENABLE_TESTING) - add_subdirectory(test) -endif() + set(PSRDADA_CPP_RS_LIBRARIES ${PSRDADA_CPP_LIBRARIES} ${CMAKE_PROJECT_NAME}_rs_spectrometer CUDA::cufft) + add_library(${CMAKE_PROJECT_NAME}_rs_spectrometer src/pipeline.cu) + add_executable(rs_spectrometer cli/rs_spectrometer_cli.cu) + target_link_libraries(rs_spectrometer ${PSRDADA_CPP_RS_LIBRARIES}) + install(TARGETS rs_spectrometer DESTINATION bin) + + if (ENABLE_TESTING) + add_subdirectory(test) + endif() endif(ENABLE_CUDA) -- GitLab