Skip to content

Commit 282cfb6

Browse files
committed
Adding libintx ci for cpp build + test
1 parent dd5bb8b commit 282cfb6

3 files changed

Lines changed: 80 additions & 19 deletions

File tree

.github/workflows/ci.yml

Lines changed: 66 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
name: libintx CI
22

3-
on: [push]
4-
5-
env:
6-
CMAKE_BUILD_PARALLEL_LEVEL : 4
3+
on:
4+
pull_request:
5+
push:
6+
branches: [main]
77

88
defaults:
99
run:
@@ -16,31 +16,79 @@ jobs:
1616
strategy:
1717
fail-fast: false
1818
matrix:
19-
os : [ macos-15 ]
20-
cxx : [ clang++ ]
21-
build_type : [ Debug ]
19+
os :
20+
- ubuntu-latest
21+
22+
compiler :
23+
- llvm
24+
- gcc
2225

23-
name: "${{ matrix.os }}: ${{ matrix.cxx }} ${{ matrix.build_type }}"
26+
build_type :
27+
- Debug
28+
- Release
29+
30+
simd:
31+
- ON
32+
- OFF
33+
34+
name: "${{ matrix.os }}: ${{ matrix.compiler }} ${{ matrix.build_type }} ${{matrix.simd == 'ON' && '(simd)' || ''}}"
2435
runs-on: ${{ matrix.os }}
25-
env:
26-
CXX : ${{ matrix.cxx }}
27-
CMAKE_CONFIG : >
28-
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
29-
-DLIBINTX_MAX_L=2
30-
-DLIBINTX_SIMD=OFF
3136

3237
steps:
33-
- uses: actions/checkout@v3
3438

35-
- name: "Configure: ${{ env.CMAKE_CONFIG }}"
39+
- uses: actions/checkout@v4
40+
41+
- name: Setup Cache
42+
uses: actions/cache@v4
43+
with:
44+
path: |
45+
~/.ccache
46+
key: ${{ runner.os }}-${{ matrix.compiler }}-${{ matrix.build_type }}-${{ matrix.simd }}-${{ hashFiles('**/CMakeLists.txt') }}
47+
restore-keys: |
48+
${{ runner.os }}-${{ matrix.compiler }}-${{ matrix.build_type }}-${{ matrix.simd }}
49+
50+
- name: Setup Cpp Build Tools
51+
uses: aminya/setup-cpp@v1
52+
with:
53+
compiler: ${{ matrix.compiler }}
54+
cmake: true
55+
ninja: true
56+
ccache: true
57+
58+
- name: Install Build Dependencies
3659
run: |
3760
set -x;
38-
cmake -B${{github.workspace}}/build $CMAKE_CONFIG
61+
sudo apt-get update && sudo apt-get install -y \
62+
libopenblas-dev \
63+
liblapacke-dev
64+
65+
- name: Set up ccache environment
66+
run: |
67+
echo "CCACHE_DIR=$HOME/.ccache" >> $GITHUB_ENV
68+
echo "CCACHE_MAXSIZE=1G" >> $GITHUB_ENV
69+
70+
- name: ccache stats
71+
run: |
72+
ccache --zero-stats && ccache --show-stats
73+
74+
- name: Configure
75+
run: |
76+
set -x;
77+
cmake -S . -B ./build -G "Ninja Multi-Config" \
78+
-DLIBINTX_MAX_L=2 \
79+
-DLIBINTX_SIMD=${{matrix.simd}} \
80+
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
81+
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
82+
-DCMAKE_BUILD_TYPE:STRING=${{matrix.build_type}}
83+
3984
4085
- name: Build
4186
working-directory: ${{github.workspace}}/build
4287
run: |
43-
cmake --build . --target all all.tests
88+
cmake --build . --target all all.tests --config ${{matrix.build_type}}
89+
90+
- name: Show ccache stats (after build)
91+
run: ccache -s
4492

4593
- name: Test
4694
working-directory: ${{github.workspace}}/build

CMakeLists.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,19 @@ if (TARGET LAPACK::LAPACK)
6262
unset(_lib)
6363
endif()
6464

65+
find_package(LAPACKE)
66+
if (NOT TARGET LAPACKE::LAPACKE)
67+
find_package(PkgConfig REQUIRED)
68+
pkg_check_modules(LAPACKE_PC lapacke)
69+
if (LAPACKE_PC_FOUND)
70+
message(STATUS "Found LAPACKE via pkg-config")
71+
set(LAPACKE_INCLUDE_DIRS ${LAPACKE_PC_INCLUDE_DIRS})
72+
set(LAPACKE_LIBRARIES ${LAPACKE_PC_LIBRARIES})
73+
else()
74+
message(FATAL_ERROR "LAPACKE not found via find_package or pkg-config")
75+
endif()
76+
endif()
77+
6578
set(LIBINTX_CBLAS_H "" CACHE STRING "")
6679
set(LIBINTX_LAPACKE_H "" CACHE STRING "")
6780
mark_as_advanced(LIBINTX_CBLAS_H LIBINTX_LAPACKE_H)

src/libintx/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ if (LIBINTX_APPLE_ACCELERATE)
1818
endif()
1919

2020
if (TARGET LAPACK::LAPACK)
21-
target_link_libraries(libintx.blas LAPACK::LAPACK)
21+
target_link_libraries(libintx.blas LAPACK::LAPACK ${LAPACKE_LIBRARIES})
2222
endif()
2323

2424
install(

0 commit comments

Comments
 (0)