From ce5e095b4fd347337744c6b31a764bded8460c39 Mon Sep 17 00:00:00 2001 From: Hombre Date: Mon, 26 Mar 2018 22:40:17 +0200 Subject: [PATCH 1/2] Enable building HDRMerge on Windows using qt5 The 'setup' target is now functionnal and will copy all required DLL from your MSYS installation. Tested on Windows for 64 bits Release target. The path to the 'lib' dir, where to find the dll to bundle, is found by looking for 'exiv2.exe'. CAVEAT: the default install directory is "C:\Program files(x86)", even thought it is a 64 bit build (should be "C:\Program files") --- CMakeLists.txt | 51 +++++++++++++++++++++++++---------- data/setup.nsi | 72 +++++++++++++++++++++++++++++++++++++++++++++----- data/winres.rc | 2 +- 3 files changed, 104 insertions(+), 21 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1ae865e..27910b1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -240,6 +240,7 @@ if(WIN32) src/main.cpp src/Launcher.cpp data/resources.qrc + ${hdrmerge_translations} ${hdrmerge_sources} ${hdrmerge_gui_sources} ${hdrmerge_moc} @@ -277,29 +278,51 @@ if(WIN32) add_executable(hdrmerge-nogui src/main.cpp src/Launcher.cpp - $ + data/resources.qrc + ${hdrmerge_translations} + ${hdrmerge_sources} + ${hdrmerge_moc} $ "${PLATFORM_SOURCES}" ) - target_link_libraries(hdrmerge-nogui ${STRIP} ${hdrmerge_libs}) + + # WARNING: ImageIO class need QImage which need Qt5::Widgets + # Launcher.cpp need QApplication which need Qt5::Widgets + target_link_libraries(hdrmerge-nogui ${STRIP} ${hdrmerge_libs} Qt5::Widgets Qt5::Core) set_target_properties(hdrmerge-nogui PROPERTIES COMPILE_DEFINITIONS "NO_GUI") # Create the installer with makensis find_program(MAKENSIS_EXECUTABLE makensis.exe PATH_SUFFIXES "NSIS/Bin") if(MAKENSIS_EXECUTABLE) - message(STATUS "NSIS found!") + message(STATUS "NSIS found") set(SETUP_PROG hdrmerge-setup${WIN_ARCH}-${HDRMERGE_VERSION}.exe) - configure_file( - "${PROJECT_SOURCE_DIR}/data/setup.nsi" - "${PROJECT_BINARY_DIR}/setup.nsi" @ONLY - ) - add_custom_command(OUTPUT ${SETUP_PROG} - COMMAND "${MAKENSIS_EXECUTABLE}" -V2 setup.nsi - MAIN_DEPENDENCY setup.nsi - DEPENDS "${PROJECT_BINARY_DIR}/hdrmerge.exe" - WORKING_DIRECTORY "${PROJECT_BINARY_DIR}") - add_custom_target(hdrmerge-setup ALL DEPENDS "${PROJECT_BINARY_DIR}/${SETUP_PROG}") + string(REPLACE "/" "\\" PROJ_SRC_DIR "${PROJECT_SOURCE_DIR}") + message(STATUS "PROJ_SRC_DIR = ${PROJ_SRC_DIR}") + + # ASSUMING YOU'RE USING EXIV2 BUNDLED WITH MSYS2 + find_program(MINGW_LIB_DIR exiv2.exe) + if(MINGW_LIB_DIR) + get_filename_component(MINGW_LIB_DIR "${MINGW_LIB_DIR}" PATH) + string(REPLACE "/" "\\" MINGW_LIB_DIR "${MINGW_LIB_DIR}") + message(STATUS "MINGW_LIB_DIR = ${MINGW_LIB_DIR}") + + set(QT5_PLUGINS_DIR "${MINGW_LIB_DIR}\\..\\share\\qt5\\plugins") + message(STATUS "QT5_PLUGINS_DIR = ${QT5_PLUGINS_DIR}") + + configure_file( + "${PROJECT_SOURCE_DIR}/data/setup.nsi" + "${PROJECT_BINARY_DIR}/setup.nsi" @ONLY + ) + add_custom_command(OUTPUT ${SETUP_PROG} + COMMAND "${MAKENSIS_EXECUTABLE}" -V2 setup.nsi + MAIN_DEPENDENCY setup.nsi + DEPENDS "${PROJECT_BINARY_DIR}/hdrmerge.exe" + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}") + add_custom_target(hdrmerge-setup ALL DEPENDS "${PROJECT_BINARY_DIR}/${SETUP_PROG}") + else(MINGW_LIB_DIR) + message(STATUS "Unable to locate the 'bin' directory to get the dependencies") + endif(MINGW_LIB_DIR) else() - message(STATUS "NSIS not found!") + message(STATUS "NSIS not found") endif() elseif(APPLE) set_source_files_properties(images/icon.icns PROPERTIES MACOSX_PACKAGE_LOCATION "Resources") diff --git a/data/setup.nsi b/data/setup.nsi index 9b386a7..8d958c1 100644 --- a/data/setup.nsi +++ b/data/setup.nsi @@ -30,9 +30,9 @@ VIAddVersionKey "FileDescription" "${APPNAME}" VIAddVersionKey "FileVersion" "@HDRMERGE_VERSION@" VIAddVersionKey "ProductVersion" "@HDRMERGE_VERSION@" -!define MUI_ICON "@PROJECT_SOURCE_DIR@/images/icon.ico" +!define MUI_ICON "@PROJ_SRC_DIR@\data\images\icon.ico" !define MUI_HEADERIMAGE -!define MUI_HEADERIMAGE_BITMAP "@PROJECT_SOURCE_DIR@/images/logo.bmp" +!define MUI_HEADERIMAGE_BITMAP "@PROJ_SRC_DIR@\data\images\logo.bmp" !define MUI_HEADERIMAGE_RIGHT ;-------------------------------- @@ -40,7 +40,7 @@ VIAddVersionKey "ProductVersion" "@HDRMERGE_VERSION@" ; Pages !insertmacro MUI_PAGE_WELCOME -!insertmacro MUI_PAGE_LICENSE "@PROJECT_SOURCE_DIR@/LICENSE" +!insertmacro MUI_PAGE_LICENSE "@PROJ_SRC_DIR@\LICENSE" !insertmacro MUI_PAGE_COMPONENTS !insertmacro MUI_PAGE_DIRECTORY !insertmacro MUI_PAGE_INSTFILES @@ -65,10 +65,41 @@ Section "HDRMerge (required)" ; Put file there File "hdrmerge.exe" \ - "@PROJECT_SOURCE_DIR@/LICENSE" \ - "@PROJECT_SOURCE_DIR@/LICENSE_icons" \ - "@PROJECT_SOURCE_DIR@/README.md" + "@PROJ_SRC_DIR@\LICENSE" \ + "@PROJ_SRC_DIR@\LICENSE_icons" \ + "@PROJ_SRC_DIR@\README.md"\ + "@MINGW_LIB_DIR@\libbz2-1.dll"\ + "@MINGW_LIB_DIR@\libexiv2.dll"\ + "@MINGW_LIB_DIR@\libexpat-1.dll"\ + "@MINGW_LIB_DIR@\libfreetype-6.dll"\ + "@MINGW_LIB_DIR@\libgcc_s_seh-1.dll"\ + "@MINGW_LIB_DIR@\libglib-2.0-0.dll"\ + "@MINGW_LIB_DIR@\libgomp-1.dll"\ + "@MINGW_LIB_DIR@\libgraphite2.dll"\ + "@MINGW_LIB_DIR@\libharfbuzz-0.dll"\ + "@MINGW_LIB_DIR@\libiconv-2.dll"\ + "@MINGW_LIB_DIR@\libicudt58.dll"\ + "@MINGW_LIB_DIR@\libicuin58.dll"\ + "@MINGW_LIB_DIR@\libicuuc58.dll"\ + "@MINGW_LIB_DIR@\libintl-8.dll"\ + "@MINGW_LIB_DIR@\libjasper-4.dll"\ + "@MINGW_LIB_DIR@\libjpeg-8.dll"\ + "@MINGW_LIB_DIR@\liblcms2-2.dll"\ + "@MINGW_LIB_DIR@\libpcre-1.dll"\ + "@MINGW_LIB_DIR@\libpcre2-16-0.dll"\ + "@MINGW_LIB_DIR@\libpng16-16.dll"\ + "@MINGW_LIB_DIR@\libraw_r-16.dll"\ + "@MINGW_LIB_DIR@\libstdc++-6.dll"\ + "@MINGW_LIB_DIR@\libwinpthread-1.dll"\ + "@MINGW_LIB_DIR@\Qt5Core.dll"\ + "@MINGW_LIB_DIR@\Qt5Gui.dll"\ + "@MINGW_LIB_DIR@\Qt5Widgets.dll"\ + "@MINGW_LIB_DIR@\zlib1.dll" File /oname=hdrmerge.com "hdrmerge-nogui.exe" + + SetOutPath $INSTDIR\platforms + + File "@QT5_PLUGINS_DIR@\platforms\qwindows.dll" ; Write the installation path into the registry WriteRegStr HKLM SOFTWARE\${APPNAME} "Install_Dir" "$INSTDIR" @@ -121,6 +152,35 @@ Section "Uninstall" Delete "$INSTDIR\LICENSE_icons" Delete "$INSTDIR\README.md" Delete "$INSTDIR\uninstall.exe" + Delete "$INSTDIR\platforms\qwindows.dll" + RMDir "$INSTDIR\platforms" + Delete "$INSTDIR\libbz2-1.dll" + Delete "$INSTDIR\libexiv2.dll" + Delete "$INSTDIR\libexpat-1.dll" + Delete "$INSTDIR\libfreetype-6.dll" + Delete "$INSTDIR\libgcc_s_seh-1.dll" + Delete "$INSTDIR\libglib-2.0-0.dll" + Delete "$INSTDIR\libgomp-1.dll" + Delete "$INSTDIR\libgraphite2.dll" + Delete "$INSTDIR\libharfbuzz-0.dll" + Delete "$INSTDIR\libiconv-2.dll" + Delete "$INSTDIR\libicudt58.dll" + Delete "$INSTDIR\libicuin58.dll" + Delete "$INSTDIR\libicuuc58.dll" + Delete "$INSTDIR\libintl-8.dll" + Delete "$INSTDIR\libjasper-4.dll" + Delete "$INSTDIR\libjpeg-8.dll" + Delete "$INSTDIR\liblcms2-2.dll" + Delete "$INSTDIR\libpcre-1.dll" + Delete "$INSTDIR\libpcre2-16-0.dll" + Delete "$INSTDIR\libpng16-16.dll" + Delete "$INSTDIR\libraw_r-16.dll" + Delete "$INSTDIR\libstdc++-6.dll" + Delete "$INSTDIR\libwinpthread-1.dll" + Delete "$INSTDIR\Qt5Core.dll" + Delete "$INSTDIR\Qt5Gui.dll" + Delete "$INSTDIR\Qt5Widgets.dll" + Delete "$INSTDIR\zlib1.dll" RMDir /REBOOTOK $INSTDIR SectionEnd diff --git a/data/winres.rc b/data/winres.rc index 6384f71..be5f348 100644 --- a/data/winres.rc +++ b/data/winres.rc @@ -1,4 +1,4 @@ -iconId ICON "@PROJECT_SOURCE_DIR@/images/icon.ico" +iconId ICON "@PROJECT_SOURCE_DIR@/data/images/icon.ico" 1 VERSIONINFO FILEVERSION @HDRMERGE_VERSION_MAJOR@,@HDRMERGE_VERSION_MINOR@,@HDRMERGE_VERSION_REV@,0 From 655ed80edb5ba324c2364000b4a145b9a1f7a4d4 Mon Sep 17 00:00:00 2001 From: Hombre Date: Tue, 27 Mar 2018 00:34:38 +0200 Subject: [PATCH 2/2] Hotfix: Set a minimum window size of 400x400 to LoadOptionsDialog This will prevent having a 80x40 initial size for this window. --- src/LoadOptionsDialog.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/LoadOptionsDialog.cpp b/src/LoadOptionsDialog.cpp index 269f8ec..1751e8b 100644 --- a/src/LoadOptionsDialog.cpp +++ b/src/LoadOptionsDialog.cpp @@ -46,6 +46,8 @@ LoadOptionsDialog::LoadOptionsDialog(QWidget * parent, Qt::WindowFlags f) QSettings settings; QVBoxLayout * layout = new QVBoxLayout(this); + setMinimumSize(400, 400); + QWidget * fileSelector = new QWidget(this); QHBoxLayout * fileSelectorLayout = new QHBoxLayout(fileSelector); fileSelectorLayout->setMargin(0);