Skip to content

Commit

Permalink
AppImage builder plus GH actions
Browse files Browse the repository at this point in the history
Included also a .desktop file and an icon.
  • Loading branch information
DrDub committed Dec 22, 2023
1 parent ae74fb2 commit 737e979
Show file tree
Hide file tree
Showing 6 changed files with 146 additions and 0 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/appimage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: C/C++ AppImage

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
build-appimage:

runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v2
with:
submodules: 'true'
- name: install dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential libglfw3-dev libglfw3 libglew-dev libglm-dev libpng-dev libopenal-dev cmake squashfs-tools
- name: configure
run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DVOXELENGINE_BUILD_APPDIR=1
- name: build
run: cmake --build build -t install
- name: Build AppImage
uses: AppImageCrafters/build-appimage-action@fe2205a4d6056be47051f7b1b3811106e9814910
env:
UPDATE_INFO: gh-releases-zsync|MihailRis|VoxelEngine-Cpp|latest|*x86_64.AppImage.zsync
with:
recipe: AppImageBuilder.yml
- uses: actions/upload-artifact@v2
with:
name: AppImage
path: './*.AppImage*'
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,7 @@ Debug/voxel_engine
.project
.git
/Default/
AppDir
appimage-build/

*~
75 changes: 75 additions & 0 deletions AppImageBuilder.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
version: 1
AppDir:
path: AppDir
app_info:
id: VoxelEngine
name: VoxelEngine
icon: VoxelEngine
version: latest
exec: usr/bin/VoxelEngine
exec_args: --dir $HOME --res $APPDIR/usr/share/VoxelEngine/res $@
apt:
arch: amd64
sources:
- sourceline: deb http://archive.ubuntu.com/ubuntu/ focal main restricted universe multiverse
key_url: 'http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3b4fe6acc0b21f32'
key_url: 'http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x871920D1991BC93C'
- sourceline: deb http://archive.ubuntu.com/ubuntu/ focal-updates main restricted universe multiverse
- sourceline: deb http://archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse
- sourceline: deb http://archive.ubuntu.com/ubuntu/ focal-security main restricted universe multiverse
include:
- libbz2-1.0
- libexpat1
- libfam0
- libgcrypt20
- libglfw3
- libglew2.1
- libpng16-16
- libopenal1
- libopengl0
- libasound2
- libglx0
exclude:
- hicolor-icon-theme
- sound-theme-freedesktop
- perl
- perl-base
- kwayland-data
- libwacom2
- libasound2
- breeze
- breeze-icon-theme
- breeze-cursor-theme
- kwin-style-breeze
- kde-style-breeze
- plasma-integration
files:
exclude:
- usr/share/man
- usr/share/doc/*/README.*
- usr/share/doc/*/changelog.*
- usr/share/doc/*/NEWS.*
- usr/share/doc/*/TODO.*
test:
fedora:
image: appimagecrafters/tests-env:fedora-30
command: ./AppRun
use_host_x: true
debian:
image: appimagecrafters/tests-env:debian-stable
command: ./AppRun
use_host_x: true
arch:
image: appimagecrafters/tests-env:archlinux-latest
command: ./AppRun
use_host_x: true
centos:
image: appimagecrafters/tests-env:centos-7
command: ./AppRun
use_host_x: true
ubuntu:
image: appimagecrafters/tests-env:ubuntu-xenial
command: ./AppRun
use_host_x: true
AppImage:
arch: x86_64
22 changes: 22 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,34 @@
cmake_minimum_required(VERSION 3.15)
project(VoxelEngine)

option(VOXELENGINE_BUILD_APPDIR OFF)

set(CMAKE_CXX_STANDARD 17)

file(GLOB_RECURSE HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/src/*.hpp)
file(GLOB_RECURSE SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp)

add_executable(${PROJECT_NAME} ${HEADERS} ${SOURCES})

if(VOXELENGINE_BUILD_APPDIR)
file(MAKE_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/AppDir/usr/bin)
file(MAKE_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/AppDir/usr/lib)
file(MAKE_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/AppDir/usr/share/icons/hicolor/256x256)
file(MAKE_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/AppDir/usr/share/applications)
file(MAKE_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/AppDir/usr/share/VoxelEngine)
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/res DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/AppDir/usr/share/VoxelEngine)
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/VoxelEngine.png DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/AppDir/usr/share/icons/hicolor/256x256)
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/VoxelEngine.png DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/AppDir)
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/VoxelEngine.png DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/AppDir/.dirIcon)
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/VoxelEngine.desktop DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/AppDir/usr/share/applications)
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/VoxelEngine.desktop DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/AppDir/)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/AppDir/usr/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/AppDir/usr/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/AppDir/usr/bin)
install(TARGETS VoxelEngine DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/AppDir/usr/bin)
endif()


if(MSVC)
target_compile_options(${PROJECT_NAME} PRIVATE /W4 /O2)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /source-charset:UTF-8")
Expand Down Expand Up @@ -50,3 +71,4 @@ endif()
target_link_libraries(${PROJECT_NAME} ${LIBS} glfw OpenGL::GL ${OPENAL_LIBRARY} GLEW::GLEW ${PNGLIB})

file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/res DESTINATION ${CMAKE_CURRENT_BINARY_DIR})

10 changes: 10 additions & 0 deletions VoxelEngine.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[Desktop Entry]
Version=1.0
Type=Application
Name=VoxelEngine
Comment=Minecraft-like game engine in C++ with OpenGL
TryExec=VoxelEngine
Exec=VoxelEngine
Icon=VoxelEngine
MimeType=image/x-foo;
Categories=Game;
Binary file added VoxelEngine.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 737e979

Please sign in to comment.