-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0187767
commit 5708144
Showing
8 changed files
with
179 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
# Build Github Action, to run a test build on all targets | ||
# (Linux, Blit, MacOS, Visual Studio) when the project is checked in. | ||
# | ||
# Thanks in large part to the phenomenal examples of DaftFreak. | ||
|
||
name: Build | ||
|
||
on: | ||
push: | ||
pull_request: | ||
release: | ||
types: [created] | ||
|
||
env: | ||
BUILD_TYPE: Release | ||
|
||
jobs: | ||
|
||
build: | ||
|
||
name: ${{matrix.name}} | ||
strategy: | ||
matrix: | ||
include: | ||
- os: ubuntu-20.04 | ||
name: Linux | ||
#release-suffix: LIN64 | ||
cmake-args: -D32BLIT_PATH=$GITHUB_WORKSPACE/32blit | ||
apt-packages: libsdl2-dev libsdl2-image-dev python3-setuptools | ||
|
||
- os: ubuntu-20.04 | ||
name: STM32 | ||
release-suffix: STM32 | ||
cmake-args: -DCMAKE_TOOLCHAIN_FILE=$GITHUB_WORKSPACE/32blit/32blit.toolchain | ||
apt-packages: gcc-arm-none-eabi libnewlib-arm-none-eabi libstdc++-arm-none-eabi-newlib python3-setuptools | ||
|
||
- os: macos-latest | ||
name: macOS | ||
#release-suffix: MACOS | ||
cmake-args: -D32BLIT_PATH=$GITHUB_WORKSPACE/32blit | ||
brew-packages: sdl2 sdl2_image | ||
|
||
- os: windows-latest | ||
name: Visual Studio | ||
#release-suffix: WIN64 | ||
cmake-args: -D32BLIT_PATH=$GITHUB_WORKSPACE/32blit | ||
|
||
runs-on: ${{matrix.os}} | ||
|
||
env: | ||
RELEASE_FILE: ${{github.event.repository.name}}-${{github.event.release.tag_name}}-${{matrix.release-suffix}} | ||
|
||
steps: | ||
# Check out the main repo | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
path: main | ||
|
||
# Check out the 32Blit API we build against | ||
- name: Checkout 32Blit API | ||
uses: actions/checkout@v2 | ||
with: | ||
repository: pimoroni/32blit-beta | ||
path: 32blit | ||
|
||
# Linux dependencies | ||
- name: Install Linux deps | ||
if: runner.os == 'Linux' | ||
run: | | ||
sudo apt update && sudo apt install ${{matrix.apt-packages}} | ||
pip3 install 32blit | ||
# MacOS dependencies | ||
- name: Install macOS deps | ||
if: runner.os == 'macOS' | ||
run: | | ||
brew install ${{matrix.brew-packages}} | ||
python3 -m pip install 32blit | ||
# Windows dependencies | ||
- name: Install Windows deps | ||
if: runner.os == 'Windows' | ||
shell: bash | ||
run: | | ||
python -m pip install 32blit | ||
# Set up the cmake build environment | ||
- name: Create Build Environment | ||
run: cmake -E make_directory ${{runner.workspace}}/main/build | ||
|
||
# Ask cmake to build the makefiles | ||
- name: Configure CMake | ||
shell: bash | ||
working-directory: ${{runner.workspace}}/main/build | ||
run: cmake $GITHUB_WORKSPACE/main -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_INSTALL_PREFIX=`pwd` ${{matrix.cmake-args}} | ||
|
||
# And then run the build itself | ||
- name: Build | ||
working-directory: ${{runner.workspace}}/main/build | ||
shell: bash | ||
run: cmake --build . --config $BUILD_TYPE -j 2 | ||
|
||
# When it's a release, generate tar/zip files of the build | ||
- name: Package Release | ||
if: github.event_name == 'release' && matrix.release-suffix != '' | ||
shell: bash | ||
working-directory: ${{runner.workspace}}/main/build | ||
run: | | ||
cmake --build . --target install | ||
tar -zcf ${RELEASE_FILE}.tar.gz bin/ | ||
7z a ${RELEASE_FILE}.zip bin/* | ||
# Push the tar file to the release | ||
- name: Upload tar | ||
if: github.event_name == 'release' && matrix.release-suffix != '' | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | ||
with: | ||
asset_path: ${{runner.workspace}}/main/build/${{env.RELEASE_FILE}}.tar.gz | ||
upload_url: ${{github.event.release.upload_url}} | ||
asset_name: ${{env.RELEASE_FILE}}.tar.gz | ||
asset_content_type: application/octet-stream | ||
|
||
# Push the zip file to the release | ||
- name: Upload zip | ||
if: github.event_name == 'release' && matrix.release-suffix != '' | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | ||
with: | ||
asset_path: ${{runner.workspace}}/main/build/${{env.RELEASE_FILE}}.zip | ||
upload_url: ${{github.event.release.upload_url}} | ||
asset_name: ${{env.RELEASE_FILE}}.zip | ||
asset_content_type: application/zip |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
build | ||
build/ | ||
build.*/ | ||
.vscode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,30 @@ | ||
cmake_minimum_required(VERSION 3.8.0) | ||
# Basic parameters; check that these match your project / environment | ||
cmake_minimum_required(VERSION 3.8) | ||
|
||
project(mjpeg-player) | ||
set(32BLIT_PATH "../" CACHE PATH "Path to 32blit.cmake") | ||
|
||
#set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fsanitize=address") | ||
|
||
include(${32BLIT_PATH}/32blit.cmake) | ||
|
||
#add_definitions("-DPROFILER") | ||
|
||
blit_executable(mjpeg-player | ||
set(PROJECT_SOURCE | ||
avi-file.cpp | ||
control-icons.cpp | ||
file-browser.cpp | ||
mjpeg-player.cpp | ||
) | ||
|
||
blit_assets_yaml(mjpeg-player assets.yml) | ||
blit_metadata(mjpeg-player metadata.yml) | ||
#set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fsanitize=address") | ||
|
||
#add_definitions("-DPROFILER") | ||
|
||
# Build configuration; approach this with caution! | ||
if(MSVC) | ||
add_compile_options("/W4" "/wd4244" "/wd4324") | ||
else() | ||
add_compile_options("-Wall" "-Wextra" "-Wdouble-promotion") | ||
endif() | ||
if(NOT EXISTS ${32BLIT_PATH}/32blit.cmake) | ||
message(FATAL_ERROR "Define location of 32Blit API with -D32BLIT_PATH=<path to 32blit.cmake>") | ||
endif() | ||
include (${32BLIT_PATH}/32blit.cmake) | ||
blit_executable (${PROJECT_NAME} ${PROJECT_SOURCE}) | ||
blit_assets_yaml (${PROJECT_NAME} assets.yml) | ||
blit_metadata (${PROJECT_NAME} metadata.yml) | ||
add_custom_target (flash DEPENDS ${PROJECT_NAME}.flash) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2020 Charlie Birks | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
File renamed without changes
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters