Merge pull request #13742 from orbea/install

cmake: Add an install target.
This commit is contained in:
Henrik Rydgård 2020-12-06 11:22:10 +01:00 committed by GitHub
commit f8c53db503
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 42 additions and 1 deletions

View File

@ -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,33 @@ if(IOS)
XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "-"
)
endif()
configure_file(
"${CMAKE_SOURCE_DIR}/ppsspp.desktop.in"
"${CMAKE_BINARY_DIR}/ppsspp.desktop"
@ONLY
)
install(
TARGETS ${TargetBin}
DESTINATION "${CMAKE_INSTALL_BINDIR}"
)
install(
DIRECTORY "${CMAKE_BINARY_DIR}/assets"
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"
)
install(
FILES "${CMAKE_SOURCE_DIR}/icons/icon-512.svg"
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/pixmaps"
RENAME ppsspp.svg
)

View File

@ -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()));

7
ppsspp.desktop.in Normal file
View File

@ -0,0 +1,7 @@
[Desktop Entry]
Name=@TargetBin@
Exec=@TargetBin@
Icon=ppsspp
Type=Application
Comment=ppsspp (fast and portable PSP emulator)
Categories=Game