Skip to content

Commit 3d017ec

Browse files
committed
Python cmake/ci overhaul
Signed-off-by: Cary Phillips <cary@ilm.com>
1 parent 6aad7fd commit 3d017ec

36 files changed

Lines changed: 1232 additions & 657 deletions

.github/workflows/ci_mingw.yml

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
name: Build with MinGW32
2+
3+
on:
4+
push:
5+
paths:
6+
- '**'
7+
- '!**.md'
8+
- '!connanfile.txt'
9+
- '!.github/workflows/**'
10+
- '.github/workflows/ci_mingw.yml'
11+
pull_request:
12+
paths:
13+
- '**'
14+
- '!**.md'
15+
- '!connanfile.txt'
16+
- '!.github/workflows/**'
17+
- '.github/workflows/ci_mingw.yml'
18+
19+
permissions:
20+
contents: read
21+
22+
jobs:
23+
build:
24+
runs-on: windows-latest
25+
defaults:
26+
run:
27+
shell: msys2 {0}
28+
29+
steps:
30+
31+
- uses: actions/checkout@v3
32+
33+
- name: Setup MSYS2
34+
uses: msys2/setup-msys2@v2
35+
with:
36+
msystem: MINGW32
37+
update: true
38+
install: >-
39+
mingw-w64-i686-gcc
40+
mingw-w64-i686-cmake
41+
mingw-w64-i686-ninja
42+
mingw-w64-i686-python
43+
mingw-w64-i686-python-pip
44+
mingw-w64-i686-boost
45+
46+
- name: Install Python dependencies
47+
run: |
48+
# Install NumPy in the MSYS2 Python environment
49+
/mingw32/bin/pip install numpy
50+
51+
- name: Install Conan
52+
run: |
53+
pip install conan
54+
55+
- name: Configure Python paths
56+
run: |
57+
PYTHON_ROOT=/mingw32
58+
PYTHON_VERSION=$(python -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')")
59+
echo "PYTHON_INCLUDE=$PYTHON_ROOT/include/python$PYTHON_VERSION" >> $GITHUB_ENV
60+
echo "PYTHON_LIB=$PYTHON_ROOT/lib/libpython$PYTHON_VERSION.dll.a" >> $GITHUB_ENV
61+
echo "PYTHON_EXECUTABLE=$PYTHON_ROOT/bin/python.exe" >> $GITHUB_ENV
62+
63+
- name: Install dependencies with Conan
64+
run: |
65+
mkdir -p /c/Users/runneradmin/.conan2/profiles/
66+
cp .conan2/profiles/default /c/Users/runneradmin/.conan2/profiles/default
67+
ls -l /c/Users/runneradmin/.conan2/profiles/
68+
cat /c/Users/runneradmin/.conan2/profiles/default
69+
70+
mkdir _build && cd _build
71+
# Use your existing default profile
72+
conan install .. \
73+
--build=missing \
74+
-o boost/*:with_python=True \
75+
-o boost/*:python_executable=${{ env.PYTHON_EXECUTABLE }} \
76+
-o boost/*:without_fiber=False \
77+
-o boost/*:without_coroutine=False \
78+
-v debug
79+
80+
- name: Build project
81+
run: |
82+
cd _build
83+
cmake .. \
84+
-DPYTHON=ON \
85+
-DPYBIND11=ON \
86+
-G Ninja \
87+
-DCMAKE_BUILD_TYPE=Release \
88+
-DPython3_EXECUTABLE=${{ env.PYTHON_EXECUTABLE }} \
89+
-DPython3_INCLUDE_DIR=${{ env.PYTHON_INCLUDE }} \
90+
-DPython3_LIBRARY=${{ env.PYTHON_LIB }}
91+
92+
cmake --build .

0 commit comments

Comments
 (0)