Skip to content

Commit 36de627

Browse files
committed
WIP: Packaging improvements
1 parent bcf1ad0 commit 36de627

File tree

9 files changed

+75
-7
lines changed

9 files changed

+75
-7
lines changed

.github/workflows/build.yaml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,17 @@ jobs:
5858
mkdir cmake-build-frontend-sdl2
5959
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"
6060
cmake --build cmake-build-frontend-sdl2 --parallel
61-
# cmake --install "${{ github.workspace }}/cmake-build-frontend-sdl2"
61+
62+
- name: Package projectMSDL
63+
run: |
64+
cd cmake-build-frontend-sdl2
65+
cpack -G DEB
66+
67+
- name: Upload Artifact
68+
uses: actions/upload-artifact@v4
69+
with:
70+
name: projectMSDL-buildcheck
71+
path: cmake-build-frontend-sdl2/*.deb
6272

6373
build-windows:
6474
name: Windows, x64

CMakeLists.txt

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ project(projectMSDL
1414
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
1515

1616
# Default install layouts.
17-
option(ENABLE_FLAT_PACKAGE "Creates a \"flat\" install layout with files and preset/texture dirs directly in the main dir." OFF)
17+
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)
1818
if(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND NOT ENABLE_FLAT_PACKAGE)
1919
include(GNUInstallDirs)
2020

@@ -34,6 +34,8 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND NOT ENABLE_FLAT_PACKAGE)
3434
set(DEFAULT_PRESETS_PATH "${_config_dir_abs_init}/presets" CACHE STRING "Default presets path in the configuration file.")
3535
set(DEFAULT_TEXTURES_PATH "${_config_dir_abs_init}/textures" CACHE STRING "Default textures path in the configuration file.")
3636
elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND NOT ENABLE_FLAT_PACKAGE)
37+
set(DEFAULT_PACKAGING_CONFIG "packaging-macos.cmake")
38+
3739
# Package as .app bundle on macOS
3840
set(BUNDLE_BASE_DIR "projectM.app/Contents")
3941
set(PROJECTMSDL_BIN_DIR "${BUNDLE_BASE_DIR}/MacOS" CACHE STRING "Directory to install executables in, relative to the install prefix.")
@@ -46,6 +48,8 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND NOT ENABLE_FLAT_PACKAGE)
4648
set(DEFAULT_PRESETS_PATH "\${application.dir}/../Resources/Presets" CACHE STRING "Default presets path in the configuration file.")
4749
set(DEFAULT_TEXTURES_PATH "\${application.dir}/../Resources/Presets" CACHE STRING "Default textures path in the configuration file.")
4850
else()
51+
set(DEFAULT_PACKAGING_CONFIG "packaging-windows.cmake")
52+
4953
# Windows and others: use flat layout.
5054
set(PROJECTMSDL_BIN_DIR "." CACHE STRING "Directory to install executables in, relative to the install prefix.")
5155
set(PROJECTMSDL_LIB_DIR "." CACHE STRING "Directory to install additional libraries in, relative to the install prefix.")
@@ -58,6 +62,18 @@ else()
5862
set(DEFAULT_TEXTURES_PATH "\${application.dir}/textures" CACHE STRING "Default textures path in the configuration file.")
5963
endif()
6064

65+
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
66+
set(DEFAULT_PACKAGING_CONFIG "packaging-linux.cmake")
67+
elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
68+
set(DEFAULT_PACKAGING_CONFIG "packaging-macos.cmake")
69+
elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows")
70+
set(DEFAULT_PACKAGING_CONFIG "packaging-windows.cmake")
71+
else()
72+
unset(DEFAULT_PACKAGING_CONFIG)
73+
endif()
74+
75+
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.")
76+
6177
set(SDL2_LINKAGE "shared" CACHE STRING "Set to either shared or static to specify how libSDL2 should be linked. Defaults to shared.")
6278
option(ENABLE_FREETYPE "Use the Freetype font rendering library instead of the built-in stb_truetype if available" ON)
6379

@@ -90,7 +106,10 @@ if(ENABLE_TESTING)
90106
endif()
91107

92108
include(install.cmake)
93-
include(packaging.cmake)
109+
110+
if(NOT PACKAGING_CONFIG_FILE STREQUAL "")
111+
include(${PACKAGING_CONFIG_FILE})
112+
endif()
94113

95114
message(STATUS "SDL version: ${SDL2_VERSION}")
96115
message(STATUS "Poco version: ${Poco_VERSION}")

install.cmake

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,18 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND NOT ENABLE_FLAT_PACKAGE)
2727
install_icon(${size})
2828
endforeach()
2929

30+
install(FILES src/resources/icons/icon_scalable.svg
31+
DESTINATION ${PROJECTMSDL_ICONS_DIR}/scalable/apps
32+
RENAME projectMSDL.svg
33+
COMPONENT projectMSDL
34+
)
35+
3036
endif()
31-
elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND NOT ENABLE_FLAT_PACKAGE)
32-
set(ICNS_FILE ${CMAKE_BINARY_DIR}/projectMSDL.icns)
33-
execute_process(COMMAND iconutil -c icns -o "${ICNS_FILE}" "${CMAKE_SOURCE_DIR}/src/resources/icons")
3437

35-
install(FILES ${ICNS_FILE}
38+
elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND NOT ENABLE_FLAT_PACKAGE)
39+
install(FILES src/resources/icons/icon.icns
3640
DESTINATION ${PROJECTMSDL_DATA_DIR}
41+
RENAME projectMSDL.icns
3742
COMPONENT projectMSDL
3843
)
3944
endif()

packaging-linux.cmake

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# projectMSDL Default Packaging Configuration for Linux
2+
3+
# General packaging variables
4+
set(CPACK_PACKAGE_NAME "projectMSDL")
5+
set(CPACK_PACKAGE_VENDOR "The projectM Development Team")
6+
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/src/resources/package-description.txt")
7+
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "A standalone, Milkdrop-like audio visualization application")
8+
set(CPACK_PACKAGE_HOMEPAGE_URL "https://projectm-visualizer.org/")
9+
set(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/src/resources/icons/icon_32x32.png")
10+
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/src/resources/gpl-3.0.txt")
11+
set(CPACK_STRIP_FILES TRUE)
12+
13+
# Package generator defaults. Override using "cpack -G [generator]"
14+
set(CPACK_GENERATOR TGZ)
15+
set(CPACK_SOURCE_GENERATOR TGZ)
16+
17+
# DEB generator
18+
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "\"The projectM Development Team\" <[email protected]>")
19+
set(CPACK_DEBIAN_PACKAGE_DESCRIPTION "A standalone, Milkdrop-like audio visualization application")
20+
set(CPACK_DEBIAN_PACKAGE_SECTION "sound")
21+
set(CPACK_DEBIAN_ARCHIVE_TYPE "gnutar")
22+
set(CPACK_DEBIAN_COMPRESSION_TYPE "xz")
23+
set(CPACK_DEBIAN_PACKAGE_PRIORITY "standard")
24+
set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "https://github.com/projectM-visualizer/frontend-sdl2/")
25+
26+
# RPM generator
27+
set(CPACK_RPM_PACKAGE_LICENSE "GPL")
28+
set(CPACK_RPM_PACKAGE_GROUP "Applications/Multimedia")
29+
set(CPACK_RPM_PACKAGE_URL "https://github.com/projectM-visualizer/frontend-sdl2/")
30+
31+
include(CPack)
File renamed without changes.

packaging-windows.cmake

Whitespace-only changes.

src/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ add_executable(projectMSDL WIN32
1919
SDLRenderingWindow.cpp
2020
SDLRenderingWindow.h
2121
main.cpp
22+
projectMSDL.rc
2223
)
2324

2425
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")

src/projectMSDL.rc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
IDI_ICON1 ICON DISCARDABLE "resources\\icons\\icon.ico"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
A Milkdrop-compatible, cross-platform and open-source audio visualization application.

0 commit comments

Comments
 (0)