From f2c21b91dd1a2d2cdf01de9906615272e829b620 Mon Sep 17 00:00:00 2001 From: Morgan Hardwood Date: Wed, 14 Mar 2018 21:23:23 +0100 Subject: [PATCH 01/12] Started porting to Qt5 --- CMakeLists.txt | 35 ++++++++++----- build-hdrmerge | 2 +- cmake/FindQt5Transitional.cmake | 77 +++++++++++++++++++++++++++++++++ 3 files changed, 102 insertions(+), 12 deletions(-) create mode 100644 cmake/FindQt5Transitional.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 40569e3..b78da15 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 3.1.0) project(hdrmerge) @@ -17,9 +17,23 @@ set(PLATFORM "") # Required and optional packages set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${PROJECT_SOURCE_DIR}/cmake") -find_package(Qt4 REQUIRED QtCore QtGui) -include(${QT_USE_FILE}) +# Find includes in corresponding build directories +set(CMAKE_INCLUDE_CURRENT_DIR ON) +# Instruct CMake to run moc automatically when needed. +set(CMAKE_AUTOMOC ON) + +#set(CMAKE_AUTOUIC ON) +#set(CMAKE_AUTORCC ON) +#set(CMAKE_INCLUDE_CURRENT_DIR ON) + +#find_package(Qt5Gui REQUIRED) +find_package(Qt5Core REQUIRED) +find_package(Qt5Widgets REQUIRED) +#find_package(Qt5Transitional REQUIRED) + +#include(${QT_USE_FILE}) add_definitions(${QT_DEFINITIONS}) + find_package(LibRaw REQUIRED) find_package(Exiv2 REQUIRED) find_package(ZLIB REQUIRED) @@ -148,7 +162,6 @@ endif() # Libs set(hdrmerge_libs "${LibRaw_r_LIBRARIES}" - "${QT_LIBRARIES}" "${EXIV2_LIBRARY}" "${ZLIB_LIBRARIES}" ) @@ -177,8 +190,8 @@ else() endif() # Qt4 intermediate files -QT4_WRAP_CPP(hdrmerge_moc ${hdrmerge_qobject_headers}) -QT4_ADD_TRANSLATION(hdrmerge_qm ${hdrmerge_translations}) +#QT4_WRAP_CPP(hdrmerge_moc ${hdrmerge_qobject_headers}) +#QT4_ADD_TRANSLATION(hdrmerge_qm ${hdrmerge_translations}) # Generate the XML version of hdrmerge_qm foreach(file ${hdrmerge_qm}) @@ -192,10 +205,10 @@ configure_file( "${PROJECT_BINARY_DIR}/translations.qrc" ) -QT4_ADD_RESOURCES(hdrmerge_rsrc - "${PROJECT_BINARY_DIR}/translations.qrc" - data/resources.qrc -) +#QT4_ADD_RESOURCES(hdrmerge_rsrc +# "${PROJECT_BINARY_DIR}/translations.qrc" +# data/resources.qrc +#) if(WIN32) add_library(alglib-objects OBJECT @@ -232,7 +245,7 @@ else() ) endif() -target_link_libraries(hdrmerge ${STRIP} ${hdrmerge_libs}) +target_link_libraries(hdrmerge ${STRIP} ${hdrmerge_libs} Qt5::Widgets) if(WIN32) # Compile a target without GUI, for the .com executable diff --git a/build-hdrmerge b/build-hdrmerge index 783f079..d8fe55e 100755 --- a/build-hdrmerge +++ b/build-hdrmerge @@ -123,7 +123,7 @@ cd "${buildDir}" || exit 1 # ----------------------------------------------------------------------------- # Compile -export QT_SELECT="qt4" +#export QT_SELECT="qt4" cmake \ -DCMAKE_CXX_FLAGS="-std=c++11 -Wno-deprecated-declarations -Wno-unused-result" \ diff --git a/cmake/FindQt5Transitional.cmake b/cmake/FindQt5Transitional.cmake new file mode 100644 index 0000000..df354fc --- /dev/null +++ b/cmake/FindQt5Transitional.cmake @@ -0,0 +1,77 @@ + +find_package(Qt5Core QUIET) + +if (Qt5Core_FOUND) + set(_allComponents + Core + Gui + DBus + Designer + Declarative + Script + ScriptTools + Network + Test + Xml + Svg + Sql + Widgets + PrintSupport + Concurrent + UiTools + WebKit + WebKitWidgets + OpenGL + X11Extras + Qml + Quick + ) + if (NOT Qt5Transitional_FIND_COMPONENTS) + foreach(_component ${_allComponents}) + find_package(Qt5${_component}) + + list(APPEND QT_LIBRARIES ${Qt5${_component}_LIBRARIES}) + endforeach() + else() + set(_components ${Qt5Transitional_FIND_COMPONENTS}) + foreach(_component ${Qt5Transitional_FIND_COMPONENTS}) + find_package(Qt5${_component} REQUIRED) + if ("${_component}" STREQUAL "WebKit") + find_package(Qt5WebKitWidgets REQUIRED) + list(APPEND QT_LIBRARIES ${Qt5WebKitWidgets_LIBRARIES} ) + endif() + if ("${_component}" STREQUAL "Gui") + find_package(Qt5Widgets REQUIRED) + find_package(Qt5PrintSupport REQUIRED) + find_package(Qt5Svg REQUIRED) + list(APPEND QT_LIBRARIES ${Qt5Widgets_LIBRARIES} + ${Qt5PrintSupport_LIBRARIES} + ${Qt5Svg_LIBRARIES} ) + endif() + if ("${_component}" STREQUAL "Core") + find_package(Qt5Concurrent REQUIRED) + list(APPEND QT_LIBRARIES ${Qt5Concurrent_LIBRARIES} ) + endif() + endforeach() + endif() + + set(Qt5Transitional_FOUND TRUE) + set(QT5_BUILD TRUE) + + include("${CMAKE_CURRENT_LIST_DIR}/ECMQt4To5Porting.cmake") # TODO: Port away from this. + +else() + foreach(_component ${Qt5Transitional_FIND_COMPONENTS}) + if("${_component}" STREQUAL "Widgets") # new in Qt5 + set(_component Gui) + elseif("${_component}" STREQUAL "Concurrent") # new in Qt5 + set(_component Core) + endif() + list(APPEND _components Qt${_component}) + endforeach() + find_package(Qt4 ${QT_MIN_VERSION} REQUIRED ${_components}) + + if(QT4_FOUND) + set(Qt5Transitional_FOUND TRUE) + endif() +endif() From 8f570287d075e412e65670cad9b1ac87700b5f43 Mon Sep 17 00:00:00 2001 From: Morgan Hardwood Date: Wed, 14 Mar 2018 21:30:06 +0100 Subject: [PATCH 02/12] 2 --- CMakeLists.txt | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b78da15..1c4f3d2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1.0) +cmake_minimum_required(VERSION 3.4) project(hdrmerge) @@ -26,10 +26,7 @@ set(CMAKE_AUTOMOC ON) #set(CMAKE_AUTORCC ON) #set(CMAKE_INCLUDE_CURRENT_DIR ON) -#find_package(Qt5Gui REQUIRED) -find_package(Qt5Core REQUIRED) -find_package(Qt5Widgets REQUIRED) -#find_package(Qt5Transitional REQUIRED) +find_package(Qt5 5.6 REQUIRED Core Widgets) #include(${QT_USE_FILE}) add_definitions(${QT_DEFINITIONS}) From fbd87e11fd5c3af25fb42b72c1cd2fd9fb73b2ef Mon Sep 17 00:00:00 2001 From: Morgan Hardwood Date: Wed, 14 Mar 2018 22:06:21 +0100 Subject: [PATCH 03/12] 3 --- CMakeLists.txt | 24 +++++++++--------------- src/DngFloatWriter.cpp | 2 +- src/EditableMask.cpp | 2 +- src/RawParameters.cpp | 2 +- 4 files changed, 12 insertions(+), 18 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1c4f3d2..f00595e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -34,7 +34,7 @@ add_definitions(${QT_DEFINITIONS}) find_package(LibRaw REQUIRED) find_package(Exiv2 REQUIRED) find_package(ZLIB REQUIRED) -find_package(Boost 1.46 COMPONENTS unit_test_framework) +#find_package(Boost 1.46 COMPONENTS unit_test_framework) find_package(OpenMP) if(WIN32) @@ -213,22 +213,14 @@ if(WIN32) ) endif() -add_library(hdrmerge-objects OBJECT - ${hdrmerge_sources} - ${hdrmerge_rsrc} -) - -add_library(hdrmerge-gui-objects OBJECT - ${hdrmerge_gui_sources} - ${hdrmerge_moc} -) - if(WIN32) add_executable(hdrmerge ${PLATFORM} src/main.cpp src/Launcher.cpp - $ - $ + ${hdrmerge_sources} + ${hdrmerge_rsrc} + ${hdrmerge_gui_sources} + ${hdrmerge_moc} $ "${PLATFORM_SOURCES}" ) @@ -236,8 +228,10 @@ else() add_executable(hdrmerge ${PLATFORM} src/main.cpp src/Launcher.cpp - $ - $ + ${hdrmerge_sources} + ${hdrmerge_rsrc} + ${hdrmerge_gui_sources} + ${hdrmerge_moc} "${PLATFORM_SOURCES}" ) endif() diff --git a/src/DngFloatWriter.cpp b/src/DngFloatWriter.cpp index 7e2b74d..42aac91 100644 --- a/src/DngFloatWriter.cpp +++ b/src/DngFloatWriter.cpp @@ -170,7 +170,7 @@ void DngFloatWriter::createMainIFD() { mainIFD.addEntry(IMAGEDESCRIPTION, params->description); QDateTime currentTime = QDateTime::currentDateTime(); QString currentTimeText = currentTime.toString("yyyy:MM:dd hh:mm:ss"); - mainIFD.addEntry(DATETIME, currentTimeText.toAscii().constData()); + mainIFD.addEntry(DATETIME, currentTimeText.toLatin1().constData()); mainIFD.addEntry(DATETIMEORIGINAL, params->dateTime); // Profile diff --git a/src/EditableMask.cpp b/src/EditableMask.cpp index eea9666..d75de9e 100644 --- a/src/EditableMask.cpp +++ b/src/EditableMask.cpp @@ -71,7 +71,7 @@ QRect EditableMask::modifyLayer(const std::list & points, int layer) { QRect a(points.front(), points.front()); for (auto p : points) { operator()(p.x(), p.y()) = layer; - a = a.unite(QRect(p, p)); + a = a.united(QRect(p, p)); } return a; } diff --git a/src/RawParameters.cpp b/src/RawParameters.cpp index b9d8c6c..17a29a6 100644 --- a/src/RawParameters.cpp +++ b/src/RawParameters.cpp @@ -221,7 +221,7 @@ void RawParameters::fromLibRaw(LibRaw & rawData) { description = r.other.desc; QDateTime dateTimeTmp = QDateTime::fromTime_t(r.other.timestamp); QString dateTimeTmpText = dateTimeTmp.toString("yyyy:MM:dd hh:mm:ss"); - dateTime = dateTimeTmpText.toAscii().constData(); + dateTime = dateTimeTmpText.toLatin1().constData(); flip = r.sizes.flip; switch ((flip + 3600) % 360) { case 270: flip = 5; break; From 7ad52cd540c0a2ae9ac9c158b041218840af0c56 Mon Sep 17 00:00:00 2001 From: Morgan Hardwood Date: Wed, 14 Mar 2018 22:15:18 +0100 Subject: [PATCH 04/12] 4 --- src/MainWindow.cpp | 2 +- src/PreviewWidget.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index 785e00c..de2399c 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -25,7 +25,7 @@ #include "MainWindow.hpp" #include #include -#include +#include #include #include #include diff --git a/src/PreviewWidget.cpp b/src/PreviewWidget.cpp index cfb72d0..db245ee 100644 --- a/src/PreviewWidget.cpp +++ b/src/PreviewWidget.cpp @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include #include #include @@ -136,7 +136,7 @@ QRgb PreviewWidget::rgb(int col, int row) const { void PreviewWidget::render(QRect zone) { if (!stack.size()) return; - zone = zone.intersect(QRect(0, 0, width, height)); + zone = zone.intersected(QRect(0, 0, width, height)); if (zone.isNull()) return; cancelRender = false; QImage image(zone.width(), zone.height(), QImage::Format_RGB32); From 35eb7c5c6c21d7015a22be24de6d7b8cd7eda6a5 Mon Sep 17 00:00:00 2001 From: Morgan Hardwood Date: Thu, 15 Mar 2018 02:17:03 +0100 Subject: [PATCH 05/12] Ported to Qt5, compiles and runs well. --- CMakeLists.txt | 31 ++++++++------------- INSTALL.md | 12 ++++---- README.md | 9 ++++++ appimage/appimage.sh | 4 +-- build-hdrmerge | 2 +- {images => data/images}/draw-brush.png | Bin {images => data/images}/draw-eraser.png | Bin {images => data/images}/icon.icns | Bin {images => data/images}/icon.ico | Bin {images => data/images}/icon.png | Bin {images => data/images}/logo.bmp | Bin {images => data/images}/logo.png | Bin {images => data/images}/logo.svg | 0 {images => data/images}/transform-move.png | Bin data/resources.qrc | 12 ++++---- src/MainWindow.cpp | 2 +- test/CMakeLists.txt | 8 ++++-- 17 files changed, 44 insertions(+), 36 deletions(-) rename {images => data/images}/draw-brush.png (100%) rename {images => data/images}/draw-eraser.png (100%) rename {images => data/images}/icon.icns (100%) rename {images => data/images}/icon.ico (100%) rename {images => data/images}/icon.png (100%) rename {images => data/images}/logo.bmp (100%) rename {images => data/images}/logo.png (100%) rename {images => data/images}/logo.svg (100%) rename {images => data/images}/transform-move.png (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index f00595e..fc69270 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,7 +10,6 @@ if(WIN32) endif() endif() -# Complain about anything, except ignored OpenMP pragma in Debug set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wno-unknown-pragmas") set(PLATFORM "") @@ -19,12 +18,12 @@ set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${PROJECT_SOURCE_DIR}/cmake") # Find includes in corresponding build directories set(CMAKE_INCLUDE_CURRENT_DIR ON) + # Instruct CMake to run moc automatically when needed. set(CMAKE_AUTOMOC ON) -#set(CMAKE_AUTOUIC ON) -#set(CMAKE_AUTORCC ON) -#set(CMAKE_INCLUDE_CURRENT_DIR ON) +# Generate resources automatically +set(CMAKE_AUTORCC ON) find_package(Qt5 5.6 REQUIRED Core Widgets) @@ -34,9 +33,11 @@ add_definitions(${QT_DEFINITIONS}) find_package(LibRaw REQUIRED) find_package(Exiv2 REQUIRED) find_package(ZLIB REQUIRED) -#find_package(Boost 1.46 COMPONENTS unit_test_framework) find_package(OpenMP) +# Commented-out as it doesn't link +#find_package(Boost 1.46 COMPONENTS unit_test_framework) + if(WIN32) set(ALGLIB_INCLUDES ${ALGLIB_ROOT}/src) else() @@ -69,15 +70,13 @@ set(HDRMERGE_VERSION_MINOR 5) set(HDRMERGE_VERSION_REV 0) set(HDRMERGE_VERSION ${HDRMERGE_VERSION_MAJOR}.${HDRMERGE_VERSION_MINOR}.${HDRMERGE_VERSION_REV}) -# configure a header file to pass some of the CMake settings -# to the source code +# configure a header file to pass some of the CMake settings to the source code configure_file( "${PROJECT_SOURCE_DIR}/src/config.h.in" "${PROJECT_BINARY_DIR}/config.h" ) -# add the binary tree to the search path for include files -# so that we will find config.h +# add the binary tree to the search path for include files so that we will find config.h include_directories("${PROJECT_BINARY_DIR}") set(PLATFORM_SOURCES "") @@ -186,8 +185,6 @@ else() ) endif() -# Qt4 intermediate files -#QT4_WRAP_CPP(hdrmerge_moc ${hdrmerge_qobject_headers}) #QT4_ADD_TRANSLATION(hdrmerge_qm ${hdrmerge_translations}) # Generate the XML version of hdrmerge_qm @@ -202,11 +199,6 @@ configure_file( "${PROJECT_BINARY_DIR}/translations.qrc" ) -#QT4_ADD_RESOURCES(hdrmerge_rsrc -# "${PROJECT_BINARY_DIR}/translations.qrc" -# data/resources.qrc -#) - if(WIN32) add_library(alglib-objects OBJECT ${alglib_sources} @@ -217,8 +209,8 @@ if(WIN32) add_executable(hdrmerge ${PLATFORM} src/main.cpp src/Launcher.cpp + data/resources.qrc ${hdrmerge_sources} - ${hdrmerge_rsrc} ${hdrmerge_gui_sources} ${hdrmerge_moc} $ @@ -228,8 +220,9 @@ else() add_executable(hdrmerge ${PLATFORM} src/main.cpp src/Launcher.cpp + data/resources.qrc + ${hdrmerge_translations} ${hdrmerge_sources} - ${hdrmerge_rsrc} ${hdrmerge_gui_sources} ${hdrmerge_moc} "${PLATFORM_SOURCES}" @@ -284,7 +277,7 @@ else() "${PROJECT_BINARY_DIR}/hdrmerge.desktop" ) install(CODE " - execute_process(COMMAND \"${XDG-ICON-RESOURCE_EXECUTABLE}\" install --novendor --size 128 \"${PROJECT_SOURCE_DIR}/images/icon.png\" hdrmerge-icon) + execute_process(COMMAND \"${XDG-ICON-RESOURCE_EXECUTABLE}\" install --novendor --size 128 \"${PROJECT_SOURCE_DIR}/data/images/icon.png\" hdrmerge-icon) execute_process(COMMAND \"${XDG-DESKTOP-MENU_EXECUTABLE}\" install --novendor \"${PROJECT_BINARY_DIR}/hdrmerge.desktop\")" ) endif() diff --git a/INSTALL.md b/INSTALL.md index 77c91e6..40907f9 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -4,13 +4,13 @@ This document explains how to compile HDRMerge. ## Dependencies - [ALGLIB](http://www.alglib.net/) - [Boost](http://www.boost.org/) -- [CMake](https://cmake.org/) +- [CMake](https://cmake.org/) 3.4 - [exiv2](http://www.exiv2.org/) - [gettext](http://www.gnu.org/software/gettext/) - [libexpat](http://expat.sourceforge.net/) - [libiconv](https://www.gnu.org/software/libiconv/) - [LibRaw](http://www.libraw.org/) -- [Qt](http://qt-project.org/) 4.8 +- [Qt](https://www.qt.io/) 5.6 - [zlib](http://www.zlib.net/) Install the dependencies and proceed to the next section. @@ -18,19 +18,19 @@ Install the dependencies and proceed to the next section. ### Arch and derivatives ```bash sudo pacman -Syy -sudo pacman -S --needed cmake libraw pacaur qt4 +sudo pacman -S --needed cmake libraw pacaur qt5 pacaur -S alglib ``` ### Debian/Ubuntu and derivatives ```bash sudo apt update -sudo apt install build-essential cmake git libalglib-dev libboost-all-dev libexiv2-dev libexpat-dev libraw-dev qt4-default zlib1g-dev +sudo apt install build-essential cmake git libalglib-dev libboost-all-dev libexiv2-dev libexpat-dev libraw-dev qt5-default zlib1g-dev ``` ### Gentoo and derivatives ```bash -sudo emerge -uva sci-libs/alglib dev-libs/boost dev-util/cmake media-gfx/exiv2 dev-vcs/git media-libs/libraw sys-devel/gettext dev-libs/expat virtual/libiconv dev-qt/qtcore:4 sys-libs/zlib +sudo emerge -uva sci-libs/alglib dev-libs/boost dev-util/cmake media-gfx/exiv2 dev-vcs/git media-libs/libraw sys-devel/gettext dev-libs/expat virtual/libiconv dev-qt/qtcore:5 sys-libs/zlib ``` ## Compilation in Windows @@ -68,6 +68,7 @@ For the 32-bit version, substitute `x86_64-w64-mingw32` for `i686-w64-mingw32` e You will need to build/download the following libraries: - Qt +_**TODO**: Update to Qt5_ Unpack Qt and build it as: ```bash ./configure -static -xplatform win32-g++ -device-option CROSS_COMPILE=x86_64-w64-mingw32- -prefix $HOME/usr/x86_64-w64-mingw32/Qt-4.8.6-static -opensource -qt-sql-sqlite -no-qt3support -no-xmlpatterns -no-multimedia -no-phonon -no-webkit -no-javascript-jit -no-script -no-scripttools -no-declarative -qt-zlib -qt-libtiff -qt-libpng -qt-libmng -qt-libjpeg -no-openssl -no-nis -no-cups -no-dbus -qt-freetype -make libs -nomake tools -nomake examples -nomake tests -qtlibinfix 4 @@ -109,6 +110,7 @@ libexpat is built with GNU Autoconf: ``` Once you have the dependencies installed, you are ready to compile HDRMerge. +_**TODO**: Is QT_ROOT still valid in Qt5?_ Set the CMake variable `QT_ROOT` to where you have the Qt libraries installed. ```bash diff --git a/README.md b/README.md index f884d30..c33d6cb 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,15 @@ Report bugs by creating a new issue on our GitHub page: https://github.com/jcelaya/hdrmerge/issues ## Changelog: +- v1.0 (not released yet) + - Allow user to specify custom white level in case of artifacts with automatically computed white level from LibRaw. + - Added support for raw files from Fufjifilm X-Trans sensors. + - Speed optimization. + - Assume aperture of f/8 if the aperture is invalid. + - Migrated from Qt4 to Qt5. + - Enable compilation in Windows. + - Documentation updated. + - Repository tree restructured. - v0.5.0: - First Mac OS X build! Thanks to Philip Ries for his help. - Several bug fixes: diff --git a/appimage/appimage.sh b/appimage/appimage.sh index 5deea6a..c201fee 100644 --- a/appimage/appimage.sh +++ b/appimage/appimage.sh @@ -67,7 +67,7 @@ chmod u+x usr/bin/$LOWERAPP #cp ./usr/share/applications/$LOWERAPP.desktop . #sed -i -e "s|gimp-2.9|$LOWERAPP|g" $LOWERAPP.desktop rm -rf ./usr/share/icons/48x48/apps || true -cp $TRAVIS_BUILD_DIR/images/icon.png hdrmerge.png +cp $TRAVIS_BUILD_DIR/data/images/icon.png hdrmerge.png get_apprun @@ -79,7 +79,7 @@ Type=Application Name=HDRMerge AppImage GenericName=HDR raw image merge GenericName[es]=Mezcla de imágenes HDR raw -Comment=Merge several raw images into a single DNG raw image with high dynamic range. +Comment=Merge several raw photos into a single raw DNG with high dynamic range. Comment[es]=Mezcla varias imágenes raw en una única imagen DNG raw de alto rango dinámico. Exec=LOWERAPP %f TryExec=LOWERAPP diff --git a/build-hdrmerge b/build-hdrmerge index d8fe55e..af02950 100755 --- a/build-hdrmerge +++ b/build-hdrmerge @@ -123,7 +123,7 @@ cd "${buildDir}" || exit 1 # ----------------------------------------------------------------------------- # Compile -#export QT_SELECT="qt4" +export QT_SELECT="qt5" cmake \ -DCMAKE_CXX_FLAGS="-std=c++11 -Wno-deprecated-declarations -Wno-unused-result" \ diff --git a/images/draw-brush.png b/data/images/draw-brush.png similarity index 100% rename from images/draw-brush.png rename to data/images/draw-brush.png diff --git a/images/draw-eraser.png b/data/images/draw-eraser.png similarity index 100% rename from images/draw-eraser.png rename to data/images/draw-eraser.png diff --git a/images/icon.icns b/data/images/icon.icns similarity index 100% rename from images/icon.icns rename to data/images/icon.icns diff --git a/images/icon.ico b/data/images/icon.ico similarity index 100% rename from images/icon.ico rename to data/images/icon.ico diff --git a/images/icon.png b/data/images/icon.png similarity index 100% rename from images/icon.png rename to data/images/icon.png diff --git a/images/logo.bmp b/data/images/logo.bmp similarity index 100% rename from images/logo.bmp rename to data/images/logo.bmp diff --git a/images/logo.png b/data/images/logo.png similarity index 100% rename from images/logo.png rename to data/images/logo.png diff --git a/images/logo.svg b/data/images/logo.svg similarity index 100% rename from images/logo.svg rename to data/images/logo.svg diff --git a/images/transform-move.png b/data/images/transform-move.png similarity index 100% rename from images/transform-move.png rename to data/images/transform-move.png diff --git a/data/resources.qrc b/data/resources.qrc index dc76d08..7af9a8d 100644 --- a/data/resources.qrc +++ b/data/resources.qrc @@ -1,9 +1,9 @@ - - ../images/logo.png - ../images/icon.png - ../images/transform-move.png - ../images/draw-brush.png - ../images/draw-eraser.png + + images/logo.png + images/icon.png + images/transform-move.png + images/draw-brush.png + images/draw-eraser.png diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index de2399c..4cb219d 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -72,7 +72,7 @@ MainWindow::MainWindow() : QMainWindow() { createMenus(); setWindowTitle(tr("HDRMerge %1 - Raw image fusion").arg(HDRMERGE_VERSION_STRING)); - setWindowIcon(QIcon(":/images/icon.png")); + setWindowIcon(QIcon(":/icon.png")); QSettings settings; restoreGeometry(settings.value("windowGeometry").toByteArray()); diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index c61c8de..8870e4a 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -11,5 +11,9 @@ set( testDngFloatWriter.cpp ) -add_executable(hdrmerge-test ${test_sources} $ $) -target_link_libraries(hdrmerge-test ${hdrmerge_libs} ${Boost_LIBRARIES}) +#add_executable(hdrmerge-test ${test_sources} $ $) +add_executable(hdrmerge-test + ${test_sources} +) + +target_link_libraries(hdrmerge-test ${hdrmerge_libs} ${Boost_LIBRARIES} Qt5::Widgets) From cd1736c1a44ee812413172d5d9fc22a6294734da Mon Sep 17 00:00:00 2001 From: Benitoite Date: Thu, 15 Mar 2018 03:22:09 -0700 Subject: [PATCH 06/12] Mac build update for Qt5 --- CMakeLists.txt | 47 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fc69270..1a92aa2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,7 @@ cmake_minimum_required(VERSION 3.4) +CMAKE_POLICY(SET CMP0025 NEW) + project(hdrmerge) if(WIN32) @@ -10,6 +12,14 @@ if(WIN32) endif() endif() +if(APPLE) + if(NOT(ALGLIB_ROOT)) + message(FATAL_ERROR "Passage of ALGLIB_ROOT to cmake failed. Download alglib and define its root directory in ALGLIB_ROOT") + else() + message(STATUS "ALGLIB_ROOT = ${ALGLIB_ROOT}") + endif() +endif() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wno-unknown-pragmas") set(PLATFORM "") @@ -155,6 +165,24 @@ if(WIN32) ) endif() +if(APPLE) + set(alglib_sources + ${ALGLIB_ROOT}/src/alglibinternal.cpp + ${ALGLIB_ROOT}/src/alglibmisc.cpp + ${ALGLIB_ROOT}/src/ap.cpp + ${ALGLIB_ROOT}/src/dataanalysis.cpp + ${ALGLIB_ROOT}/src/diffequations.cpp + ${ALGLIB_ROOT}/src/fasttransforms.cpp + ${ALGLIB_ROOT}/src/integration.cpp + ${ALGLIB_ROOT}/src/interpolation.cpp + ${ALGLIB_ROOT}/src/linalg.cpp + ${ALGLIB_ROOT}/src/optimization.cpp + ${ALGLIB_ROOT}/src/solvers.cpp + ${ALGLIB_ROOT}/src/specialfunctions.cpp + ${ALGLIB_ROOT}/src/statistics.cpp + ) +endif() + # Libs set(hdrmerge_libs "${LibRaw_r_LIBRARIES}" @@ -205,6 +233,12 @@ if(WIN32) ) endif() +if(APPLE) + add_library(alglib-objects OBJECT + ${alglib_sources} + ) +endif() + if(WIN32) add_executable(hdrmerge ${PLATFORM} src/main.cpp @@ -216,6 +250,17 @@ if(WIN32) $ "${PLATFORM_SOURCES}" ) +elseif(APPLE) + add_executable(hdrmerge ${PLATFORM} + src/main.cpp + src/Launcher.cpp + $ + ${hdrmerge_translations} + ${hdrmerge_sources} + ${hdrmerge_gui_sources} + ${hdrmerge_moc} + "${PLATFORM_SOURCES}" + ) else() add_executable(hdrmerge ${PLATFORM} src/main.cpp @@ -262,7 +307,7 @@ if(WIN32) endif() elseif(APPLE) set_source_files_properties(images/icon.icns PROPERTIES MACOSX_PACKAGE_LOCATION "Resources") - install(TARGETS hdrmerge BUNDLE DESTINATION "/Applications") + install(TARGETS hdrmerge BUNDLE DESTINATION ${CMAKE_INSTALL_BINDIR}) else() if(NOT DEFINED CMAKE_INSTALL_BINDIR) set(CMAKE_INSTALL_BINDIR "bin") From a14c76856fe40de48b96997fd25a59919ac623c5 Mon Sep 17 00:00:00 2001 From: Benitoite Date: Thu, 15 Mar 2018 03:28:34 -0700 Subject: [PATCH 07/12] Update test/CMakeLists.txt for Mac build --- test/CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 8870e4a..6fe9743 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -16,4 +16,8 @@ add_executable(hdrmerge-test ${test_sources} ) -target_link_libraries(hdrmerge-test ${hdrmerge_libs} ${Boost_LIBRARIES} Qt5::Widgets) +if(APPLE) + target_link_libraries(hdrmerge-test ${hdrmerge_libs} alglib-objects ${Boost_LIBRARIES} Qt5::Widgets) +else() + target_link_libraries(hdrmerge-test ${hdrmerge_libs} ${Boost_LIBRARIES} Qt5::Widgets) +endif() From e1166be17d1e1dc1b72c9028b541f637282a7dd1 Mon Sep 17 00:00:00 2001 From: Benitoite Date: Thu, 15 Mar 2018 04:20:28 -0700 Subject: [PATCH 08/12] Mac: Point to data/images in CMakeLists.txt --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1a92aa2..b241d25 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -108,7 +108,7 @@ elseif(APPLE) set(MACOSX_BUNDLE_SHORT_VERSION_STRING "${HDRMERGE_VERSION}") set(MACOSX_BUNDLE_BUNDLE_VERSION "${HDRMERGE_VERSION}") set(MACOSX_BUNDLE_INFO_COPYRIGHT "Copyright 2018 Javier Celaya") - set(PLATFORM_SOURCES "images/icon.icns") + set(PLATFORM_SOURCES "data/images/icon.icns") endif() # Sources and headers From bba76ca719854d614ed19c5011aa66ada56c6ad1 Mon Sep 17 00:00:00 2001 From: Morgan Hardwood Date: Fri, 16 Mar 2018 13:52:31 +0100 Subject: [PATCH 09/12] CMake files formatted. --- CMakeLists.txt | 54 ++++++++++++++++++++++----------------------- test/CMakeLists.txt | 4 ++-- 2 files changed, 29 insertions(+), 29 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b241d25..f2306e4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.4) -CMAKE_POLICY(SET CMP0025 NEW) +cmake_policy(SET CMP0025 NEW) project(hdrmerge) @@ -59,7 +59,7 @@ include_directories( "${EXIV2_INCLUDE_DIR}" "${ZLIB_INCLUDE_DIRS}" "${ALGLIB_INCLUDES}" -) + ) if(NOT(CMAKE_BUILD_TYPE)) set(CMAKE_BUILD_TYPE Release) @@ -84,7 +84,7 @@ set(HDRMERGE_VERSION ${HDRMERGE_VERSION_MAJOR}.${HDRMERGE_VERSION_MINOR}.${HDRME configure_file( "${PROJECT_SOURCE_DIR}/src/config.h.in" "${PROJECT_BINARY_DIR}/config.h" -) + ) # add the binary tree to the search path for include files so that we will find config.h include_directories("${PROJECT_BINARY_DIR}") @@ -97,7 +97,7 @@ if(WIN32) configure_file( "${PROJECT_SOURCE_DIR}/data/winres.rc" "${PROJECT_BINARY_DIR}/winres.rc" - ) + ) set(PLATFORM_SOURCES "${PROJECT_BINARY_DIR}/winres.rc") elseif(APPLE) set(PLATFORM MACOSX_BUNDLE) @@ -123,7 +123,7 @@ set(hdrmerge_sources src/BoxBlur.cpp src/ExifTransfer.cpp src/ImageIO.cpp -) + ) set(hdrmerge_gui_sources src/AboutDialog.cpp @@ -132,7 +132,7 @@ set(hdrmerge_gui_sources src/DraggableScrollArea.cpp src/DngPropertiesDialog.cpp src/LoadOptionsDialog.cpp -) + ) set(hdrmerge_qobject_headers src/MainWindow.hpp @@ -141,11 +141,11 @@ set(hdrmerge_qobject_headers src/DraggableScrollArea.hpp src/DngPropertiesDialog.hpp src/AboutDialog.hpp -) + ) set(hdrmerge_translations data/hdrmerge_es.ts -) + ) if(WIN32) set(alglib_sources @@ -162,7 +162,7 @@ if(WIN32) ${ALGLIB_ROOT}/src/solvers.cpp ${ALGLIB_ROOT}/src/specialfunctions.cpp ${ALGLIB_ROOT}/src/statistics.cpp - ) + ) endif() if(APPLE) @@ -180,7 +180,7 @@ if(APPLE) ${ALGLIB_ROOT}/src/solvers.cpp ${ALGLIB_ROOT}/src/specialfunctions.cpp ${ALGLIB_ROOT}/src/statistics.cpp - ) + ) endif() # Libs @@ -188,7 +188,7 @@ set(hdrmerge_libs "${LibRaw_r_LIBRARIES}" "${EXIV2_LIBRARY}" "${ZLIB_LIBRARIES}" -) + ) if(WIN32) get_filename_component(LIB_PATH "${EXIV2_LIBRARY}" PATH) @@ -204,13 +204,13 @@ if(WIN32) wsock32 imm32 winmm - ) + ) remove_definitions(-DQT_DLL) else() set(hdrmerge_libs "${hdrmerge_libs}" "${ALGLIB_LIBRARIES}" - ) + ) endif() #QT4_ADD_TRANSLATION(hdrmerge_qm ${hdrmerge_translations}) @@ -219,24 +219,24 @@ endif() foreach(file ${hdrmerge_qm}) get_filename_component(basename ${file} NAME) set(HDRMERGE_QM_XML "${HDRMERGE_QM_XML} - ${basename}") + ${basename}") endforeach() configure_file( "${PROJECT_SOURCE_DIR}/data/translations.qrc.in" "${PROJECT_BINARY_DIR}/translations.qrc" -) + ) if(WIN32) add_library(alglib-objects OBJECT ${alglib_sources} - ) + ) endif() if(APPLE) add_library(alglib-objects OBJECT ${alglib_sources} - ) + ) endif() if(WIN32) @@ -249,7 +249,7 @@ if(WIN32) ${hdrmerge_moc} $ "${PLATFORM_SOURCES}" - ) + ) elseif(APPLE) add_executable(hdrmerge ${PLATFORM} src/main.cpp @@ -259,8 +259,8 @@ elseif(APPLE) ${hdrmerge_sources} ${hdrmerge_gui_sources} ${hdrmerge_moc} - "${PLATFORM_SOURCES}" - ) + "${PLATFORM_SOURCES}" + ) else() add_executable(hdrmerge ${PLATFORM} src/main.cpp @@ -271,7 +271,7 @@ else() ${hdrmerge_gui_sources} ${hdrmerge_moc} "${PLATFORM_SOURCES}" - ) + ) endif() target_link_libraries(hdrmerge ${STRIP} ${hdrmerge_libs} Qt5::Widgets) @@ -284,7 +284,7 @@ if(WIN32) $ $ "${PLATFORM_SOURCES}" - ) + ) target_link_libraries(hdrmerge-nogui ${STRIP} ${hdrmerge_libs}) set_target_properties(hdrmerge-nogui PROPERTIES COMPILE_DEFINITIONS "NO_GUI") # Create the installer with makensis @@ -295,7 +295,7 @@ if(WIN32) 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 @@ -320,12 +320,12 @@ else() configure_file( "${PROJECT_SOURCE_DIR}/data/hdrmerge.desktop" "${PROJECT_BINARY_DIR}/hdrmerge.desktop" - ) + ) install(CODE " - execute_process(COMMAND \"${XDG-ICON-RESOURCE_EXECUTABLE}\" install --novendor --size 128 \"${PROJECT_SOURCE_DIR}/data/images/icon.png\" hdrmerge-icon) - execute_process(COMMAND \"${XDG-DESKTOP-MENU_EXECUTABLE}\" install --novendor \"${PROJECT_BINARY_DIR}/hdrmerge.desktop\")" + execute_process(COMMAND \"${XDG-ICON-RESOURCE_EXECUTABLE}\" install --novendor --size 128 \"${PROJECT_SOURCE_DIR}/data/images/icon.png\" hdrmerge-icon) + execute_process(COMMAND \"${XDG-DESKTOP-MENU_EXECUTABLE}\" install --novendor \"${PROJECT_BINARY_DIR}/hdrmerge.desktop\")" ) - endif() +endif() endif() if(Boost_FOUND) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 6fe9743..15cae8c 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -9,12 +9,12 @@ set( testBoxBlur.cpp testArray2D.cpp testDngFloatWriter.cpp -) + ) #add_executable(hdrmerge-test ${test_sources} $ $) add_executable(hdrmerge-test ${test_sources} -) + ) if(APPLE) target_link_libraries(hdrmerge-test ${hdrmerge_libs} alglib-objects ${Boost_LIBRARIES} Qt5::Widgets) From 7dc4fe3043faf73a08605ae96e37f7c799ca684e Mon Sep 17 00:00:00 2001 From: Morgan Hardwood Date: Mon, 19 Mar 2018 13:53:30 +0100 Subject: [PATCH 10/12] Fixes indentation of incorrectly auto-formatted lines --- CMakeLists.txt | 52 +++++++++++++++++++++++--------------------------- 1 file changed, 24 insertions(+), 28 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f2306e4..1ae865e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -59,7 +59,7 @@ include_directories( "${EXIV2_INCLUDE_DIR}" "${ZLIB_INCLUDE_DIRS}" "${ALGLIB_INCLUDES}" - ) +) if(NOT(CMAKE_BUILD_TYPE)) set(CMAKE_BUILD_TYPE Release) @@ -84,7 +84,7 @@ set(HDRMERGE_VERSION ${HDRMERGE_VERSION_MAJOR}.${HDRMERGE_VERSION_MINOR}.${HDRME configure_file( "${PROJECT_SOURCE_DIR}/src/config.h.in" "${PROJECT_BINARY_DIR}/config.h" - ) +) # add the binary tree to the search path for include files so that we will find config.h include_directories("${PROJECT_BINARY_DIR}") @@ -97,7 +97,7 @@ if(WIN32) configure_file( "${PROJECT_SOURCE_DIR}/data/winres.rc" "${PROJECT_BINARY_DIR}/winres.rc" - ) + ) set(PLATFORM_SOURCES "${PROJECT_BINARY_DIR}/winres.rc") elseif(APPLE) set(PLATFORM MACOSX_BUNDLE) @@ -123,7 +123,7 @@ set(hdrmerge_sources src/BoxBlur.cpp src/ExifTransfer.cpp src/ImageIO.cpp - ) +) set(hdrmerge_gui_sources src/AboutDialog.cpp @@ -132,7 +132,7 @@ set(hdrmerge_gui_sources src/DraggableScrollArea.cpp src/DngPropertiesDialog.cpp src/LoadOptionsDialog.cpp - ) +) set(hdrmerge_qobject_headers src/MainWindow.hpp @@ -141,11 +141,11 @@ set(hdrmerge_qobject_headers src/DraggableScrollArea.hpp src/DngPropertiesDialog.hpp src/AboutDialog.hpp - ) +) set(hdrmerge_translations data/hdrmerge_es.ts - ) +) if(WIN32) set(alglib_sources @@ -162,7 +162,7 @@ if(WIN32) ${ALGLIB_ROOT}/src/solvers.cpp ${ALGLIB_ROOT}/src/specialfunctions.cpp ${ALGLIB_ROOT}/src/statistics.cpp - ) + ) endif() if(APPLE) @@ -180,7 +180,7 @@ if(APPLE) ${ALGLIB_ROOT}/src/solvers.cpp ${ALGLIB_ROOT}/src/specialfunctions.cpp ${ALGLIB_ROOT}/src/statistics.cpp - ) + ) endif() # Libs @@ -188,7 +188,7 @@ set(hdrmerge_libs "${LibRaw_r_LIBRARIES}" "${EXIV2_LIBRARY}" "${ZLIB_LIBRARIES}" - ) +) if(WIN32) get_filename_component(LIB_PATH "${EXIV2_LIBRARY}" PATH) @@ -204,13 +204,13 @@ if(WIN32) wsock32 imm32 winmm - ) + ) remove_definitions(-DQT_DLL) else() set(hdrmerge_libs "${hdrmerge_libs}" "${ALGLIB_LIBRARIES}" - ) + ) endif() #QT4_ADD_TRANSLATION(hdrmerge_qm ${hdrmerge_translations}) @@ -225,18 +225,14 @@ endforeach() configure_file( "${PROJECT_SOURCE_DIR}/data/translations.qrc.in" "${PROJECT_BINARY_DIR}/translations.qrc" - ) +) if(WIN32) - add_library(alglib-objects OBJECT - ${alglib_sources} - ) + add_library(alglib-objects OBJECT ${alglib_sources}) endif() if(APPLE) - add_library(alglib-objects OBJECT - ${alglib_sources} - ) + add_library(alglib-objects OBJECT ${alglib_sources}) endif() if(WIN32) @@ -249,7 +245,7 @@ if(WIN32) ${hdrmerge_moc} $ "${PLATFORM_SOURCES}" - ) + ) elseif(APPLE) add_executable(hdrmerge ${PLATFORM} src/main.cpp @@ -260,7 +256,7 @@ elseif(APPLE) ${hdrmerge_gui_sources} ${hdrmerge_moc} "${PLATFORM_SOURCES}" - ) + ) else() add_executable(hdrmerge ${PLATFORM} src/main.cpp @@ -271,7 +267,7 @@ else() ${hdrmerge_gui_sources} ${hdrmerge_moc} "${PLATFORM_SOURCES}" - ) + ) endif() target_link_libraries(hdrmerge ${STRIP} ${hdrmerge_libs} Qt5::Widgets) @@ -284,7 +280,7 @@ if(WIN32) $ $ "${PLATFORM_SOURCES}" - ) + ) target_link_libraries(hdrmerge-nogui ${STRIP} ${hdrmerge_libs}) set_target_properties(hdrmerge-nogui PROPERTIES COMPILE_DEFINITIONS "NO_GUI") # Create the installer with makensis @@ -295,7 +291,7 @@ if(WIN32) 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 @@ -320,12 +316,12 @@ else() configure_file( "${PROJECT_SOURCE_DIR}/data/hdrmerge.desktop" "${PROJECT_BINARY_DIR}/hdrmerge.desktop" - ) + ) install(CODE " - execute_process(COMMAND \"${XDG-ICON-RESOURCE_EXECUTABLE}\" install --novendor --size 128 \"${PROJECT_SOURCE_DIR}/data/images/icon.png\" hdrmerge-icon) - execute_process(COMMAND \"${XDG-DESKTOP-MENU_EXECUTABLE}\" install --novendor \"${PROJECT_BINARY_DIR}/hdrmerge.desktop\")" + execute_process(COMMAND \"${XDG-ICON-RESOURCE_EXECUTABLE}\" install --novendor --size 128 \"${PROJECT_SOURCE_DIR}/data/images/icon.png\" hdrmerge-icon) + execute_process(COMMAND \"${XDG-DESKTOP-MENU_EXECUTABLE}\" install --novendor \"${PROJECT_BINARY_DIR}/hdrmerge.desktop\")" ) -endif() + endif() endif() if(Boost_FOUND) From ce5e095b4fd347337744c6b31a764bded8460c39 Mon Sep 17 00:00:00 2001 From: Hombre Date: Mon, 26 Mar 2018 22:40:17 +0200 Subject: [PATCH 11/12] 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 12/12] 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);