diff --git a/docs/maintainers/portfile-functions.md b/docs/maintainers/portfile-functions.md index fbad18c8ef..842ef6137a 100644 --- a/docs/maintainers/portfile-functions.md +++ b/docs/maintainers/portfile-functions.md @@ -73,3 +73,7 @@ ### [vcpkg-cmake-config](ports/vcpkg-cmake-config.md) - [vcpkg\_cmake\_config\_fixup](ports/vcpkg-cmake-config/vcpkg_cmake_config_fixup.md) + +### [vcpkg-pkgconfig-get-modules](ports/vcpkg-pkgconfig-get-modules.md) + +- [x\_vcpkg\_pkgconfig\_get\_modules](ports/vcpkg-pkgconfig-get-modules/x_vcpkg_pkgconfig_get_modules.md) diff --git a/docs/maintainers/ports/vcpkg-pkgconfig-get-modules.md b/docs/maintainers/ports/vcpkg-pkgconfig-get-modules.md new file mode 100644 index 0000000000..ac99412c24 --- /dev/null +++ b/docs/maintainers/ports/vcpkg-pkgconfig-get-modules.md @@ -0,0 +1,6 @@ +# vcpkg-pkgconfig-get-modules + +**Experimental: will change or be removed at any time** + +`vcpkg-pkgconfig-get-modules` provides `x_vcpkg_pkgconfig_get_modules()`, a function which simplifies calling +`pkg-config` in portfiles in order to gather dependencies for exotic buildsystems. diff --git a/docs/maintainers/ports/vcpkg-pkgconfig-get-modules/x_vcpkg_pkgconfig_get_modules.md b/docs/maintainers/ports/vcpkg-pkgconfig-get-modules/x_vcpkg_pkgconfig_get_modules.md new file mode 100644 index 0000000000..06299533a0 --- /dev/null +++ b/docs/maintainers/ports/vcpkg-pkgconfig-get-modules/x_vcpkg_pkgconfig_get_modules.md @@ -0,0 +1,44 @@ +# x_vcpkg_pkgconfig_get_modules + +The latest version of this document lives in the [vcpkg repo](https://github.com/Microsoft/vcpkg/blob/master/docs/maintainers/ports/vcpkg-pkgconfig-get-modules/x_vcpkg_pkgconfig_get_modules.md). + +Experimental +Retrieve required module information from pkgconfig modules + +## Usage +```cmake +x_vcpkg_pkgconfig_get_modules( + PREFIX + MODULES ... + [LIBS] + [LIBRARIES] + [LIBRARIES_DIRS] + [INCLUDE_DIRS] +) +``` +## Parameters + +### PREFIX +Used variable prefix to use + +### MODULES +List of pkgconfig modules to retrieve information for. + +### LIBS +Returns `"${PKGCONFIG}" --libs` in _LIBS_(DEBUG|RELEASE) + +### LIBRARIES +Returns `"${PKGCONFIG}" --libs-only-l` in _LIBRARIES_(DEBUG|RELEASE) + +### LIBRARIES_DIRS +Returns `"${PKGCONFIG}" --libs-only-L` in _LIBRARIES_DIRS_(DEBUG|RELEASE) + +### INCLUDE_DIRS +Returns `"${PKGCONFIG}" --cflags-only-I` in _INCLUDE_DIRS_(DEBUG|RELEASE) + +## Examples + +* [qt5-base](https://github.com/microsoft/vcpkg/blob/master/ports/qt5-base/portfile.cmake) + +## Source +[ports/vcpkg-pkgconfig-get-modules/x\_vcpkg\_pkgconfig\_get\_modules.cmake](https://github.com/Microsoft/vcpkg/blob/master/ports/vcpkg-pkgconfig-get-modules/x_vcpkg_pkgconfig_get_modules.cmake) diff --git a/docs/regenerate.ps1 b/docs/regenerate.ps1 index 93e78a3c91..4c847f75aa 100755 --- a/docs/regenerate.ps1 +++ b/docs/regenerate.ps1 @@ -26,6 +26,7 @@ class CMakeDocumentation { [String[]]$cmakeScriptsPorts = @( 'vcpkg-cmake' 'vcpkg-cmake-config' + 'vcpkg-pkgconfig-get-modules' ) [CMakeDocumentation[]]$tableOfContents = @() diff --git a/ports/qt5-base/cmake/qt_build_submodule.cmake b/ports/qt5-base/cmake/qt_build_submodule.cmake index b30ef02990..52f9c6c1ba 100644 --- a/ports/qt5-base/cmake/qt_build_submodule.cmake +++ b/ports/qt5-base/cmake/qt_build_submodule.cmake @@ -6,19 +6,20 @@ function(qt_build_submodule SOURCE_PATH) vcpkg_find_acquire_program(PYTHON2) get_filename_component(PYTHON2_EXE_PATH ${PYTHON2} DIRECTORY) vcpkg_add_to_path("${PYTHON2_EXE_PATH}") - + vcpkg_configure_qmake(SOURCE_PATH ${SOURCE_PATH} ${ARGV}) vcpkg_build_qmake(SKIP_MAKEFILES) - + #Fix the installation location within the makefiles qt_fix_makefile_install("${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/") qt_fix_makefile_install("${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/") #Install the module files vcpkg_build_qmake(TARGETS install SKIP_MAKEFILES BUILD_LOGNAME install) - + qt_fix_cmake(${CURRENT_PACKAGES_DIR} ${PORT}) + vcpkg_fixup_pkgconfig() # Needs further investigation if this is enough! #Replace with VCPKG variables if PR #7733 is merged unset(BUILDTYPES) @@ -26,13 +27,13 @@ function(qt_build_submodule SOURCE_PATH) set(_buildname "DEBUG") list(APPEND BUILDTYPES ${_buildname}) set(_short_name_${_buildname} "dbg") - set(_path_suffix_${_buildname} "/debug") + set(_path_suffix_${_buildname} "/debug") endif() if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release") set(_buildname "RELEASE") list(APPEND BUILDTYPES ${_buildname}) set(_short_name_${_buildname} "rel") - set(_path_suffix_${_buildname} "") + set(_path_suffix_${_buildname} "") endif() unset(_buildname) @@ -42,14 +43,14 @@ function(qt_build_submodule SOURCE_PATH) file(GLOB_RECURSE PRL_FILES "${CURRENT_BUILD_PACKAGE_DIR}/lib/*.prl" "${CURRENT_PACKAGES_DIR}/tools/qt5${_path_suffix_${_buildname}}/lib/*.prl" "${CURRENT_PACKAGES_DIR}/tools/qt5${_path_suffix_${_buildname}}/mkspecs/*.pri") qt_fix_prl("${CURRENT_BUILD_PACKAGE_DIR}" "${PRL_FILES}") - + # This makes it impossible to use the build tools in any meaningful way. qt5 assumes they are all in one folder! # So does the Qt VS Plugin which even assumes all of the in a bin folder #Move tools to the correct directory #if(EXISTS ${CURRENT_BUILD_PACKAGE_DIR}/tools/qt5) # file(RENAME ${CURRENT_BUILD_PACKAGE_DIR}/tools/qt5 ${CURRENT_PACKAGES_DIR}/tools/${PORT}) #endif() - + # Move executables in bin to tools # This is ok since those are not build tools. file(GLOB PACKAGE_EXE ${CURRENT_BUILD_PACKAGE_DIR}/bin/*.exe) @@ -64,13 +65,13 @@ function(qt_build_submodule SOURCE_PATH) endif() endforeach() endif() - + #cleanup empty folders file(GLOB PACKAGE_LIBS "${CURRENT_BUILD_PACKAGE_DIR}/lib/*") if(NOT PACKAGE_LIBS) file(REMOVE_RECURSE "${CURRENT_BUILD_PACKAGE_DIR}/lib") endif() - + file(GLOB PACKAGE_BINS "${CURRENT_BUILD_PACKAGE_DIR}/bin/*") if(NOT PACKAGE_BINS) file(REMOVE_RECURSE "${CURRENT_BUILD_PACKAGE_DIR}/bin") @@ -78,12 +79,12 @@ function(qt_build_submodule SOURCE_PATH) endforeach() if(EXISTS "${CURRENT_PACKAGES_DIR}/tools/qt5/bin") file(COPY "${CURRENT_PACKAGES_DIR}/tools/qt5/bin" DESTINATION "${CURRENT_PACKAGES_DIR}/tools/${PORT}") - + set(CURRENT_INSTALLED_DIR_BACKUP "${CURRENT_INSTALLED_DIR}") set(CURRENT_INSTALLED_DIR "./../../.." ) # Making the qt.conf relative and not absolute configure_file(${CURRENT_INSTALLED_DIR_BACKUP}/tools/qt5/qt_release.conf ${CURRENT_PACKAGES_DIR}/tools/${PORT}/bin/qt.conf) # This makes the tools at least useable for release set(CURRENT_INSTALLED_DIR "${CURRENT_INSTALLED_DIR_BACKUP}") - + vcpkg_copy_tool_dependencies("${CURRENT_PACKAGES_DIR}/tools/${PORT}/bin") if(VCPKG_TARGET_IS_WINDOWS AND VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") file(GLOB_RECURSE DLL_DEPS_AVAIL "${CURRENT_INSTALLED_DIR}/tools/qt5/bin/*.dll") @@ -99,14 +100,14 @@ function(qt_build_submodule SOURCE_PATH) endforeach() endif() endif() - + #This should be removed if somehow possible if(EXISTS "${CURRENT_PACKAGES_DIR}/tools/qt5/debug/bin") set(CURRENT_INSTALLED_DIR_BACKUP "${CURRENT_INSTALLED_DIR}") set(CURRENT_INSTALLED_DIR "./../../../.." ) # Making the qt.conf relative and not absolute configure_file(${CURRENT_INSTALLED_DIR_BACKUP}/tools/qt5/qt_debug.conf ${CURRENT_PACKAGES_DIR}/tools/${PORT}/debug/bin/qt.conf) # This makes the tools at least useable for release set(CURRENT_INSTALLED_DIR "${CURRENT_INSTALLED_DIR_BACKUP}") - + vcpkg_copy_tool_dependencies("${CURRENT_PACKAGES_DIR}/tools/${PORT}/debug/bin") if(VCPKG_TARGET_IS_WINDOWS AND VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") file(GLOB_RECURSE DLL_DEPS_AVAIL "${CURRENT_INSTALLED_DIR}/tools/qt5/debug/bin/*.dll") @@ -122,5 +123,5 @@ function(qt_build_submodule SOURCE_PATH) endforeach() endif() endif() - + endfunction() \ No newline at end of file diff --git a/ports/qt5-base/portfile.cmake b/ports/qt5-base/portfile.cmake index 1ca13c5597..5137f72d00 100644 --- a/ports/qt5-base/portfile.cmake +++ b/ports/qt5-base/portfile.cmake @@ -1,19 +1,11 @@ vcpkg_buildpath_length_warning(37) if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") - option(QT_OPENSSL_LINK "Link against OpenSSL at compile-time." ON) + set(QT_OPENSSL_LINK_DEFAULT ON) else() - option(QT_OPENSSL_LINK "Link against OpenSSL at compile-time." OFF) + set(QT_OPENSSL_LINK_DEFAULT OFF) endif() - -if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") - option(QT_MYSQL_PLUGIN "Create MySQL plugin" OFF) -else() - if ("mysqlplugin" IN_LIST FEATURES) - option(QT_MYSQL_PLUGIN "Create MySQL plugin" ON) - endif() -endif() - +option(QT_OPENSSL_LINK "Link against OpenSSL at compile-time." ${QT_OPENSSL_LINK_DEFAULT}) if (VCPKG_TARGET_IS_LINUX) message(WARNING "qt5-base currently requires some packages from the system package manager, see https://doc.qt.io/qt-5/linux-requirements.html") @@ -45,9 +37,17 @@ else() ) endif() -set(WITH_PGSQL OFF) +set(WITH_PGSQL_PLUGIN OFF) if("postgresqlplugin" IN_LIST FEATURES) - set(WITH_PGSQL ON) + set(WITH_PGSQL_PLUGIN ON) +endif() + +set(WITH_MYSQL_PLUGIN OFF) +if ("mysqlplugin" IN_LIST FEATURES) + set(WITH_MYSQL_PLUGIN ON) +endif() +if(WITH_MYSQL_PLUGIN AND NOT VCPKG_TARGET_IS_WINDOWS) + message(WARNING "${PORT} is currently not setup to support feature 'mysqlplugin' on platforms other than windows. Feel free to open up a PR to fix it!") endif() include(qt_port_functions) @@ -121,31 +121,33 @@ list(APPEND CORE_OPTIONS -system-zlib -system-libjpeg -system-libpng - -system-freetype # static builds require to also link its dependent bzip! + -system-freetype -system-pcre -system-doubleconversion -system-sqlite -system-harfbuzz -icu -no-vulkan - -no-angle) # Qt does not need to build angle. VCPKG will build angle! + -no-angle # Qt does not need to build angle. VCPKG will build angle! + -no-glib + ) if(QT_OPENSSL_LINK) list(APPEND CORE_OPTIONS -openssl-linked) endif() -if(WITH_PGSQL) +if(WITH_PGSQL_PLUGIN) list(APPEND CORE_OPTIONS -sql-psql) else() list(APPEND CORE_OPTIONS -no-sql-psql) endif() - -if(VCPKG_TARGET_IS_WINDOWS) - if(QT_MYSQL_PLUGIN) - list(APPEND CORE_OPTIONS -sql-mysql) - endif() +if(WITH_MYSQL_PLUGIN) + list(APPEND CORE_OPTIONS -sql-mysql) +else() + list(APPEND CORE_OPTIONS -no-sql-mysql) endif() + find_library(ZLIB_RELEASE NAMES z zlib PATHS "${CURRENT_INSTALLED_DIR}/lib" NO_DEFAULT_PATH) find_library(ZLIB_DEBUG NAMES z zlib zd zlibd PATHS "${CURRENT_INSTALLED_DIR}/debug/lib" NO_DEFAULT_PATH) find_library(JPEG_RELEASE NAMES jpeg jpeg-static PATHS "${CURRENT_INSTALLED_DIR}/lib" NO_DEFAULT_PATH) @@ -202,7 +204,6 @@ if(VCPKG_TARGET_IS_WINDOWS) set(ICU_DEBUG "${ICU_DEBUG} Advapi32.lib" ) endif() - find_library(FONTCONFIG_RELEASE NAMES fontconfig PATHS "${CURRENT_INSTALLED_DIR}/lib" NO_DEFAULT_PATH) find_library(FONTCONFIG_DEBUG NAMES fontconfig PATHS "${CURRENT_INSTALLED_DIR}/debug/lib" NO_DEFAULT_PATH) find_library(EXPAT_RELEASE NAMES expat PATHS "${CURRENT_INSTALLED_DIR}/lib" NO_DEFAULT_PATH) @@ -222,13 +223,7 @@ set(FREETYPE_RELEASE_ALL "${FREETYPE_RELEASE} ${BZ2_RELEASE} ${LIBPNG_RELEASE} $ set(FREETYPE_DEBUG_ALL "${FREETYPE_DEBUG} ${BZ2_DEBUG} ${LIBPNG_DEBUG} ${ZLIB_DEBUG} ${BROTLI_DEC_DEBUG} ${BROTLI_COMMON_DEBUG}") # If HarfBuzz is built with GLib enabled, it must be statically link -set(GLIB_LIB_VERSION 2.0) -find_library(GLIB_RELEASE NAMES glib-${GLIB_LIB_VERSION} PATHS "${CURRENT_INSTALLED_DIR}/lib" NO_DEFAULT_PATH) -find_library(GLIB_DEBUG NAMES glib-${GLIB_LIB_VERSION} PATHS "${CURRENT_INSTALLED_DIR}/debug/lib" NO_DEFAULT_PATH) -if(GLIB_RELEASE MATCHES "-NOTFOUND" OR GLIB_DEBUG MATCHES "-NOTFOUND") - set(GLIB_RELEASE "") - set(GLIB_DEBUG "") -endif() +x_vcpkg_pkgconfig_get_modules(PREFIX harfbuzz MODULES harfbuzz LIBRARIES) set(RELEASE_OPTIONS "LIBJPEG_LIBS=${JPEG_RELEASE}" @@ -266,23 +261,23 @@ if(VCPKG_TARGET_IS_WINDOWS) endif() list(APPEND RELEASE_OPTIONS "SQLITE_LIBS=${SQLITE_RELEASE}" - "HARFBUZZ_LIBS=${HARFBUZZ_RELEASE} ${FREETYPE_RELEASE_ALL}" + "HARFBUZZ_LIBS=${harfbuzz_LIBRARIES_RELEASE}" "OPENSSL_LIBS=${SSL_RELEASE} ${EAY_RELEASE} ws2_32.lib secur32.lib advapi32.lib shell32.lib crypt32.lib user32.lib gdi32.lib" ) list(APPEND DEBUG_OPTIONS "SQLITE_LIBS=${SQLITE_DEBUG}" - "HARFBUZZ_LIBS=${HARFBUZZ_DEBUG} ${FREETYPE_DEBUG_ALL}" + "HARFBUZZ_LIBS=${harfbuzz_LIBRARIES_DEBUG}" "OPENSSL_LIBS=${SSL_DEBUG} ${EAY_DEBUG} ws2_32.lib secur32.lib advapi32.lib shell32.lib crypt32.lib user32.lib gdi32.lib" ) - if(WITH_PGSQL) + if(WITH_PGSQL_PLUGIN) list(APPEND RELEASE_OPTIONS "PSQL_LIBS=${PSQL_RELEASE} ${PSQL_PORT_RELEASE} ${PSQL_COMMON_RELEASE} ${SSL_RELEASE} ${EAY_RELEASE} ws2_32.lib secur32.lib advapi32.lib shell32.lib crypt32.lib user32.lib gdi32.lib") list(APPEND DEBUG_OPTIONS "PSQL_LIBS=${PSQL_DEBUG} ${PSQL_PORT_DEBUG} ${PSQL_COMMON_DEBUG} ${SSL_DEBUG} ${EAY_DEBUG} ws2_32.lib secur32.lib advapi32.lib shell32.lib crypt32.lib user32.lib gdi32.lib") endif() - if (QT_MYSQL_PLUGIN) + if (WITH_MYSQL_PLUGIN) list(APPEND RELEASE_OPTIONS "MYSQL_LIBS=${MYSQL_RELEASE}") list(APPEND DEBUG_OPTIONS "MYSQL_LIBS=${MYSQL_DEBUG}") - endif(QT_MYSQL_PLUGIN) + endif(WITH_MYSQL_PLUGIN) elseif(VCPKG_TARGET_IS_LINUX) list(APPEND CORE_OPTIONS -fontconfig -xcb-xlib -xcb -linuxfb) @@ -291,17 +286,17 @@ elseif(VCPKG_TARGET_IS_LINUX) endif() list(APPEND RELEASE_OPTIONS "SQLITE_LIBS=${SQLITE_RELEASE} -ldl -lpthread" - "HARFBUZZ_LIBS=${HARFBUZZ_RELEASE} ${FREETYPE_RELEASE_ALL} ${GLIB_RELEASE} -lpthread" + "HARFBUZZ_LIBS=${harfbuzz_LIBRARIES_RELEASE}" "OPENSSL_LIBS=${SSL_RELEASE} ${EAY_RELEASE} -ldl -lpthread" "FONTCONFIG_LIBS=${FONTCONFIG_RELEASE} ${FREETYPE_RELEASE} ${EXPAT_RELEASE} -luuid" ) list(APPEND DEBUG_OPTIONS "SQLITE_LIBS=${SQLITE_DEBUG} -ldl -lpthread" - "HARFBUZZ_LIBS=${HARFBUZZ_DEBUG} ${FREETYPE_DEBUG_ALL} ${GLIB_DEBUG} -lpthread" + "HARFBUZZ_LIBS=${harfbuzz_LIBRARIES_DEBUG}" "OPENSSL_LIBS=${SSL_DEBUG} ${EAY_DEBUG} -ldl -lpthread" "FONTCONFIG_LIBS=${FONTCONFIG_DEBUG} ${FREETYPE_DEBUG} ${EXPAT_DEBUG} -luuid" ) - if(WITH_PGSQL) + if(WITH_PGSQL_PLUGIN) list(APPEND RELEASE_OPTIONS "PSQL_LIBS=${PSQL_RELEASE} ${PSQL_PORT_RELEASE} ${PSQL_TYPES_RELEASE} ${PSQL_COMMON_RELEASE} ${SSL_RELEASE} ${EAY_RELEASE} -ldl -lpthread") list(APPEND DEBUG_OPTIONS "PSQL_LIBS=${PSQL_DEBUG} ${PSQL_PORT_DEBUG} ${PSQL_TYPES_DEBUG} ${PSQL_COMMON_DEBUG} ${SSL_DEBUG} ${EAY_DEBUG} -ldl -lpthread") endif() @@ -331,18 +326,18 @@ elseif(VCPKG_TARGET_IS_OSX) #list(APPEND QT_PLATFORM_CONFIGURE_OPTIONS HOST_PLATFORM ${TARGET_MKSPEC}) list(APPEND RELEASE_OPTIONS "SQLITE_LIBS=${SQLITE_RELEASE} -ldl -lpthread" - "HARFBUZZ_LIBS=${HARFBUZZ_RELEASE} ${FREETYPE_RELEASE_ALL} -framework ApplicationServices" + "HARFBUZZ_LIBS=${harfbuzz_LIBRARIES_RELEASE} -framework ApplicationServices" "OPENSSL_LIBS=${SSL_RELEASE} ${EAY_RELEASE} -ldl -lpthread" "FONTCONFIG_LIBS=${FONTCONFIG_RELEASE} ${FREETYPE_RELEASE} ${EXPAT_RELEASE} -liconv" ) list(APPEND DEBUG_OPTIONS "SQLITE_LIBS=${SQLITE_DEBUG} -ldl -lpthread" - "HARFBUZZ_LIBS=${HARFBUZZ_DEBUG} ${FREETYPE_DEBUG_ALL} -framework ApplicationServices" + "HARFBUZZ_LIBS=${harfbuzz_LIBRARIES_DEBUG} -framework ApplicationServices" "OPENSSL_LIBS=${SSL_DEBUG} ${EAY_DEBUG} -ldl -lpthread" "FONTCONFIG_LIBS=${FONTCONFIG_DEBUG} ${FREETYPE_DEBUG} ${EXPAT_DEBUG} -liconv" ) - if(WITH_PGSQL) + if(WITH_PGSQL_PLUGIN) list(APPEND RELEASE_OPTIONS "PSQL_LIBS=${PSQL_RELEASE} ${PSQL_PORT_RELEASE} ${PSQL_TYPES_RELEASE} ${PSQL_COMMON_RELEASE} ${SSL_RELEASE} ${EAY_RELEASE} -ldl -lpthread") list(APPEND DEBUG_OPTIONS "PSQL_LIBS=${PSQL_DEBUG} ${PSQL_PORT_DEBUG} ${PSQL_TYPES_DEBUG} ${PSQL_COMMON_DEBUG} ${SSL_DEBUG} ${EAY_DEBUG} -ldl -lpthread") endif() diff --git a/ports/qt5-base/vcpkg.json b/ports/qt5-base/vcpkg.json index 37e62526c2..e71dbb245f 100644 --- a/ports/qt5-base/vcpkg.json +++ b/ports/qt5-base/vcpkg.json @@ -1,7 +1,7 @@ { "name": "qt5-base", "version-string": "5.15.2", - "port-version": 3, + "port-version": 4, "description": "Qt5 Application Framework Base Module. Includes Core, GUI, Widgets, Networking, SQL, Concurrent and other essential qt components.", "homepage": "https://www.qt.io/", "dependencies": [ @@ -26,6 +26,10 @@ "openssl", "pcre2", "sqlite3", + { + "name": "vcpkg-pkgconfig-get-modules", + "host": true + }, "zlib", "zstd" ], diff --git a/ports/vcpkg-pkgconfig-get-modules/README.md b/ports/vcpkg-pkgconfig-get-modules/README.md new file mode 100644 index 0000000000..ac99412c24 --- /dev/null +++ b/ports/vcpkg-pkgconfig-get-modules/README.md @@ -0,0 +1,6 @@ +# vcpkg-pkgconfig-get-modules + +**Experimental: will change or be removed at any time** + +`vcpkg-pkgconfig-get-modules` provides `x_vcpkg_pkgconfig_get_modules()`, a function which simplifies calling +`pkg-config` in portfiles in order to gather dependencies for exotic buildsystems. diff --git a/ports/vcpkg-pkgconfig-get-modules/copyright b/ports/vcpkg-pkgconfig-get-modules/copyright new file mode 100644 index 0000000000..2e4eac8264 --- /dev/null +++ b/ports/vcpkg-pkgconfig-get-modules/copyright @@ -0,0 +1,23 @@ +Copyright (c) Microsoft Corporation + +All rights reserved. + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/ports/vcpkg-pkgconfig-get-modules/portfile.cmake b/ports/vcpkg-pkgconfig-get-modules/portfile.cmake new file mode 100644 index 0000000000..18df919b49 --- /dev/null +++ b/ports/vcpkg-pkgconfig-get-modules/portfile.cmake @@ -0,0 +1,12 @@ +if(NOT TARGET_TRIPLET STREQUAL HOST_TRIPLET) + # make FATAL_ERROR in CI when issue #16773 fixed + message(WARNING "vcpkg-pkgconfig-get-modules is a host-only port; please mark it as a host port in your dependencies.") +endif() + +file(COPY + "${CMAKE_CURRENT_LIST_DIR}/x_vcpkg_pkgconfig_get_modules.cmake" + "${CMAKE_CURRENT_LIST_DIR}/vcpkg-port-config.cmake" + "${CMAKE_CURRENT_LIST_DIR}/copyright" + DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") + +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) diff --git a/ports/vcpkg-pkgconfig-get-modules/vcpkg-port-config.cmake b/ports/vcpkg-pkgconfig-get-modules/vcpkg-port-config.cmake new file mode 100644 index 0000000000..01c9e6aec6 --- /dev/null +++ b/ports/vcpkg-pkgconfig-get-modules/vcpkg-port-config.cmake @@ -0,0 +1 @@ +include("${CMAKE_CURRENT_LIST_DIR}/x_vcpkg_pkgconfig_get_modules.cmake") diff --git a/ports/vcpkg-pkgconfig-get-modules/vcpkg.json b/ports/vcpkg-pkgconfig-get-modules/vcpkg.json new file mode 100644 index 0000000000..f9c24c7f36 --- /dev/null +++ b/ports/vcpkg-pkgconfig-get-modules/vcpkg.json @@ -0,0 +1,4 @@ +{ + "name": "vcpkg-pkgconfig-get-modules", + "version-date": "2021-04-02" +} diff --git a/ports/vcpkg-pkgconfig-get-modules/x_vcpkg_pkgconfig_get_modules.cmake b/ports/vcpkg-pkgconfig-get-modules/x_vcpkg_pkgconfig_get_modules.cmake new file mode 100644 index 0000000000..43ccf92e7a --- /dev/null +++ b/ports/vcpkg-pkgconfig-get-modules/x_vcpkg_pkgconfig_get_modules.cmake @@ -0,0 +1,146 @@ +#[===[.md: +# x_vcpkg_pkgconfig_get_modules + +Experimental +Retrieve required module information from pkgconfig modules + +## Usage +```cmake +x_vcpkg_pkgconfig_get_modules( + PREFIX + MODULES ... + [LIBS] + [LIBRARIES] + [LIBRARIES_DIRS] + [INCLUDE_DIRS] +) +``` +## Parameters + +### PREFIX +Used variable prefix to use + +### MODULES +List of pkgconfig modules to retrieve information for. + +### LIBS +Returns `"${PKGCONFIG}" --libs` in _LIBS_(DEBUG|RELEASE) + +### LIBRARIES +Returns `"${PKGCONFIG}" --libs-only-l` in _LIBRARIES_(DEBUG|RELEASE) + +### LIBRARIES_DIRS +Returns `"${PKGCONFIG}" --libs-only-L` in _LIBRARIES_DIRS_(DEBUG|RELEASE) + +### INCLUDE_DIRS +Returns `"${PKGCONFIG}" --cflags-only-I` in _INCLUDE_DIRS_(DEBUG|RELEASE) + +## Examples + +* [qt5-base](https://github.com/microsoft/vcpkg/blob/master/ports/qt5-base/portfile.cmake) +#]===] +if(Z_VCPKG_PKGCONFIG_GET_MODULES_GUARD) + return() +endif() +set(Z_VCPKG_PKGCONFIG_GET_MODULES_GUARD ON CACHE INTERNAL "guard variable") + +function(x_vcpkg_pkgconfig_get_modules) + cmake_parse_arguments(PARSE_ARGV 0 "arg" "LIBS;LIBRARIES;LIBRARIES_DIR;INCLUDE_DIRS" "PREFIX" "MODULES") + if(NOT DEFINED arg_PREFIX OR arg_PREFIX STREQUAL "") + message(FATAL_ERROR "x_vcpkg_pkgconfig_get_modules requires parameter PREFIX!") + endif() + if(NOT DEFINED arg_MODULES OR arg_MODULES STREQUAL "") + message(FATAL_ERROR "x_vcpkg_pkgconfig_get_modules requires parameter MODULES!") + endif() + if(DEFINED arg_UNPARSED_ARGUMENTS) + message(FATAL_ERROR "extra arguments passed to x_vcpkg_pkgconfig_get_modules: ${arg_UNPARSED_ARGUMENTS}") + endif() + + vcpkg_find_acquire_program(PKGCONFIG) + set(backup_PKG_CONFIG_PATH "$ENV{PKG_CONFIG_PATH}") + + set(var_suffixes) + if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release") + z_vcpkg_set_pkgconfig_path("${CURRENT_INSTALLED_DIR}/lib/pkgconfig" "${backup_PKG_CONFIG_PATH}") + if(arg_LIBS) + execute_process( + COMMAND "${PKGCONFIG}" --libs ${arg_MODULES} + OUTPUT_VARIABLE ${arg_PREFIX}_LIBS_RELEASE + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + list(APPEND var_suffixes LIBS_RELEASE) + endif() + if(arg_LIBRARIES) + execute_process( + COMMAND "${PKGCONFIG}" --libs-only-l ${arg_MODULES} + OUTPUT_VARIABLE ${arg_PREFIX}_LIBRARIES_RELEASE + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + list(APPEND var_suffixes LIBRARIES_RELEASE) + endif() + if(arg_LIBRARIES_DIRS) + execute_process( + COMMAND "${PKGCONFIG}" --libs-only-L ${arg_MODULES} + OUTPUT_VARIABLE ${arg_PREFIX}_LIBRARIES_DIRS_RELEASE + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + list(APPEND var_suffixes LIBRARIES_DIRS_RELEASE) + endif() + if(arg_INCLUDE_DIRS) + execute_process( + COMMAND "${PKGCONFIG}" --cflags-only-I ${arg_MODULES} + OUTPUT_VARIABLE ${arg_PREFIX}_INCLUDE_DIRS_RELEASE + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + list(APPEND var_suffixes INCLUDE_DIRS_RELEASE) + endif() + endif() + if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") + z_vcpkg_set_pkgconfig_path("${CURRENT_INSTALLED_DIR}/debug/lib/pkgconfig" "${backup_PKG_CONFIG_PATH}") + if(arg_LIBS) + execute_process( + COMMAND "${PKGCONFIG}" --libs ${arg_MODULES} + OUTPUT_VARIABLE ${arg_PREFIX}_LIBS_DEBUG + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + list(APPEND var_suffixes LIBS_DEBUG) + endif() + if(arg_LIBRARIES) + execute_process( + COMMAND "${PKGCONFIG}" --libs-only-l ${arg_MODULES} + OUTPUT_VARIABLE ${arg_PREFIX}_LIBRARIES_DEBUG + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + list(APPEND var_suffixes LIBRARIES_DEBUG) + endif() + if(arg_LIBRARIES_DIRS) + execute_process( + COMMAND "${PKGCONFIG}" --libs-only-L ${arg_MODULES} + OUTPUT_VARIABLE ${arg_PREFIX}_LIBRARIES_DIRS_DEBUG + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + list(APPEND var_suffixes LIBRARIES_DIRS_DEBUG) + endif() + if(arg_INCLUDE_DIRS) + execute_process( + COMMAND "${PKGCONFIG}" --cflags-only-I ${arg_MODULES} + OUTPUT_VARIABLE ${arg_PREFIX}_INCLUDE_DIRS_DEBUG + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + list(APPEND var_suffixes INCLUDE_DIRS_DEBUG) + endif() + endif() + set(ENV{PKG_CONFIG_PATH} "${backup_PKG_CONFIG_PATH}") + + foreach(_var IN LISTS var_suffixes) + set("${arg_PREFIX}_${_var}" "${${arg_PREFIX}_${_var}}" PARENT_SCOPE) + endforeach() +endfunction() + +function(z_vcpkg_set_pkgconfig_path _path _backup) + if(NOT _backup STREQUAL "") + set(ENV{PKG_CONFIG_PATH} "${_path}${VCPKG_HOST_PATH_SEPARATOR}${_backup}") + else() + set(ENV{PKG_CONFIG_PATH} "${_path}") + endif() +endfunction() diff --git a/scripts/ci.baseline.txt b/scripts/ci.baseline.txt index 9b0bd80f47..124afea578 100644 --- a/scripts/ci.baseline.txt +++ b/scripts/ci.baseline.txt @@ -1213,7 +1213,6 @@ paho-mqtt:arm-uwp=fail paho-mqtt:x64-uwp=fail pangomm:x64-osx=fail pangomm:arm64-windows=fail -paraview:x64-linux=fail parmetis:x64-linux=fail parmetis:x64-osx=fail pdal:x64-linux=fail diff --git a/versions/baseline.json b/versions/baseline.json index 7ba361f3b1..eefd125a72 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -4962,7 +4962,7 @@ }, "qt5-base": { "baseline": "5.15.2", - "port-version": 3 + "port-version": 4 }, "qt5-canvas3d": { "baseline": "0", @@ -6264,6 +6264,10 @@ "baseline": "3", "port-version": 0 }, + "vcpkg-pkgconfig-get-modules": { + "baseline": "2021-04-02", + "port-version": 0 + }, "vectorclass": { "baseline": "2.00.01", "port-version": 0 diff --git a/versions/q-/qt5-base.json b/versions/q-/qt5-base.json index 4fbe36d47d..8b437940ad 100644 --- a/versions/q-/qt5-base.json +++ b/versions/q-/qt5-base.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "6bd06b14752f1123c7d43df59ae19c584c24ea54", + "version-string": "5.15.2", + "port-version": 4 + }, { "git-tree": "da84dcfb306668b2cdb510efb6a130882da2055a", "version-string": "5.15.2", diff --git a/versions/v-/vcpkg-pkgconfig-get-modules.json b/versions/v-/vcpkg-pkgconfig-get-modules.json new file mode 100644 index 0000000000..c1c65a5417 --- /dev/null +++ b/versions/v-/vcpkg-pkgconfig-get-modules.json @@ -0,0 +1,9 @@ +{ + "versions": [ + { + "git-tree": "827541895526ebcd68711de9d05e98acd09bd323", + "version-date": "2021-04-02", + "port-version": 0 + } + ] +}