diff --git a/CMakeLists.txt b/CMakeLists.txt index 274aa7d..430535d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -42,13 +42,12 @@ find_package (Qt5Xml 5.4 REQUIRED) find_package (Qt5Svg 5.4 REQUIRED) find_package (Qt5LinguistTools) -if (MINGW) +if (WIN32) # Locate Qt directories execute_process (COMMAND qtpaths --install-prefix OUTPUT_VARIABLE QT_BASE_DIR OUTPUT_STRIP_TRAILING_WHITESPACE) set (QT_BIN_DIR ${QT_BASE_DIR}/bin) endif () - # # Optional dependencies # @@ -131,6 +130,10 @@ else (Qt5Test_FOUND) message (STATUS "QtTest (optional)........ No.") endif (Qt5Test_FOUND) +if (MSVC) + message (STATUS "MSVC Qt location ........ " ${QT_BASE_DIR}) +endif (MSVC) + if (MINGW) message (STATUS "MinGW location .......... " ${MINGW_BASE_DIR}) message (STATUS "MinGW Qt location ....... " ${QT_BASE_DIR}) diff --git a/README.md b/README.md index bf763e8..29d796c 100644 --- a/README.md +++ b/README.md @@ -15,9 +15,9 @@ gLabels-qt is the development version of the next major version of gLabels (4.0) ## What's new in gLabels-qt? - Based on the Qt5 framework. -- Unlike previous versions, glabels-qt is a cross-platform application. - * So far, it has been built and tested under both Linux and Windows 7 (using MSYS/MINGW toolchain). - Updated UI based on typical workflows. +- Intended to be a cross-platform application. + * So far, it has been built and tested under both Linux, Windows 7, and Windows 10. (Windows testing is still very intermittent.) ## Status @@ -62,7 +62,7 @@ expect compatability or consistency of features between snapshots. * Help is needed to add support to build and package glabels for various platforms and packaging systems. These include - - Windows (VisualStudio) + - Windows (VisualStudio) - Windows (MINGW) - Mac - Linux (flatpak) diff --git a/docs/BUILD-INSTRUCTIONS-WINDOWS.md b/docs/BUILD-INSTRUCTIONS-WINDOWS.md index 42108eb..a710e1c 100644 --- a/docs/BUILD-INSTRUCTIONS-WINDOWS.md +++ b/docs/BUILD-INSTRUCTIONS-WINDOWS.md @@ -15,27 +15,35 @@ MSYS/MINGW - MSYS/MINGW, including the following packages + mingw32-gcc-g++ + mingw32-libz -- CMake 2.8.12+ -- Qt5 5.4+ for MINGW +- CMake 3.2+ +- Qt5 5.9+ for MINGW -Make sure that Qt tools are in your executable search path. For example, add something like this to your .profile file: +Make sure that Qt tools and CMake are in your executable search path. For example, add something like this to your .profile file: ``` -export PATH=/c/Qt/Qt5.6.0/5.6/mingw49_32/bin:${PATH} +export PATH=/c/Qt/5.9.3/mingw53_32/bin:${PATH} +export PATH="/c/Program Files/CMake/bin":${PATH} ``` -The exact path will depend on the version of Qt and MINGW you have installed. +The exact paths will depend on the version of Qt and CMake you have installed. ### Compile and Install -gLabels uses the CMake meta build system. From the MSYS shell, type the following commands: +From an MSYS shell, type the following commands:
 $ cd glabels_source_directory
 $ mkdir build
 $ cd build
 $ cmake -G "MSYS Makefiles" ..
+$ make
+
+ +To install glabels, run an MSYS shell `as administrator`, and type the following commands: + +
+$ cd glabels_source_directory/build
 $ make install
 
@@ -44,4 +52,37 @@ $ make install Visual Studio ------------- -TBD \ No newline at end of file +### Prerequisites + +- Visual Studio (these instructions are for _Visual Studio 15 2017 Win64_) +- CMake 3.2+ +- Qt5 5.9+ for your version of Visual Studio + +Make sure that CMake and the Qt tools are in your executable search path. For example, you may need to add something like the following to your PATH environment variable: + +``` +c:\Program Files\CMake\bin +c:\Qt\5.9.3\msvc2017_64\bin +``` + +The exact paths will depend on the version of Qt and CMake you have installed. + +### Compile and Install + +From a Windows Power Shell, use CMake to create and build a Visual Studio Solution: + +
+> cd glabels_source_directory
+> mkdir build
+> cd build
+> cmake -G "Visual Studio 15 2017 Win64" -DCMAKE_PREFIX_PATH="c:\qt\5.9.3\msvc2017_64" ..
+> cmake --build . --config Release 
+
+ +To install, run a Windows Power Shell `as administrator`, and type the following commands: + +
+> cd glabels_source_directory/build
+> cmake --build . --config Release --target INSTALL
+
+ diff --git a/glabels/CMakeLists.txt b/glabels/CMakeLists.txt index d18be0d..30aa1cd 100644 --- a/glabels/CMakeLists.txt +++ b/glabels/CMakeLists.txt @@ -132,19 +132,67 @@ install (FILES icons/16x16/mimetypes/x-glabels-project.svg DESTINATION share/ install (FILES icons/22x22/mimetypes/x-glabels-project.svg DESTINATION share/icons/hicolor/22x22/mimetypes) install (FILES icons/24x24/mimetypes/x-glabels-project.svg DESTINATION share/icons/hicolor/24x24/mimetypes) -if (MINGW) - # Install Windows runtime DLLs in application bin - set (runtime_dlls - ${MINGW_BIN_DIR}/libgcc_s_dw2-1.dll - ${MINGW_BIN_DIR}/libstdc++-6.dll - ${MINGW_BIN_DIR}/zlib1.dll - ${QT_BIN_DIR}/libwinpthread-1.dll - ${QT_BIN_DIR}/Qt5Core.dll - ${QT_BIN_DIR}/Qt5Gui.dll - ${QT_BIN_DIR}/Qt5PrintSupport.dll - ${QT_BIN_DIR}/Qt5Widgets.dll - ${QT_BIN_DIR}/Qt5Svg.dll - ${QT_BIN_DIR}/Qt5Xml.dll - ) - install (FILES ${runtime_dlls} DESTINATION bin) -endif () +# +# Windows Runtime +# +if (WIN32) + + find_program (WINDEPLOYQT_EXECUTABLE windeployqt HINTS "${QT_BIN_DIR}") + + # + # Visual Studio toolchain + # + if (MSVC) + # Run windeployqt immediately after build + add_custom_command (TARGET glabels-qt POST_BUILD + COMMAND "${CMAKE_COMMAND}" -E + env PATH="${QT_BIN_DIR}" "${WINDEPLOYQT_EXECUTABLE}" + --verbose 0 + --no-compiler-runtime + --no-angle + --no-opengl-sw + \"$\" + ) + + # Install files staged by windeployqt + install (DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/$/ DESTINATION bin + FILES_MATCHING PATTERN *.dll PATTERN *.qm) + + # Install necessary system libraries + set (CMAKE_INSTALL_UCRT_LIBRARIES TRUE) + include (InstallRequiredSystemLibraries) + endif (MSVC) + + # + # MSYS/MINGW toolchain + # + if (MINGW) + # Run windeployqt immediately after build + add_custom_command (TARGET glabels-qt POST_BUILD + COMMAND "${CMAKE_COMMAND}" -E + env PATH="${QT_BIN_DIR}" "${WINDEPLOYQT_EXECUTABLE}" + --verbose 0 + --release + --no-compiler-runtime + --no-angle + --no-opengl-sw + \"$\" + ) + + # Install files staged by windeployqt + install (DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/$/ DESTINATION bin + FILES_MATCHING PATTERN *.dll PATTERN *.qm) + + # Install necessary system libraries + install (FILES + ${QT_BIN_DIR}/libgcc_s_dw2-1.dll + ${QT_BIN_DIR}/libstdc++-6.dll + ${QT_BIN_DIR}/libwinpthread-1.dll + DESTINATION bin + ) + if (ZLIB_FOUND) + install (FILES ${MINGW_BIN_DIR}/zlib1.dll DESTINATION bin) + endif () + endif (MINGW) + +endif (WIN32)