diff --git a/CMakeLists.txt b/CMakeLists.txt index d770a00af..d7e8767e4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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() diff --git a/tools/create_AppImage.sh b/tools/create_AppImage.sh index 709518b43..12110fbab 100755 --- a/tools/create_AppImage.sh +++ b/tools/create_AppImage.sh @@ -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 diff --git a/tools/create_AppImage_SteamDeck.sh b/tools/create_AppImage_SteamDeck.sh index 3d468a910..b8838352a 100755 --- a/tools/create_AppImage_SteamDeck.sh +++ b/tools/create_AppImage_SteamDeck.sh @@ -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