From 3776224fd28bd7e0c78617d73696753219e8d272 Mon Sep 17 00:00:00 2001 From: Alexander Neumann <30894796+Neumann-A@users.noreply.github.com> Date: Thu, 17 Nov 2022 09:35:23 +0100 Subject: [PATCH] [qwt|vcpkg-qmake] Update and switch to Qt6 (#22012) --- .../ports/vcpkg-qmake/vcpkg_qmake_build.md | 27 +++ .../vcpkg-qmake/vcpkg_qmake_configure.md | 3 +- .../ports/vcpkg-qmake/vcpkg_qmake_install.md | 20 ++ ports/qwt/config.patch | 187 ++++++++++++++++++ ports/qwt/fix-dynamic-static.patch | 15 -- ports/qwt/fix_dll_install.patch | 28 +++ ports/qwt/portfile.cmake | 50 +++-- ports/qwt/vcpkg.json | 21 +- ports/vcpkg-qmake/portfile.cmake | 3 + ports/vcpkg-qmake/vcpkg-port-config.cmake | 3 + ports/vcpkg-qmake/vcpkg.json | 3 +- ports/vcpkg-qmake/vcpkg_qmake_build.cmake | 72 +++++++ ports/vcpkg-qmake/vcpkg_qmake_configure.cmake | 63 ++++-- ports/vcpkg-qmake/vcpkg_qmake_install.cmake | 46 +++++ .../z_vcpkg_qmake_fix_makefiles.cmake | 28 +++ versions/baseline.json | 8 +- versions/q-/qwt.json | 5 + versions/v-/vcpkg-qmake.json | 5 + 18 files changed, 512 insertions(+), 75 deletions(-) create mode 100644 docs/maintainers/ports/vcpkg-qmake/vcpkg_qmake_build.md create mode 100644 docs/maintainers/ports/vcpkg-qmake/vcpkg_qmake_install.md create mode 100644 ports/qwt/config.patch delete mode 100644 ports/qwt/fix-dynamic-static.patch create mode 100644 ports/qwt/fix_dll_install.patch create mode 100644 ports/vcpkg-qmake/vcpkg_qmake_build.cmake create mode 100644 ports/vcpkg-qmake/vcpkg_qmake_install.cmake create mode 100644 ports/vcpkg-qmake/z_vcpkg_qmake_fix_makefiles.cmake diff --git a/docs/maintainers/ports/vcpkg-qmake/vcpkg_qmake_build.md b/docs/maintainers/ports/vcpkg-qmake/vcpkg_qmake_build.md new file mode 100644 index 0000000000..92171c977c --- /dev/null +++ b/docs/maintainers/ports/vcpkg-qmake/vcpkg_qmake_build.md @@ -0,0 +1,27 @@ +# vcpkg_qmake_build + +The latest version of this document lives in the [vcpkg repo](https://github.com/Microsoft/vcpkg/blob/master/docs/maintainers/ports/vcpkg-qmake/vcpkg_qmake_build.md). + +Build a qmake-based project, previously configured using vcpkg_qmake_configure. + +```cmake +vcpkg_qmake_configure( + [SKIP_MAKEFILES] + [BUILD_LOGNAME arg1] + [TARGETS arg1 [arg2 ...]] + [RELEASE_TARGETS arg1 [arg2 ...]] + [DEBUG_TARGETS arg1 [arg2 ...]] +) +``` + +### SKIP_MAKEFILES +Skip the generation of makefiles + +### BUILD_LOGNAME +Configuration independent prefix for the build log files (default:'build') + +### TARGETS, RELEASE\_TARGETS, DEBUG\_TARGETS +Targets to build for a certain configuration. + +## Source +[ports/vcpkg-qmake/vcpkg\_qmake\_configure.cmake](https://github.com/Microsoft/vcpkg/blob/master/ports/vcpkg-qmake/vcpkg_qmake_build.cmake) diff --git a/docs/maintainers/ports/vcpkg-qmake/vcpkg_qmake_configure.md b/docs/maintainers/ports/vcpkg-qmake/vcpkg_qmake_configure.md index 4130426579..6ad2384c33 100644 --- a/docs/maintainers/ports/vcpkg-qmake/vcpkg_qmake_configure.md +++ b/docs/maintainers/ports/vcpkg-qmake/vcpkg_qmake_configure.md @@ -8,6 +8,7 @@ Configure a qmake-based project. VCPKG_OSX_DEPLOYMENT_TARGET: Determines QMAKE_MACOSX_DEPLOYMENT_TARGET VCPKG_QMAKE_COMMAND: Path to qmake. (default: "${CURRENT_HOST_INSTALLED_DIR}/tools/Qt6/bin/qmake${VCPKG_HOST_EXECUTABLE_SUFFIX}") VCPKG_QT_CONF_(RELEASE|DEBUG): Path to qt.config being used for RELEASE/DEBUG. (default: "${CURRENT_INSTALLED_DIR}/tools/Qt6/qt_(release|debug).conf") +VCPKG_QT_TARGET_MKSPEC: Qt mkspec to use VCPKG_QMAKE_OPTIONS(_RELEASE|_DEBUG)?: Extra options to pass to QMake ```cmake @@ -26,7 +27,7 @@ vcpkg_qmake_configure( The path to the *.pro qmake project file. ### QMAKE_OPTIONS, QMAKE_OPTIONS\_RELEASE, QMAKE_OPTIONS\_DEBUG -options directly passed to qmake with the form QMAKE_X=something or CONFIG=something +options directly passed to qmake with the form QMAKE_X=something or CONFIG=something ### OPTIONS, OPTIONS\_RELEASE, OPTIONS\_DEBUG The options passed after -- to qmake. diff --git a/docs/maintainers/ports/vcpkg-qmake/vcpkg_qmake_install.md b/docs/maintainers/ports/vcpkg-qmake/vcpkg_qmake_install.md new file mode 100644 index 0000000000..55ef586046 --- /dev/null +++ b/docs/maintainers/ports/vcpkg-qmake/vcpkg_qmake_install.md @@ -0,0 +1,20 @@ +# vcpkg_qmake_install + +The latest version of this document lives in the [vcpkg repo](https://github.com/Microsoft/vcpkg/blob/master/docs/maintainers/ports/vcpkg-qmake/vcpkg_qmake_install.md). + +Build and install a qmake project. + + +```cmake +vcpkg_qmake_install(...) +``` + +### Parameters: +See [`vcpkg_qmake_build()`](vcpkg_qmake_build.md). + +### Notes: +This command transparently forwards to [`vcpkg_qmake_build()`](vcpkg_qmake_build.md) +and appends the 'install' target + +## Source +[ports/vcpkg-qmake/vcpkg\_qmake\_configure.cmake](https://github.com/Microsoft/vcpkg/blob/master/ports/vcpkg-qmake/vcpkg_qmake_install.cmake) diff --git a/ports/qwt/config.patch b/ports/qwt/config.patch new file mode 100644 index 0000000000..410af313a0 --- /dev/null +++ b/ports/qwt/config.patch @@ -0,0 +1,187 @@ +diff --git a/designer/designer.pro b/designer/designer.pro +index fa4d8c7fd..ce3f82081 100644 +--- a/designer/designer.pro ++++ b/designer/designer.pro +@@ -23,8 +23,8 @@ CONFIG( debug_and_release ) { + + message("debug_and_release: building the Qwt designer plugin in release mode only") + +- CONFIG -= debug_and_release +- CONFIG += release ++ # CONFIG -= debug_and_release ++ # CONFIG += release + } + + contains(QWT_CONFIG, QwtDesigner ) { +diff --git a/qwtbuild.pri b/qwtbuild.pri +index 9306b6ed0..5b51218b6 100644 +--- a/qwtbuild.pri ++++ b/qwtbuild.pri +@@ -54,12 +54,12 @@ win32 { + # might need a debug version. + # Enable debug_and_release + build_all if you want to build both. + +- CONFIG += debug_and_release +- CONFIG += build_all ++ # CONFIG += debug_and_release ++ # CONFIG += build_all + } + else { + +- CONFIG += release ++ # CONFIG += release + + VER_MAJ = $${QWT_VER_MAJ} + VER_MIN = $${QWT_VER_MIN} +diff --git a/qwtconfig.pri b/qwtconfig.pri +index 7da1485a0..b69b5ca71 100644 +--- a/qwtconfig.pri ++++ b/qwtconfig.pri +@@ -19,18 +19,19 @@ QWT_VERSION = $${QWT_VER_MAJ}.$${QWT_VER_MIN}.$${QWT_VER_PAT} + QWT_INSTALL_PREFIX = $$[QT_INSTALL_PREFIX] + + unix { +- QWT_INSTALL_PREFIX = /usr/local/qwt-$$QWT_VERSION-dev ++ # QWT_INSTALL_PREFIX = /usr/local/qwt-$$QWT_VERSION-dev + # QWT_INSTALL_PREFIX = /usr/local/qwt-$$QWT_VERSION-dev-qt-$$QT_VERSION + } + + win32 { +- QWT_INSTALL_PREFIX = C:/Qwt-$$QWT_VERSION-dev ++ # QWT_INSTALL_PREFIX = C:/Qwt-$$QWT_VERSION-dev + # QWT_INSTALL_PREFIX = C:/Qwt-$$QWT_VERSION-dev-qt-$$QT_VERSION + } + +-QWT_INSTALL_DOCS = $${QWT_INSTALL_PREFIX}/doc ++QWT_INSTALL_DOCS = $$[QT_INSTALL_DOCS]/doc +-QWT_INSTALL_HEADERS = $${QWT_INSTALL_PREFIX}/include ++QWT_INSTALL_HEADERS = $${QWT_INSTALL_PREFIX}/include/qwt +-QWT_INSTALL_LIBS = $${QWT_INSTALL_PREFIX}/lib ++QWT_INSTALL_LIBS = $$[QT_INSTALL_LIBS] ++QWT_INSTALL_BINS = $$[QT_INSTALL_BINS] + + ###################################################################### + # Designer plugin +@@ -42,7 +43,7 @@ QWT_INSTALL_LIBS = $${QWT_INSTALL_PREFIX}/lib + # runtime environment of designer/creator. + ###################################################################### + +-QWT_INSTALL_PLUGINS = $${QWT_INSTALL_PREFIX}/plugins/designer ++QWT_INSTALL_PLUGINS = $$[QT_INSTALL_PLUGINS]/designer + + # linux distributors often organize the Qt installation + # their way and QT_INSTALL_PREFIX doesn't offer a good +@@ -63,7 +64,7 @@ QWT_INSTALL_PLUGINS = $${QWT_INSTALL_PREFIX}/plugins/designer + # with every Qt upgrade. + ###################################################################### + +-QWT_INSTALL_FEATURES = $${QWT_INSTALL_PREFIX}/features ++QWT_INSTALL_FEATURES = $$[QT_INSTALL_DATA]/mkspecs/features + # QWT_INSTALL_FEATURES = $$[QT_INSTALL_PREFIX]/features + + ###################################################################### +@@ -72,7 +73,7 @@ QWT_INSTALL_FEATURES = $${QWT_INSTALL_PREFIX}/features + # it will be a static library. + ###################################################################### + +-QWT_CONFIG += QwtDll ++# QWT_CONFIG += QwtDll + + ###################################################################### + # QwtPlot enables all classes, that are needed to use the QwtPlot +@@ -114,7 +115,7 @@ QWT_CONFIG += QwtOpenGL + # Otherwise you have to build it from the designer directory. + ###################################################################### + +-QWT_CONFIG += QwtDesigner ++# QWT_CONFIG += QwtDesigner + + ###################################################################### + # Compile all Qwt classes into the designer plugin instead +@@ -137,7 +138,7 @@ win32 { + # Otherwise you have to build them from the examples directory. + ###################################################################### + +-QWT_CONFIG += QwtExamples ++# QWT_CONFIG += QwtExamples + + ###################################################################### + # The playground is primarily intended for the Qwt development +@@ -148,14 +149,14 @@ QWT_CONFIG += QwtExamples + # Otherwise you have to build them from the playground directory. + ###################################################################### + +-QWT_CONFIG += QwtPlayground ++# QWT_CONFIG += QwtPlayground + + ###################################################################### + # If you want to auto build the tests, enable the line below + # Otherwise you have to build them from the tests directory. + ###################################################################### + +-QWT_CONFIG += QwtTests ++# QWT_CONFIG += QwtTests + + ###################################################################### + # When Qt has been built as framework qmake wants +@@ -171,8 +172,4 @@ macx:!static:CONFIG(qt_framework, qt_framework|qt_no_framework) { + # Create and install pc files for pkg-config + # See http://www.freedesktop.org/wiki/Software/pkg-config/ + ###################################################################### +- +-unix { +- +- QWT_CONFIG += QwtPkgConfig +-} ++# QWT_CONFIG += QwtPkgConfig # Qt6 has no pkgconfig files +diff --git a/src/src.pro b/src/src.pro +index 762e4c49b..d70a1b62b 100644 +--- a/src/src.pro ++++ b/src/src.pro +@@ -49,27 +50,27 @@ contains(QWT_CONFIG, QwtFramework) { + include ( $${PWD}/src.pri ) + + # Install directives + + target.path = $${QWT_INSTALL_LIBS} + INSTALLS = target + + CONFIG(lib_bundle) { + + FRAMEWORK_HEADERS.version = Versions + FRAMEWORK_HEADERS.files = $${HEADERS} + FRAMEWORK_HEADERS.path = Headers + QMAKE_BUNDLE_DATA += FRAMEWORK_HEADERS + } + else { + + headers.files = $${HEADERS} + headers.path = $${QWT_INSTALL_HEADERS} + INSTALLS += headers + } + + contains(QWT_CONFIG, QwtPkgConfig) { + +- CONFIG += create_pc create_prl no_install_prl ++ CONFIG += create_pc create_prl + + QMAKE_PKGCONFIG_NAME = Qwt$${QWT_VER_MAJ} + QMAKE_PKGCONFIG_DESCRIPTION = Qt Widgets for Technical Applications +@@ -82,14 +81,14 @@ contains(QWT_CONFIG, QwtPkgConfig) { + greaterThan(QT_MAJOR_VERSION, 4) { + + QMAKE_PKGCONFIG_FILE = Qt$${QT_MAJOR_VERSION}$${QMAKE_PKGCONFIG_NAME} +- QMAKE_PKGCONFIG_REQUIRES = Qt5Widgets Qt5Concurrent Qt5PrintSupport ++ QMAKE_PKGCONFIG_REQUIRES = Qt$${QT_MAJOR_VERSION}Widgets Qt$${QT_MAJOR_VERSION}Concurrent Qt$${QT_MAJOR_VERSION}PrintSupport + + contains(QWT_CONFIG, QwtSvg) { +- QMAKE_PKGCONFIG_REQUIRES += Qt5Svg ++ QMAKE_PKGCONFIG_REQUIRES += Qt$${QT_MAJOR_VERSION}Svg + } + + contains(QWT_CONFIG, QwtOpenGL) { +- QMAKE_PKGCONFIG_REQUIRES += Qt5OpenGL ++ QMAKE_PKGCONFIG_REQUIRES += Qt$${QT_MAJOR_VERSION}OpenGL + } + + QMAKE_DISTCLEAN += $${DESTDIR}/$${QMAKE_PKGCONFIG_DESTDIR}/$${QMAKE_PKGCONFIG_FILE}.pc diff --git a/ports/qwt/fix-dynamic-static.patch b/ports/qwt/fix-dynamic-static.patch deleted file mode 100644 index d0bd646fca..0000000000 --- a/ports/qwt/fix-dynamic-static.patch +++ /dev/null @@ -1,15 +0,0 @@ -diff --git a/qwtconfig.pri b/qwtconfig.pri -index 0b054e0..f93fef6 100644 ---- a/qwtconfig.pri -+++ b/qwtconfig.pri -@@ -72,7 +72,10 @@ QWT_INSTALL_FEATURES = $${QWT_INSTALL_PREFIX}/features - # it will be a static library. - ###################################################################### - -+CONFIG(dynamic, dynamic|static) { -+ - QWT_CONFIG += QwtDll -+} - - ###################################################################### - # QwtPlot enables all classes, that are needed to use the QwtPlot diff --git a/ports/qwt/fix_dll_install.patch b/ports/qwt/fix_dll_install.patch new file mode 100644 index 0000000000..134531b7c4 --- /dev/null +++ b/ports/qwt/fix_dll_install.patch @@ -0,0 +1,28 @@ +diff --git a/src/src.pro b/src/src.pro +index 0ce903fe7..16524b8e2 100644 +--- a/src/src.pro ++++ b/src/src.pro +@@ -20,6 +20,7 @@ TEMPLATE = lib + TARGET = $$qwtLibraryTarget(qwt) + + DESTDIR = $${QWT_OUT_ROOT}/lib ++DLLDESTDIR = $${QWT_OUT_ROOT}/bin + + contains(QWT_CONFIG, QwtDll) { + +@@ -49,9 +50,13 @@ contains(QWT_CONFIG, QwtFramework) { + include ( $${PWD}/src.pri ) + + # Install directives +- ++win32 { ++ dlltarget.path = $${QWT_INSTALL_BINS} ++ INSTALLS += dlltarget ++} + target.path = $${QWT_INSTALL_LIBS} +-INSTALLS = target ++!static: target.CONFIG = no_dll ++INSTALLS += target + + CONFIG(lib_bundle) { + diff --git a/ports/qwt/portfile.cmake b/ports/qwt/portfile.cmake index 9bee7b211b..d11f7da0f8 100644 --- a/ports/qwt/portfile.cmake +++ b/ports/qwt/portfile.cmake @@ -1,38 +1,32 @@ -vcpkg_from_sourceforge( +vcpkg_from_git( OUT_SOURCE_PATH SOURCE_PATH - REPO qwt/qwt - REF 6.2.0 - FILENAME "qwt-6.2.0.zip" - SHA512 a3946c6e23481b5a2193819a1c1298db5a069d514ca60de54accb3a249403f5acd778172ae6fae24fae252767b1e58deba524de6225462f1bafd7c947996aae9 - PATCHES - fix-dynamic-static.patch + URL "https://git.code.sf.net/p/qwt/git" + REF "06d6822b595b70c9fd567a4fe0d835759bf271fe" + FETCH_REF qwt-6.2 + PATCHES + config.patch + fix_dll_install.patch ) -vcpkg_configure_qmake( - SOURCE_PATH "${SOURCE_PATH}" - OPTIONS - CONFIG+=${VCPKG_LIBRARY_LINKAGE} -) - -if (VCPKG_TARGET_IS_WINDOWS) - vcpkg_install_qmake( - RELEASE_TARGETS sub-src-release_ordered - DEBUG_TARGETS sub-src-debug_ordered - ) -else () - vcpkg_install_qmake( - RELEASE_TARGETS sub-src-all-ordered - DEBUG_TARGETS sub-src-all-ordered - ) +string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" IS_DYNAMIC) +set(OPTIONS "") +if(IS_DYNAMIC) + set(OPTIONS "QWT_CONFIG+=QwtDll") endif() +vcpkg_qmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + QMAKE_OPTIONS + ${OPTIONS} + "CONFIG-=debug_and_release" + "CONFIG+=create_prl" + "CONFIG+=link_prl" +) +vcpkg_qmake_install() +vcpkg_copy_pdbs() if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") - file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin") + file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin") endif() -#Install the header files -file(GLOB HEADER_FILES "${SOURCE_PATH}/src/*.h" "${SOURCE_PATH}/classincludes/*") -file(INSTALL ${HEADER_FILES} DESTINATION "${CURRENT_PACKAGES_DIR}/include/${PORT}") - # Handle copyright file(INSTALL "${SOURCE_PATH}/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) diff --git a/ports/qwt/vcpkg.json b/ports/qwt/vcpkg.json index 380c844549..43aec67f43 100644 --- a/ports/qwt/vcpkg.json +++ b/ports/qwt/vcpkg.json @@ -1,15 +1,24 @@ { "name": "qwt", - "version-semver": "6.2.0", - "port-version": 2, + "version": "6.2.0+20220616", "description": "qt widgets library for technical applications", "homepage": "https://sourceforge.net/projects/qwt", + "license": null, "dependencies": [ { - "name": "qt5-base", - "default-features": false + "name": "qtbase", + "default-features": false, + "features": [ + "concurrent", + "gui", + "widgets" + ] }, - "qt5-svg", - "qt5-tools" + "qtsvg", + { + "name": "vcpkg-qmake", + "host": true, + "default-features": false + } ] } diff --git a/ports/vcpkg-qmake/portfile.cmake b/ports/vcpkg-qmake/portfile.cmake index d2ff5db157..24e9eb17cc 100644 --- a/ports/vcpkg-qmake/portfile.cmake +++ b/ports/vcpkg-qmake/portfile.cmake @@ -1,5 +1,8 @@ file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/vcpkg_qmake_configure.cmake" + "${CMAKE_CURRENT_LIST_DIR}/vcpkg_qmake_build.cmake" + "${CMAKE_CURRENT_LIST_DIR}/vcpkg_qmake_install.cmake" + "${CMAKE_CURRENT_LIST_DIR}/z_vcpkg_qmake_fix_makefiles.cmake" "${CMAKE_CURRENT_LIST_DIR}/vcpkg-port-config.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") diff --git a/ports/vcpkg-qmake/vcpkg-port-config.cmake b/ports/vcpkg-qmake/vcpkg-port-config.cmake index 325cba3b91..b95854c03d 100644 --- a/ports/vcpkg-qmake/vcpkg-port-config.cmake +++ b/ports/vcpkg-qmake/vcpkg-port-config.cmake @@ -1,4 +1,7 @@ include_guard(GLOBAL) include("${CMAKE_CURRENT_LIST_DIR}/../vcpkg-cmake-get-vars/vcpkg-port-config.cmake") +include("${CMAKE_CURRENT_LIST_DIR}/z_vcpkg_qmake_fix_makefiles.cmake") include("${CMAKE_CURRENT_LIST_DIR}/vcpkg_qmake_configure.cmake") +include("${CMAKE_CURRENT_LIST_DIR}/vcpkg_qmake_build.cmake") +include("${CMAKE_CURRENT_LIST_DIR}/vcpkg_qmake_install.cmake") diff --git a/ports/vcpkg-qmake/vcpkg.json b/ports/vcpkg-qmake/vcpkg.json index 727763343e..63a50ea811 100644 --- a/ports/vcpkg-qmake/vcpkg.json +++ b/ports/vcpkg-qmake/vcpkg.json @@ -1,7 +1,6 @@ { "name": "vcpkg-qmake", - "version-date": "2022-05-10", - "port-version": 1, + "version-date": "2022-11-16", "documentation": "https://vcpkg.io/en/docs/README.html", "license": "MIT", "supports": "native", diff --git a/ports/vcpkg-qmake/vcpkg_qmake_build.cmake b/ports/vcpkg-qmake/vcpkg_qmake_build.cmake new file mode 100644 index 0000000000..1f269cf525 --- /dev/null +++ b/ports/vcpkg-qmake/vcpkg_qmake_build.cmake @@ -0,0 +1,72 @@ +include_guard(GLOBAL) + +function(z_run_jom_build invoke_command targets log_prefix log_suffix) + message(STATUS "Package ${log_prefix}-${TARGET_TRIPLET}-${log_suffix}") + vcpkg_execute_build_process( + COMMAND "${invoke_command}" -j ${VCPKG_CONCURRENCY} ${targets} + NO_PARALLEL_COMMAND "${invoke_command}" -j 1 ${targets} + WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${log_suffix}" + LOGNAME "package-${log_prefix}-${TARGET_TRIPLET}-${log_suffix}" + ) +endfunction() + +function(vcpkg_qmake_build) + # parse parameters such that semicolons in options arguments to COMMAND don't get erased + cmake_parse_arguments(PARSE_ARGV 0 arg + "SKIP_MAKEFILES" + "BUILD_LOGNAME" + "TARGETS;RELEASE_TARGETS;DEBUG_TARGETS" + ) + + # Make sure that the linker finds the libraries used + vcpkg_backup_env_variables(VARS PATH LD_LIBRARY_PATH) + + if(CMAKE_HOST_WIN32) + if (VCPKG_QMAKE_USE_NMAKE) + find_program(NMAKE nmake) + set(invoke_command "${NMAKE}") + get_filename_component(nmake_exe_path "${NMAKE}" DIRECTORY) + vcpkg_host_path_list(APPEND ENV{PATH} "${nmake_exe_path}") + else() + vcpkg_find_acquire_program(JOM) + set(invoke_command "${JOM}") + endif() + else() + find_program(MAKE make) + set(invoke_command "${MAKE}") + endif() + + file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}" NATIVE_INSTALLED_DIR) + + if(NOT DEFINED arg_BUILD_LOGNAME) + set(arg_BUILD_LOGNAME build) + endif() + + set(short_name_debug "dbg") + set(path_suffix_debug "/debug") + set(targets_debug "${arg_DEBUG_TARGETS}") + + set(short_name_release "rel") + set(path_suffix_release "") + set(targets_release "${arg_RELEASE_TARGETS}") + + if(NOT DEFINED VCPKG_BUILD_TYPE) + set(items debug release) + else() + set(items release) + endif() + foreach(build_type IN ITEMS ${items}) + set(current_installed_prefix "${CURRENT_INSTALLED_DIR}${path_suffix_${build_type}}") + + vcpkg_add_to_path(PREPEND "${current_installed_prefix}/lib" "${current_installed_prefix}/bin") + + vcpkg_list(SET targets ${targets_${build_type}} ${arg_TARGETS}) + if(NOT arg_SKIP_MAKEFILES) + z_run_jom_build("${invoke_command}" qmake_all makefiles "${short_name_${build_type}}") + z_vcpkg_qmake_fix_makefiles("${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${short_name_${build_type}}") + endif() + z_run_jom_build("${invoke_command}" "${targets}" "${arg_BUILD_LOGNAME}" "${short_name_${build_type}}") + + vcpkg_restore_env_variables(VARS PATH LD_LIBRARY_PATH) + endforeach() +endfunction() diff --git a/ports/vcpkg-qmake/vcpkg_qmake_configure.cmake b/ports/vcpkg-qmake/vcpkg_qmake_configure.cmake index 89edab5d85..9846d183cb 100644 --- a/ports/vcpkg-qmake/vcpkg_qmake_configure.cmake +++ b/ports/vcpkg-qmake/vcpkg_qmake_configure.cmake @@ -15,7 +15,7 @@ function(vcpkg_qmake_configure) vcpkg_list(APPEND arg_QMAKE_OPTIONS_DEBUG "CONFIG*=separate_debug_info") endif() if(VCPKG_TARGET_IS_WINDOWS AND VCPKG_CRT_LINKAGE STREQUAL "static") - vcpkg_list(APPEND _csc_QMAKE_OPTIONS "CONFIG*=static-runtime") + vcpkg_list(APPEND arg_QMAKE_OPTIONS "CONFIG*=static-runtime") endif() if(DEFINED VCPKG_OSX_DEPLOYMENT_TARGET) @@ -68,14 +68,22 @@ function(vcpkg_qmake_configure) qmake_append_program(qmake_build_tools "QMAKE_RC" "${VCPKG_DETECTED_CMAKE_RC_COMPILER}") qmake_append_program(qmake_build_tools "QMAKE_MT" "${VCPKG_DETECTED_CMAKE_MT}") - # QMAKE_OBJCOPY ? + if(NOT VCPKG_TARGET_IS_WINDOWS OR VCPKG_DETECTED_CMAKE_AR MATCHES "ar$") + vcpkg_list(APPEND qmake_build_tools "QMAKE_AR+=qc") + endif() + if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW) - qmake_append_program(qmake_build_tools "LINKER" "${VCPKG_DETECTED_CMAKE_LINKER}") + qmake_append_program(qmake_build_tools "QMAKE_LIB" "${VCPKG_DETECTED_CMAKE_AR}") qmake_append_program(qmake_build_tools "QMAKE_LINK" "${VCPKG_DETECTED_CMAKE_LINKER}") - qmake_append_program(qmake_build_tools "QMAKE_LINK_C" "${VCPKG_DETECTED_CMAKE_LINKER}") else() qmake_append_program(qmake_build_tools "QMAKE_LINK" "${VCPKG_DETECTED_CMAKE_CXX_COMPILER}") + qmake_append_program(qmake_build_tools "QMAKE_LINK_SHLIB" "${VCPKG_DETECTED_CMAKE_CXX_COMPILER}") qmake_append_program(qmake_build_tools "QMAKE_LINK_C" "${VCPKG_DETECTED_CMAKE_C_COMPILER}") + qmake_append_program(qmake_build_tools "QMAKE_LINK_C_SHLIB" "${VCPKG_DETECTED_CMAKE_C_COMPILER}") + endif() + + if(DEFINED VCPKG_QT_TARGET_MKSPEC) + vcpkg_list(APPEND arg_QMAKE_OPTIONS "-spec" "${VCPKG_QT_TARGET_MKSPEC}") endif() foreach(buildtype IN LISTS buildtypes) @@ -87,25 +95,40 @@ function(vcpkg_qmake_configure) # Cleanup build directories file(REMOVE_RECURSE "${CURRENT_BUILDTREES_DIR}/${config_triplet}") + set(qmake_comp_flags "") + macro(qmake_add_flags qmake_var operation flags) + string(STRIP "${flags}" striped_flags) + if(striped_flags) + vcpkg_list(APPEND qmake_comp_flags "${qmake_var}${operation}${striped_flags}") + endif() + endmacro() + + qmake_add_flags("QMAKE_LIBS" "+=" "${VCPKG_DETECTED_CMAKE_C_STANDARD_LIBRARIES} ${VCPKG_DETECTED_CMAKE_CXX_STANDARD_LIBRARIES}") + qmake_add_flags("QMAKE_RC" "+=" "${VCPKG_COMBINED_RC_FLAGS_${buildtype}}") # not exported by vcpkg_cmake_get_vars yet + qmake_add_flags("QMAKE_CFLAGS_${buildtype}" "+=" "${VCPKG_COMBINED_C_FLAGS_${buildtype}}") + qmake_add_flags("QMAKE_CXXFLAGS_${buildtype}" "+=" "${VCPKG_COMBINED_CXX_FLAGS_${buildtype}}") + qmake_add_flags("QMAKE_LFLAGS" "+=" "${VCPKG_COMBINED_STATIC_LINKER_FLAGS_${buildtype}}") + qmake_add_flags("QMAKE_LFLAGS_SHLIB" "+=" "${VCPKG_COMBINED_SHARED_LINKER_FLAGS_${buildtype}}") + qmake_add_flags("QMAKE_LFLAGS_PLUGIN" "+=" "${VCPKG_COMBINED_MODULE_LINKER_FLAGS_${buildtype}}") + qmake_add_flags("QMAKE_LIBFLAGS" "+=" "${VCPKG_COMBINED_STATIC_LINKER_FLAGS_${buildtype}}") + qmake_add_flags("QMAKE_LIBFLAGS_${buildtype}" "+=" "${VCPKG_COMBINED_STATIC_LINKER_FLAGS_${buildtype}}") + vcpkg_list(APPEND qmake_build_tools "QMAKE_AR+=${VCPKG_COMBINED_STATIC_LINKER_FLAGS_${buildtype}}") + + # QMAKE_CXXFLAGS_SHLIB + # Setup qt.conf if(NOT VCPKG_QT_CONF_${buildtype}) set(VCPKG_QT_CONF_${buildtype} "${CURRENT_INSTALLED_DIR}/tools/Qt6/qt_${lowerbuildtype}.conf") + else() + # Let a supplied qt.conf override everything. + # The file will still be configured so users might use the variables within this scope. + set(qmake_build_tools "") + set(qmake_comp_flags "") endif() - configure_file("${VCPKG_QT_CONF_${buildtype}}" "${CURRENT_BUILDTREES_DIR}/${config_triplet}/qt.conf") # Needs probably more TODO for cross builds + configure_file("${VCPKG_QT_CONF_${buildtype}}" "${CURRENT_BUILDTREES_DIR}/${config_triplet}/qt.conf") vcpkg_backup_env_variables(VARS PKG_CONFIG_PATH) - vcpkg_host_path_list(PREPEND PKG_CONFIG_PATH "${prefix}/lib/pkgconfig" "${prefix}/share/pkgconfig") - - set(qmake_comp_flags "") - # Note sure about these. VCPKG_QMAKE_OPTIONS offers a way to opt out of these. (earlier values being overwritten by later values; = set +=append *=append unique -=remove) - vcpkg_list(APPEND qmake_comp_flags "QMAKE_LIBS+=${VCPKG_DETECTED_CMAKE_C_STANDARD_LIBRARIES} ${VCPKG_DETECTED_CMAKE_CXX_STANDARD_LIBRARIES}" - "QMAKE_RC+=${VCPKG_COMBINED_RC_FLAGS_${buildtype}}" - "QMAKE_CFLAGS_${buildtype}*=${VCPKG_COMBINED_C_FLAGS_${buildtype}}" - "QMAKE_CXXFLAGS_${buildtype}*=${VCPKG_COMBINED_CXX_FLAGS_${buildtype}}" - "QMAKE_LFLAGS*=${VCPKG_COMBINED_SHARED_LINKER_FLAGS_${buildtype}}" - "QMAKE_LIBFLAGS*=${VCPKG_COMBINED_STATIC_LINKER_FLAGS_${buildtype}}" - "QMAKE_LFLAGS_EXE*=${VCPKG_COMBINED_EXE_LINKER_FLAGS_${buildtype}}" - ) + vcpkg_host_path_list(PREPEND PKG_CONFIG_PATH "${prefix}/lib/pkgconfig" "${CURRENT_INSTALLED_DIR}/share/pkgconfig") message(STATUS "Configuring ${config_triplet}") file(MAKE_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${config_triplet}") @@ -115,15 +138,17 @@ function(vcpkg_qmake_configure) # Options might need to go into a response file? I am a bit concerned about cmd line length. vcpkg_execute_required_process( COMMAND ${VCPKG_QMAKE_COMMAND} ${qmake_config_${buildtype}} - ${arg_QMAKE_OPTIONS} ${arg_QMAKE_OPTIONS_DEBUG} + ${arg_QMAKE_OPTIONS} ${arg_QMAKE_OPTIONS_${buildtype}} ${VCPKG_QMAKE_OPTIONS} ${VCPKG_QMAKE_OPTIONS_${buildtype}} # Advanced users need a way to inject QMAKE variables via the triplet. ${qmake_build_tools} ${qmake_comp_flags} "${arg_SOURCE_PATH}" -qtconf "${CURRENT_BUILDTREES_DIR}/${config_triplet}/qt.conf" ${options} - WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${config_triplet} + WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${config_triplet}" LOGNAME config-${config_triplet} + SAVE_LOG_FILES config.log ) + z_vcpkg_qmake_fix_makefiles("${CURRENT_BUILDTREES_DIR}/${config_triplet}") message(STATUS "Configuring ${config_triplet} done") vcpkg_restore_env_variables(VARS PKG_CONFIG_PATH) diff --git a/ports/vcpkg-qmake/vcpkg_qmake_install.cmake b/ports/vcpkg-qmake/vcpkg_qmake_install.cmake new file mode 100644 index 0000000000..ce2e206375 --- /dev/null +++ b/ports/vcpkg-qmake/vcpkg_qmake_install.cmake @@ -0,0 +1,46 @@ +#[===[.md: +# vcpkg_qmake_install + +Build and install a qmake project. + +## Usage: +```cmake +vcpkg_qmake_install(...) +``` + +## Parameters: +See [`vcpkg_qmake_build()`](vcpkg_qmake_build.md). + +## Notes: +This command transparently forwards to [`vcpkg_qmake_build()`](vcpkg_qmake_build.md). +and appends the 'install' target + +#]===] + +function(z_vcpkg_qmake_fix_prl PACKAGE_DIR PRL_FILES) + file(TO_CMAKE_PATH "${PACKAGE_DIR}/lib" CMAKE_LIB_PATH) + file(TO_CMAKE_PATH "${PACKAGE_DIR}/include/Qt6" CMAKE_INCLUDE_PATH_QT6) + file(TO_CMAKE_PATH "${PACKAGE_DIR}/include" CMAKE_INCLUDE_PATH) + file(TO_CMAKE_PATH "${CURRENT_INSTALLED_DIR}" CMAKE_INSTALLED_PREFIX) + foreach(PRL_FILE IN LISTS PRL_FILES) + file(READ "${PRL_FILE}" _contents) + string(REPLACE "${CMAKE_LIB_PATH}" "\$\$[QT_INSTALL_LIBS]" _contents "${_contents}") + string(REPLACE "${CMAKE_INCLUDE_PATH_QT6}" "\$\$[QT_INSTALL_HEADERS]" _contents "${_contents}") + string(REPLACE "${CMAKE_INCLUDE_PATH}" "\$\$[QT_INSTALL_HEADERS]/../" _contents "${_contents}") + string(REPLACE "${CMAKE_INSTALLED_PREFIX}" "\$\$[QT_INSTALL_PREFIX]" _contents "${_contents}") + string(REGEX REPLACE "QMAKE_PRL_BUILD_DIR[^\\\n]+" "QMAKE_PRL_BUILD_DIR =" _contents "${_contents}") + #Note: This only works without an extra if case since QT_INSTALL_PREFIX is the same for debug and release + file(WRITE "${PRL_FILE}" "${_contents}") + endforeach() +endfunction() + +function(vcpkg_qmake_install) + z_vcpkg_function_arguments(args) + vcpkg_qmake_build(${args}) + vcpkg_qmake_build(SKIP_MAKEFILES BUILD_LOGNAME "install" TARGETS "install") + + # Fix absolute paths in prl files + file(GLOB_RECURSE prl_files "${CURRENT_PACKAGES_DIR}/**.prl") + debug_message(STATUS "prl_files:${prl_files}") + z_vcpkg_qmake_fix_prl("${CURRENT_PACKAGES_DIR}" "${prl_files}") +endfunction() diff --git a/ports/vcpkg-qmake/z_vcpkg_qmake_fix_makefiles.cmake b/ports/vcpkg-qmake/z_vcpkg_qmake_fix_makefiles.cmake new file mode 100644 index 0000000000..9ecd402798 --- /dev/null +++ b/ports/vcpkg-qmake/z_vcpkg_qmake_fix_makefiles.cmake @@ -0,0 +1,28 @@ +include_guard(GLOBAL) +function(z_vcpkg_qmake_fix_makefiles BUILD_DIR) + #Fix the installation location + file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}" NATIVE_INSTALLED_DIR) + file(TO_NATIVE_PATH "${CURRENT_PACKAGES_DIR}" NATIVE_PACKAGES_DIR) + + if(WIN32) + string(SUBSTRING "${NATIVE_INSTALLED_DIR}" 2 -1 INSTALLED_DIR_WITHOUT_DRIVE) + string(SUBSTRING "${NATIVE_PACKAGES_DIR}" 2 -1 PACKAGES_DIR_WITHOUT_DRIVE) + string(SUBSTRING "${NATIVE_INSTALLED_DIR}" 0 2 INSTALLED_DRIVE) + string(SUBSTRING "${NATIVE_PACKAGES_DIR}" 0 2 PACKAGES_DRIVE) + else() + set(INSTALLED_DRIVE "") + set(PACKAGES_DRIVE "") + set(INSTALLED_DIR_WITHOUT_DRIVE "${NATIVE_INSTALLED_DIR}") + set(PACKAGES_DIR_WITHOUT_DRIVE "${NATIVE_PACKAGES_DIR}") + endif() + + file(GLOB_RECURSE MAKEFILES "${BUILD_DIR}/**Makefile**") + + foreach(MAKEFILE ${MAKEFILES}) + #Set the correct install directory to packages + vcpkg_replace_string("${MAKEFILE}" + "${INSTALLED_DRIVE}$(INSTALL_ROOT)${INSTALLED_DIR_WITHOUT_DRIVE}" + "${PACKAGES_DRIVE}$(INSTALL_ROOT)${PACKAGES_DIR_WITHOUT_DRIVE}") + endforeach() + +endfunction() \ No newline at end of file diff --git a/versions/baseline.json b/versions/baseline.json index 2d69c709b0..39eefb7539 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -6425,8 +6425,8 @@ "port-version": 3 }, "qwt": { - "baseline": "6.2.0", - "port-version": 2 + "baseline": "6.2.0+20220616", + "port-version": 0 }, "qwtw": { "baseline": "3.1.0", @@ -7785,8 +7785,8 @@ "port-version": 1 }, "vcpkg-qmake": { - "baseline": "2022-05-10", - "port-version": 1 + "baseline": "2022-11-16", + "port-version": 0 }, "vcpkg-tool-bazel": { "baseline": "5.2.0", diff --git a/versions/q-/qwt.json b/versions/q-/qwt.json index d9652ae7fb..3cf7a74b4b 100644 --- a/versions/q-/qwt.json +++ b/versions/q-/qwt.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "a1b3566c4c60065d5ace2db38b6ce97543534e6f", + "version": "6.2.0+20220616", + "port-version": 0 + }, { "git-tree": "c1e9f6474ec00dce373a287dcb04cca0a7398fa2", "version-semver": "6.2.0", diff --git a/versions/v-/vcpkg-qmake.json b/versions/v-/vcpkg-qmake.json index 92995e2064..4824c720c5 100644 --- a/versions/v-/vcpkg-qmake.json +++ b/versions/v-/vcpkg-qmake.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "993a25e3e7a43175fb3d7d4981bc3e0de1f65c32", + "version-date": "2022-11-16", + "port-version": 0 + }, { "git-tree": "546491787b275bfae887457a5eb17a7b502ae891", "version-date": "2022-05-10",