diff --git a/.github/workflows/check-install.yaml b/.github/workflows/check-install.yaml new file mode 100644 index 0000000..7216fdf --- /dev/null +++ b/.github/workflows/check-install.yaml @@ -0,0 +1,57 @@ +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: Cache installed igraph + id: cache-igraph + if: ${{ matrix.config.os == 'ubuntu-latest' }} + uses: actions/cache@v4 + with: + path: _deps + key: libigraph + + - name: Make and install igraph + if: ${{ matrix.config.os == 'ubuntu-latest' && steps.cache-igraph.outputs.cache-hit != 'true' }} + run: | + version=0.10.13 + path=$(pwd) + wget https://github.com/igraph/igraph/releases/download/${version}/igraph-${version}.tar.gz + tar -xf igraph-${version}.tar.gz + cd igraph-${version} + mkdir build && cd build + cmake .. -DCMAKE_INSTALL_PREFIX=${path}/_deps + cmake --build . + sudo cmake --install . + + - name: Configure the build + run: cmake -S . -B build -DSCRAN_GRAPH_CLUSTER_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_graph_cluster) + target_link_libraries(whee libscran::scran_graph_cluster) + EOF + cd _downstream && cmake -S . -B build diff --git a/CMakeLists.txt b/CMakeLists.txt index a337b45..cbaf742 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,16 +15,16 @@ target_include_directories(scran_graph_cluster INTERFACE target_compile_features(scran_graph_cluster INTERFACE cxx_std_17) # Dependencies -option(SCRAN_MARKERS_FETCH_EXTERN "Automatically fetch scran_graph_cluster's external dependencies (except for igraph)." ON) -option(SCRAN_MARKERS_FETCH_EXTERN_IGRAPH "Automatically fetch scran_graph_cluster's external igraph dependency." OFF) +option(SCRAN_GRAPH_CLUSTER_FETCH_EXTERN "Automatically fetch scran_graph_cluster's external dependencies (except for igraph)." ON) +option(SCRAN_GRAPH_CLUSTER_FETCH_EXTERN_IGRAPH "Automatically fetch scran_graph_cluster's external igraph dependency." OFF) -if (NOT SCRAN_MARKERS_FETCH_EXTERN_IGRAPH) +if (NOT SCRAN_GRAPH_CLUSTER_FETCH_EXTERN_IGRAPH) # igraph needs compilation so we just try to get it from the system by # default, rather than pulling it down and building the whole thing. find_package(igraph 0.10.0 CONFIG REQUIRED) endif() -if(SCRAN_MARKERS_FETCH_EXTERN) +if(SCRAN_GRAPH_CLUSTER_FETCH_EXTERN) add_subdirectory(extern) else() find_package(ltla_raiigraph 1.0.0 CONFIG REQUIRED) @@ -35,12 +35,12 @@ target_link_libraries(scran_graph_cluster INTERFACE igraph::igraph ltla::raiigra # Tests if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME) - option(SCRAN_MARKERS_TESTS "Build scran_graph_cluster's test suite." ON) + option(SCRAN_GRAPH_CLUSTER_TESTS "Build scran_graph_cluster's test suite." ON) else() - option(SCRAN_MARKERS_TESTS "Build scran_graph_cluster's test suite." OFF) + option(SCRAN_GRAPH_CLUSTER_TESTS "Build scran_graph_cluster's test suite." OFF) endif() -if(SCRAN_MARKERS_TESTS) +if(SCRAN_GRAPH_CLUSTER_TESTS) include(CTest) if(BUILD_TESTING) add_subdirectory(tests)