Skip to content

Commit 83e94dd

Browse files
committed
rework packaging for shared library with python library
1 parent 95c8acb commit 83e94dd

File tree

2 files changed

+38
-4
lines changed

2 files changed

+38
-4
lines changed

.github/workflows/pip.yml

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
run: python -m pytest ./test/python
3636

3737
build_shared:
38-
name: Build with Pip
38+
name: Build with Pip shared lib
3939
runs-on: ${{ matrix.platform }}
4040
strategy:
4141
fail-fast: false
@@ -46,6 +46,40 @@ jobs:
4646
steps:
4747
- uses: actions/checkout@v4
4848

49+
- uses: actions/setup-python@v5
50+
with:
51+
python-version: ${{ matrix.python-version }}
52+
53+
- name: Set min macOS version
54+
if: runner.os == 'macOS'
55+
run: |
56+
echo "MACOSX_DEPLOYMENT_TARGET=11.0" >> $GITHUB_ENV
57+
58+
- name: Build and install
59+
run: |
60+
mkdir -p build
61+
cd build
62+
cmake .. -DUNITS_BUILD_SHARED_LIBRARY=ON -DUNITS_BUILD_STATIC_LIBRARY=OFF -DUNITS_INSTALL=ON
63+
make -j 4
64+
make install
65+
python -m pip install pytest
66+
pip install -vv -C cmake.define.UNITS_BUILD_SHARED_LIBRARY:BOOL=ON -C cmake.define.UNITS_BUILD_STATIC_LIBRARY:BOOL=OFF .
67+
68+
- name: Test
69+
run: python -m pytest ./test/python
70+
71+
build_shared_windows:
72+
name: Build with Pip shared lib
73+
runs-on: ${{ matrix.platform }}
74+
strategy:
75+
fail-fast: false
76+
matrix:
77+
platform: [windows-latest]
78+
python-version: ["3.11", "3.13"]
79+
80+
steps:
81+
- uses: actions/checkout@v4
82+
4983
- uses: actions/setup-python@v5
5084
with:
5185
python-version: ${{ matrix.python-version }}
@@ -58,7 +92,7 @@ jobs:
5892
- name: Build and install
5993
run: |
6094
python -m pip install pytest
61-
pip install -vv -C cmake.define.UNITS_BUILD_SHARED_LIBRARY:BOOL=ON .
95+
pip install -vv -C cmake.define.UNITS_BUILD_SHARED_LIBRARY:BOOL=ON -C cmake.define.UNITS_BUILD_STATIC_LIBRARY:BOOL=OFF -C cmake.define.UNITS_PYTHON_INSTALL_SHARED_LIBRARY:BOOL=ON .
6296
6397
- name: Test
6498
run: python -m pytest ./test/python

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ if(NOT UNITS_HEADER_ONLY AND UNITS_BUILD_PYTHON_LIBRARY)
266266

267267
# Install directive for scikit-build-core
268268
install(TARGETS units_llnl_ext LIBRARY DESTINATION units_llnl)
269-
if(UNITS_BUILD_SHARED_LIBRARY)
269+
if(UNITS_BUILD_SHARED_LIBRARY AND UNITS_PYTHON_INSTALL_SHARED_LIBRARY)
270270

271271
# -------------------------------------------------------------
272272
# setting the RPATH
@@ -283,7 +283,7 @@ if(NOT UNITS_HEADER_ONLY AND UNITS_BUILD_PYTHON_LIBRARY)
283283

284284
# Add the local directory to the rpath
285285
if(NOT APPLE)
286-
list(APPEND CMAKE_INSTALL_RPATH $ORIGIN)
286+
list(APPEND CMAKE_INSTALL_RPATH "$ORIGIN")
287287
else()
288288
list(APPEND CMAKE_INSTALL_RPATH "@loader_path")
289289
list(APPEND CMAKE_INSTALL_RPATH "@executable_path")

0 commit comments

Comments
 (0)