Skip to content

Commit

Permalink
Merge pull request #410 from eseiler/infra/cleanup
Browse files Browse the repository at this point in the history
[INFRA] Cleanup
  • Loading branch information
eseiler authored Dec 27, 2023
2 parents ccc09b2 + c42191b commit 6bfcf2a
Show file tree
Hide file tree
Showing 49 changed files with 424 additions and 642 deletions.
3 changes: 3 additions & 0 deletions .cmake-format.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ parse:
cpmgetpackage:
pargs: 1
spelling: CPMGetPackage
cpmgetsystempackage:
pargs: 1
spelling: CPMGetSystemPackage
cpmaddpackage:
pargs:
nargs: '*'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci_macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
timeout-minutes: 120
if: github.repository_owner == 'seqan' || github.event_name == 'workflow_dispatch' || github.event.label.name == 'lint'
strategy:
fail-fast: true
fail-fast: false
matrix:
include:
- name: "gcc13"
Expand Down
31 changes: 17 additions & 14 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,34 @@
# shipped with this file and also available at: https://github.com/seqan/raptor/blob/main/LICENSE.md
# --------------------------------------------------------------------------------------------------

cmake_minimum_required (VERSION 3.18)
cmake_minimum_required (VERSION 3.21)

find_path (RAPTOR_MODULE_PATH "raptor-config.cmake" HINTS "${CMAKE_CURRENT_LIST_DIR}/cmake/")
find_path (RAPTOR_MODULE_PATH "configuration.cmake" HINTS "${CMAKE_CURRENT_LIST_DIR}/cmake/")
list (APPEND CMAKE_MODULE_PATH "${RAPTOR_MODULE_PATH}")

include (raptor-config-version)
include (version)

project (raptor
LANGUAGES CXX C
project (Raptor
LANGUAGES CXX
VERSION "${RAPTOR_PROJECT_VERSION}"
DESCRIPTION "Raptor -- A fast and space-efficient pre-filter for querying very large collections of nucleotide sequences"
HOMEPAGE_URL "https://github.com/seqan/raptor"
)

find_package (Raptor REQUIRED HINTS ${RAPTOR_MODULE_PATH})
if (NOT CMAKE_BUILD_TYPE)
set (CMAKE_BUILD_TYPE
Release
CACHE STRING "Choose the type of build, options are: Debug Coverage Release RelWithDebInfo MinSizeRel." FORCE
)
endif ()

option (BUILD_RAPTOR "Enable building of Raptor." ON)
include (configuration)

if (BUILD_RAPTOR)
add_subdirectory (src)
endif ()
add_subdirectory (src)

option (INSTALL_RAPTOR_HEADERS "Enable installation of Raptor headers." OFF)
option (INSTALL_RAPTOR "Enable installation of Raptor." ON)

if (INSTALL_RAPTOR_HEADERS)
include (raptor-install)
include (raptor-package)
if (INSTALL_RAPTOR)
include (GNUInstallDirs)
install (TARGETS raptor RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
endif ()
30 changes: 30 additions & 0 deletions cmake/CPMGetSystemPackage.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# SPDX-FileCopyrightText: 2006-2023, Knut Reinert & Freie Universität Berlin
# SPDX-FileCopyrightText: 2016-2023, Knut Reinert & MPI für molekulare Genetik
# SPDX-License-Identifier: BSD-3-Clause

# SYSTEM property is only implemented with CMake 3.25
macro (CPMGetSystemPackage package)
CPMGetPackage (${package})

if (CMAKE_VERSION VERSION_LESS 3.25)
set (target_name "${package}")
if ("${package}" STREQUAL "seqan3")
set (target_name "seqan3_seqan3")
elseif ("${package}" STREQUAL "sharg")
set (target_name "sharg_sharg")
endif ()

if (${package}_ADDED)
set (interface_include "$<TARGET_PROPERTY:${target_name},INTERFACE_INCLUDE_DIRECTORIES>")
set (include "$<TARGET_PROPERTY:${target_name},INCLUDE_DIRECTORIES>")
set_target_properties (${target_name}
PROPERTIES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES
"$<$<BOOL:${interface_include}>:${interface_include}>;$<$<BOOL:${include}>:${include}>"
)
unset (interface_include)
unset (include)
endif ()

unset (target_name)
endif ()
endmacro ()
30 changes: 9 additions & 21 deletions test/cmake/raptor_require_ccache.cmake → cmake/ccache.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# shipped with this file and also available at: https://github.com/seqan/raptor/blob/main/LICENSE.md
# --------------------------------------------------------------------------------------------------

cmake_minimum_required (VERSION 3.18)
cmake_minimum_required (VERSION 3.21)

include (FindPackageMessage)

Expand All @@ -28,33 +28,21 @@ macro (raptor_require_ccache)
else ()
find_package_message (CCACHE_PROGRAM " Ccache program: available" "[${CCACHE_PROGRAM}]")
set (RAPTOR_FPROFILE_ABS_PATH "--ccache-skip -fprofile-abs-path")
# New option since cmake >= 3.4:
# https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_COMPILER_LAUNCHER.html
if (NOT CMAKE_VERSION VERSION_LESS 3.15) # cmake >= 3.15
list (PREPEND CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_PROGRAM}")
list (PREPEND CMAKE_C_COMPILER_LAUNCHER "${CCACHE_PROGRAM}")
else ()
# prepend ccache to CMAKE_CXX_COMPILER_LAUNCHER
list (INSERT CMAKE_CXX_COMPILER_LAUNCHER 0 "${CCACHE_PROGRAM}")
list (INSERT CMAKE_C_COMPILER_LAUNCHER 0 "${CCACHE_PROGRAM}")
endif ()

list (PREPEND CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_PROGRAM}")
list (PREPEND CMAKE_C_COMPILER_LAUNCHER "${CCACHE_PROGRAM}")

# use ccache in external cmake projects
list (APPEND SEQAN3_EXTERNAL_PROJECT_CMAKE_ARGS
"-DCMAKE_CXX_COMPILER_LAUNCHER=${CMAKE_CXX_COMPILER_LAUNCHER}"
)
list (APPEND SEQAN3_EXTERNAL_PROJECT_CMAKE_ARGS "-DCMAKE_C_COMPILER_LAUNCHER=${CMAKE_C_COMPILER_LAUNCHER}")

if (NOT CMAKE_VERSION VERSION_LESS 3.21) # cmake >= 3.21
list (PREPEND CMAKE_CXX_LINKER_LAUNCHER "${CCACHE_PROGRAM}")
list (PREPEND CMAKE_C_LINKER_LAUNCHER "${CCACHE_PROGRAM}")
list (APPEND SEQAN3_EXTERNAL_PROJECT_CMAKE_ARGS
"-DCMAKE_CXX_LINKER_LAUNCHER=${CMAKE_CXX_LINKER_LAUNCHER}"
)
list (APPEND SEQAN3_EXTERNAL_PROJECT_CMAKE_ARGS "-DCMAKE_C_LINKER_LAUNCHER=${CMAKE_C_LINKER_LAUNCHER}")
else ()
set_property (GLOBAL PROPERTY RULE_LAUNCH_LINK "${CCACHE_PROGRAM}")
endif ()
list (PREPEND CMAKE_CXX_LINKER_LAUNCHER "${CCACHE_PROGRAM}")
list (PREPEND CMAKE_C_LINKER_LAUNCHER "${CCACHE_PROGRAM}")
list (APPEND SEQAN3_EXTERNAL_PROJECT_CMAKE_ARGS "-DCMAKE_CXX_LINKER_LAUNCHER=${CMAKE_CXX_LINKER_LAUNCHER}")
list (APPEND SEQAN3_EXTERNAL_PROJECT_CMAKE_ARGS "-DCMAKE_C_LINKER_LAUNCHER=${CMAKE_C_LINKER_LAUNCHER}")

endif ()
unset (CCACHE_PROGRAM)
endif ()
Expand Down
96 changes: 96 additions & 0 deletions cmake/configuration.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
# SPDX-FileCopyrightText: 2006-2023, Knut Reinert & Freie Universität Berlin
# SPDX-FileCopyrightText: 2016-2023, Knut Reinert & MPI für molekulare Genetik
# SPDX-License-Identifier: BSD-3-Clause

cmake_minimum_required (VERSION 3.21)

# ----------------------------------------------------------------------------
# Short-circuit if Raptor is already configured
# ----------------------------------------------------------------------------

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

# ----------------------------------------------------------------------------
# Greeter
# ----------------------------------------------------------------------------

message (STATUS "Finding Raptor (${RAPTOR_VERSION}) and checking requirements")

# ----------------------------------------------------------------------------
# Pretty printing and error handling
# ----------------------------------------------------------------------------

macro (raptor_config_print text)
message (STATUS " ${text}")
endmacro ()

macro (raptor_config_error text)
message (FATAL_ERROR " ${text}")
endmacro ()

# ----------------------------------------------------------------------------
# ccache
# ----------------------------------------------------------------------------

include (ccache)
raptor_require_ccache ()

# ----------------------------------------------------------------------------
# CPM
# ----------------------------------------------------------------------------

set (CPM_INDENT " CMake Package Manager CPM: ")
include (CPM)
CPMUsePackageLock (${Raptor_SOURCE_DIR}/cmake/package-lock.cmake)

# ----------------------------------------------------------------------------
# Find or add dependencies
# ----------------------------------------------------------------------------

include (CPMGetSystemPackage)

CPMGetSystemPackage (hibf)
CPMGetSystemPackage (sharg)
CPMGetSystemPackage (seqan3)
CPMGetSystemPackage (chopper)

# ----------------------------------------------------------------------------
# Find Raptor include path
# ----------------------------------------------------------------------------

find_path (RAPTOR_INCLUDE_DIR
NAMES raptor/version.hpp
HINTS "${Raptor_SOURCE_DIR}/include"
)

if (RAPTOR_INCLUDE_DIR)
raptor_config_print ("Raptor include dir found: ${RAPTOR_INCLUDE_DIR}")
else ()
raptor_config_error ("Raptor include directory could not be found (RAPTOR_INCLUDE_DIR: '${RAPTOR_INCLUDE_DIR}')")
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}")

# !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}")

# !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}")

add_library (raptor::raptor ALIAS raptor_raptor)
94 changes: 0 additions & 94 deletions cmake/raptor-config-version.cmake

This file was deleted.

Loading

1 comment on commit 6bfcf2a

@vercel
Copy link

@vercel vercel bot commented on 6bfcf2a Dec 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

raptor – ./

raptor-git-main-seqan.vercel.app
seqan-raptor.vercel.app
raptor-seqan.vercel.app

Please sign in to comment.