Skip to content

Commit

Permalink
Package up Slint compiler separately
Browse files Browse the repository at this point in the history
  • Loading branch information
tronical committed Aug 28, 2024
1 parent 35de15c commit 659a25f
Showing 1 changed file with 205 additions and 156 deletions.
361 changes: 205 additions & 156 deletions .github/workflows/cpp_package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,164 +16,213 @@ env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

jobs:
cmake_package_desktop:
env:
DYLD_FRAMEWORK_PATH: /Users/runner/work/slint/Qt/6.5.1/clang_64/lib
QT_QPA_PLATFORM: offscreen
CARGO_INCREMENTAL: false
strategy:
matrix:
os: [ubuntu-20.04, macOS-12, macos-14, windows-2022]
include:
- os: ubuntu-20.04
package_suffix: linux
- os: macOS-12
package_suffix: macos-x86_64
- os: macos-14
package_suffix: macos-aarch64
- os: windows-2022
package_suffix: windows
# cmake_package_desktop:
# env:
# DYLD_FRAMEWORK_PATH: /Users/runner/work/slint/Qt/6.5.1/clang_64/lib
# QT_QPA_PLATFORM: offscreen
# CARGO_INCREMENTAL: false
# strategy:
# matrix:
# os: [ubuntu-20.04, macOS-12, macos-14, windows-2022]
# include:
# - os: ubuntu-20.04
# package_suffix: linux
# - os: macOS-12
# package_suffix: macos-x86_64
# - os: macos-14
# package_suffix: macos-aarch64
# - os: windows-2022
# package_suffix: windows

runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/install-linux-dependencies
with:
old-ubuntu: true
- name: Install Qt (Ubuntu)
uses: jurplel/install-qt-action@v3
if: matrix.os == 'ubuntu-20.04'
with:
version: 5.15.2
cache: true
- uses: ./.github/actions/setup-rust
- uses: baptiste0928/cargo-install@v3
with:
crate: cargo-about
- name: Prepare licenses
run: bash -x ../../scripts/prepare_binary_package.sh ../..
working-directory: api/cpp/
- uses: ilammy/msvc-dev-cmd@v1
- name: Select MSVC (windows)
run: |
echo "CC=cl.exe" >> $GITHUB_ENV
echo "CXX=cl.exe" >> $GITHUB_ENV
if: matrix.os == 'windows-2022'
- name: C++ Build
uses: lukka/[email protected]
with:
cmakeListsOrSettingsJson: CMakeListsTxtAdvanced
cmakeListsTxtPath: CMakeLists.txt
cmakeAppendedArgs: "-DCMAKE_BUILD_TYPE=RelWithDebInfo ${{ env.SLINT_BINARY_FEATURES }}"
buildDirectory: ${{ runner.workspace }}/cppbuild
buildWithCMakeArgs: "--config Release"
- name: cpack
working-directory: ${{ runner.workspace }}/cppbuild
run: cmake --build . --config Release --target package
- name: "Upload C++ packages"
uses: actions/upload-artifact@v4
with:
name: cpp_bin-${{ matrix.package_suffix }}
path: ${{ runner.workspace }}/cppbuild/Slint-cpp-*
# runs-on: ${{ matrix.os }}
# steps:
# - uses: actions/checkout@v4
# - uses: ./.github/actions/install-linux-dependencies
# with:
# old-ubuntu: true
# - name: Install Qt (Ubuntu)
# uses: jurplel/install-qt-action@v3
# if: matrix.os == 'ubuntu-20.04'
# with:
# version: 5.15.2
# cache: true
# - uses: ./.github/actions/setup-rust
# - uses: baptiste0928/cargo-install@v3
# with:
# crate: cargo-about
# - name: Prepare licenses
# run: bash -x ../../scripts/prepare_binary_package.sh ../..
# working-directory: api/cpp/
# - uses: ilammy/msvc-dev-cmd@v1
# - name: Select MSVC (windows)
# run: |
# echo "CC=cl.exe" >> $GITHUB_ENV
# echo "CXX=cl.exe" >> $GITHUB_ENV
# if: matrix.os == 'windows-2022'
# - name: C++ Build
# uses: lukka/[email protected]
# with:
# cmakeListsOrSettingsJson: CMakeListsTxtAdvanced
# cmakeListsTxtPath: CMakeLists.txt
# cmakeAppendedArgs: "-DCMAKE_BUILD_TYPE=RelWithDebInfo ${{ env.SLINT_BINARY_FEATURES }}"
# buildDirectory: ${{ runner.workspace }}/cppbuild
# buildWithCMakeArgs: "--config Release"
# - name: cpack
# working-directory: ${{ runner.workspace }}/cppbuild
# run: cmake --build . --config Release --target package
# - name: "Upload C++ packages"
# uses: actions/upload-artifact@v4
# with:
# name: cpp_bin-${{ matrix.package_suffix }}
# path: ${{ runner.workspace }}/cppbuild/Slint-cpp-*

cmake_package_mcu_arm:
env:
CARGO_INCREMENTAL: false
strategy:
matrix:
target: [thumbv7em-none-eabihf]
host: [ubuntu-20.04, windows-2022, macOS-12]
# cmake_package_mcu_arm:
# env:
# CARGO_INCREMENTAL: false
# strategy:
# matrix:
# target: [thumbv7em-none-eabihf]
# host: [ubuntu-20.04, windows-2022, macOS-12]

runs-on: ${{ matrix.host }}
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/install-linux-dependencies
with:
old-ubuntu: true
- uses: ./.github/actions/setup-rust
with:
target: ${{ matrix.target }}
- name: Install GNU Arm Embedded Toolchain
uses: carlosperate/arm-none-eabi-gcc-action@v1
with:
release: '13.3.Rel1'
- uses: baptiste0928/cargo-install@v3
with:
crate: cargo-about
- name: Prepare licenses
run: bash -x ../../scripts/prepare_binary_package.sh ../..
working-directory: api/cpp/
- name: C++ Build
uses: lukka/[email protected]
with:
cmakeListsOrSettingsJson: CMakeListsTxtAdvanced
cmakeListsTxtPath: CMakeLists.txt
cmakeAppendedArgs: "-GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_SHARED_LIBS=OFF -DRust_CARGO_TARGET=${{ matrix.target }} -DCMAKE_C_COMPILER=arm-none-eabi-gcc -DCMAKE_CXX_COMPILER=arm-none-eabi-g++ -DCMAKE_AR=arm-none-eabi-ar -DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY ${{ env.SLINT_MCU_FEATURES }}"
buildDirectory: ${{ runner.workspace }}/cppbuild
buildWithCMakeArgs: "--config Release"
- name: cpack
working-directory: ${{ runner.workspace }}/cppbuild
run: cpack -G TGZ
- name: "Upload C++ packages"
uses: actions/upload-artifact@v4
with:
name: cpp_mcu_bin-${{ runner.os }}-${{ runner.arch }}-${{ matrix.target }}
path: ${{ runner.workspace }}/cppbuild/Slint-cpp-*
# runs-on: ${{ matrix.host }}
# steps:
# - uses: actions/checkout@v4
# - uses: ./.github/actions/install-linux-dependencies
# with:
# old-ubuntu: true
# - uses: ./.github/actions/setup-rust
# with:
# target: ${{ matrix.target }}
# - name: Install GNU Arm Embedded Toolchain
# uses: carlosperate/arm-none-eabi-gcc-action@v1
# with:
# release: '13.3.Rel1'
# - uses: baptiste0928/cargo-install@v3
# with:
# crate: cargo-about
# - name: Prepare licenses
# run: bash -x ../../scripts/prepare_binary_package.sh ../..
# working-directory: api/cpp/
# - name: C++ Build
# uses: lukka/[email protected]
# with:
# cmakeListsOrSettingsJson: CMakeListsTxtAdvanced
# cmakeListsTxtPath: CMakeLists.txt
# cmakeAppendedArgs: "-GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_SHARED_LIBS=OFF -DRust_CARGO_TARGET=${{ matrix.target }} -DCMAKE_C_COMPILER=arm-none-eabi-gcc -DCMAKE_CXX_COMPILER=arm-none-eabi-g++ -DCMAKE_AR=arm-none-eabi-ar -DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY ${{ env.SLINT_MCU_FEATURES }}"
# buildDirectory: ${{ runner.workspace }}/cppbuild
# buildWithCMakeArgs: "--config Release"
# - name: cpack
# working-directory: ${{ runner.workspace }}/cppbuild
# run: cpack -G TGZ
# - name: "Upload C++ packages"
# uses: actions/upload-artifact@v4
# with:
# name: cpp_mcu_bin-${{ runner.os }}-${{ runner.arch }}-${{ matrix.target }}
# path: ${{ runner.workspace }}/cppbuild/Slint-cpp-*

cmake_package_mcu_esp:
env:
CARGO_INCREMENTAL: false
strategy:
matrix:
idf_target: [esp32s2, esp32s3, esp32p4]
host: [ubuntu-22.04, macOS-12]
include:
- idf_target: esp32s2
rust_target: xtensa-esp32s2-none-elf
- idf_target: esp32s3
rust_target: xtensa-esp32s3-none-elf
- idf_target: esp32p4
rust_target: riscv32imafc-esp-espidf
# cmake_package_mcu_esp:
# env:
# CARGO_INCREMENTAL: false
# strategy:
# matrix:
# idf_target: [esp32s2, esp32s3, esp32p4]
# host: [ubuntu-22.04, macOS-12]
# include:
# - idf_target: esp32s2
# rust_target: xtensa-esp32s2-none-elf
# - idf_target: esp32s3
# rust_target: xtensa-esp32s3-none-elf
# - idf_target: esp32p4
# rust_target: riscv32imafc-esp-espidf

runs-on: ${{ matrix.host }}
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/install-linux-dependencies
with:
old-ubuntu: true
- uses: dtolnay/rust-toolchain@stable
- name: install espup
run: |
cargo install espup
espup install
rustup default esp
- name: add esp toolchains to PATH
if: runner.os != 'Windows'
run: |
source "$HOME/export-esp.sh"
echo "$PATH" >> "$GITHUB_PATH"
- uses: baptiste0928/cargo-install@v3
with:
crate: cargo-about
- name: Prepare licenses
run: bash -x ../../scripts/prepare_binary_package.sh ../..
working-directory: api/cpp/
- name: C++ Build
uses: lukka/[email protected]
with:
cmakeListsOrSettingsJson: CMakeListsTxtAdvanced
cmakeListsTxtPath: CMakeLists.txt
# NOTE: xtensa-esp-elf-gcc as compiler for the RISC-V targets is wrong, but the compiler argument here is only
# used to ensure that SIZEOF_VOID_P is 4 in the generated cmake config file. Otherwise this build requires no
# C compiler.
cmakeAppendedArgs: "-GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -DESP_PLATFORM=1 -DIDF_TARGET=${{ matrix.idf_target }} -DRust_CARGO_TARGET=${{ matrix.rust_target }} -DCMAKE_C_COMPILER=xtensa-esp-elf-gcc -DCMAKE_AR=xtensa-esp-elf-ar -DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY -DSLINT_LIBRARY_CARGO_FLAGS='-Zbuild-std=core,alloc' ${{ env.SLINT_MCU_FEATURES }}"
buildDirectory: ${{ runner.workspace }}/cppbuild
buildWithCMakeArgs: "--config Release"
- name: cpack
working-directory: ${{ runner.workspace }}/cppbuild
run: cpack -G TGZ
- name: "Upload C++ packages"
uses: actions/upload-artifact@v4
with:
name: cpp_mcu_bin-${{ runner.os }}-${{ runner.arch }}-${{ matrix.idf_target }}
path: ${{ runner.workspace }}/cppbuild/Slint-cpp-*
# runs-on: ${{ matrix.host }}
# steps:
# - uses: actions/checkout@v4
# - uses: ./.github/actions/install-linux-dependencies
# with:
# old-ubuntu: true
# - uses: dtolnay/rust-toolchain@stable
# - name: install espup
# run: |
# cargo install espup
# espup install
# rustup default esp
# - name: add esp toolchains to PATH
# if: runner.os != 'Windows'
# run: |
# source "$HOME/export-esp.sh"
# echo "$PATH" >> "$GITHUB_PATH"
# - uses: baptiste0928/cargo-install@v3
# with:
# crate: cargo-about
# - name: Prepare licenses
# run: bash -x ../../scripts/prepare_binary_package.sh ../..
# working-directory: api/cpp/
# - name: C++ Build
# uses: lukka/[email protected]
# with:
# cmakeListsOrSettingsJson: CMakeListsTxtAdvanced
# cmakeListsTxtPath: CMakeLists.txt
# # NOTE: xtensa-esp-elf-gcc as compiler for the RISC-V targets is wrong, but the compiler argument here is only
# # used to ensure that SIZEOF_VOID_P is 4 in the generated cmake config file. Otherwise this build requires no
# # C compiler.
# cmakeAppendedArgs: "-GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -DESP_PLATFORM=1 -DIDF_TARGET=${{ matrix.idf_target }} -DRust_CARGO_TARGET=${{ matrix.rust_target }} -DCMAKE_C_COMPILER=xtensa-esp-elf-gcc -DCMAKE_AR=xtensa-esp-elf-ar -DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY -DSLINT_LIBRARY_CARGO_FLAGS='-Zbuild-std=core,alloc' ${{ env.SLINT_MCU_FEATURES }}"
# buildDirectory: ${{ runner.workspace }}/cppbuild
# buildWithCMakeArgs: "--config Release"
# - name: cpack
# working-directory: ${{ runner.workspace }}/cppbuild
# run: cpack -G TGZ
# - name: "Upload C++ packages"
# uses: actions/upload-artifact@v4
# with:
# name: cpp_mcu_bin-${{ runner.os }}-${{ runner.arch }}-${{ matrix.idf_target }}
# path: ${{ runner.workspace }}/cppbuild/Slint-cpp-*

cmake_slint_compiler:
env:
CARGO_INCREMENTAL: false
strategy:
matrix:
os: [ubuntu-20.04, macOS-12, macos-14, windows-2022]
include:
- os: ubuntu-20.04
package_suffix: linux
- os: macOS-12
package_suffix: macos-x86_64
- os: macos-14
package_suffix: macos-aarch64
- os: windows-2022
package_suffix: windows

runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/install-linux-dependencies
with:
old-ubuntu: true
- uses: ./.github/actions/setup-rust
# Build Slint-compiler with CMake so that CMakeLists.txt can configure C++ specific features
- name: Slint Compiler Build
uses: lukka/[email protected]
with:
cmakeListsOrSettingsJson: CMakeListsTxtAdvanced
cmakeListsTxtPath: CMakeLists.txt
cmakeAppendedArgs: "-GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DSLINT_BUILD_RUNTIME=OFF"
buildDirectory: ${{ runner.workspace }}/cppbuild
buildWithCMakeArgs: "--config Release"
- name: cpack
working-directory: ${{ runner.workspace }}/cppbuild
run: cpack -G TGZ
- name: Extract Slint Compiler binary
working-directory: ${{ runner.workspace }}/cppbuild
run: cmake -E tar xvf Slint-cpp-*.tgz
- name: Repackage
working-directory: ${{ runner.workspace }}/cppbuild
run: |
cd Slint-cpp-*/bin
cmake -E tar czf ../../slint-compiler-${{ matrix.package_suffix }}.tgz slint-compiler*
- name: "Upload Slint compiler package"
uses: actions/upload-artifact@v4
with:
name: slint-compiler-bin-${{ runner.os }}-${{ runner.arch }}
path: ${{ runner.workspace }}/cppbuild/slint-compiler-*.tgz

0 comments on commit 659a25f

Please sign in to comment.