Skip to content

Commit

Permalink
Don't install crashpad binary if not built, make install/asset dirs c…
Browse files Browse the repository at this point in the history
…onfigurable by cmake vars
  • Loading branch information
phantamanta44 committed Sep 29, 2023
1 parent 9e45a80 commit 7cdc8a2
Showing 1 changed file with 31 additions and 24 deletions.
55 changes: 31 additions & 24 deletions CMake/Helpers/CPackSetup.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,23 @@ set(CPACK_RESOURCE_FILE_LICENSE ${PROJECT_SOURCE_DIR}/CMake/CPack/license_instal
set(CPACK_COMPONENT_ETTERNA_REQUIRED TRUE) # Require Etterna component to be installed

# Custom Variables
set(INSTALL_DIR "Etterna")
set(INSTALL_DIR "Etterna" CACHE STRING "Output directory for built game")
set(ASSET_DIR "${INSTALL_DIR}" CACHE STRING "Output directory for game assets")

if(UNIX)
set(CPACK_GENERATOR TGZ)
set(CPACK_DEBIAN_PACKAGE_DEPENDS "")
set(CPACK_PACKAGE_CONTACT https://github.com/etternagame/etterna)

install(TARGETS Etterna COMPONENT Etterna DESTINATION ${INSTALL_DIR})
install(FILES ${PROJECT_BINARY_DIR}/gn_crashpad/crashpad_handler
COMPONENT Etterna
DESTINATION ${INSTALL_DIR}
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE)
if(WITH_CRASHPAD AND TARGET crashpad)
install(FILES ${PROJECT_BINARY_DIR}/gn_crashpad/crashpad_handler
COMPONENT Etterna
DESTINATION ${INSTALL_DIR}
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE)
endif()
endif()

# Windows Specific CPack
Expand Down Expand Up @@ -47,8 +50,10 @@ if(WIN32)

# List every DLL etterna needs.
list(APPEND WIN_DLLS "${PROJECT_SOURCE_DIR}/Program/avcodec-55.dll" "${PROJECT_SOURCE_DIR}/Program/avformat-55.dll"
"${PROJECT_SOURCE_DIR}/Program/avutil-52.dll" "${PROJECT_SOURCE_DIR}/Program/swscale-2.dll"
${PROJECT_BINARY_DIR}/gn_crashpad/crashpad_handler.exe)
"${PROJECT_SOURCE_DIR}/Program/avutil-52.dll" "${PROJECT_SOURCE_DIR}/Program/swscale-2.dll")
if(WITH_CRASHPAD AND TARGET crashpad)
list(APPEND WIN_DLLS ${PROJECT_BINARY_DIR}/gn_crashpad/crashpad_handler.exe)
endif()
install(FILES ${WIN_DLLS} COMPONENT Etterna DESTINATION Program)
install(TARGETS Etterna COMPONENT Etterna DESTINATION Program)
install(FILES CMake/CPack/license_install.txt COMPONENT Etterna DESTINATION Docs)
Expand All @@ -60,24 +65,26 @@ elseif(APPLE)
set(CPACK_DMG_VOLUME_NAME Etterna)

install(TARGETS Etterna COMPONENT Etterna DESTINATION Etterna)
install(FILES ${PROJECT_BINARY_DIR}/gn_crashpad/crashpad_handler
COMPONENT Etterna DESTINATION ${INSTALL_DIR}
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE)
if(WITH_CRASHPAD AND TARGET crashpad)
install(FILES ${PROJECT_BINARY_DIR}/gn_crashpad/crashpad_handler
COMPONENT Etterna DESTINATION ${INSTALL_DIR}
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE)
endif()
endif()

# Universal Install Directories
## Files Only
install(FILES Songs/instructions.txt COMPONENT Etterna DESTINATION "${INSTALL_DIR}/Songs")
install(FILES Announcers/instructions.txt COMPONENT Etterna DESTINATION "${INSTALL_DIR}/Announcers")
install(FILES Songs/instructions.txt COMPONENT Etterna DESTINATION "${ASSET_DIR}/Songs")
install(FILES Announcers/instructions.txt COMPONENT Etterna DESTINATION "${ASSET_DIR}/Announcers")

## Essential Game Files
install(DIRECTORY Assets COMPONENT Etterna DESTINATION "${INSTALL_DIR}")
install(DIRECTORY BackgroundEffects COMPONENT Etterna DESTINATION "${INSTALL_DIR}")
install(DIRECTORY BackgroundTransitions COMPONENT Etterna DESTINATION "${INSTALL_DIR}")
install(DIRECTORY BGAnimations COMPONENT Etterna DESTINATION "${INSTALL_DIR}")
install(DIRECTORY Data COMPONENT Etterna DESTINATION "${INSTALL_DIR}")
install(DIRECTORY NoteSkins COMPONENT Etterna DESTINATION "${INSTALL_DIR}")
install(DIRECTORY Scripts COMPONENT Etterna DESTINATION "${INSTALL_DIR}")
install(DIRECTORY Themes COMPONENT Etterna DESTINATION "${INSTALL_DIR}")
install(DIRECTORY Assets COMPONENT Etterna DESTINATION "${ASSET_DIR}")
install(DIRECTORY BackgroundEffects COMPONENT Etterna DESTINATION "${ASSET_DIR}")
install(DIRECTORY BackgroundTransitions COMPONENT Etterna DESTINATION "${ASSET_DIR}")
install(DIRECTORY BGAnimations COMPONENT Etterna DESTINATION "${ASSET_DIR}")
install(DIRECTORY Data COMPONENT Etterna DESTINATION "${ASSET_DIR}")
install(DIRECTORY NoteSkins COMPONENT Etterna DESTINATION "${ASSET_DIR}")
install(DIRECTORY Scripts COMPONENT Etterna DESTINATION "${ASSET_DIR}")
install(DIRECTORY Themes COMPONENT Etterna DESTINATION "${ASSET_DIR}")

0 comments on commit 7cdc8a2

Please sign in to comment.