aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authornicole mazzuca <mazzucan@outlook.com>2021-03-10 15:33:16 -0800
committerGitHub <noreply@github.com>2021-03-10 15:33:16 -0800
commitfe2a6bb789e904520797ec229272c6c1a42e7e38 (patch)
treecedcaf8be3521bf5e3b5ce92f2a8cb496f2615fc /scripts
parent6ee0e916d34e45ea0b41b35c3fd8cfb7ce2455e9 (diff)
downloadvcpkg-fe2a6bb789e904520797ec229272c6c1a42e7e38.tar.gz
vcpkg-fe2a6bb789e904520797ec229272c6c1a42e7e38.zip
[host dependencies] add support in the scripts (#16627)
This contains all the docs and scripts changes from #16479, without any of the ports changes, for easier CR
Diffstat (limited to 'scripts')
-rw-r--r--scripts/buildsystems/msbuild/vcpkg-general.xml3
-rw-r--r--scripts/buildsystems/msbuild/vcpkg.targets14
-rw-r--r--scripts/buildsystems/vcpkg.cmake5
-rw-r--r--scripts/cmake/vcpkg_common_definitions.cmake4
-rw-r--r--scripts/ports.cmake3
-rw-r--r--scripts/vcpkg.schema.json19
6 files changed, 35 insertions, 13 deletions
diff --git a/scripts/buildsystems/msbuild/vcpkg-general.xml b/scripts/buildsystems/msbuild/vcpkg-general.xml
index 49865e74e..5c84aa0da 100644
--- a/scripts/buildsystems/msbuild/vcpkg-general.xml
+++ b/scripts/buildsystems/msbuild/vcpkg-general.xml
@@ -65,6 +65,9 @@
<StringProperty Name="VcpkgTriplet" DisplayName="Triplet" Category="Conditional" Subtype="Text"
Description="Specifies the triplet used by Vcpkg. Does not include the '-static' suffix that may be added by the 'Use static libraries' flag." />
+ <StringProperty Name="VcpkgHostTriplet" DisplayName="Host Triplet" Category="Conditional" Subtype="Text"
+ Description="Specifies the host triplet used by Vcpkg. If empty, this will be automatically determined." />
+
<StringProperty Name="VcpkgAdditionalInstallOptions" DisplayName="Additional Options" Category="General" Subtype="Text"
Description="Additional command line options to be passed to the underlying vcpkg tool when installing in manifest mode." />
diff --git a/scripts/buildsystems/msbuild/vcpkg.targets b/scripts/buildsystems/msbuild/vcpkg.targets
index 074d35d90..b99011324 100644
--- a/scripts/buildsystems/msbuild/vcpkg.targets
+++ b/scripts/buildsystems/msbuild/vcpkg.targets
@@ -30,6 +30,10 @@
<VcpkgConfigSubdir Condition="'$(VcpkgNormalizedConfiguration)' == 'Debug'">debug\</VcpkgConfigSubdir>
<VcpkgApplocalDeps Condition="'$(VcpkgApplocalDeps)' == ''">true</VcpkgApplocalDeps>
+
+ <_ZVcpkgHostTripletParameter Condition="'$(VcpkgHostTriplet)' != ''">"--host-triplet=$(VcpkgHostTriplet)"</_ZVcpkgHostTripletParameter>
+ <_ZVcpkgExecutable>$([System.IO.Path]::Combine($(VcpkgRoot), 'vcpkg.exe'))</_ZVcpkgExecutable>
+
<ProjectStateLine>VcpkgTriplet=$(VcpkgTriplet):$(ProjectStateLine)</ProjectStateLine>
</PropertyGroup>
@@ -77,7 +81,7 @@
<Target Name="VcpkgInstallManifestDependencies" BeforeTargets="ClCompile"
Condition="'$(VcpkgEnabled)' == 'true' and '$(VcpkgEnableManifest)' == 'true' and '$(VcpkgManifestInstall)' == 'true'"
Inputs="@(_ZVcpkgInstallManifestDependenciesInputs)"
- Outputs="$(TLogLocation)VcpkgInstallManifest$(VcpkgTriplet).read.1u.tlog;$(VcpkgInstalledDir).msbuildstamp-$(VcpkgTriplet)">
+ Outputs="$(TLogLocation)VcpkgInstallManifest$(VcpkgTriplet).read.1u.tlog;$(VcpkgInstalledDir).msbuildstamp-$(VcpkgTriplet).$(VcpkgHostTriplet).stamp">
<Message Text="Installing vcpkg dependencies to $(VcpkgInstalledDir)" Importance="High" />
<MakeDir Directories="$(TLogLocation)" />
<ItemGroup>
@@ -85,15 +89,15 @@
<_VcpkgItemToDelete Include="$(VcpkgInstalledDir).msbuildstamp-*" />
</ItemGroup>
<Delete Files="@(_VcpkgItemToDelete)" />
- <Message Text="%22$([System.IO.Path]::Combine($(VcpkgRoot), 'vcpkg.exe'))%22 install --x-wait-for-lock --triplet %22$(VcpkgTriplet)%22 --vcpkg-root %22$(VcpkgRoot)\%22 %22--x-manifest-root=$(VcpkgManifestRoot)\%22 %22--x-install-root=$(VcpkgInstalledDir)\%22 $(VcpkgAdditionalInstallOptions)"
+ <Message Text="%22$(_ZVcpkgExecutable)%22 install $(_ZVcpkgHostTripletParameter) --x-wait-for-lock --triplet %22$(VcpkgTriplet)%22 --vcpkg-root %22$(VcpkgRoot)\%22 %22--x-manifest-root=$(VcpkgManifestRoot)\%22 %22--x-install-root=$(VcpkgInstalledDir)\%22 $(VcpkgAdditionalInstallOptions)"
Importance="High" />
- <Exec Command="%22$([System.IO.Path]::Combine($(VcpkgRoot), 'vcpkg.exe'))%22 install --x-wait-for-lock --triplet %22$(VcpkgTriplet)%22 --vcpkg-root %22$(VcpkgRoot)\%22 %22--x-manifest-root=$(VcpkgManifestRoot)\%22 %22--x-install-root=$(VcpkgInstalledDir)\%22 $(VcpkgAdditionalInstallOptions)"
+ <Exec Command="%22$(_ZVcpkgExecutable)%22 install $(_ZVcpkgHostTripletParameter) --x-wait-for-lock --triplet %22$(VcpkgTriplet)%22 --vcpkg-root %22$(VcpkgRoot)\%22 %22--x-manifest-root=$(VcpkgManifestRoot)\%22 %22--x-install-root=$(VcpkgInstalledDir)\%22 $(VcpkgAdditionalInstallOptions)"
StandardOutputImportance="High" />
- <WriteLinesToFile File="$(TLogLocation)VcpkgInstallManifest$(VcpkgTriplet).read.1u.tlog"
+ <WriteLinesToFile File="$(TLogLocation)VcpkgInstallManifest$(VcpkgTriplet).$(VcpkgHostTriplet).read.1u.tlog"
Lines="@(_VcpkgInstallManifestDependenciesInputs -> '^%(Identity)')"
Encoding="Unicode"
Overwrite="true"/>
- <Touch Files="$(VcpkgInstalledDir).msbuildstamp-$(VcpkgTriplet)" AlwaysCreate="true" />
+ <Touch Files="$(VcpkgInstalledDir).msbuildstamp-$(VcpkgTriplet).$(VcpkgHostTriplet).stamp" AlwaysCreate="true" />
<CreateProperty Value="false">
<Output TaskParameter="ValueSetByTask" PropertyName="Link_MinimalRebuildFromTracking" />
diff --git a/scripts/buildsystems/vcpkg.cmake b/scripts/buildsystems/vcpkg.cmake
index c830644e9..9bdf6573e 100644
--- a/scripts/buildsystems/vcpkg.cmake
+++ b/scripts/buildsystems/vcpkg.cmake
@@ -578,6 +578,11 @@ if(VCPKG_MANIFEST_MODE AND VCPKG_MANIFEST_INSTALL AND NOT Z_VCPKG_CMAKE_IN_TRY_C
message(STATUS "Running vcpkg install")
set(Z_VCPKG_ADDITIONAL_MANIFEST_PARAMS)
+
+ if(DEFINED VCPKG_HOST_TRIPLET AND NOT VCPKG_HOST_TRIPLET STREQUAL "")
+ list(APPEND Z_VCPKG_ADDITIONAL_MANIFEST_PARAMS "--host-triplet=${VCPKG_HOST_TRIPLET}")
+ endif()
+
if(VCPKG_OVERLAY_PORTS)
foreach(Z_VCPKG_OVERLAY_PORT IN LISTS VCPKG_OVERLAY_PORTS)
list(APPEND Z_VCPKG_ADDITIONAL_MANIFEST_PARAMS "--overlay-ports=${Z_VCPKG_OVERLAY_PORT}")
diff --git a/scripts/cmake/vcpkg_common_definitions.cmake b/scripts/cmake/vcpkg_common_definitions.cmake
index 897d30832..b505f3693 100644
--- a/scripts/cmake/vcpkg_common_definitions.cmake
+++ b/scripts/cmake/vcpkg_common_definitions.cmake
@@ -18,6 +18,10 @@ VCPKG_TARGET_IMPORT_LIBRARY_SUFFIX import library suffix for target (same
VCPKG_FIND_LIBRARY_PREFIXES target dependent prefixes used for find_library calls in portfiles
VCPKG_FIND_LIBRARY_SUFFIXES target dependent suffixes used for find_library calls in portfiles
VCPKG_SYSTEM_LIBRARIES list of libraries are provide by the toolchain and are not managed by vcpkg
+TARGET_TRIPLET the name of the current triplet to build for
+CURRENT_INSTALLED_DIR the absolute path to the installed files for the current triplet
+HOST_TRIPLET the name of the triplet corresponding to the host
+CURRENT_HOST_INSTALLED_DIR the absolute path to the installed files for the host triplet
```
CMAKE_STATIC_LIBRARY_(PREFIX|SUFFIX), CMAKE_SHARED_LIBRARY_(PREFIX|SUFFIX) and CMAKE_IMPORT_LIBRARY_(PREFIX|SUFFIX) are defined for the target
diff --git a/scripts/ports.cmake b/scripts/ports.cmake
index 62ee9f6aa..4adb48149 100644
--- a/scripts/ports.cmake
+++ b/scripts/ports.cmake
@@ -79,6 +79,9 @@ if(CMD MATCHES "^BUILD$")
endforeach()
endif()
+ set(HOST_TRIPLET "${_HOST_TRIPLET}")
+ set(CURRENT_HOST_INSTALLED_DIR "${_VCPKG_INSTALLED_DIR}/${HOST_TRIPLET}" CACHE PATH "Location to install final packages for the host")
+
set(TRIPLET_SYSTEM_ARCH "${VCPKG_TARGET_ARCHITECTURE}")
include("${SCRIPTS}/cmake/vcpkg_common_definitions.cmake")
include("${SCRIPTS}/cmake/execute_process.cmake")
diff --git a/scripts/vcpkg.schema.json b/scripts/vcpkg.schema.json
index c485aa415..215f5dd9c 100644
--- a/scripts/vcpkg.schema.json
+++ b/scripts/vcpkg.schema.json
@@ -128,6 +128,10 @@
"$ref": "#/definitions/identifier"
}
},
+ "host": {
+ "type": "boolean",
+ "default": false
+ },
"default-features": {
"type": "boolean",
"default": true
@@ -190,9 +194,6 @@
"description": "A package feature that can be activated by consumers.",
"type": "object",
"properties": {
- "name": {
- "$ref": "#/definitions/identifier"
- },
"description": {
"$ref": "#/definitions/description-field"
},
@@ -208,7 +209,6 @@
"^\\$": {}
},
"required": [
- "name",
"description"
],
"additionalProperties": false
@@ -279,10 +279,13 @@
}
},
"features": {
- "description": "An array of features supported by the package",
- "type": "array",
- "items": {
- "$ref": "#/definitions/feature"
+ "description": "An object of features supported by the package",
+ "type": "object",
+ "patternProperties": {
+ "^\\$": {},
+ "^[a-z-]+": {
+ "$ref": "#/definitions/feature"
+ }
}
},
"default-features": {