-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Convert this into a standalone library with its own namespace. (#1)
- Loading branch information
Showing
11 changed files
with
327 additions
and
188 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
|
||
name: Check CMake install | ||
|
||
jobs: | ||
install: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Get latest CMake | ||
uses: lukka/get-cmake@latest | ||
|
||
- name: Configure the build | ||
run: cmake -S . -B build -DSCRAN_AGGREGATE_TESTS=OFF | ||
|
||
- name: Install the library | ||
run: sudo cmake --install build | ||
|
||
- name: Test downstream usage | ||
run: | | ||
mkdir _downstream | ||
touch _downstream/source.cpp | ||
cat << EOF > _downstream/CMakeLists.txt | ||
cmake_minimum_required(VERSION 3.24) | ||
project(test_install) | ||
add_executable(whee source.cpp) | ||
find_package(libscran_scran_aggregate) | ||
target_link_libraries(whee libscran::scran_aggregate) | ||
EOF | ||
cd _downstream && cmake -S . -B build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,66 @@ | ||
cmake_minimum_required(VERSION 3.14) | ||
|
||
project(scran_aggregate_across_cells | ||
project(scran_aggregate | ||
VERSION 1.0.0 | ||
DESCRIPTION "Aggregate expression values across cells" | ||
LANGUAGES CXX) | ||
|
||
add_library(scran_aggregate_across_cells INTERFACE) | ||
target_compile_features(scran_aggregate_across_cells INTERFACE cxx_std_17) | ||
target_include_directories(scran_aggregate_across_cells INTERFACE include/scran) | ||
include(GNUInstallDirs) | ||
include(CMakePackageConfigHelpers) | ||
|
||
add_subdirectory(extern) | ||
target_link_libraries(scran_aggregate_across_cells INTERFACE tatami::tatami) | ||
# Library | ||
add_library(scran_aggregate INTERFACE) | ||
add_library(libscran::scran_aggregate ALIAS scran_aggregate) | ||
|
||
target_include_directories(scran_aggregate INTERFACE | ||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> | ||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/scran_aggregate>) | ||
target_compile_features(scran_aggregate INTERFACE cxx_std_17) | ||
|
||
# Dependencies | ||
option(SCRAN_AGGREGATE_FETCH_EXTERN "Automatically fetch scran_aggregate's external dependencies." ON) | ||
if(SCRAN_AGGREGATE_FETCH_EXTERN) | ||
add_subdirectory(extern) | ||
else() | ||
find_package(tatami_tatami 3.0.0 CONFIG REQUIRED) | ||
endif() | ||
|
||
target_link_libraries(scran_aggregate INTERFACE tatami::tatami) | ||
|
||
# Tests | ||
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME) | ||
option(SCRAN_AGGREGATE_TESTS "Build scran_aggregate's test suite." ON) | ||
else() | ||
option(SCRAN_AGGREGATE_TESTS "Build scran_aggregate's test suite." OFF) | ||
endif() | ||
|
||
if(SCRAN_AGGREGATE_TESTS) | ||
include(CTest) | ||
if(BUILD_TESTING) | ||
add_subdirectory(tests) | ||
endif() | ||
endif() | ||
endif() | ||
|
||
# Install | ||
install(DIRECTORY include/ | ||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/scran_aggregate) | ||
|
||
install(TARGETS scran_aggregate | ||
EXPORT scran_aggregateTargets) | ||
|
||
install(EXPORT scran_aggregateTargets | ||
FILE libscran_scran_aggregateTargets.cmake | ||
NAMESPACE libscran:: | ||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libscran_scran_aggregate) | ||
|
||
configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/Config.cmake.in | ||
"${CMAKE_CURRENT_BINARY_DIR}/libscran_scran_aggregateConfig.cmake" | ||
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libscran_scran_aggregate) | ||
|
||
write_basic_package_version_file( | ||
"${CMAKE_CURRENT_BINARY_DIR}/libscran_scran_aggregateConfigVersion.cmake" | ||
COMPATIBILITY SameMajorVersion) | ||
|
||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libscran_scran_aggregateConfig.cmake" | ||
"${CMAKE_CURRENT_BINARY_DIR}/libscran_scran_aggregateConfigVersion.cmake" | ||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libscran_scran_aggregate) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
@PACKAGE_INIT@ | ||
|
||
include(CMakeFindDependencyMacro) | ||
find_dependency(tatami_tatami 3.0.0 CONFIG REQUIRED) | ||
|
||
include("${CMAKE_CURRENT_LIST_DIR}/libscran_scran_aggregateTargets.cmake") |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.