From 96b061bd1cf2268d2721dd9611c61282788e35b0 Mon Sep 17 00:00:00 2001 From: orbea Date: Sat, 5 Dec 2020 17:49:21 -0800 Subject: [PATCH 1/2] cmake: Add an install target. --- CMakeLists.txt | 22 +++++++++++++++++++++- UI/NativeApp.cpp | 3 +++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0a5fceb50b..e8a459dfdf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -96,7 +96,9 @@ if(NOT (ARM64 AND MACOSX)) endif() include(ccache) +include(GNUInstallDirs) +add_definitions(-DASSETS_DIR="${CMAKE_INSTALL_FULL_DATADIR}/ppsspp/assets/") if(GOLD) add_definitions(-DGOLD) @@ -1015,7 +1017,6 @@ elseif(TARGET SDL2::SDL2) elseif(USING_EGL) set(nativeExtraLibs ${nativeExtraLibs} pthread) endif() - set(TargetBin PPSSPPSDL) elseif(NOT LIBRETRO) message(FATAL_ERROR "Could not find SDL2. Failing.") endif() @@ -2186,3 +2187,22 @@ if(IOS) XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "-" ) endif() + +install( + TARGETS ${TargetBin} + DESTINATION "${CMAKE_INSTALL_BINDIR}" +) +install( + DIRECTORY "${CMAKE_BINARY_DIR}/assets" + DESTINATION "${CMAKE_INSTALL_DATADIR}/ppsspp" + PATTERN ".git*" EXCLUDE +) +install( + DIRECTORY "${CMAKE_SOURCE_DIR}/icons/hicolor" + DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons" +) +install( + FILES "${CMAKE_SOURCE_DIR}/icons/icon-512.svg" + DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/pixmaps" + RENAME ppsspp.svg +) diff --git a/UI/NativeApp.cpp b/UI/NativeApp.cpp index d9ac927aef..d51adad672 100644 --- a/UI/NativeApp.cpp +++ b/UI/NativeApp.cpp @@ -466,6 +466,9 @@ void NativeInit(int argc, const char *argv[], const char *savegame_dir, const ch // Packed assets are included in app VFSRegister("", new DirectoryAssetReader(external_dir)); #endif +#if defined(ASSETS_DIR) + VFSRegister("", new DirectoryAssetReader(ASSETS_DIR)); +#endif #if !defined(MOBILE_DEVICE) && !defined(_WIN32) && !PPSSPP_PLATFORM(SWITCH) VFSRegister("", new DirectoryAssetReader((File::GetExeDirectory() + "assets/").c_str())); VFSRegister("", new DirectoryAssetReader((File::GetExeDirectory()).c_str())); From e8ec18bfbb0f4c7e3d6299408f3c112fd698b8cf Mon Sep 17 00:00:00 2001 From: orbea Date: Sat, 5 Dec 2020 17:53:27 -0800 Subject: [PATCH 2/2] cmake: Add a desktop file. --- CMakeLists.txt | 11 +++++++++++ ppsspp.desktop.in | 7 +++++++ 2 files changed, 18 insertions(+) create mode 100644 ppsspp.desktop.in diff --git a/CMakeLists.txt b/CMakeLists.txt index e8a459dfdf..5ef0e9d384 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2188,6 +2188,12 @@ if(IOS) ) endif() +configure_file( + "${CMAKE_SOURCE_DIR}/ppsspp.desktop.in" + "${CMAKE_BINARY_DIR}/ppsspp.desktop" + @ONLY +) + install( TARGETS ${TargetBin} DESTINATION "${CMAKE_INSTALL_BINDIR}" @@ -2197,6 +2203,11 @@ install( DESTINATION "${CMAKE_INSTALL_DATADIR}/ppsspp" PATTERN ".git*" EXCLUDE ) +install( + FILES "${CMAKE_BINARY_DIR}/ppsspp.desktop" + DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/applications" + RENAME ${TargetBin}.desktop +) install( DIRECTORY "${CMAKE_SOURCE_DIR}/icons/hicolor" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons" diff --git a/ppsspp.desktop.in b/ppsspp.desktop.in new file mode 100644 index 0000000000..49debf93c0 --- /dev/null +++ b/ppsspp.desktop.in @@ -0,0 +1,7 @@ +[Desktop Entry] +Name=@TargetBin@ +Exec=@TargetBin@ +Icon=ppsspp +Type=Application +Comment=ppsspp (fast and portable PSP emulator) +Categories=Game