Skip to content

Commit d6bda2a

Browse files
author
brdav
committed
building armadillo
1 parent 5675476 commit d6bda2a

2 files changed

Lines changed: 25 additions & 22 deletions

File tree

.github/workflows/build.yml

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,35 @@
1-
name: Build Wheels
1+
name: Wheel builder
2+
23
on: [push, pull_request]
4+
35
jobs:
46
build_wheels:
57
runs-on: ${{ matrix.os }}
8+
69
strategy:
710
fail-fast: false
811
matrix:
912
os: [ubuntu-latest, macos-latest] # skip Windows
13+
1014
steps:
11-
- uses: actions/checkout@v4
15+
- name: Checkout code
16+
uses: actions/checkout@v4
1217
with:
1318
submodules: recursive # for CARMA submodule
14-
- uses: actions/setup-python@v4
15-
- name: Install system BLAS/LAPACK
16-
if: matrix.os == 'ubuntu-latest'
17-
run: sudo apt-get update && sudo apt-get install -y libopenblas-dev liblapack-dev
18-
- run: pip install cibuildwheel
19-
- run: cibuildwheel --output-dir wheelhouse
20-
- uses: actions/upload-artifact@v4
19+
20+
- name: Setup Python
21+
uses: actions/setup-python@v5
22+
with:
23+
python-version: "3.11"
24+
25+
- name: Install cibuildwheel
26+
run: pip install cibuildwheel
27+
28+
- name: Build wheels
29+
run: cibuildwheel --output-dir wheelhouse
30+
31+
- name: Upload wheels
32+
uses: actions/upload-artifact@v4
2133
with:
2234
name: wheels-${{ matrix.os }}
2335
path: wheelhouse/

src/cpp/CMakeLists.txt

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,19 @@ set(CMAKE_CXX_STANDARD 17)
77
set(CMAKE_CXX_STANDARD_REQUIRED ON)
88
set(CMAKE_CXX_EXTENSIONS OFF)
99

10-
# Find and link BLAS/LAPACK (required by Armadillo)
11-
find_package(BLAS REQUIRED)
12-
find_package(LAPACK REQUIRED)
13-
1410
include(FetchContent)
1511

16-
## # --- Armadillo vendoring using FetchContent ------------------------------
12+
# --- Armadillo vendoring using FetchContent ------------------------------
1713
set(ARMADILLO_VERSION "15.0.2")
14+
set(HEADER_ONLY ON CACHE BOOL "Build Armadillo header-only")
1815

19-
# By setting SOURCE_SUBDIR to a non-existing path, we prevent automatic
20-
# add_subdirectory in FetchContent_MakeAvailable.
21-
# https://gitlab.kitware.com/cmake/cmake/-/issues/26220
2216
FetchContent_Declare(
2317
armadillo_vendored
2418
URL "https://sourceforge.net/projects/arma/files/armadillo-${ARMADILLO_VERSION}.tar.xz/download"
2519
URL_HASH SHA256=990ab4ccb7eff1b6d70409e9aa7fa4119877ac5f5d10ba219e98460ab3e4d6eb
2620
DOWNLOAD_EXTRACT_TIMESTAMP true
27-
SOURCE_SUBDIR "PATH_THAT_DOES_NOT_EXIST" # Prevents automatic add_subdirectory
2821
)
2922
FetchContent_MakeAvailable(armadillo_vendored)
30-
add_library(armadillo INTERFACE)
31-
target_include_directories(armadillo INTERFACE "${armadillo_vendored_SOURCE_DIR}/include")
3223

3324
# --- Core library --------------------------------------------------------
3425
add_library(ppca STATIC
@@ -42,5 +33,5 @@ target_include_directories(ppca PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
4233
# Ensure the static library is built as PIC so it can be linked into a shared module
4334
set_target_properties(ppca PROPERTIES POSITION_INDEPENDENT_CODE ON)
4435

45-
# Link to Armadillo target and system BLAS/LAPACK
46-
target_link_libraries(ppca PUBLIC armadillo ${BLAS_LIBRARIES} ${LAPACK_LIBRARIES})
36+
# Link to Armadillo target
37+
target_link_libraries(ppca PUBLIC armadillo)

0 commit comments

Comments
 (0)