Skip to content

Commit b8ce049

Browse files
follesoeclaude
andcommitted
Fix Windows build and add CI workflow
- Fix library rename logic using basename for correctness - Update MSVC compiler version to 195 in Windows profiles - Add platform argument support to build.sh for flexible CI - Add multi-platform CI workflow (macOS, Linux/Docker, Windows) - Add automatic GitHub Release creation on tag push Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 49077bb commit b8ce049

4 files changed

Lines changed: 168 additions & 16 deletions

File tree

‎.github/workflows/ci-build.yaml‎

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
name: CI build
2+
3+
on:
4+
push:
5+
branches: [main]
6+
tags: ['v*']
7+
8+
jobs:
9+
build-apple-android:
10+
runs-on: macos-15
11+
steps:
12+
- name: Install dependencies
13+
run: |
14+
brew update
15+
brew install conan
16+
brew cleanup
17+
18+
- name: Set up Conan
19+
run: |
20+
conan profile detect
21+
22+
- name: Checkout source
23+
uses: actions/checkout@v4
24+
25+
- name: Build iOS, Android, macOS
26+
run: |
27+
./build.sh ios android macos
28+
29+
- name: Upload artifacts
30+
uses: actions/upload-artifact@v4
31+
with:
32+
name: package-apple-android
33+
path: |
34+
include
35+
lib
36+
37+
build-linux:
38+
runs-on: ubuntu-latest
39+
steps:
40+
- name: Checkout source
41+
uses: actions/checkout@v4
42+
43+
- name: Build Linux (Docker)
44+
run: |
45+
./build.sh linux
46+
47+
- name: Upload artifacts
48+
uses: actions/upload-artifact@v4
49+
with:
50+
name: package-linux
51+
path: |
52+
lib
53+
54+
build-windows:
55+
runs-on: windows-latest
56+
steps:
57+
- name: Install Conan
58+
run: pip install conan
59+
60+
- name: Set up Conan
61+
run: conan profile detect
62+
63+
- name: Checkout source
64+
uses: actions/checkout@v4
65+
66+
- name: Build Windows
67+
shell: bash
68+
run: |
69+
./build.sh windows
70+
71+
- name: Upload artifacts
72+
uses: actions/upload-artifact@v4
73+
with:
74+
name: package-windows
75+
path: |
76+
lib
77+
78+
package:
79+
needs: [build-apple-android, build-linux, build-windows]
80+
runs-on: ubuntu-latest
81+
steps:
82+
- name: Download Apple/Android artifacts
83+
uses: actions/download-artifact@v4
84+
with:
85+
name: package-apple-android
86+
path: output
87+
88+
- name: Download Linux artifacts
89+
uses: actions/download-artifact@v4
90+
with:
91+
name: package-linux
92+
path: output
93+
94+
- name: Download Windows artifacts
95+
uses: actions/download-artifact@v4
96+
with:
97+
name: package-windows
98+
path: output
99+
100+
- name: Create combined package
101+
run: |
102+
cd output
103+
zip -r ../package.zip include lib
104+
105+
- name: Upload combined package
106+
uses: actions/upload-artifact@v4
107+
with:
108+
name: package
109+
path: package.zip
110+
111+
release:
112+
needs: [package]
113+
if: startsWith(github.ref, 'refs/tags/v')
114+
runs-on: ubuntu-latest
115+
permissions:
116+
contents: write
117+
steps:
118+
- name: Download package
119+
uses: actions/download-artifact@v4
120+
with:
121+
name: package
122+
123+
- name: Create GitHub Release
124+
env:
125+
GH_TOKEN: ${{ github.token }}
126+
run: |
127+
gh release create "${{ github.ref_name }}" package.zip \
128+
--repo "${{ github.repository }}" \
129+
--title "${{ github.ref_name }}" \
130+
--generate-notes

‎build.sh‎

Lines changed: 36 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,13 @@ buildLinuxLibraries() {
7373
buildWindows() {
7474
scripts/build-library.sh windows-x64 windows/x64
7575

76-
# Normalize library names: Conan/MSVC may produce libssl.lib/libcrypto.lib
76+
# Normalize library names: Conan/MSVC produces libssl.lib/libcrypto.lib
7777
# but CMake links with 'ssl' and 'crypto' which expects ssl.lib/crypto.lib.
7878
for dir in lib/windows/*/; do
79-
for lib in "$dir"/libssl.lib "$dir"/libcrypto.lib; do
80-
if [[ -f "$lib" ]]; then
81-
mv "$lib" "${lib/lib/}"
79+
for file in "$dir"/libssl.lib "$dir"/libcrypto.lib; do
80+
if [[ -f "$file" ]]; then
81+
local base=$(basename "$file")
82+
mv "$file" "$dir/${base#lib}"
8283
fi
8384
done
8485
done
@@ -87,18 +88,39 @@ buildWindows() {
8788
set -e
8889
cd "$(dirname "$0")"
8990

90-
rm -rf lib include
91-
92-
if [[ "$OSTYPE" == "msys" || "$OSTYPE" == "cygwin" || "$OS" == "Windows_NT" ]]; then
93-
buildWindows
94-
else
95-
buildiOS
96-
buildAndroid
97-
buildMacOS
98-
buildLinux
91+
# Parse arguments: platform names and --package flag
92+
PLATFORMS=()
93+
PACKAGE=false
94+
for arg in "$@"; do
95+
case "$arg" in
96+
--package) PACKAGE=true ;;
97+
*) PLATFORMS+=("$arg") ;;
98+
esac
99+
done
100+
101+
# If no platforms specified, auto-detect based on OS
102+
if [[ ${#PLATFORMS[@]} -eq 0 ]]; then
103+
if [[ "$OSTYPE" == "msys" || "$OSTYPE" == "cygwin" || "$OS" == "Windows_NT" ]]; then
104+
PLATFORMS=(windows)
105+
else
106+
PLATFORMS=(ios android macos linux)
107+
fi
99108
fi
100109

101-
if [[ $1 == "--package" ]]; then
110+
rm -rf lib include
111+
112+
for platform in "${PLATFORMS[@]}"; do
113+
case "$platform" in
114+
ios) buildiOS ;;
115+
android) buildAndroid ;;
116+
macos) buildMacOS ;;
117+
linux) buildLinux ;;
118+
windows) buildWindows ;;
119+
*) echo "Unknown platform: $platform"; exit 1 ;;
120+
esac
121+
done
122+
123+
if $PACKAGE; then
102124
zip -r package.zip include lib
103125
echo "Package has been created at $(pwd)/package.zip"
104126
fi

‎profiles/windows-arm64.profile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ include(default)
44
os=Windows
55
arch=armv8
66
compiler=msvc
7-
compiler.version=194
7+
compiler.version=195
88
compiler.runtime=static

‎profiles/windows-x64.profile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ include(default)
44
os=Windows
55
arch=x86_64
66
compiler=msvc
7-
compiler.version=194
7+
compiler.version=195
88
compiler.runtime=static

0 commit comments

Comments
 (0)