forked from supertuxkart/stk-code
-
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.
Add Switch to Github actions (supertuxkart#4514)
- Loading branch information
Showing
8 changed files
with
238 additions
and
20 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,100 @@ | ||
name: switch | ||
on: | ||
push: | ||
branches: | ||
- master | ||
tags: | ||
- '*' | ||
pull_request: {} | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build_switch: | ||
name: Build Switch | ||
runs-on: ubuntu-latest | ||
container: | ||
image: 'devkitpro/devkita64' | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 1 | ||
path: "./stk-code" | ||
- name: Checkout OpenAL | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 1 | ||
path: "./stk-code/lib/openal" | ||
repository: "kcat/openal-soft" | ||
- name: Checkout Harfbuzz | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 1 | ||
path: "./stk-code/lib/harfbuzz" | ||
repository: "harfbuzz/harfbuzz" | ||
- name: Grab assets | ||
run: | | ||
sudo apt update | ||
sudo apt install unzip zip -y | ||
wget -q https://github.com/supertuxkart/stk-assets-mobile/releases/download/git/stk-assets-full.zip | ||
unzip -q stk-assets-full.zip -d stk-assets | ||
rm stk-assets-full.zip | ||
# Env setup! | ||
- name: Configure packaging name for git master branch | ||
if: ${{ github.ref == 'refs/heads/master' }} | ||
run: | | ||
echo "release_tag=git`date +%Y%m%d`" >> $GITHUB_ENV | ||
echo "release_name=preview" >> $GITHUB_ENV | ||
- name: Configure packaging name for tag | ||
if: ${{ startsWith(github.ref, 'refs/tags/') }} | ||
run: | | ||
echo "release_tag=`basename $GITHUB_REF`" >> $GITHUB_ENV | ||
echo "release_name=`basename $GITHUB_REF`" >> $GITHUB_ENV | ||
- name: Configure packaging name for non-releasing branch | ||
if: ${{ (github.ref != 'refs/heads/master' && !startsWith(github.ref, 'refs/tags/')) || github.repository_owner != 'supertuxkart' }} | ||
run: | | ||
echo "release_tag=" >> $GITHUB_ENV | ||
echo "release_name=" >> $GITHUB_ENV | ||
- name: Check for prerelease | ||
if: ${{ github.ref == 'refs/heads/master' || contains(github.ref, 'rc') || contains(github.ref, 'beta') }} | ||
run: | | ||
echo "release_pre=true" >> $GITHUB_ENV | ||
- name: Check for non-prerelease | ||
if: ${{ github.ref != 'refs/heads/master' && !contains(github.ref, 'rc') && !contains(github.ref, 'beta') }} | ||
run: | | ||
echo "release_pre=false" >> $GITHUB_ENV | ||
- name: Show packaging name | ||
run : | | ||
echo "${{ env.release_tag }}" | ||
echo "${{ env.release_name }}" | ||
echo "${{ env.release_pre }}" | ||
- name: Cache cmake_build | ||
id: cache-switch-cmake | ||
uses: actions/cache@v2 | ||
with: | ||
path: | | ||
stk-code/cmake_build | ||
stk-code/lib/openal/cmake_build | ||
stk-code/lib/harfbuzz/cmake_build | ||
# Make sure PRs can't overwrite! | ||
key: ${{ github.ref }}-switch-cmake-0 | ||
|
||
- name: Run build script | ||
run: | | ||
cp -v stk-code/switch/pkgbuild-scripts/* "$DEVKITPRO/" | ||
cd stk-code/switch | ||
PROJECT_VERSION="${{ env.release_tag }}" ./make.sh | ||
- name: Create release | ||
uses: ncipollo/release-action@v1 | ||
if: ${{ env.release_tag != '' }} | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
artifacts: "stk-code/cmake_build/bin/SuperTuxKart-${{ env.release_tag }}-switch.zip" | ||
tag: ${{ env.release_tag }} | ||
omitBodyDuringUpdate: true | ||
omitNameDuringUpdate: true | ||
allowUpdates: true | ||
prerelease: ${{ env.release_pre }} | ||
|
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
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
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,25 @@ | ||
cmake_minimum_required(VERSION 3.2) | ||
|
||
set(CMAKE_SYSTEM_NAME Generic) | ||
set(CMAKE_SYSTEM_VERSION 1) | ||
set(CMAKE_SYSTEM_PROCESSOR "aarch64") | ||
set(CMAKE_CROSSCOMPILING 1) | ||
|
||
set(DEVKITPRO /opt/devkitpro) | ||
|
||
set(TOOL_PREFIX ${DEVKITPRO}/devkitA64/bin/aarch64-none-elf-) | ||
|
||
set(CMAKE_ASM_COMPILER ${TOOL_PREFIX}gcc CACHE PATH "") | ||
set(CMAKE_C_COMPILER ${TOOL_PREFIX}gcc CACHE PATH "") | ||
set(CMAKE_CXX_COMPILER ${TOOL_PREFIX}g++ CACHE PATH "") | ||
set(CMAKE_LINKER ${TOOL_PREFIX}g++ CACHE PATH "") | ||
set(CMAKE_AR ${TOOL_PREFIX}ar CACHE PATH "") | ||
set(CMAKE_STRIP ${TOOL_PREFIX}strip CACHE PATH "") | ||
|
||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH) | ||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) | ||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) | ||
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) | ||
|
||
SET(BUILD_SHARED_LIBS OFF CACHE INTERNAL "Shared libs not available" ) | ||
|
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,7 @@ | ||
#!/usr/bin/env bash | ||
export DEVKITPRO=/opt/devkitpro | ||
export PORTLIBS_ROOT=${DEVKITPRO}/portlibs | ||
export PATH=${DEVKITPRO}/tools/bin:${DEVKITPRO}/devkitA64/bin:$PATH | ||
export TOOL_PREFIX=aarch64-none-elf- | ||
export AR=${TOOL_PREFIX}gcc-ar | ||
export RANLIB=${TOOL_PREFIX}gcc-ranlib |
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,11 @@ | ||
#!/usr/bin/env bash | ||
SCRIPTDIR="${BASH_SOURCE%/*}" | ||
|
||
if [ -z "$1" ]; then | ||
echo "No platform specified." 1>&2 | ||
exit 1 | ||
fi | ||
|
||
PLATFORM="$1" | ||
source ${SCRIPTDIR}/${PLATFORM}vars.sh | ||
echo "${PORTLIBS_PREFIX}" |
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,38 @@ | ||
include(/opt/devkitpro/devkita64.cmake) | ||
|
||
set (DKA_SWITCH_C_FLAGS "-D__SWITCH__ -march=armv8-a+crc+crypto -mtune=cortex-a57 -mtp=soft -ftls-model=local-exec -ffunction-sections -fdata-sections") | ||
set(CMAKE_C_FLAGS "${DKA_SWITCH_C_FLAGS}" CACHE STRING "") | ||
set(CMAKE_CXX_FLAGS "${DKA_SWITCH_C_FLAGS}" CACHE STRING "") | ||
set(CMAKE_ASM_FLAGS "${DKA_SWITCH_C_FLAGS}" CACHE STRING "") | ||
|
||
set(CMAKE_EXE_LINKER_FLAGS_INIT "-specs=${DEVKITPRO}/libnx/switch.specs") | ||
|
||
set(CMAKE_FIND_ROOT_PATH | ||
${DEVKITPRO}/devkitA64 | ||
${DEVKITPRO}/tools | ||
${DEVKITPRO}/portlibs/switch | ||
${DEVKITPRO}/libnx | ||
) | ||
|
||
# Set pkg-config for the same | ||
find_program(PKG_CONFIG_EXECUTABLE NAMES aarch64-none-elf-pkg-config HINTS "${DEVKITPRO}/portlibs/switch/bin") | ||
if (NOT PKG_CONFIG_EXECUTABLE) | ||
message(WARNING "Could not find aarch64-none-elf-pkg-config: try installing switch-pkg-config") | ||
endif() | ||
|
||
set(NSWITCH TRUE) | ||
|
||
set(CMAKE_POSITION_INDEPENDENT_CODE ON) | ||
|
||
set(NX_ROOT ${DEVKITPRO}/libnx) | ||
|
||
set(NX_STANDARD_LIBRARIES "${NX_ROOT}/lib/libnx.a") | ||
set(CMAKE_C_STANDARD_LIBRARIES "${NX_STANDARD_LIBRARIES}" CACHE STRING "") | ||
set(CMAKE_CXX_STANDARD_LIBRARIES "${NX_STANDARD_LIBRARIES}" CACHE STRING "") | ||
set(CMAKE_ASM_STANDARD_LIBRARIES "${NX_STANDARD_LIBRARIES}" CACHE STRING "") | ||
|
||
#for some reason cmake (3.14.3) doesn't appreciate having \" here | ||
set(NX_STANDARD_INCLUDE_DIRECTORIES "${NX_ROOT}/include") | ||
set(CMAKE_C_STANDARD_INCLUDE_DIRECTORIES "${NX_STANDARD_INCLUDE_DIRECTORIES}" CACHE STRING "") | ||
set(CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES "${NX_STANDARD_INCLUDE_DIRECTORIES}" CACHE STRING "") | ||
set(CMAKE_ASM_STANDARD_INCLUDE_DIRECTORIES "${NX_STANDARD_INCLUDE_DIRECTORIES}" CACHE STRING "") |
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,11 @@ | ||
. "${BASH_SOURCE%/*}"/devkita64.sh | ||
|
||
export PORTLIBS_PREFIX=${DEVKITPRO}/portlibs/switch | ||
export PATH=$PORTLIBS_PREFIX/bin:$PATH | ||
|
||
export ARCH="-march=armv8-a+crc+crypto -mtune=cortex-a57 -mtp=soft -fPIC -ftls-model=local-exec" | ||
export CFLAGS="${ARCH} -O2 -ffunction-sections -fdata-sections" | ||
export CXXFLAGS="${CFLAGS}" | ||
export CPPFLAGS="-D__SWITCH__ -I ${PORTLIBS_PREFIX}/include -isystem ${DEVKITPRO}/libnx/include" | ||
export LDFLAGS="${ARCH} -L${PORTLIBS_PREFIX}/lib -L${DEVKITPRO}/libnx/lib" | ||
export LIBS="-lnx" |