diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4fe1a1c..877afaa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,9 +1,9 @@ name: libintx CI -on: [push] - -env: - CMAKE_BUILD_PARALLEL_LEVEL : 4 +on: + pull_request: + push: + branches: [main] defaults: run: @@ -16,31 +16,74 @@ jobs: strategy: fail-fast: false matrix: - os : [ macos-15 ] - cxx : [ clang++ ] - build_type : [ Debug ] + os : + - ubuntu-latest + - ubuntu-24.04-arm + + compiler : + - clang + - gcc - name: "${{ matrix.os }}: ${{ matrix.cxx }} ${{ matrix.build_type }}" + build_type : + # - Debug + - Release + + simd: + - ON + - OFF + + name: "${{ matrix.os }}: ${{ matrix.compiler }} ${{ matrix.build_type }} ${{matrix.simd == 'ON' && '(simd)' || ''}}" runs-on: ${{ matrix.os }} - env: - CXX : ${{ matrix.cxx }} - CMAKE_CONFIG : > - -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} - -DLIBINTX_MAX_L=2 - -DLIBINTX_SIMD=OFF steps: - - uses: actions/checkout@v3 + - name: Run sccache-cache + uses: mozilla-actions/sccache-action@v0.0.9 + + - uses: actions/checkout@v4 + + - name: Set compiler and sccache environment + run: | + echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV + + if [[ "${{ matrix.compiler }}" == "gcc" ]]; then + echo "CC=gcc" >> $GITHUB_ENV + echo "CXX=g++" >> $GITHUB_ENV + elif [[ "${{ matrix.compiler }}" == "clang" ]]; then + echo "CC=clang" >> $GITHUB_ENV + echo "CXX=clang++" >> $GITHUB_ENV + else + echo "Unsupported compiler: ${{ matrix.compiler }}" + exit 1 + fi - - name: "Configure: ${{ env.CMAKE_CONFIG }}" + - name: Verify compiler run: | set -x; - cmake -B${{github.workspace}}/build $CMAKE_CONFIG + $CC --version + $CXX --version + + - name: Install Build Dependencies + run: | + set -x; + sudo apt-get update && sudo apt-get install -y \ + libopenblas-dev \ + liblapacke-dev + + - name: Configure + run: | + set -x; + cmake -S . -B ./build -G "Ninja Multi-Config" \ + -DLIBINTX_MAX_L=2 \ + -DLIBINTX_SIMD=${{matrix.simd}} \ + -DCMAKE_CXX_COMPILER_LAUNCHER=sccache \ + -DCMAKE_C_COMPILER_LAUNCHER=sccache \ + -DCMAKE_BUILD_TYPE:STRING=${{matrix.build_type}} + - name: Build working-directory: ${{github.workspace}}/build run: | - cmake --build . --target all all.tests + cmake --build . --target all all.tests --config ${{matrix.build_type}} - name: Test working-directory: ${{github.workspace}}/build diff --git a/CMakeLists.txt b/CMakeLists.txt index ba2fe73..57b0e63 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -62,6 +62,19 @@ if (TARGET LAPACK::LAPACK) unset(_lib) endif() +find_package(LAPACKE QUIET) +if (NOT TARGET LAPACKE::LAPACKE) + find_package(PkgConfig REQUIRED) + pkg_check_modules(LAPACKE_PC lapacke) + if (LAPACKE_PC_FOUND) + message(STATUS "Found LAPACKE via pkg-config") + set(LAPACKE_INCLUDE_DIRS ${LAPACKE_PC_INCLUDE_DIRS}) + set(LAPACKE_LIBRARIES ${LAPACKE_PC_LIBRARIES}) + else() + message(FATAL_ERROR "LAPACKE not found via find_package or pkg-config") + endif() +endif() + set(LIBINTX_CBLAS_H "" CACHE STRING "") set(LIBINTX_LAPACKE_H "" CACHE STRING "") mark_as_advanced(LIBINTX_CBLAS_H LIBINTX_LAPACKE_H) diff --git a/src/libintx/CMakeLists.txt b/src/libintx/CMakeLists.txt index 731c23c..968c3b9 100644 --- a/src/libintx/CMakeLists.txt +++ b/src/libintx/CMakeLists.txt @@ -18,7 +18,7 @@ if (LIBINTX_APPLE_ACCELERATE) endif() if (TARGET LAPACK::LAPACK) - target_link_libraries(libintx.blas LAPACK::LAPACK) + target_link_libraries(libintx.blas LAPACK::LAPACK ${LAPACKE_LIBRARIES}) endif() install(