diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 63b825c..10ab62d 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -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 diff --git a/CMakeLists.txt b/CMakeLists.txt index e251ce2..d285f0b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) @@ -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.") @@ -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.") @@ -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) @@ -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}") diff --git a/install.cmake b/install.cmake index 7dab564..9847731 100644 --- a/install.cmake +++ b/install.cmake @@ -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() diff --git a/packaging-linux.cmake b/packaging-linux.cmake new file mode 100644 index 0000000..8583bb0 --- /dev/null +++ b/packaging-linux.cmake @@ -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\" ") +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) diff --git a/packaging.cmake b/packaging-macos.cmake similarity index 100% rename from packaging.cmake rename to packaging-macos.cmake diff --git a/packaging-windows.cmake b/packaging-windows.cmake new file mode 100644 index 0000000..e69de29 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3fb61fd..292e729 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -19,6 +19,7 @@ add_executable(projectMSDL WIN32 SDLRenderingWindow.cpp SDLRenderingWindow.h main.cpp + projectMSDL.rc ) if(CMAKE_SYSTEM_NAME STREQUAL "Windows") diff --git a/src/projectMSDL.rc b/src/projectMSDL.rc new file mode 100644 index 0000000..81e34a5 --- /dev/null +++ b/src/projectMSDL.rc @@ -0,0 +1 @@ +IDI_ICON1 ICON DISCARDABLE "resources\\icons\\icon.ico" \ No newline at end of file diff --git a/src/resources/package-description.txt b/src/resources/package-description.txt new file mode 100644 index 0000000..a10024c --- /dev/null +++ b/src/resources/package-description.txt @@ -0,0 +1 @@ +A Milkdrop-compatible, cross-platform and open-source audio visualization application. \ No newline at end of file