Skip to content

Commit

Permalink
Add CMake file installation code for Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
rollerozxa committed Sep 3, 2023
1 parent 6874504 commit e03d1e0
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 0 deletions.
20 changes: 20 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -157,3 +157,23 @@ set(CMAKE_CXX_FLAGS_DEBUG "${COMMON_FLAGS_DEBUG} -O0")
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "-Wl,-O,-s,--gc-sections")
set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "-Wl,-O,--gc-sections")
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "-rdynamic")

# Installation

if(UNIX)
include(GNUInstallDirs)
set(SHAREDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}")
set(BINDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}")
set(APPS_DIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATADIR}/applications")
set(ICONDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATADIR}/icons")

install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/data-pc" DESTINATION "${SHAREDIR}")
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/data-shared" DESTINATION "${SHAREDIR}")

install(FILES "packaging/principia.desktop" DESTINATION "${APPS_DIR}")
install(FILES "packaging/principia-url-handler.desktop" DESTINATION "${APPS_DIR}")

install(FILES "packaging/principia.png" DESTINATION "${ICONDIR}/hicolor/128x128/apps")

install(TARGETS ${PROJECT_NAME} DESTINATION ${BINDIR})
endif()
7 changes: 7 additions & 0 deletions packaging/principia-url-handler.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[Desktop Entry]
Name=Principia (principia:// Protocol)
Exec=principia %u
Type=Application
Terminal=false
NoDisplay=true
MimeType=x-scheme-handler/principia;
9 changes: 9 additions & 0 deletions packaging/principia.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[Desktop Entry]
Name=Principia
GenericName=Physics-based sandbox building game
Exec=principia
Type=Application
StartupNotify=true
Icon=principia
StartupWMClass=principia
Categories=Game;
Binary file added packaging/principia.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit e03d1e0

Please sign in to comment.