Skip to content

Commit 5f0c42a

Browse files
committed
fix(build): app icons, liblo DLL, installer shortcuts
- embed openmix.ico in the exe (RC) so Explorer, taskbar, and the WinSparkle update dialog pick it up; NSIS installer + ARP icons - bundle openmix.icns and set CFBundleIconFile on macOS - set the runtime window icon from a qrc PNG on all platforms - install vcpkg's lo.dll: the Qt deploy script only bundles Qt, so the NSIS installer shipped without liblo and the app failed to launch - add start menu + desktop shortcuts and a finish-page run option
1 parent 878bfd0 commit 5f0c42a

8 files changed

Lines changed: 34 additions & 0 deletions

File tree

CMakeLists.txt

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,14 @@ if(WIN32)
5353
find_library(LIBLO_LIBRARIES NAMES lo liblo REQUIRED)
5454
target_include_directories(openmix_liblo INTERFACE ${LIBLO_INCLUDE_DIRS})
5555
target_link_libraries(openmix_liblo INTERFACE ${LIBLO_LIBRARIES})
56+
# the deploy script only bundles Qt; ship liblo's runtime DLL ourselves
57+
get_filename_component(_liblo_libdir ${LIBLO_LIBRARIES} DIRECTORY)
58+
find_file(LIBLO_DLL NAMES lo.dll liblo.dll
59+
HINTS ${_liblo_libdir}/../bin ${LIBLO_INCLUDE_DIRS}/../bin)
60+
if(NOT LIBLO_DLL)
61+
message(FATAL_ERROR "liblo runtime DLL not found; the installer would ship without it")
62+
endif()
63+
install(FILES ${LIBLO_DLL} DESTINATION ${CMAKE_INSTALL_BINDIR})
5664
else()
5765
find_package(PkgConfig REQUIRED)
5866
pkg_check_modules(LIBLO REQUIRED IMPORTED_TARGET liblo)
@@ -439,13 +447,21 @@ if(WIN32)
439447
set_target_properties(${PROJECT_NAME} PROPERTIES
440448
WIN32_EXECUTABLE TRUE
441449
)
450+
# embed the app icon into the executable (needs the RC language, which
451+
# project(LANGUAGES CXX) leaves off)
452+
enable_language(RC)
453+
target_sources(${PROJECT_NAME} PRIVATE packaging/openmix.rc)
442454
elseif(APPLE)
443455
set_target_properties(${PROJECT_NAME} PROPERTIES
444456
MACOSX_BUNDLE TRUE
445457
MACOSX_BUNDLE_BUNDLE_NAME "OpenMix"
446458
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
447459
MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION}
448460
)
461+
# bundle icon: ship the icns in Resources (Info.plist.in names it)
462+
target_sources(${PROJECT_NAME} PRIVATE packaging/openmix.icns)
463+
set_source_files_properties(packaging/openmix.icns
464+
PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
449465
endif()
450466

451467
# install rules
@@ -488,6 +504,18 @@ if(WIN32)
488504
set(CPACK_NSIS_DISPLAY_NAME "OpenMix")
489505
set(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL ON)
490506
set(CPACK_NSIS_MODIFY_PATH OFF)
507+
# installer/uninstaller + Add/Remove Programs icons
508+
set(CPACK_NSIS_MUI_ICON "${CMAKE_SOURCE_DIR}/packaging/openmix.ico")
509+
set(CPACK_NSIS_MUI_UNIICON "${CMAKE_SOURCE_DIR}/packaging/openmix.ico")
510+
set(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\OpenMix.exe")
511+
# start menu entry + desktop shortcut (removed again on uninstall)
512+
set(CPACK_PACKAGE_EXECUTABLES "OpenMix" "OpenMix")
513+
set(CPACK_NSIS_CREATE_ICONS_EXTRA
514+
"CreateShortCut '$DESKTOP\\\\OpenMix.lnk' '$INSTDIR\\\\bin\\\\OpenMix.exe'")
515+
set(CPACK_NSIS_DELETE_ICONS_EXTRA
516+
"Delete '$DESKTOP\\\\OpenMix.lnk'")
517+
# offer to launch the app from the installer's finish page
518+
set(CPACK_NSIS_MUI_FINISHPAGE_RUN "bin\\\\OpenMix.exe")
491519
elseif(APPLE)
492520
set(CPACK_GENERATOR "DragNDrop")
493521
else()

packaging/Info.plist.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
<string>@PROJECT_VERSION@</string>
1717
<key>CFBundlePackageType</key>
1818
<string>APPL</string>
19+
<key>CFBundleIconFile</key>
20+
<string>openmix</string>
1921
<key>NSHighResolutionCapable</key>
2022
<true/>
2123
<key>LSMinimumSystemVersion</key>

packaging/openmix.icns

34.6 KB
Binary file not shown.

packaging/openmix.ico

364 KB
Binary file not shown.

packaging/openmix.rc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
IDI_ICON1 ICON "openmix.ico"

resources/icons/openmix.png

3.5 KB
Loading

resources/resources.qrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
<RCC version="1.0">
33
<qresource prefix="/">
44
<file>styles/main.qss</file>
5+
<file>icons/openmix.png</file>
56
<file>icons/chevron-up.svg</file>
67
<file>icons/chevron-down.svg</file>
78
</qresource>

src/main.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include "ui/WelcomeDialog.h"
44
#include "ui/theme/Theme.h"
55
#include <QApplication>
6+
#include <QIcon>
67
#include <QSettings>
78
#include <QFile>
89
#include <QPalette>
@@ -37,6 +38,7 @@ int main(int argc, char* argv[]) {
3738
QApplication::setApplicationName("OpenMix");
3839
QApplication::setApplicationVersion("0.1.0");
3940
QApplication::setOrganizationName("OpenMix");
41+
QApplication::setWindowIcon(QIcon(":/icons/openmix.png"));
4042

4143
oclero::qlementine::icons::initializeIconTheme();
4244

0 commit comments

Comments
 (0)