Skip to content

Commit

Permalink
WIP: Packaging improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
kblaschke committed Apr 22, 2024
1 parent bcf1ad0 commit 36de627
Show file tree
Hide file tree
Showing 9 changed files with 75 additions and 7 deletions.
12 changes: 11 additions & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,17 @@ jobs:
mkdir cmake-build-frontend-sdl2
cmake -G Ninja -S frontend-sdl2 -B cmake-build-frontend-sdl2 -DCMAKE_BUILD_TYPE=Release "-DCMAKE_PREFIX_PATH=${GITHUB_WORKSPACE}/install-libprojectm;${GITHUB_WORKSPACE}/install-poco" "-DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/install-frontend-sdl2"
cmake --build cmake-build-frontend-sdl2 --parallel
# cmake --install "${{ github.workspace }}/cmake-build-frontend-sdl2"
- name: Package projectMSDL
run: |
cd cmake-build-frontend-sdl2
cpack -G DEB
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: projectMSDL-buildcheck
path: cmake-build-frontend-sdl2/*.deb

build-windows:
name: Windows, x64
Expand Down
23 changes: 21 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ project(projectMSDL
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")

# Default install layouts.
option(ENABLE_FLAT_PACKAGE "Creates a \"flat\" install layout with files and preset/texture dirs directly in the main dir." OFF)
option(ENABLE_FLAT_PACKAGE "Creates a \"flat\" install layout with the executable, configuration file(s) and preset/texture dirs directly in the install prefix." OFF)
if(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND NOT ENABLE_FLAT_PACKAGE)
include(GNUInstallDirs)

Expand All @@ -34,6 +34,8 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND NOT ENABLE_FLAT_PACKAGE)
set(DEFAULT_PRESETS_PATH "${_config_dir_abs_init}/presets" CACHE STRING "Default presets path in the configuration file.")
set(DEFAULT_TEXTURES_PATH "${_config_dir_abs_init}/textures" CACHE STRING "Default textures path in the configuration file.")
elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND NOT ENABLE_FLAT_PACKAGE)
set(DEFAULT_PACKAGING_CONFIG "packaging-macos.cmake")

# Package as .app bundle on macOS
set(BUNDLE_BASE_DIR "projectM.app/Contents")
set(PROJECTMSDL_BIN_DIR "${BUNDLE_BASE_DIR}/MacOS" CACHE STRING "Directory to install executables in, relative to the install prefix.")
Expand All @@ -46,6 +48,8 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND NOT ENABLE_FLAT_PACKAGE)
set(DEFAULT_PRESETS_PATH "\${application.dir}/../Resources/Presets" CACHE STRING "Default presets path in the configuration file.")
set(DEFAULT_TEXTURES_PATH "\${application.dir}/../Resources/Presets" CACHE STRING "Default textures path in the configuration file.")
else()
set(DEFAULT_PACKAGING_CONFIG "packaging-windows.cmake")

# Windows and others: use flat layout.
set(PROJECTMSDL_BIN_DIR "." CACHE STRING "Directory to install executables in, relative to the install prefix.")
set(PROJECTMSDL_LIB_DIR "." CACHE STRING "Directory to install additional libraries in, relative to the install prefix.")
Expand All @@ -58,6 +62,18 @@ else()
set(DEFAULT_TEXTURES_PATH "\${application.dir}/textures" CACHE STRING "Default textures path in the configuration file.")
endif()

if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
set(DEFAULT_PACKAGING_CONFIG "packaging-linux.cmake")
elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
set(DEFAULT_PACKAGING_CONFIG "packaging-macos.cmake")
elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows")
set(DEFAULT_PACKAGING_CONFIG "packaging-windows.cmake")
else()
unset(DEFAULT_PACKAGING_CONFIG)
endif()

set(PACKAGING_CONFIG_FILE "${DEFAULT_PACKAGING_CONFIG}" CACHE FILEPATH "CPack configuration file to use for packaging. This file must \"include(CPack)\" at the end to work properly.")

set(SDL2_LINKAGE "shared" CACHE STRING "Set to either shared or static to specify how libSDL2 should be linked. Defaults to shared.")
option(ENABLE_FREETYPE "Use the Freetype font rendering library instead of the built-in stb_truetype if available" ON)

Expand Down Expand Up @@ -90,7 +106,10 @@ if(ENABLE_TESTING)
endif()

include(install.cmake)
include(packaging.cmake)

if(NOT PACKAGING_CONFIG_FILE STREQUAL "")
include(${PACKAGING_CONFIG_FILE})
endif()

message(STATUS "SDL version: ${SDL2_VERSION}")
message(STATUS "Poco version: ${Poco_VERSION}")
Expand Down
13 changes: 9 additions & 4 deletions install.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,18 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND NOT ENABLE_FLAT_PACKAGE)
install_icon(${size})
endforeach()

install(FILES src/resources/icons/icon_scalable.svg
DESTINATION ${PROJECTMSDL_ICONS_DIR}/scalable/apps
RENAME projectMSDL.svg
COMPONENT projectMSDL
)

endif()
elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND NOT ENABLE_FLAT_PACKAGE)
set(ICNS_FILE ${CMAKE_BINARY_DIR}/projectMSDL.icns)
execute_process(COMMAND iconutil -c icns -o "${ICNS_FILE}" "${CMAKE_SOURCE_DIR}/src/resources/icons")

install(FILES ${ICNS_FILE}
elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND NOT ENABLE_FLAT_PACKAGE)
install(FILES src/resources/icons/icon.icns
DESTINATION ${PROJECTMSDL_DATA_DIR}
RENAME projectMSDL.icns
COMPONENT projectMSDL
)
endif()
Expand Down
31 changes: 31 additions & 0 deletions packaging-linux.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# projectMSDL Default Packaging Configuration for Linux

# General packaging variables
set(CPACK_PACKAGE_NAME "projectMSDL")
set(CPACK_PACKAGE_VENDOR "The projectM Development Team")
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/src/resources/package-description.txt")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "A standalone, Milkdrop-like audio visualization application")
set(CPACK_PACKAGE_HOMEPAGE_URL "https://projectm-visualizer.org/")
set(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/src/resources/icons/icon_32x32.png")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/src/resources/gpl-3.0.txt")
set(CPACK_STRIP_FILES TRUE)

# Package generator defaults. Override using "cpack -G [generator]"
set(CPACK_GENERATOR TGZ)
set(CPACK_SOURCE_GENERATOR TGZ)

# DEB generator
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "\"The projectM Development Team\" <[email protected]>")
set(CPACK_DEBIAN_PACKAGE_DESCRIPTION "A standalone, Milkdrop-like audio visualization application")
set(CPACK_DEBIAN_PACKAGE_SECTION "sound")
set(CPACK_DEBIAN_ARCHIVE_TYPE "gnutar")
set(CPACK_DEBIAN_COMPRESSION_TYPE "xz")
set(CPACK_DEBIAN_PACKAGE_PRIORITY "standard")
set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "https://github.com/projectM-visualizer/frontend-sdl2/")

# RPM generator
set(CPACK_RPM_PACKAGE_LICENSE "GPL")
set(CPACK_RPM_PACKAGE_GROUP "Applications/Multimedia")
set(CPACK_RPM_PACKAGE_URL "https://github.com/projectM-visualizer/frontend-sdl2/")

include(CPack)
File renamed without changes.
Empty file added packaging-windows.cmake
Empty file.
1 change: 1 addition & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ add_executable(projectMSDL WIN32
SDLRenderingWindow.cpp
SDLRenderingWindow.h
main.cpp
projectMSDL.rc
)

if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
Expand Down
1 change: 1 addition & 0 deletions src/projectMSDL.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
IDI_ICON1 ICON DISCARDABLE "resources\\icons\\icon.ico"
1 change: 1 addition & 0 deletions src/resources/package-description.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
A Milkdrop-compatible, cross-platform and open-source audio visualization application.

0 comments on commit 36de627

Please sign in to comment.