From 9e129aaf8de1e52cfc5cffb157c65a02072bf817 Mon Sep 17 00:00:00 2001 From: PancakeTAS Date: Tue, 23 Dec 2025 22:12:18 +0100 Subject: [PATCH] refactor(cleanup): add installation logic to buildscript --- CMakeLists.txt | 15 +++-- lsfg-vk-backend/CMakeLists.txt | 8 +++ lsfg-vk-common/CMakeLists.txt | 8 +++ lsfg-vk-debug/layer_json.json | 14 ++++ lsfg-vk-layer/CMakeLists.txt | 12 ++++ ...> VkLayer_LSFGVK_frame_generation.json.in} | 4 +- lsfg-vk-ui/CMakeLists.txt | 11 +++- .../{icon.png => gay.pancake.lsfg-vk-ui.png} | Bin .../rsc/lsfg-vk-ui.desktop | 2 +- lsfg-vk-ui/src/main.cpp | 2 +- ui/build_appimage.sh | 60 ------------------ 11 files changed, 64 insertions(+), 72 deletions(-) create mode 100644 lsfg-vk-debug/layer_json.json rename lsfg-vk-layer/{VkLayer_LS_frame_generation.json => VkLayer_LSFGVK_frame_generation.json.in} (72%) rename lsfg-vk-ui/rsc/{icon.png => gay.pancake.lsfg-vk-ui.png} (100%) rename ui/rsc/gay.pancake.lsfg-vk-ui.desktop => lsfg-vk-ui/rsc/lsfg-vk-ui.desktop (92%) delete mode 100755 ui/build_appimage.sh diff --git a/CMakeLists.txt b/CMakeLists.txt index c4962cb..4b11401 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,13 +1,14 @@ cmake_minimum_required(VERSION 3.10) project(lsfg-vk LANGUAGES CXX) +include(GNUInstallDirs) -# === user facing options -option(LSFGVK_BUILD_VULKAN_LAYER - "Build the Vulkan layer" ON) -option(LSFGVK_BUILD_USER_INTERFACE - "Build the user interface" ON) -option(LSFGVK_BUILD_DEBUG_TOOL - "Build the debug tool for testing and debugging" OFF) +# === READ HERE FOR BUILD OPTIONS === +option(LSFGVK_BUILD_VULKAN_LAYER "Build the Vulkan layer" ON) +option(LSFGVK_BUILD_USER_INTERFACE "Build the user interface" ON) +option(LSFGVK_BUILD_DEBUG_TOOL "Build the debug tool" OFF) +option(LSFGVK_INSTALL_DEVELOP "Install development files" OFF) +option(LSFGVK_INSTALL_XDG_FILES "Install xdg app files" ON) +# === READ HERE FOR BUILD OPTIONS === set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) diff --git a/lsfg-vk-backend/CMakeLists.txt b/lsfg-vk-backend/CMakeLists.txt index d167430..e14fc72 100644 --- a/lsfg-vk-backend/CMakeLists.txt +++ b/lsfg-vk-backend/CMakeLists.txt @@ -26,3 +26,11 @@ target_link_libraries(lsfg-vk-backend set_target_properties(lsfg-vk-backend PROPERTIES CXX_VISIBILITY_PRESET hidden) + +if(LSFGVK_INSTALL_DEVELOP) + install(TARGETS lsfg-vk-backend + ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}") + install(DIRECTORY "include/lsfg-vk-backend/" + DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/lsfg-vk-backend" + FILES_MATCHING PATTERN "*.hpp") +endif() diff --git a/lsfg-vk-common/CMakeLists.txt b/lsfg-vk-common/CMakeLists.txt index 6a05960..f422863 100644 --- a/lsfg-vk-common/CMakeLists.txt +++ b/lsfg-vk-common/CMakeLists.txt @@ -21,3 +21,11 @@ target_include_directories(lsfg-vk-common target_include_directories(lsfg-vk-common SYSTEM PRIVATE thirdparty/include) + +if(LSFGVK_INSTALL_DEVELOP) + install(TARGETS lsfg-vk-common + ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}") + install(DIRECTORY "include/lsfg-vk-common/" + DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/lsfg-vk-common" + FILES_MATCHING PATTERN "*.hpp") +endif() diff --git a/lsfg-vk-debug/layer_json.json b/lsfg-vk-debug/layer_json.json new file mode 100644 index 0000000..f3c1cdc --- /dev/null +++ b/lsfg-vk-debug/layer_json.json @@ -0,0 +1,14 @@ +{ + "file_format_version": "1.1.0", + "layer": { + "name": "VK_LAYER_LSFGVK_frame_generation", + "description": "Lossless Scaling frame generation layer (debug)", + "implementation_version": "2", + "library_path": "liblsfg-vk-layer.so", + "type": "GLOBAL", + "api_version": "1.4.328", + "disable_environment": { + "DISABLE_LSFGVK": "1" + } + } +} diff --git a/lsfg-vk-layer/CMakeLists.txt b/lsfg-vk-layer/CMakeLists.txt index b19efb4..6a8522c 100644 --- a/lsfg-vk-layer/CMakeLists.txt +++ b/lsfg-vk-layer/CMakeLists.txt @@ -11,3 +11,15 @@ target_link_libraries(lsfg-vk-layer set_target_properties(lsfg-vk-layer PROPERTIES CXX_VISIBILITY_PRESET hidden) + +set(LSFGVK_LAYER_LIBRARY_PATH + "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/liblsfg-vk-layer.so") +configure_file( + "VkLayer_LSFGVK_frame_generation.json.in" + "VkLayer_LSFGVK_frame_generation.json" + @ONLY) + +install(TARGETS lsfg-vk-layer + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}") +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/VkLayer_LSFGVK_frame_generation.json" + DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/vulkan/implicit_layer.d") diff --git a/lsfg-vk-layer/VkLayer_LS_frame_generation.json b/lsfg-vk-layer/VkLayer_LSFGVK_frame_generation.json.in similarity index 72% rename from lsfg-vk-layer/VkLayer_LS_frame_generation.json rename to lsfg-vk-layer/VkLayer_LSFGVK_frame_generation.json.in index 2c1e5e4..7c0f91a 100644 --- a/lsfg-vk-layer/VkLayer_LS_frame_generation.json +++ b/lsfg-vk-layer/VkLayer_LSFGVK_frame_generation.json.in @@ -1,10 +1,10 @@ { "file_format_version": "1.1.0", "layer": { - "name": "VK_LAYER_LS_frame_generation", + "name": "VK_LAYER_LSFGVK_frame_generation", "description": "Lossless Scaling frame generation layer", "implementation_version": "2", - "library_path": "liblsfg-vk-layer.so", + "library_path": "@LSFGVK_LAYER_LIBRARY_PATH@", "type": "GLOBAL", "api_version": "1.4.328", "disable_environment": { diff --git a/lsfg-vk-ui/CMakeLists.txt b/lsfg-vk-ui/CMakeLists.txt index be086e1..412186f 100644 --- a/lsfg-vk-ui/CMakeLists.txt +++ b/lsfg-vk-ui/CMakeLists.txt @@ -14,7 +14,7 @@ set(UI_RESOURCES "rsc/widgets/FileEdit.qml" "rsc/widgets/FlowSlider.qml" "rsc/widgets/List.qml" - "rsc/icon.png" + "rsc/gay.pancake.lsfg-vk-ui.png" "rsc/UI.qml") qt_add_executable(lsfg-vk-ui ${UI_SOURCES}) @@ -37,3 +37,12 @@ target_link_libraries(lsfg-vk-ui PRIVATE lsfg-vk-common PRIVATE lsfg-vk-backend PRIVATE Qt6::Quick) + +install(TARGETS lsfg-vk-ui + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") +if(LSFGVK_INSTALL_XDG_FILES) + install(FILES "rsc/gay.pancake.lsfg-vk-ui.png" + DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/256x256/apps") + install(FILES "rsc/lsfg-vk-ui.desktop" + DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/applications") +endif() diff --git a/lsfg-vk-ui/rsc/icon.png b/lsfg-vk-ui/rsc/gay.pancake.lsfg-vk-ui.png similarity index 100% rename from lsfg-vk-ui/rsc/icon.png rename to lsfg-vk-ui/rsc/gay.pancake.lsfg-vk-ui.png diff --git a/ui/rsc/gay.pancake.lsfg-vk-ui.desktop b/lsfg-vk-ui/rsc/lsfg-vk-ui.desktop similarity index 92% rename from ui/rsc/gay.pancake.lsfg-vk-ui.desktop rename to lsfg-vk-ui/rsc/lsfg-vk-ui.desktop index 5b7ada2..e0375d0 100644 --- a/ui/rsc/gay.pancake.lsfg-vk-ui.desktop +++ b/lsfg-vk-ui/rsc/lsfg-vk-ui.desktop @@ -6,7 +6,7 @@ Comment=Easy to use configuration editor for lsfg-vk. Exec=lsfg-vk-ui %U Icon=gay.pancake.lsfg-vk-ui Terminal=false -Categories=GTK;Settings; +Categories=Settings; Keywords=gaming;graphics;configuration; StartupNotify=true StartupWMClass=gay.pancake.lsfg-vk-ui diff --git a/lsfg-vk-ui/src/main.cpp b/lsfg-vk-ui/src/main.cpp index 0a936b8..d1178bb 100644 --- a/lsfg-vk-ui/src/main.cpp +++ b/lsfg-vk-ui/src/main.cpp @@ -10,7 +10,7 @@ using namespace lsfgvk::ui; int main(int argc, char* argv[]) { const QGuiApplication app(argc, argv); - QGuiApplication::setWindowIcon(QIcon(":/rsc/icon.png")); + QGuiApplication::setWindowIcon(QIcon(":/rsc/gay.pancake.lsfg-vk-ui.png")); QGuiApplication::setApplicationName("lsfg-vk-ui"); QGuiApplication::setApplicationDisplayName("lsfg-vk-ui"); diff --git a/ui/build_appimage.sh b/ui/build_appimage.sh deleted file mode 100755 index 703716c..0000000 --- a/ui/build_appimage.sh +++ /dev/null @@ -1,60 +0,0 @@ -#!/bin/sh -set -eux - -# AppImage build script provided by @Samueru-sama -# (with removed aarch64 supported and removed update functionality, temporarily) - -URUNTIME="https://github.com/VHSgunzo/uruntime/releases/latest/download/uruntime-appimage-dwarfs-x86_64" -URUNTIME_LITE="https://github.com/VHSgunzo/uruntime/releases/latest/download/uruntime-appimage-dwarfs-lite-x86_64" -SHARUN="https://github.com/VHSgunzo/sharun/releases/latest/download/sharun-x86_64-aio" - -VERSION=$(awk -F'=|"' '/^version/{print $3}' ./Cargo.toml) -echo "$VERSION-dev" > ~/version - -# grab required resources -wget -O sharun-aio "$SHARUN" -chmod +x sharun-aio - -wget -O uruntime "$URUNTIME" -wget -O uruntime-lite "$URUNTIME_LITE" -chmod +x uruntime uruntime-lite - -# build lsfg-vk-ui -echo "Building lsfg-vk-ui..." -cargo build --release - -# deploy app directory -echo "Deploying app directory..." -mkdir -p AppDir -cp -v rsc/*.desktop AppDir -cp -v rsc/icon.png AppDir/lsfg-vk-ui.png -cp -v rsc/icon.png AppDir/.DirIcon -mkdir -p AppDir/shared/bin -mv -v target/release/lsfg-vk-ui AppDir/shared/bin - -cd AppDir - xvfb-run -a ../sharun-aio l -p -v -e -s -k \ - shared/bin/lsfg-vk-ui \ - /usr/lib/*/libdecor* \ - /usr/lib/*/gdk-pixbuf-*/*/loaders/* \ - /usr/lib/*/gio/modules/libdconfsettings.so - ln -fv ./sharun ./AppRun - ./sharun -g -cd .. - -# create appimage -echo "Generating app image..." -./uruntime --appimage-mkdwarfs -f \ - --set-owner 0 --set-group 0 \ - --no-history --no-create-timestamp \ - --compression zstd:level=22 -S26 -B8 \ - --header uruntime-lite \ - -i ./AppDir -o "./lsfg-vk-ui.AppImage" - -# cleanup -echo "Cleaning up..." -rm -rf AppDir -rm -f sharun-aio uruntime uruntime-lite - -# done -echo "Done"