Add macOS simulator build to pipelines (#162)

- GitHub actions changed to build simulator on macOS (it's broken, but at least we get a good code portability check for now!)
- `Buildscripts/` shell scripts updated to use `/bin/sh` so it works on macOS too
- Various includes fixed in various subprojects so the code is more portable
This commit is contained in:
Ken Van Hoeylandt 2025-01-12 17:48:59 +01:00 committed by GitHub
parent 431fa84ffb
commit 5d189fe5a3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
20 changed files with 38 additions and 22 deletions

View File

@ -7,6 +7,9 @@ inputs:
platform_name: platform_name:
description: A descriptive name for the target platform (e.g. amd64, aarch64, etc.) description: A descriptive name for the target platform (e.g. amd64, aarch64, etc.)
required: true required: true
publish:
description: A boolean that enables publishing of artifacts
required: true
runs: runs:
using: "composite" using: "composite"
@ -16,7 +19,7 @@ runs:
with: with:
submodules: recursive submodules: recursive
- name: Install Linux Dependencies for SDL - name: Install Linux Dependencies for SDL
if: ${{ inputs.platform_name }} == 'linux' if: ${{ runner.os == 'Linux' }}
shell: bash shell: bash
# See Libraries/SDL/docs/README-linux.md # See Libraries/SDL/docs/README-linux.md
run: > run: >
@ -45,6 +48,7 @@ runs:
run: Buildscripts/release-simulator.sh buildsim release/Simulator-${{ inputs.os_name }}-${{ inputs.platform_name }} run: Buildscripts/release-simulator.sh buildsim release/Simulator-${{ inputs.os_name }}-${{ inputs.platform_name }}
- name: 'Upload Artifact' - name: 'Upload Artifact'
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
if: ${{ inputs.publish == 'true' }}
with: with:
name: Simulator-${{ inputs.os_name }}-${{ inputs.platform_name }} name: Simulator-${{ inputs.os_name }}-${{ inputs.platform_name }}
path: release/Simulator-${{ inputs.os_name }}-${{ inputs.platform_name }} path: release/Simulator-${{ inputs.os_name }}-${{ inputs.platform_name }}

View File

@ -2,7 +2,7 @@
name: Build Simulator name: Build Simulator
on: [push] on: [push]
jobs: jobs:
Build-Simulator: Build-Simulator-Linux:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
@ -11,3 +11,15 @@ jobs:
with: with:
os_name: linux os_name: linux
platform_name: amd64 platform_name: amd64
publish: true
Build-Simulator-macOS:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: "Build"
uses: ./.github/actions/build-simulator
with:
os_name: macos
platform_name: aarch64
# macOS simulator currently fails due to main thread requirement for rendering
publish: false

View File

@ -11,15 +11,15 @@ class SimulatorPower : public Power {
public: public:
SimulatorPower() {} SimulatorPower() = default;
~SimulatorPower() {} ~SimulatorPower() override = default;
bool supportsMetric(MetricType type) const override; bool supportsMetric(MetricType type) const override;
bool getMetric(Power::MetricType type, Power::MetricData& data) override; bool getMetric(Power::MetricType type, Power::MetricData& data) override;
bool supportsChargeControl() const { return true; } bool supportsChargeControl() const override { return true; }
bool isAllowedToCharge() const { return allowedToCharge; } bool isAllowedToCharge() const override { return allowedToCharge; }
void setAllowedToCharge(bool canCharge) { allowedToCharge = canCharge; } void setAllowedToCharge(bool canCharge) override { allowedToCharge = canCharge; }
}; };
std::shared_ptr<Power> simulatorPower(); std::shared_ptr<Power> simulatorPower();

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/bin/sh
# Usage: # Usage:
# flash.sh [port] # flash.sh [port]

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/bin/sh
function build() { function build() {
Buildscripts/build.sh $1 Buildscripts/build.sh $1

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/bin/sh
# #
# Usage: build.sh [boardname] # Usage: build.sh [boardname]

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/bin/sh
# #
# Description: Releases the current build files as an SDK in release/TactilitySDK # Description: Releases the current build files as an SDK in release/TactilitySDK

View File

@ -1,4 +1,4 @@
#!/usr/bin/bash #!/bin/sh
# #
# Usage: release-sdk.sh [target_path] # Usage: release-sdk.sh [target_path]

View File

@ -1,4 +1,4 @@
#!/usr/bin/bash #!/bin/sh
# #
# Usage: release-simulator.sh [builddir] [target_path] # Usage: release-simulator.sh [builddir] [target_path]

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/bin/sh
# #
# Usage: release.sh [boardname] # Usage: release.sh [boardname]

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/bin/sh
cmake -S ./ -B build-sim cmake -S ./ -B build-sim
cmake --build build-sim --target build-tests -j 14 cmake --build build-sim --target build-tests -j 14

View File

@ -70,7 +70,6 @@ if (NOT DEFINED ENV{ESP_IDF_VERSION})
endif() endif()
if (NOT DEFINED ENV{ESP_IDF_VERSION}) if (NOT DEFINED ENV{ESP_IDF_VERSION})
# FreeRTOS # FreeRTOS
set(FREERTOS_CONFIG_FILE_DIRECTORY ${PROJECT_SOURCE_DIR}/Boards/Simulator/Source CACHE STRING "") set(FREERTOS_CONFIG_FILE_DIRECTORY ${PROJECT_SOURCE_DIR}/Boards/Simulator/Source CACHE STRING "")
set(FREERTOS_PORT GCC_POSIX CACHE STRING "") set(FREERTOS_PORT GCC_POSIX CACHE STRING "")

View File

@ -1,7 +1,6 @@
#include "FileUtils.h" #include "FileUtils.h"
#include "TactilityCore.h" #include "TactilityCore.h"
#include <cstring> #include <cstring>
#include <bits/stdc++.h>
#include <StringUtils.h> #include <StringUtils.h>
namespace tt::app::files { namespace tt::app::files {

View File

@ -1,4 +1,3 @@
#include <cstring>
#include "app/alertdialog/AlertDialog.h" #include "app/alertdialog/AlertDialog.h"
#include "app/imageviewer/ImageViewer.h" #include "app/imageviewer/ImageViewer.h"
#include "app/inputdialog/InputDialog.h" #include "app/inputdialog/InputDialog.h"
@ -11,7 +10,8 @@
#include "Tactility.h" #include "Tactility.h"
#include "View.h" #include "View.h"
#include "StringUtils.h" #include "StringUtils.h"
#include <filesystem> #include <cstring>
#include <unistd.h>
#define TAG "files_app" #define TAG "files_app"

View File

@ -3,6 +3,7 @@
#include "StringUtils.h" #include "StringUtils.h"
#include <iomanip> #include <iomanip>
#include <vector> #include <vector>
#include <sstream>
namespace tt::app::i2cscanner { namespace tt::app::i2cscanner {

View File

@ -5,7 +5,7 @@
#include "hal/Touch.h" #include "hal/Touch.h"
#include "hal/Keyboard.h" #include "hal/Keyboard.h"
#include "lvgl/LvglKeypad.h" #include "lvgl/LvglKeypad.h"
#include "lvgl/Lvgl.h" #include "lvgl/LvglDisplay.h"
#include "kernel/SystemEvents.h" #include "kernel/SystemEvents.h"
namespace tt::lvgl { namespace tt::lvgl {

View File

@ -1,4 +1,4 @@
#include "lvgl/Lvgl.h" #include "lvgl/LvglDisplay.h"
#include "Check.h" #include "Check.h"
namespace tt::lvgl { namespace tt::lvgl {

View File

@ -1,5 +1,6 @@
#include "Mutex.h" #include "Mutex.h"
#include <cstring> #include <cstring>
#include <sstream>
namespace tt { namespace tt {

View File

@ -1,6 +1,6 @@
#pragma once #pragma once
#include <bits/stdc++.h> #include <algorithm>
#include <cstdio> #include <cstdio>
#include <string> #include <string>
#include <vector> #include <vector>