diff options
| author | Robert Schumacher <roschuma@microsoft.com> | 2016-10-31 09:38:07 -0700 |
|---|---|---|
| committer | Robert Schumacher <roschuma@microsoft.com> | 2016-10-31 09:38:07 -0700 |
| commit | 4a61e3154e9de19a9de05fcee7bb0f5f4d86f456 (patch) | |
| tree | 3600e843834bf1dd6c47e854ad292b452cdbc62d /scripts/buildsystems | |
| parent | 01ae1e172053c9e41464d7d3238a54e4c74f39b1 (diff) | |
| parent | 956f3b110ba2826899c97ab28dafc04ca36b4b20 (diff) | |
| download | vcpkg-4a61e3154e9de19a9de05fcee7bb0f5f4d86f456.tar.gz vcpkg-4a61e3154e9de19a9de05fcee7bb0f5f4d86f456.zip | |
Merge pull request #231
Add cl.exe path based architecture detection for CMake toolchain
Diffstat (limited to 'scripts/buildsystems')
| -rw-r--r-- | scripts/buildsystems/msbuild/vcpkg.targets | 44 | ||||
| -rw-r--r-- | scripts/buildsystems/vcpkg.cmake | 13 |
2 files changed, 34 insertions, 23 deletions
diff --git a/scripts/buildsystems/msbuild/vcpkg.targets b/scripts/buildsystems/msbuild/vcpkg.targets index 3a74099f0..0d89fedd3 100644 --- a/scripts/buildsystems/msbuild/vcpkg.targets +++ b/scripts/buildsystems/msbuild/vcpkg.targets @@ -1,56 +1,56 @@ <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup Condition="'$(Platform)|$(ApplicationType)|$(ApplicationTypeRevision)' == 'Win32||'"> - <VCPkgEnabled Condition="'$(VCPkgEnabled)' == ''">true</VCPkgEnabled> - <VCPkgTriplet Condition="'$(VCPkgTriplet)' == ''">x86-windows</VCPkgTriplet> + <VcpkgEnabled Condition="'$(VcpkgEnabled)' == ''">true</VcpkgEnabled> + <VcpkgTriplet Condition="'$(VcpkgTriplet)' == ''">x86-windows</VcpkgTriplet> </PropertyGroup> <PropertyGroup Condition="'$(Platform)|$(ApplicationType)|$(ApplicationTypeRevision)' == 'Win32|Windows Store|10.0'"> - <VCPkgEnabled Condition="'$(VCPkgEnabled)' == ''">true</VCPkgEnabled> - <VCPkgTriplet Condition="'$(VCPkgTriplet)' == ''">x86-uwp</VCPkgTriplet> + <VcpkgEnabled Condition="'$(VcpkgEnabled)' == ''">true</VcpkgEnabled> + <VcpkgTriplet Condition="'$(VcpkgTriplet)' == ''">x86-uwp</VcpkgTriplet> </PropertyGroup> <PropertyGroup Condition="'$(Platform)|$(ApplicationType)|$(ApplicationTypeRevision)' == 'x64||'"> - <VCPkgEnabled Condition="'$(VCPkgEnabled)' == ''">true</VCPkgEnabled> - <VCPkgTriplet Condition="'$(VCPkgTriplet)' == ''">x64-windows</VCPkgTriplet> + <VcpkgEnabled Condition="'$(VcpkgEnabled)' == ''">true</VcpkgEnabled> + <VcpkgTriplet Condition="'$(VcpkgTriplet)' == ''">x64-windows</VcpkgTriplet> </PropertyGroup> <PropertyGroup Condition="'$(Platform)|$(ApplicationType)|$(ApplicationTypeRevision)' == 'x64|Windows Store|10.0'"> - <VCPkgEnabled Condition="'$(VCPkgEnabled)' == ''">true</VCPkgEnabled> - <VCPkgTriplet Condition="'$(VCPkgTriplet)' == ''">x64-uwp</VCPkgTriplet> + <VcpkgEnabled Condition="'$(VcpkgEnabled)' == ''">true</VcpkgEnabled> + <VcpkgTriplet Condition="'$(VcpkgTriplet)' == ''">x64-uwp</VcpkgTriplet> </PropertyGroup> <PropertyGroup Condition="'$(Platform)|$(ApplicationType)|$(ApplicationTypeRevision)' == 'arm|Windows Store|10.0'"> - <VCPkgEnabled Condition="'$(VCPkgEnabled)' == ''">true</VCPkgEnabled> - <VCPkgTriplet Condition="'$(VCPkgTriplet)' == ''">arm-uwp</VCPkgTriplet> + <VcpkgEnabled Condition="'$(VcpkgEnabled)' == ''">true</VcpkgEnabled> + <VcpkgTriplet Condition="'$(VcpkgTriplet)' == ''">arm-uwp</VcpkgTriplet> </PropertyGroup> - <PropertyGroup Condition="'$(VCPkgEnabled)' == 'true'"> - <VCPkgConfiguration Condition="'$(VCPkgConfiguration)' == ''">$(Configuration)</VCPkgConfiguration> + <PropertyGroup Condition="'$(VcpkgEnabled)' == 'true'"> + <VcpkgConfiguration Condition="'$(VcpkgConfiguration)' == ''">$(Configuration)</VcpkgConfiguration> <!-- Expected to ..\..\..\ over scripts\buildsystems\msbuild --> - <VCPkgRoot Condition="'$(VCPkgRoot)' == ''">$(MSBuildThisFileDirectory)..\..\..\installed\$(VCPkgTriplet)\</VCPkgRoot> + <VcpkgRoot Condition="'$(VcpkgRoot)' == ''">$(MSBuildThisFileDirectory)..\..\..\installed\$(VcpkgTriplet)\</VcpkgRoot> </PropertyGroup> - <ItemDefinitionGroup Condition="'$(VCPkgEnabled)' == 'true'"> + <ItemDefinitionGroup Condition="'$(VcpkgEnabled)' == 'true'"> <Link> - <AdditionalDependencies Condition="'$(VCPkgConfiguration)' == 'Debug'">$(VCPkgRoot)debug\lib\*.lib;%(AdditionalDependencies)</AdditionalDependencies> - <AdditionalDependencies Condition="'$(VCPkgConfiguration)' == 'Release'">$(VCPkgRoot)lib\*.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalDependencies Condition="'$(VcpkgConfiguration)' == 'Debug'">$(VcpkgRoot)debug\lib\*.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalDependencies Condition="'$(VcpkgConfiguration)' == 'Release'">$(VcpkgRoot)lib\*.lib;%(AdditionalDependencies)</AdditionalDependencies> </Link> <ClCompile> - <AdditionalIncludeDirectories>$(VCPkgRoot)include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <AdditionalIncludeDirectories>$(VcpkgRoot)include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> </ClCompile> </ItemDefinitionGroup> - <Target Name="AppLocalFromInstalled" AfterTargets="CopyFilesToOutputDirectory" BeforeTargets="CopyLocalFilesOutputGroup" Condition="'$(VCPkgEnabled)' == 'true' and '$(OutputType)' == 'exe'"> + <Target Name="AppLocalFromInstalled" AfterTargets="CopyFilesToOutputDirectory" BeforeTargets="CopyLocalFilesOutputGroup" Condition="'$(VcpkgEnabled)' == 'true' and '$(OutputType)' == 'exe'"> <WriteLinesToFile File="$(TLogLocation)$(ProjectName).write.1u.tlog" Lines="^$(OutputPath)$(TargetName).$(OutputType);" Encoding="Unicode"/> - <Exec Condition="'$(VCPkgConfiguration)' == 'Debug'" - Command="powershell.exe -ExecutionPolicy Unrestricted -noprofile -File %22$(MSBuildThisFileDirectory)applocal.ps1%22 %22$(OutputPath)$(TargetName).$(OutputType)%22 %22$(VCPkgRoot)debug\bin%22 %22$(TLogLocation)$(ProjectName).write.1u.tlog%22" + <Exec Condition="'$(VcpkgConfiguration)' == 'Debug'" + Command="powershell.exe -ExecutionPolicy Unrestricted -noprofile -File %22$(MSBuildThisFileDirectory)applocal.ps1%22 %22$(OutputPath)$(TargetName).$(OutputType)%22 %22$(VcpkgRoot)debug\bin%22 %22$(TLogLocation)$(ProjectName).write.1u.tlog%22" ConsoleToMSBuild="true"> <Output TaskParameter="ConsoleOutput" ItemName="ReferenceCopyLocalPaths" /> </Exec> - <Exec Condition="'$(VCPkgConfiguration)' == 'Release'" - Command="powershell.exe -ExecutionPolicy Unrestricted -noprofile -File %22$(MSBuildThisFileDirectory)applocal.ps1%22 %22$(OutputPath)$(TargetName).$(OutputType)%22 %22$(VCPkgRoot)bin%22 %22$(TLogLocation)$(ProjectName).write.1u.tlog%22" + <Exec Condition="'$(VcpkgConfiguration)' == 'Release'" + Command="powershell.exe -ExecutionPolicy Unrestricted -noprofile -File %22$(MSBuildThisFileDirectory)applocal.ps1%22 %22$(OutputPath)$(TargetName).$(OutputType)%22 %22$(VcpkgRoot)bin%22 %22$(TLogLocation)$(ProjectName).write.1u.tlog%22" ConsoleToMSBuild="true"> <Output TaskParameter="ConsoleOutput" ItemName="ReferenceCopyLocalPaths" /> </Exec> diff --git a/scripts/buildsystems/vcpkg.cmake b/scripts/buildsystems/vcpkg.cmake index 88acc8436..590b4994a 100644 --- a/scripts/buildsystems/vcpkg.cmake +++ b/scripts/buildsystems/vcpkg.cmake @@ -10,8 +10,19 @@ if(NOT VCPKG_TOOLCHAIN) set(_VCPKG_TARGET_TRIPLET_ARCH x64) elseif(CMAKE_GENERATOR MATCHES "^Visual Studio 14 2015 ARM$") set(_VCPKG_TARGET_TRIPLET_ARCH arm) - else() + elseif(CMAKE_GENERATOR MATCHES "^Visual Studio 14 2015$") set(_VCPKG_TARGET_TRIPLET_ARCH x86) + else() + find_program(_VCPKG_CL cl) + if(_VCPKG_CL MATCHES "amd64/cl.exe$") + set(_VCPKG_TARGET_TRIPLET_ARCH x64) + elseif(_VCPKG_CL MATCHES "arm/cl.exe$") + set(_VCPKG_TARGET_TRIPLET_ARCH arm) + elseif(_VCPKG_CL MATCHES "x86/cl.exe$") + set(_VCPKG_TARGET_TRIPLET_ARCH x86) + else() + message(FATAL_ERROR "Unable to determine target architecture.") + endif() endif() endif() |
