diff --git a/.github/workflows/appimage.yml b/.github/workflows/appimage.yml new file mode 100644 index 000000000..e29553cc8 --- /dev/null +++ b/.github/workflows/appimage.yml @@ -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*' diff --git a/.gitignore b/.gitignore index a722d6422..cae9b8a13 100644 --- a/.gitignore +++ b/.gitignore @@ -27,3 +27,7 @@ Debug/voxel_engine .project .git /Default/ +AppDir +appimage-build/ + +*~ diff --git a/AppImageBuilder.yml b/AppImageBuilder.yml new file mode 100644 index 000000000..6c4bc2834 --- /dev/null +++ b/AppImageBuilder.yml @@ -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 diff --git a/CMakeLists.txt b/CMakeLists.txt index d8b2f6320..0ca54e804 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,8 @@ 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) @@ -8,6 +10,25 @@ 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") @@ -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}) + diff --git a/VoxelEngine.desktop b/VoxelEngine.desktop new file mode 100644 index 000000000..e5cbb0ab6 --- /dev/null +++ b/VoxelEngine.desktop @@ -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; diff --git a/VoxelEngine.png b/VoxelEngine.png new file mode 100644 index 000000000..689245472 Binary files /dev/null and b/VoxelEngine.png differ