Skip to content

Commit 86f10bf

Browse files
committed
Add Linux desktop file installation and update CPack configuration
- Add element.desktop.in template with CMake variable substitution - Configure and install desktop file to /usr/share/applications - Install icon to freedesktop.org standard location - Update Debian package dependencies with X11 libraries - Add libjack-jackd2-0, fonts-roboto, libxrender1, libxcomposite1 - Improve CPack configuration with cleaner system naming - Add installer target to clean CPack staging directories
1 parent dbbecc6 commit 86f10bf

3 files changed

Lines changed: 54 additions & 3 deletions

File tree

CMakeLists.txt

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -202,21 +202,38 @@ set(CPACK_PACKAGE_INSTALL_DIRECTORY "Element")
202202
set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/data/intro.txt")
203203
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSES/GPL3.txt")
204204

205+
string(TOLOWER "${CMAKE_SYSTEM_PROCESSOR}" ELEMENT_PROCESSOR)
206+
205207
if(LINUX)
206-
set(CPACK_GENERATOR "TGZ;STGZ;DEB")
208+
set(ELEMENT_SYSTEM_NAME "linux")
209+
set(CPACK_GENERATOR "DEB")
210+
set(CPACK_PACKAGE_NAME "element")
207211
set(CPACK_ARCHIVE_COMPONENT_INSTALL OFF)
208212
set(CPACK_PACKAGING_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
209-
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libasound2;libfreetype6;libx11-6;libxext6;libxrandr2;libxinerama1;libxcursor1;libcurl4;libgl1;libstdc++6")
213+
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libasound2;libjack-jackd2-0;fonts-roboto;libfreetype6;libx11-6;libxext6;libxrandr2;libxinerama1;libxcursor1;libxrender1;libxcomposite1;libcurl4;libgl1;libstdc++6")
210214
elseif(APPLE)
215+
set(ELEMENT_SYSTEM_NAME "macos")
216+
set(ELEMENT_PROCESSOR "universal")
211217
set(CPACK_GENERATOR "ZIP")
212218
set(CPACK_ARCHIVE_COMPONENT_INSTALL OFF)
213219
set(CPACK_SET_DESTDIR OFF)
214220
set(CPACK_PACKAGING_INSTALL_PREFIX "/")
215221
else()
222+
set(ELEMENT_SYSTEM_NAME "windows")
216223
set(CPACK_GENERATOR "ZIP")
217224
set(CPACK_ARCHIVE_COMPONENT_INSTALL OFF)
218225
set(CPACK_PACKAGING_INSTALL_PREFIX "/")
219226
endif()
220227

221-
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}")
228+
set(ELEMENT_GENERATOR ${CPACK_GENERATOR})
229+
set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${CPACK_PACKAGE_VERSION}-${ELEMENT_SYSTEM_NAME}-${ELEMENT_PROCESSOR}")
222230
include(CPack)
231+
232+
# Clean CPack staging directory before and after packaging to prevent macOS relocation issues
233+
add_custom_target(installer
234+
COMMAND ${CMAKE_COMMAND} -E rm -rf "${PROJECT_BINARY_DIR}/_CPack_Packages"
235+
COMMAND ${CMAKE_COMMAND} --build "${PROJECT_BINARY_DIR}" --target package
236+
COMMAND ${CMAKE_COMMAND} -E rm -rf "${PROJECT_BINARY_DIR}/_CPack_Packages"
237+
COMMENT "Cleaning CPack staging and building package"
238+
VERBATIM
239+
USES_TERMINAL)

data/CMakeLists.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,24 @@ juce_add_binary_data(element-binarydata
66
HEADER_NAME binarydata.hpp
77
NAMESPACE element::res
88
SOURCES ${ELEMENT_RES})
9+
10+
# Linux desktop file and icon installation
11+
if(UNIX AND NOT APPLE)
12+
# Configure desktop file with CMake variables
13+
configure_file(
14+
${CMAKE_CURRENT_SOURCE_DIR}/element.desktop.in
15+
${CMAKE_CURRENT_BINARY_DIR}/element.desktop
16+
@ONLY
17+
)
18+
19+
# Install desktop file
20+
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/element.desktop
21+
DESTINATION ${CMAKE_INSTALL_DATADIR}/applications
22+
)
23+
24+
# Install icon
25+
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/images/icon.png
26+
DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/512x512/apps
27+
RENAME element.png
28+
)
29+
endif()

data/element.desktop.in

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[Desktop Entry]
2+
Version=1.0
3+
Type=Application
4+
Name=Element
5+
GenericName=Audio Plugin Host
6+
Comment=Audio Plugin Host and Modular Instrument (v@PROJECT_VERSION_FULL@)
7+
Exec=@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_BINDIR@/element
8+
Icon=element
9+
Terminal=false
10+
Categories=AudioVideo;Audio;Midi;Sequencer;
11+
MimeType=application/x-element-session;application/x-element-graph;
12+
Keywords=audio;midi;plugin;host;daw;vst;lv2;
13+
StartupNotify=true

0 commit comments

Comments
 (0)