Skip to content

Commit

Permalink
Merge pull request #428 from eseiler/infra/lib
Browse files Browse the repository at this point in the history
[INFRA] Rework libs
  • Loading branch information
eseiler committed Aug 13, 2024
2 parents a27a923 + 3fceedb commit cd2b90f
Show file tree
Hide file tree
Showing 14 changed files with 45 additions and 40 deletions.
4 changes: 2 additions & 2 deletions cmake/CPM.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
#
# SPDX-FileCopyrightText: Copyright (c) 2019-2023 Lars Melchior and contributors

set (CPM_DOWNLOAD_VERSION 0.40.0)
set (CPM_HASH_SUM "7b354f3a5976c4626c876850c93944e52c83ec59a159ae5de5be7983f0e17a2a")
set (CPM_DOWNLOAD_VERSION 0.40.2)
set (CPM_HASH_SUM "c8cdc32c03816538ce22781ed72964dc864b2a34a310d3b7104812a5ca2d835d")

if (CPM_SOURCE_CACHE)
set (CPM_DOWNLOAD_LOCATION "${CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake")
Expand Down
14 changes: 7 additions & 7 deletions cmake/configuration.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ cmake_minimum_required (VERSION 3.25)
# Short-circuit if Raptor is already configured
# ----------------------------------------------------------------------------

if (TARGET raptor::raptor)
if (TARGET raptor::interface)
return ()
endif ()

Expand Down Expand Up @@ -82,22 +82,22 @@ endif ()
# Export targets
# ----------------------------------------------------------------------------

add_library (raptor_raptor INTERFACE)
target_link_libraries (raptor_raptor INTERFACE seqan::hibf sharg::sharg seqan3::seqan3)
target_include_directories (raptor_raptor INTERFACE "${RAPTOR_INCLUDE_DIR}")
add_library (raptor_interface INTERFACE)
target_link_libraries (raptor_interface INTERFACE seqan::hibf sharg::sharg seqan3::seqan3)
target_include_directories (raptor_interface INTERFACE "${RAPTOR_INCLUDE_DIR}")

# !Workaround: Get chopper include dir from chopper_shared target
find_path (CHOPPER_INCLUDE_DIR
NAMES chopper/configuration.hpp
HINTS "${chopper_SOURCE_DIR}/include"
)
target_include_directories (raptor_raptor SYSTEM INTERFACE "${CHOPPER_INCLUDE_DIR}")
target_include_directories (raptor_interface SYSTEM INTERFACE "${CHOPPER_INCLUDE_DIR}")

# !Workaround: Get seqan3 test include dir from seqan3 target
find_path (SEQAN3_TEST_INCLUDE_DIR
NAMES seqan3/test/tmp_directory.hpp
HINTS "${seqan3_SOURCE_DIR}/test/include"
)
target_include_directories (raptor_raptor SYSTEM INTERFACE "${SEQAN3_TEST_INCLUDE_DIR}")
target_include_directories (raptor_interface SYSTEM INTERFACE "${SEQAN3_TEST_INCLUDE_DIR}")

add_library (raptor::raptor ALIAS raptor_raptor)
add_library (raptor::interface ALIAS raptor_interface)
4 changes: 2 additions & 2 deletions cmake/package-lock.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ CPMDeclarePackage (benchmark
"CMAKE_MESSAGE_LOG_LEVEL WARNING" "CMAKE_CXX_STANDARD ${CMAKE_CXX_STANDARD}"
)
# googletest
set (RAPTOR_GOOGLETEST_VERSION 1.14.0)
set (RAPTOR_GOOGLETEST_VERSION 1.15.2)
CPMDeclarePackage (googletest
NAME GTest
NAME googletest
VERSION ${RAPTOR_GOOGLETEST_VERSION}
GITHUB_REPOSITORY google/googletest
SYSTEM TRUE
Expand Down
18 changes: 10 additions & 8 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,20 @@ endif ()
# Raptor library
add_library ("raptor_lib" INTERFACE)
target_link_libraries ("raptor_lib"
INTERFACE "raptor_argument_parsing"
"raptor_build"
"raptor_prepare"
"raptor_search"
"raptor_threshold"
"raptor_upgrade"
"raptor_layout"
INTERFACE "raptor::argument_parsing"
"raptor::build"
"raptor::prepare"
"raptor::search"
"raptor::threshold"
"raptor::upgrade"
"raptor::layout"
)
add_library (raptor::raptor ALIAS raptor_lib)

# Raptor executable
add_executable ("raptor" raptor.cpp)
target_link_libraries ("raptor" PUBLIC "raptor_lib")
target_link_libraries ("raptor" PUBLIC "raptor::raptor")
set_property (TARGET raptor PROPERTY RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")

add_subdirectory (argument_parsing)
add_subdirectory (build)
Expand Down
5 changes: 3 additions & 2 deletions src/argument_parsing/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

cmake_minimum_required (VERSION 3.25)

if (TARGET raptor_argument_parsing)
if (TARGET raptor::argument_parsing)
return ()
endif ()

Expand Down Expand Up @@ -62,4 +62,5 @@ set_source_files_properties (init_shared_meta.cpp
"RAPTOR_VERSION=\"${PACKAGE_VERSION} (${RAPTOR_COMMIT_HASH})\";RAPTOR_DATE=\"${RAPTOR_COMMIT_DATE}\""
)

target_link_libraries ("raptor_argument_parsing" PUBLIC "raptor::raptor")
target_link_libraries ("raptor_argument_parsing" PUBLIC "raptor::interface")
add_library (raptor::argument_parsing ALIAS raptor_argument_parsing)
6 changes: 3 additions & 3 deletions src/build/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

cmake_minimum_required (VERSION 3.25)

if (TARGET raptor_build)
if (TARGET raptor::build)
return ()
endif ()

add_library ("raptor_build" STATIC build_hibf.cpp build_ibf.cpp max_count_per_partition.cpp raptor_build.cpp)

target_link_libraries ("raptor_build" PUBLIC "raptor::raptor" "raptor_prepare" "seqan::hibf")
target_link_libraries ("raptor_build" PUBLIC "raptor::interface" "raptor::prepare" "seqan::hibf")
add_library (raptor::build ALIAS raptor_build)
5 changes: 3 additions & 2 deletions src/layout/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@

cmake_minimum_required (VERSION 3.15)

if (TARGET raptor_layout)
if (TARGET raptor::layout)
return ()
endif ()

add_library ("raptor_layout" STATIC raptor_layout.cpp)
target_link_libraries ("raptor_layout" PUBLIC "raptor::raptor" "chopper_lib")
target_link_libraries ("raptor_layout" PUBLIC "raptor::interface" "chopper_lib")
add_library (raptor::layout ALIAS raptor_layout)
6 changes: 3 additions & 3 deletions src/prepare/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

cmake_minimum_required (VERSION 3.25)

if (TARGET raptor_prepare)
if (TARGET raptor::prepare)
return ()
endif ()

add_library ("raptor_prepare" STATIC compute_minimiser.cpp)

target_link_libraries ("raptor_prepare" PUBLIC "raptor::raptor")
target_link_libraries ("raptor_prepare" PUBLIC "raptor::interface")
add_library (raptor::prepare ALIAS raptor_prepare)
6 changes: 3 additions & 3 deletions src/search/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

cmake_minimum_required (VERSION 3.25)

if (TARGET raptor_search)
if (TARGET raptor::search)
return ()
endif ()

add_library ("raptor_search" STATIC raptor_search.cpp search_hibf.cpp search_ibf.cpp search_partitioned_ibf.cpp)

target_link_libraries ("raptor_search" PUBLIC "raptor::raptor")
target_link_libraries ("raptor_search" PUBLIC "raptor::interface")
add_library (raptor::search ALIAS raptor_search)
5 changes: 3 additions & 2 deletions src/threshold/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

cmake_minimum_required (VERSION 3.25)

if (TARGET raptor_threshold)
if (TARGET raptor::threshold)
return ()
endif ()

Expand All @@ -18,4 +18,5 @@ add_library ("raptor_threshold" STATIC
threshold.cpp
)

target_link_libraries ("raptor_threshold" PUBLIC "raptor::raptor")
target_link_libraries ("raptor_threshold" PUBLIC "raptor::interface")
add_library (raptor::threshold ALIAS raptor_threshold)
5 changes: 3 additions & 2 deletions src/upgrade/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@

cmake_minimum_required (VERSION 3.25)

if (TARGET raptor_upgrade)
if (TARGET raptor::upgrade)
return ()
endif ()

add_library ("raptor_upgrade" STATIC raptor_upgrade.cpp)
target_link_libraries ("raptor_upgrade" PUBLIC "raptor::raptor")
target_link_libraries ("raptor_upgrade" PUBLIC "raptor::interface")
add_library (raptor::upgrade ALIAS raptor_upgrade)
3 changes: 1 addition & 2 deletions test/raptor-test.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ message (STATUS "${ColourBold}Configuring tests${ColourReset}")
get_filename_component (Raptor_SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/.." ABSOLUTE)
include ("${Raptor_SOURCE_DIR}/cmake/configuration.cmake")
add_subdirectory ("${Raptor_SOURCE_DIR}" "${CMAKE_CURRENT_BINARY_DIR}/raptor")
set_property (TARGET raptor PROPERTY RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
target_compile_options (raptor_raptor INTERFACE "-pedantic" "-Wall" "-Wextra" "-Werror")
target_compile_options (raptor_interface INTERFACE "-pedantic" "-Wall" "-Wextra" "-Werror")

# ----------------------------------------------------------------------------
# CPM
Expand Down
2 changes: 1 addition & 1 deletion util/applications/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ include ("${Raptor_SOURCE_DIR}/cmake/configuration.cmake")
add_subdirectory ("${Raptor_SOURCE_DIR}" "${CMAKE_CURRENT_BINARY_DIR}/raptor")

add_library (utility_common INTERFACE)
target_link_libraries ("utility_common" INTERFACE raptor::raptor)
target_link_libraries ("utility_common" INTERFACE raptor::interface)
target_include_directories ("utility_common" INTERFACE "../include")

add_executable ("hibf_sizes" hibf_sizes.cpp)
Expand Down
2 changes: 1 addition & 1 deletion util/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ set (CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
get_filename_component (Raptor_SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/../.." ABSOLUTE)
include ("${Raptor_SOURCE_DIR}/cmake/configuration.cmake")
add_subdirectory ("${Raptor_SOURCE_DIR}" "${CMAKE_CURRENT_BINARY_DIR}/raptor")
target_compile_options (raptor_raptor INTERFACE "-pedantic" "-Wall" "-Wextra" "-Werror")
target_compile_options (raptor_interface INTERFACE "-pedantic" "-Wall" "-Wextra" "-Werror")

get_filename_component (RAPTOR_UTIL_ROOT "${CMAKE_CURRENT_LIST_DIR}/../dummy" DIRECTORY)

Expand Down

0 comments on commit cd2b90f

Please sign in to comment.