Skip to content

Commit 6731053

Browse files
committed
WIP: Attempt to build MCU binary packages
1 parent 49d0c96 commit 6731053

File tree

2 files changed

+104
-1
lines changed

2 files changed

+104
-1
lines changed

.github/workflows/cpp_package.yaml

+100-1
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@ env:
1111
MACOSX_DEPLOYMENT_TARGET: "11.0"
1212
# Keep in sync with features in nightly_snapshot.yaml, slint_tool_binary.yaml, api/node/Cargo.toml, and api/python/Cargo.toml
1313
SLINT_BINARY_FEATURES: "-DSLINT_FEATURE_BACKEND_LINUXKMS_NOSEAT=ON -DSLINT_FEATURE_BACKEND_WINIT=ON -DSLINT_FEATURE_RENDERER_FEMTOVG=ON -DSLINT_FEATURE_RENDERER_SKIA=ON -DSLINT_FEATURE_RENDERER_SOFTWARE=ON"
14+
SLINT_MCU_FEATURES: "-DSLINT_FEATURE_FREESTANDING=ON -DSLINT_FEATURE_RENDERER_SOFTWARE=ON"
1415

1516
jobs:
16-
cmake_package:
17+
cmake_package_desktop:
1718
env:
1819
DYLD_FRAMEWORK_PATH: /Users/runner/work/slint/Qt/6.5.1/clang_64/lib
1920
QT_QPA_PLATFORM: offscreen
@@ -70,3 +71,101 @@ jobs:
7071
with:
7172
name: cpp_bin-${{ matrix.package_suffix }}
7273
path: ${{ runner.workspace }}/cppbuild/Slint-cpp-*
74+
75+
cmake_package_mcu:
76+
env:
77+
CARGO_INCREMENTAL: false
78+
strategy:
79+
matrix:
80+
target: [thumbv7em-none-eabihf]
81+
host: [ubuntu-20.04, windows-2022, macOS-12]
82+
83+
runs-on: ${{ matrix.host }}
84+
steps:
85+
- uses: actions/checkout@v4
86+
- uses: ./.github/actions/install-linux-dependencies
87+
with:
88+
old-ubuntu: true
89+
- uses: ./.github/actions/setup-rust
90+
- uses: baptiste0928/cargo-install@v3
91+
with:
92+
crate: cargo-about
93+
- name: Prepare licenses
94+
run: bash -x ../../scripts/prepare_binary_package.sh ../..
95+
working-directory: api/cpp/
96+
- uses: ilammy/msvc-dev-cmd@v1
97+
- name: Select MSVC (windows)
98+
run: |
99+
echo "CC=cl.exe" >> $GITHUB_ENV
100+
echo "CXX=cl.exe" >> $GITHUB_ENV
101+
if: matrix.host == 'windows-2022'
102+
- name: C++ Build
103+
uses: lukka/[email protected]
104+
with:
105+
cmakeListsOrSettingsJson: CMakeListsTxtAdvanced
106+
cmakeListsTxtPath: CMakeLists.txt
107+
cmakeAppendedArgs: "-DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -DRust_CARGO_TARGET=${{ matrix.target }} ${{ env.SLINT_MCU_FEATURES }} ${{ matrix.build_flags }}"
108+
buildDirectory: ${{ runner.workspace }}/cppbuild
109+
buildWithCMakeArgs: "--config Release"
110+
- name: cpack
111+
working-directory: ${{ runner.workspace }}/cppbuild
112+
run: cpack -G TGZ
113+
- name: "Upload C++ packages"
114+
uses: actions/upload-artifact@v4
115+
with:
116+
name: cpp_mcu_bin-${{ runner.os }}-${{ runner.arch }}-${{ matrix.target }}
117+
path: ${{ runner.workspace }}/cppbuild/Slint-cpp-*
118+
119+
cmake_package_mcu_esp:
120+
env:
121+
CARGO_INCREMENTAL: false
122+
strategy:
123+
matrix:
124+
target: [riscv32imafc-esp-espidf]
125+
host: [ubuntu-22.04, windows-2022] #, macOS-12]
126+
127+
runs-on: ${{ matrix.host }}
128+
steps:
129+
- uses: actions/checkout@v4
130+
- uses: ./.github/actions/install-linux-dependencies
131+
with:
132+
old-ubuntu: true
133+
- uses: dtolnay/rust-toolchain@stable
134+
- name: install espup
135+
run: |
136+
cargo install espup
137+
espup install
138+
rustup default esp
139+
- name: add esp toolchains to PATH
140+
if: runner.os == 'Linux'
141+
run: |
142+
source "$HOME/export-esp.sh"
143+
echo "$PATH" >> "$GITHUB_PATH"
144+
- uses: baptiste0928/cargo-install@v3
145+
with:
146+
crate: cargo-about
147+
- name: Prepare licenses
148+
run: bash -x ../../scripts/prepare_binary_package.sh ../..
149+
working-directory: api/cpp/
150+
- uses: ilammy/msvc-dev-cmd@v1
151+
- name: Select MSVC (windows)
152+
run: |
153+
echo "CC=cl.exe" >> $GITHUB_ENV
154+
echo "CXX=cl.exe" >> $GITHUB_ENV
155+
if: matrix.host == 'windows-2022'
156+
- name: C++ Build
157+
uses: lukka/[email protected]
158+
with:
159+
cmakeListsOrSettingsJson: CMakeListsTxtAdvanced
160+
cmakeListsTxtPath: CMakeLists.txt
161+
cmakeAppendedArgs: "-DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -DRust_CARGO_TARGET=${{ matrix.target }} -DSLINT_LIBRARY_CARGO_FLAGS='-Zbuild-std=core,alloc' ${{ env.SLINT_MCU_FEATURES }} ${{ matrix.build_flags }}"
162+
buildDirectory: ${{ runner.workspace }}/cppbuild
163+
buildWithCMakeArgs: "--config Release"
164+
- name: cpack
165+
working-directory: ${{ runner.workspace }}/cppbuild
166+
run: cpack -G TGZ
167+
- name: "Upload C++ packages"
168+
uses: actions/upload-artifact@v4
169+
with:
170+
name: cpp_mcu_bin-${{ runner.os }}-${{ runner.arch }}-${{ matrix.target }}
171+
path: ${{ runner.workspace }}/cppbuild/Slint-cpp-*

api/cpp/CMakeLists.txt

+4
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,10 @@ else()
475475
set(CPACK_SYSTEM_NAME "${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}")
476476
endif()
477477

478+
if (Rust_CARGO_TARGET)
479+
set(CPACK_SYSTEM_NAME "${CPACK_SYSTEM_NAME}-${Rust_CARGO_TARGET}")
480+
endif()
481+
478482
include(CPack)
479483

480484
if(SLINT_BUILD_TESTING)

0 commit comments

Comments
 (0)