-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create AppImage instead of .tar.gz for Linux release.
This fixes compatibility issues between different Linux distros.
- Loading branch information
1 parent
26f6fbe
commit c170bb2
Showing
5 changed files
with
240 additions
and
45 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 |
---|---|---|
|
@@ -3,56 +3,64 @@ name: Raycaster CI | |
on: [push, pull_request] | ||
|
||
jobs: | ||
executable-build: | ||
runs-on: ${{ matrix.config.os }} | ||
strategy: | ||
matrix: | ||
config: | ||
- { name: "Ubuntu Latest GCC", os: ubuntu-latest, cxx: g++, cc: gcc } | ||
- { | ||
name: "Windows Latest MSVC", | ||
os: windows-latest, | ||
cxx: cl.exe, | ||
cc: cl.exe, | ||
} | ||
|
||
windows-build: | ||
runs-on: windows-2022 | ||
steps: | ||
- uses: ilammy/msvc-dev-cmd@v1 | ||
|
||
- name: Set compiler environment | ||
uses: lukka/set-shell-env@v1 | ||
with: | ||
CXX: ${{ matrix.config.cxx }} | ||
CC: ${{ matrix.config.cc }} | ||
|
||
- name: Set compiler environment for Windows | ||
if: matrix.config.os == 'windows-latest' | ||
uses: lukka/set-shell-env@v1 | ||
with: | ||
CXX: cl.exe | ||
CC: cl.exe | ||
VS160COMNTOOLS: C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools | ||
|
||
- name: Checkout | ||
uses: actions/[email protected] | ||
|
||
uses: actions/checkout@v3 | ||
- uses: lukka/get-cmake@latest | ||
|
||
- name: Build project | ||
uses: lukka/run-cmake@v3 | ||
with: | ||
cmakeAppendedArgs: "-DCMAKE_BUILD_TYPE=Release" | ||
buildDirectory: "${{ github.workspace }}/build/" | ||
|
||
- name: Generate package | ||
- name: Generate ZIP package | ||
working-directory: build | ||
run: | | ||
cd build | ||
cpack -C "Release" | ||
- name: Publish release | ||
if: startsWith(github.ref, 'refs/tags/') | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
files: | | ||
build/Raycaster-*.tar.gz | ||
build/Raycaster-*.zip | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
linux-build: | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
# https://github.com/AppImage/AppImageKit/wiki/FUSE | ||
- name: Install FUSE | ||
run: | | ||
sudo add-apt-repository universe | ||
sudo apt-get update | ||
sudo apt-get install libfuse2 | ||
- uses: lukka/get-cmake@latest | ||
- name: Build project | ||
run: | | ||
cmake -DCMAKE_BUILD_TYPE=Release | ||
make -j`nproc` | ||
- name: Generate AppImage package | ||
run: | | ||
make install DESTDIR=. | ||
- name: Publish release | ||
if: startsWith(github.ref, 'refs/tags/') | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
files: | | ||
Raycaster-*.AppImage | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
# TODO: Emscripten build | ||
|
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,91 @@ | ||
# MIT License | ||
# | ||
# Copyright (c) 2021 Ravbug | ||
# | ||
# 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. | ||
function(make_appimage) | ||
set(optional) | ||
set(args EXE NAME DIR_ICON ICON OUTPUT_NAME) | ||
set(list_args ASSETS) | ||
cmake_parse_arguments( | ||
PARSE_ARGV 0 | ||
ARGS | ||
"${optional}" | ||
"${args}" | ||
"${list_args}" | ||
) | ||
|
||
if(${ARGS_UNPARSED_ARGUMENTS}) | ||
message(WARNING "Unparsed arguments: ${ARGS_UNPARSED_ARGUMENTS}") | ||
endif() | ||
|
||
|
||
# download AppImageTool if needed (TODO: non-x86 build machine?) | ||
SET(AIT_PATH "${CMAKE_BINARY_DIR}/AppImageTool.AppImage" CACHE INTERNAL "") | ||
if (NOT EXISTS "${AIT_PATH}") | ||
file(DOWNLOAD https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage "${AIT_PATH}") | ||
execute_process(COMMAND chmod +x ${AIT_PATH}) | ||
endif() | ||
|
||
# make the AppDir | ||
set(APPDIR "${CMAKE_BINARY_DIR}/AppDir") | ||
file(REMOVE_RECURSE "${APPDIR}") # remove if leftover | ||
file(MAKE_DIRECTORY "${APPDIR}") | ||
|
||
# copy executable to appdir | ||
file(COPY "${ARGS_EXE}" DESTINATION "${APPDIR}" FOLLOW_SYMLINK_CHAIN) | ||
get_filename_component(EXE_NAME "${ARGS_EXE}" NAME) | ||
|
||
# create the script that will launch the AppImage | ||
file(WRITE "${APPDIR}/AppRun" | ||
"#!/bin/sh | ||
cd \"$(dirname \"$0\")\"; | ||
./${EXE_NAME} $@" | ||
) | ||
execute_process(COMMAND chmod +x "${APPDIR}/AppRun") | ||
|
||
# copy assets to appdir | ||
file(COPY ${ARGS_ASSETS} DESTINATION "${APPDIR}") | ||
|
||
# copy icon thumbnail | ||
file(COPY ${ARGS_DIR_ICON} DESTINATION "${APPDIR}") | ||
get_filename_component(THUMB_NAME "${ARGS_DIR_ICON}" NAME) | ||
file(RENAME "${APPDIR}/${THUMB_NAME}" "${APPDIR}/.DirIcon") | ||
|
||
# copy icon highres | ||
file(COPY ${ARGS_ICON} DESTINATION "${APPDIR}") | ||
get_filename_component(ICON_NAME "${ARGS_ICON}" NAME) | ||
get_filename_component(ICON_EXT "${ARGS_ICON}" EXT) | ||
file(RENAME "${APPDIR}/${ICON_NAME}" "${APPDIR}/${ARGS_NAME}${ICON_EXT}") | ||
|
||
# Create the .desktop file | ||
file(WRITE "${APPDIR}/${ARGS_NAME}.desktop" | ||
"[Desktop Entry] | ||
Type=Application | ||
Name=${ARGS_NAME} | ||
Icon=${ARGS_NAME} | ||
Categories=X-None;" | ||
) | ||
|
||
# Invoke AppImageTool | ||
execute_process(COMMAND ${AIT_PATH} ${APPDIR} ${ARGS_OUTPUT_NAME}) | ||
file(REMOVE_RECURSE "${APPDIR}") | ||
|
||
endfunction() | ||
|
Oops, something went wrong.