[scripts] add vcpkg-msbuild (#28773)

* add vcpkg-msbuild

* v db

* Apply some suggestions from code review

* revert v db and format manifest

* v db

* fix missing rename

* v db

* revert back to USE_MSVC_SYNTAX_ON_WINDOWS

* v db

* Fix logic

* v db

* Update versions/v-/vcpkg-msbuild.json

* Apply suggestions from code review

Co-authored-by: Javier Matos Denizac <javier.matosd@gmail.com>

* remove include destination since it wasn't used any way

* v db

---------

Co-authored-by: Jonliu1993 <13720414433@163.com>
Co-authored-by: Javier Matos Denizac <javier.matosd@gmail.com>
This commit is contained in:
Alexander Neumann 2023-06-23 21:07:47 +02:00 committed by GitHub
parent 1286cac875
commit 95c0444591
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 402 additions and 39 deletions

View File

@ -0,0 +1,10 @@
file(INSTALL
"${CMAKE_CURRENT_LIST_DIR}/vcpkg_msbuild.props.in"
"${CMAKE_CURRENT_LIST_DIR}/vcpkg_msbuild.targets.in"
"${CMAKE_CURRENT_LIST_DIR}/z_vcpkg_msbuild_create_props.cmake"
"${CMAKE_CURRENT_LIST_DIR}/vcpkg_msbuild_install.cmake"
"${CMAKE_CURRENT_LIST_DIR}/vcpkg-port-config.cmake"
DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
file(INSTALL "${VCPKG_ROOT_DIR}/LICENSE.txt" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
set(VCPKG_POLICY_CMAKE_HELPER_PORT enabled)

View File

@ -0,0 +1,5 @@
include_guard(GLOBAL)
include("${CMAKE_CURRENT_LIST_DIR}/../vcpkg-cmake-get-vars/vcpkg-port-config.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/../vcpkg-pkgconfig-get-modules/vcpkg-port-config.cmake" OPTIONAL)
include("${CMAKE_CURRENT_LIST_DIR}/z_vcpkg_msbuild_create_props.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/vcpkg_msbuild_install.cmake")

View File

@ -0,0 +1,25 @@
{
"name": "vcpkg-msbuild",
"version-date": "2023-06-22",
"documentation": "https://vcpkg.io/en/docs/README.html",
"license": "MIT",
"supports": "native & windows",
"dependencies": [
{
"name": "vcpkg-cmake-get-vars",
"host": true
},
{
"name": "vcpkg-pkgconfig-get-modules",
"host": true
}
],
"features": {
"pkg-config": {
"description": "Enable pkg-config lookup for msbuild",
"dependencies": [
"pkgconf"
]
}
}
}

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<vcpkg_msbuild_props_imported>true</vcpkg_msbuild_props_imported>
</PropertyGroup>
<PropertyGroup>
<WindowsTargetPlatformVersion>@arg_TARGET_PLATFORM_VERSION@</WindowsTargetPlatformVersion>
<PlatformToolset>@VCPKG_PLATFORM_TOOLSET@</PlatformToolset>
<!-- <Platform>@arg_PLATFORM@</Platform> -->
<VcpkgApplocalDeps>false</VcpkgApplocalDeps>
<VcpkgManifestInstall>false</VcpkgManifestInstall>
<VcpkgManifestEnabled>false</VcpkgManifestEnabled>
<VcpkgEnabled>false</VcpkgEnabled>
<VcpkgTriplet>@TARGET_TRIPLET@</VcpkgTriplet>
<VcpkgInstalledDir>@_VCPKG_INSTALLED_DIR@</VcpkgInstalledDir>
<UseIntelMKL>No</UseIntelMKL>
<ImportProjectExtensionProps>false</ImportProjectExtensionProps>
<ForceImportAfterCppProps>vcpkg_msbuild.props</ForceImportAfterCppProps>
<ForceImportAfterCppTargets>vcpkg_msbuild.targets</ForceImportAfterCppTargets>
</PropertyGroup>
@VCPKG_MSBUILD_ADDITIONAL_PROPS_XML@
</Project>

View File

@ -0,0 +1,64 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Condition="'$(vcpkg_msbuild_props_imported)' != 'true'" Project="vcpkg_msbuild.props" />
<PropertyGroup>
<WindowsTargetPlatformVersion>@arg_TARGET_PLATFORM_VERSION@</WindowsTargetPlatformVersion>
<PlatformToolset>@VCPKG_PLATFORM_TOOLSET@</PlatformToolset>
<!-- <Platform>@arg_PLATFORM@</Platform> -->
<VcpkgApplocalDeps>false</VcpkgApplocalDeps>
<VcpkgManifestInstall>false</VcpkgManifestInstall>
<VcpkgManifestEnabled>false</VcpkgManifestEnabled>
<VcpkgEnabled>false</VcpkgEnabled>
<VcpkgTriplet>@TARGET_TRIPLET@</VcpkgTriplet>
<VcpkgInstalledDir>@_VCPKG_INSTALLED_DIR@</VcpkgInstalledDir>
<UseIntelMKL>No</UseIntelMKL>
<ImportProjectExtensionProps>false</ImportProjectExtensionProps>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<!-- vcpkg -->
<RuntimeLibrary Condition="'${VCPKG_CRT_LINKAGE}|$(Configuration)' == 'static|${arg_DEBUG_CONFIGURATION}'">MultiThreadedDebug</RuntimeLibrary>
<RuntimeLibrary Condition="'${VCPKG_CRT_LINKAGE}|$(Configuration)' == 'static|${arg_RELEASE_CONFIGURATION}'">MultiThreaded</RuntimeLibrary>
<RuntimeLibrary Condition="'${VCPKG_CRT_LINKAGE}|$(Configuration)' == 'dynamic|${arg_DEBUG_CONFIGURATION}'">MultiThreadedDebugDLL</RuntimeLibrary>
<RuntimeLibrary Condition="'${VCPKG_CRT_LINKAGE}|$(Configuration)' == 'dynamic|${arg_RELEASE_CONFIGURATION}'">MultiThreadedDLL</RuntimeLibrary>
<AdditionalIncludeDirectories Condition="'$(Configuration)'=='${arg_DEBUG_CONFIGURATION}'" >@MSBUILD_INCLUDE_DIRS_DEBUG@</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories Condition="'$(Configuration)'=='${arg_RELEASE_CONFIGURATION}'">@MSBUILD_INCLUDE_DIRS_RELEASE@</AdditionalIncludeDirectories>
</ClCompile>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Update="@project_root@**/*.cpp;@project_root@**/*.cxx">
<AdditionalOptions Condition="'$(Configuration)'=='${arg_DEBUG_CONFIGURATION}'" >%(AdditionalOptions) @VCPKG_COMBINED_CXX_FLAGS_DEBUG@ @MSBUILD_CFLAGS_DEBUG@ /WX-</AdditionalOptions>
<AdditionalOptions Condition="'$(Configuration)'=='${arg_RELEASE_CONFIGURATION}'">%(AdditionalOptions) @VCPKG_COMBINED_CXX_FLAGS_RELEASE@ @MSBUILD_CFLAGS_RELEASE@ /WX-</AdditionalOptions>
</ClCompile>
</ItemGroup>
<ItemGroup >
<ClCompile Update="@project_root@**/*.c">
<AdditionalOptions Condition="'$(Configuration)'=='${arg_DEBUG_CONFIGURATION}'" >%(AdditionalOptions) @VCPKG_COMBINED_C_FLAGS_DEBUG@ @MSBUILD_CFLAGS_DEBUG@ /WX-</AdditionalOptions>
<AdditionalOptions Condition="'$(Configuration)'=='${arg_RELEASE_CONFIGURATION}'">%(AdditionalOptions) @VCPKG_COMBINED_C_FLAGS_RELEASE@ @MSBUILD_CFLAGS_RELEASE@ /WX-</AdditionalOptions>
</ClCompile>
</ItemGroup>
<ItemDefinitionGroup>
<Link>
<!-- Required Libs -->
<AdditionalDependencies Condition="'$(Configuration)'=='${arg_DEBUG_CONFIGURATION}'" >@MSBUILD_LIBRARIES_DEBUG@</AdditionalDependencies>
<AdditionalLibraryDirectories Condition="'$(Configuration)'=='${arg_DEBUG_CONFIGURATION}'" >@MSBUILD_LIBRARIES_DIRS_DEBUG@</AdditionalLibraryDirectories>
<AdditionalDependencies Condition="'$(Configuration)'=='${arg_RELEASE_CONFIGURATION}'" >@MSBUILD_LIBRARIES_RELEASE@</AdditionalDependencies >
<AdditionalLibraryDirectories Condition="'$(Configuration)'=='${arg_RELEASE_CONFIGURATION}'">@MSBUILD_LIBRARIES_DIRS_RELEASE@</AdditionalLibraryDirectories>
<AdditionalOptions Condition="'$(Configuration)|$(ConfigurationType)'=='${arg_DEBUG_CONFIGURATION}|DynamicLibrary'" >%(AdditionalOptions) @VCPKG_COMBINED_SHARED_LINKER_FLAGS_DEBUG@ @MSBUILD_LIBS_DEBUG@ /WX:NO</AdditionalOptions>
<AdditionalOptions Condition="'$(Configuration)|$(ConfigurationType)'=='${arg_RELEASE_CONFIGURATION}|DynamicLibrary'">%(AdditionalOptions) @VCPKG_COMBINED_SHARED_LINKER_FLAGS_RELEASE@ @MSBUILD_LIBS_RELEASE@ /WX:NO</AdditionalOptions>
<AdditionalOptions Condition="'$(Configuration)|$(ConfigurationType)'=='${arg_DEBUG_CONFIGURATION}|Application'" >%(AdditionalOptions) @VCPKG_COMBINED_EXE_LINKER_FLAGS_DEBUG@ @MSBUILD_LIBS_DEBUG@ /WX:NO</AdditionalOptions>
<AdditionalOptions Condition="'$(Configuration)|$(ConfigurationType)'=='${arg_RELEASE_CONFIGURATION}|Application'">%(AdditionalOptions) @VCPKG_COMBINED_EXE_LINKER_FLAGS_RELEASE@ @MSBUILD_LIBS_RELEASE@ /WX:NO</AdditionalOptions>
<AdditionalOptions Condition="'$(Configuration)|$(ConfigurationType)'=='${arg_DEBUG_CONFIGURATION}|StaticLibrary'">%(AdditionalOptions) @VCPKG_COMBINED_STATIC_LINKER_FLAGS_DEBUG@</AdditionalOptions>
<AdditionalOptions Condition="'$(Configuration)|$(ConfigurationType)'=='${arg_RELEASE_CONFIGURATION}|StaticLibrary'">%(AdditionalOptions) @VCPKG_COMBINED_STATIC_LINKER_FLAGS_RELEASE@</AdditionalOptions>
</Link>
<Lib>
<AdditionalOptions Condition="'$(Configuration)|$(ConfigurationType)'=='${arg_DEBUG_CONFIGURATION}|StaticLibrary'">%(AdditionalOptions) @VCPKG_COMBINED_STATIC_LINKER_FLAGS_DEBUG@</AdditionalOptions>
<AdditionalOptions Condition="'$(Configuration)|$(ConfigurationType)'=='${arg_RELEASE_CONFIGURATION}|StaticLibrary'">%(AdditionalOptions) @VCPKG_COMBINED_STATIC_LINKER_FLAGS_RELEASE@</AdditionalOptions>
<!-- Required to prevent linker errors on Visual Studio 2017 with static CRT -->
<TargetMachine Condition="'${VCPKG_TARGET_ARCHITECTURE}'=='x86'">MachineX86</TargetMachine>
<TargetMachine Condition="'${VCPKG_TARGET_ARCHITECTURE}'=='x64'">MachineX64</TargetMachine>
<TargetMachine Condition="'${VCPKG_TARGET_ARCHITECTURE}'=='arm'">MachineARM</TargetMachine>
</Lib>
</ItemDefinitionGroup>
@VCPKG_MSBUILD_ADDITIONAL_TARGETS_XML@
</Project>

View File

@ -0,0 +1,152 @@
function(vcpkg_msbuild_install)
cmake_parse_arguments(
PARSE_ARGV 0
"arg"
"CLEAN;NO_TOOLCHAIN_PROPS;NO_INSTALL"
"SOURCE_PATH;PROJECT_SUBPATH;RELEASE_CONFIGURATION;DEBUG_CONFIGURATION;PLATFORM;TARGET"
"OPTIONS;OPTIONS_RELEASE;OPTIONS_DEBUG;DEPENDENT_PKGCONFIG;ADDITIONAL_LIBS;ADDITIONAL_LIBS_DEBUG;ADDITIONAL_LIBS_RELEASE"
)
if(DEFINED arg_UNPARSED_ARGUMENTS)
message(WARNING "${CMAKE_CURRENT_FUNCTION} was passed extra arguments: ${arg_UNPARSED_ARGUMENTS}")
endif()
if(NOT DEFINED arg_RELEASE_CONFIGURATION)
set(arg_RELEASE_CONFIGURATION Release)
endif()
if(NOT DEFINED arg_DEBUG_CONFIGURATION)
set(arg_DEBUG_CONFIGURATION Debug)
endif()
if(NOT DEFINED arg_PLATFORM)
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64")
set(arg_PLATFORM x64)
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86")
set(arg_PLATFORM Win32)
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm")
set(arg_PLATFORM ARM)
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64")
set(arg_PLATFORM arm64)
else()
message(FATAL_ERROR "Unsupported target architecture")
endif()
endif()
if(NOT DEFINED arg_PLATFORM_TOOLSET)
set(arg_PLATFORM_TOOLSET "${VCPKG_PLATFORM_TOOLSET}")
endif()
if(NOT DEFINED arg_TARGET)
set(arg_TARGET Rebuild)
endif()
if(DEFINED arg_ADDITIONAL_LIBS)
list(APPEND arg_ADDITIONAL_LIBS_DEBUG ${arg_ADDITIONAL_LIBS})
list(APPEND arg_ADDITIONAL_LIBS_RELEASE ${arg_ADDITIONAL_LIBS})
endif()
vcpkg_get_windows_sdk(arg_TARGET_PLATFORM_VERSION)
if(NOT arg_NO_TOOLCHAIN_PROPS)
file(RELATIVE_PATH project_root "${arg_SOURCE_PATH}/${arg_PROJECT_SUBPATH}" "${arg_SOURCE_PATH}") # required by z_vcpkg_msbuild_create_props
z_vcpkg_msbuild_create_props(OUTPUT_PROPS props_file
OUTPUT_TARGETS target_file
RELEASE_CONFIGURATION "${arg_RELEASE_CONFIGURATION}"
DEBUG_CONFIGURATION "${arg_DEBUG_CONFIGURATION}"
DEPENDENT_PKGCONFIG ${arg_DEPENDENT_PKGCONFIG}
ADDITIONAL_LIBS_DEBUG ${arg_ADDITIONAL_LIBS_DEBUG}
ADDITIONAL_LIBS_RELEASE ${arg_ADDITIONAL_LIBS_RELEASE})
list(APPEND arg_OPTIONS
"/p:ForceImportAfterCppProps=${props_file}"
"/p:ForceImportAfterCppTargets=${target_file}"
)
endif()
list(APPEND arg_OPTIONS
"/t:${arg_TARGET}"
"/p:UseMultiToolTask=true"
"/p:MultiProcMaxCount=${VCPKG_CONCURRENCY}"
"/p:EnforceProcessCountAcrossBuilds=true"
"/m:${VCPKG_CONCURRENCY}"
"-maxCpuCount:${VCPKG_CONCURRENCY}"
# other Properties
"/p:Platform=${arg_PLATFORM}"
"/p:PlatformToolset=${arg_PLATFORM_TOOLSET}"
"/p:WindowsTargetPlatformVersion=${arg_TARGET_PLATFORM_VERSION}"
# vcpkg properties
"/p:VcpkgApplocalDeps=false"
"/p:VcpkgManifestInstall=false"
"/p:VcpkgManifestEnabled=false"
"/p:VcpkgEnabled=false"
"/p:VcpkgTriplet=${TARGET_TRIPLET}"
"/p:VcpkgInstalledDir=${_VCPKG_INSTALLED_DIR}"
)
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
# Disable LTCG for static libraries because this setting introduces ABI incompatibility between minor compiler versions
# TODO: Add a way for the user to override this if they want to opt-in to incompatibility
list(APPEND arg_OPTIONS "/p:WholeProgramOptimization=false")
endif()
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
message(STATUS "Building ${arg_PROJECT_SUBPATH} for Release")
set(working_dir "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel")
file(REMOVE_RECURSE "${working_dir}")
file(MAKE_DIRECTORY "${working_dir}")
file(COPY "${arg_SOURCE_PATH}/" DESTINATION "${working_dir}")
vcpkg_execute_required_process(
COMMAND msbuild "${working_dir}/${arg_PROJECT_SUBPATH}"
"/p:Configuration=${arg_RELEASE_CONFIGURATION}"
${arg_OPTIONS}
${arg_OPTIONS_RELEASE}
WORKING_DIRECTORY "${working_dir}"
LOGNAME "build-${TARGET_TRIPLET}-rel"
)
if(NOT arg_NO_INSTALL)
file(GLOB_RECURSE libs "${working_dir}/*.lib")
file(GLOB_RECURSE dlls "${working_dir}/*.dll")
file(GLOB_RECURSE exes "${working_dir}/*.exe")
if(NOT libs STREQUAL "")
file(COPY ${libs} DESTINATION "${CURRENT_PACKAGES_DIR}/lib")
endif()
if(NOT dlls STREQUAL "")
file(COPY ${dlls} DESTINATION "${CURRENT_PACKAGES_DIR}/bin")
endif()
if(NOT exes STREQUAL "")
file(COPY ${exes} DESTINATION "${CURRENT_PACKAGES_DIR}/tools/${PORT}")
vcpkg_copy_tool_dependencies("${CURRENT_PACKAGES_DIR}/tools/${PORT}")
endif()
endif()
endif()
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
message(STATUS "Building ${arg_PROJECT_SUBPATH} for Debug")
set(working_dir "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg")
file(REMOVE_RECURSE "${working_dir}")
file(MAKE_DIRECTORY "${working_dir}")
file(COPY "${arg_SOURCE_PATH}/" DESTINATION "${working_dir}")
vcpkg_execute_required_process(
COMMAND msbuild "${working_dir}/${arg_PROJECT_SUBPATH}"
"/p:Configuration=${arg_DEBUG_CONFIGURATION}"
${arg_OPTIONS}
${arg_OPTIONS_DEBUG}
WORKING_DIRECTORY "${working_dir}"
LOGNAME "build-${TARGET_TRIPLET}-dbg"
)
if(NOT arg_NO_INSTALL)
file(GLOB_RECURSE libs "${working_dir}/*.lib")
file(GLOB_RECURSE dlls "${working_dir}/*.dll")
if(NOT libs STREQUAL "")
file(COPY ${libs} DESTINATION "${CURRENT_PACKAGES_DIR}/debug/lib")
endif()
if(NOT dlls STREQUAL "")
file(COPY ${dlls} DESTINATION "${CURRENT_PACKAGES_DIR}/debug/bin")
endif()
endif()
endif()
vcpkg_copy_pdbs()
if(arg_CLEAN)
vcpkg_clean_msbuild()
endif()
endfunction()

View File

@ -0,0 +1,76 @@
function(z_vcpkg_msbuild_create_props)
cmake_parse_arguments(
PARSE_ARGV 0
"arg"
""
"OUTPUT_PROPS;OUTPUT_TARGETS;RELEASE_CONFIGURATION;DEBUG_CONFIGURATION"
"DEPENDENT_PKGCONFIG;ADDITIONAL_LIBS_DEBUG;ADDITIONAL_LIBS_RELEASE"
)
if(NOT arg_OUTPUT_PROPS)
message(FATAL_ERROR "'${CMAKE_CURRENT_FUNCTION}' requires option 'OUTPUT_PROPS'!")
endif()
if(NOT arg_OUTPUT_TARGETS)
message(FATAL_ERROR "'${CMAKE_CURRENT_FUNCTION}' requires option 'OUTPUT_TARGETS'!")
endif()
if(DEFINED arg_UNPARSED_ARGUMENTS)
message(WARNING "'${CMAKE_CURRENT_FUNCTION}' was passed extra arguments: ${arg_UNPARSED_ARGUMENTS}")
endif()
# TODO: detect and set these ?
# <LanguageStandard>stdcpp20</LanguageStandard>
# <LanguageStandard_C>stdc17</LanguageStandard_C>
if(NOT DEFINED arg_RELEASE_CONFIGURATION)
set(arg_RELEASE_CONFIGURATION Release)
endif()
if(NOT DEFINED arg_DEBUG_CONFIGURATION)
set(arg_DEBUG_CONFIGURATION Debug)
endif()
set(TARGET_PLATFORM_VERSION "")
vcpkg_get_windows_sdk(TARGET_PLATFORM_VERSION)
if(arg_DEPENDENT_PKGCONFIG)
if(NOT COMMAND x_vcpkg_pkgconfig_get_modules)
message(FATAL_ERROR "Port vcpkg-msbuild needs to have feature 'pkg-config' enabled for 'DEPENDENT_PKGCONFIG'")
endif()
x_vcpkg_pkgconfig_get_modules(PREFIX MSBUILD INCLUDE_DIRS LIBRARIES LIBRARIES_DIR CFLAGS USE_MSVC_SYNTAX_ON_WINDOWS MODULES ${arg_DEPENDENT_PKGCONFIG})
separate_arguments(MSBUILD_INCLUDE_DIRS_RELEASE WINDOWS_COMMAND "${MSBUILD_INCLUDE_DIRS_RELEASE}")
separate_arguments(MSBUILD_INCLUDE_DIRS_DEBUG WINDOWS_COMMAND "${MSBUILD_INCLUDE_DIRS_DEBUG}")
foreach(inc_dirs IN LISTS MSBUILD_INCLUDE_DIRS_RELEASE)
string(REPLACE "${inc_dirs}" "" MSBUILD_CFLAGS_RELEASE "${MSBUILD_CFLAGS_RELEASE}")
endforeach()
foreach(inc_dirs IN LISTS MSBUILD_INCLUDE_DIRS_DEBUG)
string(REPLACE "${inc_dirs}" "" MSBUILD_CFLAGS_DEBUG "${MSBUILD_CFLAGS_DEBUG}")
endforeach()
list(TRANSFORM MSBUILD_INCLUDE_DIRS_RELEASE REPLACE "^/I" "")
list(TRANSFORM MSBUILD_INCLUDE_DIRS_DEBUG REPLACE "^/I" "")
separate_arguments(MSBUILD_LIBRARIES_DIRS_RELEASE WINDOWS_COMMAND "${MSBUILD_LIBRARIES_DIRS_RELEASE}")
separate_arguments(MSBUILD_LIBRARIES_DIRS_DEBUG WINDOWS_COMMAND "${MSBUILD_LIBRARIES_DIRS_DEBUG}")
separate_arguments(MSBUILD_LIBRARIES_RELEASE WINDOWS_COMMAND "${MSBUILD_LIBRARIES_RELEASE}")
separate_arguments(MSBUILD_LIBRARIES_DEBUG WINDOWS_COMMAND "${MSBUILD_LIBRARIES_DEBUG}")
endif()
vcpkg_cmake_get_vars(vars_file)
include("${vars_file}")
vcpkg_list(APPEND MSBUILD_INCLUDE_DIRS_RELEASE "${CURRENT_PACKAGES_DIR}/include" "${CURRENT_INSTALLED_DIR}/include")
vcpkg_list(APPEND MSBUILD_INCLUDE_DIRS_DEBUG "${CURRENT_PACKAGES_DIR}/include" "${CURRENT_INSTALLED_DIR}/include")
vcpkg_list(APPEND MSBUILD_LIBRARIES_DIRS_RELEASE "${CURRENT_PACKAGES_DIR}/lib" "${CURRENT_INSTALLED_DIR}/lib")
vcpkg_list(APPEND MSBUILD_LIBRARIES_DIRS_DEBUG "${CURRENT_PACKAGES_DIR}/debug/lib" "${CURRENT_INSTALLED_DIR}/debug/lib")
vcpkg_list(APPEND MSBUILD_LIBRARIES_RELEASE ${arg_ADDITIONAL_LIBS_RELEASE})
vcpkg_list(APPEND MSBUILD_LIBRARIES_DEBUG ${arg_ADDITIONAL_LIBS_DEBUG})
vcpkg_list(PREPEND MSBUILD_INCLUDE_DIRS_RELEASE "%(AdditionalIncludeDirectories)")
vcpkg_list(PREPEND MSBUILD_INCLUDE_DIRS_DEBUG "%(AdditionalIncludeDirectories)")
vcpkg_list(PREPEND MSBUILD_LIBRARIES_DIRS_RELEASE "%(AdditionalLibraryDirectories)")
vcpkg_list(PREPEND MSBUILD_LIBRARIES_DIRS_DEBUG "%(AdditionalLibraryDirectories)")
vcpkg_list(PREPEND MSBUILD_LIBRARIES_RELEASE "%(AdditionalDependencies)")
vcpkg_list(PREPEND MSBUILD_LIBRARIES_DEBUG "%(AdditionalDependencies)")
configure_file("${CMAKE_CURRENT_FUNCTION_LIST_DIR}/vcpkg_msbuild.targets.in" "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}/vcpkg_msbuild.targets")
configure_file("${CMAKE_CURRENT_FUNCTION_LIST_DIR}/vcpkg_msbuild.props.in" "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}/vcpkg_msbuild.props")
set(${arg_OUTPUT_PROPS} "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}/vcpkg_msbuild.props" PARENT_SCOPE)
set(${arg_OUTPUT_TARGETS} "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}/vcpkg_msbuild.targets" PARENT_SCOPE)
endfunction()

View File

@ -1,23 +0,0 @@
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.

View File

@ -5,9 +5,10 @@ endif()
file(COPY
"${CMAKE_CURRENT_LIST_DIR}/vcpkg-port-config.cmake"
"${CMAKE_CURRENT_LIST_DIR}/copyright"
DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
file(INSTALL "${VCPKG_ROOT_DIR}/LICENSE.txt" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
configure_file("${CMAKE_CURRENT_LIST_DIR}/x_vcpkg_pkgconfig_get_modules.cmake" "${CURRENT_PACKAGES_DIR}/share/${PORT}/x_vcpkg_pkgconfig_get_modules.cmake" @ONLY)
set(VCPKG_POLICY_EMPTY_PACKAGE enabled)

View File

@ -1,7 +1,6 @@
{
"name": "vcpkg-pkgconfig-get-modules",
"version-date": "2022-02-10",
"port-version": 1,
"version-date": "2023-02-25",
"documentation": "https://vcpkg.io/en/docs/README.html",
"license": "MIT",
"dependencies": [

View File

@ -1,7 +1,7 @@
include_guard(GLOBAL)
function(x_vcpkg_pkgconfig_get_modules)
cmake_parse_arguments(PARSE_ARGV 0 "arg" "CFLAGS;LIBS;LIBRARIES;LIBRARIES_DIR;INCLUDE_DIRS" "PREFIX" "MODULES")
cmake_parse_arguments(PARSE_ARGV 0 "arg" "CFLAGS;LIBS;LIBRARIES;LIBRARIES_DIR;INCLUDE_DIRS;USE_MSVC_SYNTAX_ON_WINDOWS" "PREFIX" "MODULES")
if(NOT DEFINED arg_PREFIX OR arg_PREFIX STREQUAL "")
message(FATAL_ERROR "x_vcpkg_pkgconfig_get_modules requires parameter PREFIX!")
endif()
@ -11,6 +11,10 @@ function(x_vcpkg_pkgconfig_get_modules)
if(DEFINED arg_UNPARSED_ARGUMENTS)
message(FATAL_ERROR "extra arguments passed to x_vcpkg_pkgconfig_get_modules: ${arg_UNPARSED_ARGUMENTS}")
endif()
set(msvc "")
if(arg_USE_MSVC_SYNTAX_ON_WINDOWS AND VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
set(msvc "--msvc-syntax")
endif()
set(PKGCONFIG "${CURRENT_INSTALLED_DIR}/../@HOST_TRIPLET@/tools/pkgconf/pkgconf@VCPKG_HOST_EXECUTABLE_SUFFIX@")
@ -21,41 +25,46 @@ function(x_vcpkg_pkgconfig_get_modules)
z_vcpkg_set_pkgconfig_path("${CURRENT_INSTALLED_DIR}/lib/pkgconfig${VCPKG_HOST_PATH_SEPARATOR}${CURRENT_PACKAGES_DIR}/lib/pkgconfig" "${backup_PKG_CONFIG_PATH}")
if(arg_LIBS)
execute_process(
COMMAND "${PKGCONFIG}" --libs ${arg_MODULES}
COMMAND "${PKGCONFIG}" ${msvc} --libs ${arg_MODULES}
OUTPUT_VARIABLE ${arg_PREFIX}_LIBS_RELEASE
OUTPUT_STRIP_TRAILING_WHITESPACE
COMMAND_ERROR_IS_FATAL ANY
)
list(APPEND var_suffixes LIBS_RELEASE)
endif()
if(arg_LIBRARIES)
execute_process(
COMMAND "${PKGCONFIG}" --libs-only-l ${arg_MODULES}
COMMAND "${PKGCONFIG}" ${msvc} --libs-only-l ${arg_MODULES}
OUTPUT_VARIABLE ${arg_PREFIX}_LIBRARIES_RELEASE
OUTPUT_STRIP_TRAILING_WHITESPACE
COMMAND_ERROR_IS_FATAL ANY
)
list(APPEND var_suffixes LIBRARIES_RELEASE)
endif()
if(arg_LIBRARIES_DIRS)
execute_process(
COMMAND "${PKGCONFIG}" --libs-only-L ${arg_MODULES}
COMMAND "${PKGCONFIG}" ${msvc} --libs-only-L ${arg_MODULES}
OUTPUT_VARIABLE ${arg_PREFIX}_LIBRARIES_DIRS_RELEASE
OUTPUT_STRIP_TRAILING_WHITESPACE
COMMAND_ERROR_IS_FATAL ANY
)
list(APPEND var_suffixes LIBRARIES_DIRS_RELEASE)
endif()
if(arg_INCLUDE_DIRS)
execute_process(
COMMAND "${PKGCONFIG}" --cflags-only-I ${arg_MODULES}
COMMAND "${PKGCONFIG}" ${msvc} --cflags-only-I ${arg_MODULES}
OUTPUT_VARIABLE ${arg_PREFIX}_INCLUDE_DIRS_RELEASE
OUTPUT_STRIP_TRAILING_WHITESPACE
COMMAND_ERROR_IS_FATAL ANY
)
list(APPEND var_suffixes INCLUDE_DIRS_RELEASE)
endif()
if(arg_CFLAGS)
execute_process(
COMMAND "${PKGCONFIG}" --cflags ${arg_MODULES}
COMMAND "${PKGCONFIG}" ${msvc} --cflags ${arg_MODULES}
OUTPUT_VARIABLE ${arg_PREFIX}_CFLAGS_RELEASE
OUTPUT_STRIP_TRAILING_WHITESPACE
COMMAND_ERROR_IS_FATAL ANY
)
list(APPEND var_suffixes CFLAGS_RELEASE)
endif()
@ -64,41 +73,46 @@ function(x_vcpkg_pkgconfig_get_modules)
z_vcpkg_set_pkgconfig_path("${CURRENT_INSTALLED_DIR}/debug/lib/pkgconfig${VCPKG_HOST_PATH_SEPARATOR}${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig" "${backup_PKG_CONFIG_PATH}")
if(arg_LIBS)
execute_process(
COMMAND "${PKGCONFIG}" --libs ${arg_MODULES}
COMMAND "${PKGCONFIG}" ${msvc} --libs ${arg_MODULES}
OUTPUT_VARIABLE ${arg_PREFIX}_LIBS_DEBUG
OUTPUT_STRIP_TRAILING_WHITESPACE
COMMAND_ERROR_IS_FATAL ANY
)
list(APPEND var_suffixes LIBS_DEBUG)
endif()
if(arg_LIBRARIES)
execute_process(
COMMAND "${PKGCONFIG}" --libs-only-l ${arg_MODULES}
COMMAND "${PKGCONFIG}" ${msvc} --libs-only-l ${arg_MODULES}
OUTPUT_VARIABLE ${arg_PREFIX}_LIBRARIES_DEBUG
OUTPUT_STRIP_TRAILING_WHITESPACE
COMMAND_ERROR_IS_FATAL ANY
)
list(APPEND var_suffixes LIBRARIES_DEBUG)
endif()
if(arg_LIBRARIES_DIRS)
execute_process(
COMMAND "${PKGCONFIG}" --libs-only-L ${arg_MODULES}
COMMAND "${PKGCONFIG}" ${msvc} --libs-only-L ${arg_MODULES}
OUTPUT_VARIABLE ${arg_PREFIX}_LIBRARIES_DIRS_DEBUG
OUTPUT_STRIP_TRAILING_WHITESPACE
COMMAND_ERROR_IS_FATAL ANY
)
list(APPEND var_suffixes LIBRARIES_DIRS_DEBUG)
endif()
if(arg_INCLUDE_DIRS)
execute_process(
COMMAND "${PKGCONFIG}" --cflags-only-I ${arg_MODULES}
COMMAND "${PKGCONFIG}" ${msvc} --cflags-only-I ${arg_MODULES}
OUTPUT_VARIABLE ${arg_PREFIX}_INCLUDE_DIRS_DEBUG
OUTPUT_STRIP_TRAILING_WHITESPACE
COMMAND_ERROR_IS_FATAL ANY
)
list(APPEND var_suffixes INCLUDE_DIRS_DEBUG)
endif()
if(arg_CFLAGS)
execute_process(
COMMAND "${PKGCONFIG}" --cflags ${arg_MODULES}
COMMAND "${PKGCONFIG}" ${msvc} --cflags ${arg_MODULES}
OUTPUT_VARIABLE ${arg_PREFIX}_CFLAGS_DEBUG
OUTPUT_STRIP_TRAILING_WHITESPACE
COMMAND_ERROR_IS_FATAL ANY
)
list(APPEND var_suffixes CFLAGS_DEBUG)
endif()

View File

@ -8416,9 +8416,13 @@
"baseline": "2021-11-16",
"port-version": 3
},
"vcpkg-msbuild": {
"baseline": "2023-06-22",
"port-version": 0
},
"vcpkg-pkgconfig-get-modules": {
"baseline": "2022-02-10",
"port-version": 1
"baseline": "2023-02-25",
"port-version": 0
},
"vcpkg-qmake": {
"baseline": "2023-03-22",

View File

@ -0,0 +1,9 @@
{
"versions": [
{
"git-tree": "e9effc7e0ed636888b0bf3660d602f0737cba97e",
"version-date": "2023-06-22",
"port-version": 0
}
]
}

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "57e857fda6b1dadd02036d9c012963db900bfc33",
"version-date": "2023-02-25",
"port-version": 0
},
{
"git-tree": "48bfa748f78837921860329547ed6e5799665698",
"version-date": "2022-02-10",