-
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.
Switched to a standalone library with the full CMake setup.
This avoids having to try to assemble the full libscran library later on.
- Loading branch information
Showing
12 changed files
with
265 additions
and
154 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_BLOCKS_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_blocks) | ||
target_link_libraries(whee libscran::scran_blocks) | ||
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,17 +1,66 @@ | ||
cmake_minimum_required(VERSION 3.14) | ||
|
||
project(scran_utils | ||
VERSION 1.0.0 | ||
DESCRIPTION "Core utilities for libscran" | ||
project(scran_blocks | ||
VERSION 2.0.0 | ||
DESCRIPTION "Utilities for handling blocks" | ||
LANGUAGES CXX) | ||
|
||
add_library(scran_core_utils INTERFACE) | ||
target_compile_features(scran_core_utils INTERFACE cxx_std_17) | ||
target_include_directories(scran_core_utils INTERFACE include/scran) | ||
include(GNUInstallDirs) | ||
include(CMakePackageConfigHelpers) | ||
|
||
# Library | ||
add_library(scran_blocks INTERFACE) | ||
add_library(libscran::scran_blocks ALIAS scran_blocks) | ||
|
||
target_include_directories(scran_blocks INTERFACE | ||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> | ||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/scran_blocks>) | ||
target_compile_features(scran_blocks INTERFACE cxx_std_17) | ||
|
||
## Dependencies | ||
#option(SCRAN_MARKERS_FETCH_EXTERN "Automatically fetch scran_blocks's external dependencies." ON) | ||
#if(SCRAN_MARKERS_FETCH_EXTERN) | ||
# add_subdirectory(extern) | ||
#else() | ||
# find_package(tatami_tatami 3.0.0 CONFIG REQUIRED) | ||
# find_package(tatami_tatami_stats 1.1.0 CONFIG REQUIRED) | ||
# find_package(scran_blocks 1.0.0 CONFIG REQUIRED) | ||
#endif() | ||
|
||
# Tests | ||
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME) | ||
option(SCRAN_MARKERS_TESTS "Build scran_blocks's test suite." ON) | ||
else() | ||
option(SCRAN_MARKERS_TESTS "Build scran_blocks's test suite." OFF) | ||
endif() | ||
|
||
if(SCRAN_MARKERS_TESTS) | ||
include(CTest) | ||
if(BUILD_TESTING) | ||
add_subdirectory(tests) | ||
endif() | ||
endif() | ||
endif() | ||
|
||
# Install | ||
install(DIRECTORY include/ | ||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/scran_blocks) | ||
|
||
install(TARGETS scran_blocks | ||
EXPORT scran_blocksTargets) | ||
|
||
install(EXPORT scran_blocksTargets | ||
FILE libscran_scran_blocksTargets.cmake | ||
NAMESPACE libscran:: | ||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libscran_scran_blocks) | ||
|
||
configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/Config.cmake.in | ||
"${CMAKE_CURRENT_BINARY_DIR}/libscran_scran_blocksConfig.cmake" | ||
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libscran_scran_blocks) | ||
|
||
write_basic_package_version_file( | ||
"${CMAKE_CURRENT_BINARY_DIR}/libscran_scran_blocksConfigVersion.cmake" | ||
COMPATIBILITY SameMajorVersion) | ||
|
||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libscran_scran_blocksConfig.cmake" | ||
"${CMAKE_CURRENT_BINARY_DIR}/libscran_scran_blocksConfigVersion.cmake" | ||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libscran_scran_blocks) |
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,3 @@ | ||
@PACKAGE_INIT@ | ||
|
||
include("${CMAKE_CURRENT_LIST_DIR}/libscran_scran_blocksTargets.cmake") |
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 was deleted.
Oops, something went wrong.
Oops, something went wrong.