Skip to content

Commit 0ba8598

Browse files
committed
use cmake for github build
1 parent 49291bb commit 0ba8598

2 files changed

Lines changed: 32 additions & 22 deletions

File tree

.github/workflows/release.yaml

Lines changed: 28 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -66,30 +66,33 @@ jobs:
6666
mv SDK ../
6767
git clone https://github.com/hotbso/xplib.git ../xplib
6868
69-
- name: Build Executable
69+
- name: Install dependencies (Linux)
70+
if: runner.os == 'Linux'
71+
run: sudo apt-get update && sudo apt-get install -y ninja-build libexpat1-dev
72+
73+
- name: Install dependencies (macOS)
74+
if: runner.os == 'macOS'
75+
run: brew install ninja expat
76+
77+
- name: Configure and build
7078
shell: bash
71-
env:
72-
OS: ${{ matrix.os }}
7379
run: |
7480
TAG=${GITHUB_REF##*/}
75-
if [ ! -z "$TAG" ]; then
81+
if [ -n "$TAG" ]; then
7682
echo "VERSION=$TAG" > version.mak
7783
fi
78-
79-
if [ $OS == "macos-15" ]; then
80-
make -f Makefile.mac64
81-
else
82-
make -f Makefile.lin64
83-
fi
84-
85-
tar cvf binary.tar openSAM-pkg*/openSAM/*_x64
84+
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release \
85+
-DBUILD_TESTS=OFF \
86+
-S . -B build
87+
cmake --build build
88+
cmake --install build
89+
tar cvf binary.tar openSAM-pkg/openSAM/*_x64
8690
8791
- name: Upload Build Artifact
8892
uses: actions/upload-artifact@v7
8993
with:
9094
name: build-${{ matrix.os }}
91-
path: |
92-
binary.tar
95+
path: binary.tar
9396

9497
build-windows:
9598
runs-on: windows-latest
@@ -102,13 +105,14 @@ jobs:
102105
install: >-
103106
mingw-w64-x86_64-gcc
104107
mingw-w64-x86_64-expat
105-
make
108+
mingw-w64-x86_64-cmake
109+
mingw-w64-x86_64-ninja
106110
git
107111
108112
- uses: actions/checkout@v6
109113

110114
- name: Get XPlane SDK + xplib
111-
shell: bash
115+
shell: msys2 {0}
112116
run: |
113117
SDK_VERSION=411
114118
curl -L "https://developer.x-plane.com/wp-content/plugins/code-sample-generation/sdk_zip_files/XPSDK${SDK_VERSION}.zip" -o "XPSDK${SDK_VERSION}.zip"
@@ -120,18 +124,21 @@ jobs:
120124
shell: msys2 {0}
121125
run: |
122126
TAG=${GITHUB_REF##*/}
123-
if [ ! -z "$TAG" ]; then
127+
if [ -n "$TAG" ]; then
124128
echo "VERSION=$TAG" > version.mak
125129
fi
126-
make -f Makefile.mgw64
127-
tar cvf binary.tar openSAM-pkg*/openSAM/*_x64
130+
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release \
131+
-DBUILD_TESTS=OFF \
132+
-S . -B build
133+
cmake --build build
134+
cmake --install build
135+
tar cvf binary.tar openSAM-pkg/openSAM/*_x64
128136
129137
- name: Upload Build Artifact
130138
uses: actions/upload-artifact@v7
131139
with:
132140
name: build-windows
133-
path: |
134-
binary.tar
141+
path: binary.tar
135142

136143
release:
137144
runs-on: ubuntu-latest

CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,10 @@ endif()
139139
# ==============================================================================
140140
# sam_xml_test (all platforms, matching Makefile.mgw64 test target)
141141
# ==============================================================================
142-
option(BUILD_TESTS "Build sam_xml_test" ON)
142+
if (WIN32)
143+
option(BUILD_TESTS "Build sam_xml_test" ON)
144+
endif()
145+
143146
if(BUILD_TESTS)
144147
add_executable(sam_xml_test
145148
sam_xml_test.cpp

0 commit comments

Comments
 (0)