Added a CMake option for building as an AppImage and enabled it in the AppImage build scripts.

This commit is contained in:
Leon Styhre 2022-08-20 11:28:20 +02:00
parent 13fcfdbb03
commit fb61849d4f
3 changed files with 18 additions and 3 deletions

View file

@ -34,6 +34,7 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/CMake/Utils
# Define the options.
option(GL "Set to ON if targeting Desktop OpenGL 3.3" ${GL})
option(GLES "Set to ON if targeting OpenGL ES 3.0" ${GLES})
option(APPIMAGE_BUILD "Set to ON when building as an AppImage" ${APPIMAGE_BUILD})
option(FLATPAK_BUILD "Set to ON when building as a Flatpak" ${FLATPAK_BUILD})
option(STEAM_DECK "Set to ON to enable Valve Steam Deck specific build" ${STEAM_DECK})
option(RPI "Set to ON to enable Raspberry Pi specific build" ${RPI})
@ -284,8 +285,22 @@ if(GLES)
add_compile_definitions(USE_OPENGLES)
endif()
# When building as a Flatpak, all launch commands will be prefixed by "flatpak-spawn --host".
if (APPIMAGE_BUILD AND FLATPAK_BUILD)
message(FATAL_ERROR "-- APPIMAGE_BUILD and FLATPAK_BUILD can't be combined")
endif()
if(APPIMAGE_BUILD)
if(NOT CMAKE_SYSTEM_NAME MATCHES Linux)
message(FATAL_ERROR "-- APPIMAGE_BUILD can only be used when building on Linux")
endif()
add_compile_definitions(APPIMAGE_BUILD)
message("-- Building as an AppImage")
endif()
if(FLATPAK_BUILD)
if(NOT CMAKE_SYSTEM_NAME MATCHES Linux)
message(FATAL_ERROR "-- FLATPAK_BUILD can only be used when building on Linux")
endif()
add_compile_definitions(FLATPAK_BUILD)
message("-- Building as a Flatpak")
endif()

View file

@ -38,7 +38,7 @@ rm -rf ./AppDir
mkdir AppDir
rm -f CMakeCache.txt
cmake -DBUNDLED_CERTS=on .
cmake -DAPPIMAGE_BUILD=on -DBUNDLED_CERTS=on .
make clean
make -j8
make install DESTDIR=AppDir

View file

@ -34,7 +34,7 @@ rm -rf ./AppDir
mkdir AppDir
rm -f CMakeCache.txt
cmake -DSTEAM_DECK=on .
cmake -DAPPIMAGE_BUILD=on -DSTEAM_DECK=on .
make clean
make -j8
make install DESTDIR=AppDir