-
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 to a standalone library with its own namespace.
- Loading branch information
Showing
17 changed files
with
1,040 additions
and
838 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_VARIANCES_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_variances) | ||
target_link_libraries(whee libscran::scran_variances) | ||
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
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,69 @@ | ||
cmake_minimum_required(VERSION 3.14) | ||
|
||
project(scran_model_gene_variances | ||
project(scran_variances | ||
VERSION 1.0.0 | ||
DESCRIPTION "Aggregate expression values across cells" | ||
DESCRIPTION "Model per-gene variances in single-cell expression" | ||
LANGUAGES CXX) | ||
|
||
add_library(scran_model_gene_variances INTERFACE) | ||
target_compile_features(scran_model_gene_variances INTERFACE cxx_std_17) | ||
target_include_directories(scran_model_gene_variances INTERFACE include/scran) | ||
include(GNUInstallDirs) | ||
include(CMakePackageConfigHelpers) | ||
|
||
add_subdirectory(extern) | ||
target_link_libraries(scran_model_gene_variances INTERFACE tatami::tatami tatami::tatami_stats ltla::WeightedLowess scran_core_utils) | ||
# Library | ||
add_library(scran_variances INTERFACE) | ||
add_library(libscran::scran_variances ALIAS scran_variances) | ||
|
||
target_include_directories(scran_variances INTERFACE | ||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> | ||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/scran_variances>) | ||
target_compile_features(scran_variances INTERFACE cxx_std_17) | ||
|
||
# Dependencies | ||
option(SCRAN_VARIANCES_FETCH_EXTERN "Automatically fetch scran_variances's external dependencies." ON) | ||
if(SCRAN_VARIANCES_FETCH_EXTERN) | ||
add_subdirectory(extern) | ||
else() | ||
find_package(tatami_tatami 3.0.0 CONFIG REQUIRED) | ||
find_package(tatami_tatami_stats 1.0.0 CONFIG REQUIRED) | ||
find_package(ltla_WeightedLowess 2.0.0 CONFIG REQUIRED) | ||
find_package(libscran_scran_blocks 1.0.0 CONFIG REQUIRED) | ||
endif() | ||
|
||
target_link_libraries(scran_variances INTERFACE tatami::tatami tatami::tatami_stats ltla::WeightedLowess libscran::scran_blocks) | ||
|
||
# Tests | ||
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME) | ||
option(SCRAN_VARIANCES_TESTS "Build scran_variances's test suite." ON) | ||
else() | ||
option(SCRAN_VARIANCES_TESTS "Build scran_variances's test suite." OFF) | ||
endif() | ||
|
||
if(SCRAN_VARIANCES_TESTS) | ||
include(CTest) | ||
if(BUILD_TESTING) | ||
add_subdirectory(tests) | ||
endif() | ||
endif() | ||
endif() | ||
|
||
# Install | ||
install(DIRECTORY include/ | ||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/scran_variances) | ||
|
||
install(TARGETS scran_variances | ||
EXPORT scran_variancesTargets) | ||
|
||
install(EXPORT scran_variancesTargets | ||
FILE libscran_scran_variancesTargets.cmake | ||
NAMESPACE libscran:: | ||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libscran_scran_variances) | ||
|
||
configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/Config.cmake.in | ||
"${CMAKE_CURRENT_BINARY_DIR}/libscran_scran_variancesConfig.cmake" | ||
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libscran_scran_variances) | ||
|
||
write_basic_package_version_file( | ||
"${CMAKE_CURRENT_BINARY_DIR}/libscran_scran_variancesConfigVersion.cmake" | ||
COMPATIBILITY SameMajorVersion) | ||
|
||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libscran_scran_variancesConfig.cmake" | ||
"${CMAKE_CURRENT_BINARY_DIR}/libscran_scran_variancesConfigVersion.cmake" | ||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libscran_scran_variances) |
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,9 @@ | ||
@PACKAGE_INIT@ | ||
|
||
include(CMakeFindDependencyMacro) | ||
find_dependency(tatami_tatami 3.0.0 CONFIG REQUIRED) | ||
find_dependency(tatami_tatami_stats 1.0.0 CONFIG REQUIRED) | ||
find_dependency(ltla_WeightedLowess 2.0.0 CONFIG REQUIRED) | ||
find_dependency(libscran_scran_blocks 1.0.0 CONFIG REQUIRED) | ||
|
||
include("${CMAKE_CURRENT_LIST_DIR}/libscran_scran_variancesTargets.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 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
Oops, something went wrong.