From: Steve MacLean Date: Wed, 5 Dec 2018 18:16:30 +0000 (-0500) Subject: Change arm64 build to use public VS tools instead of private toolset X-Git-Tag: submit/tizen/20210909.063632~11032^2~474 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=aaa01f8bddbf440cc84aa55137f0053a8a5f503e;p=platform%2Fupstream%2Fdotnet%2Fruntime.git Change arm64 build to use public VS tools instead of private toolset Commit migrated from https://github.com/dotnet/core-setup/commit/2ba8b36820d8237d8b46bd71bfe284e7ed47ba9e --- diff --git a/src/installer/buildpipeline/pipeline.json b/src/installer/buildpipeline/pipeline.json index e83ddc2..59f98e7 100644 --- a/src/installer/buildpipeline/pipeline.json +++ b/src/installer/buildpipeline/pipeline.json @@ -139,7 +139,7 @@ { "Name": "Core-Setup-Windows-Arm-BT", "Parameters": { - "PB_AdditionalMSBuildArguments": "/p:SkipTests=true /p:NativeToolSetDir=C:\\tools\\clr /p:DotNetRestoreSources=$(PB_RestoreSource) /p:StabilizePackageVersion=$(PB_IsStable) /p:PackageVersionStamp=$(PB_VersionStamp)", + "PB_AdditionalMSBuildArguments": "/p:SkipTests=true /p:DotNetRestoreSources=$(PB_RestoreSource) /p:StabilizePackageVersion=$(PB_IsStable) /p:PackageVersionStamp=$(PB_VersionStamp)", "PB_TargetArchitecture": "arm64", "PB_PortableBuild": "true" }, diff --git a/src/installer/corehost/Windows/gen-buildsys-win.bat b/src/installer/corehost/Windows/gen-buildsys-win.bat index 8d70f26..bcfc53a 100644 --- a/src/installer/corehost/Windows/gen-buildsys-win.bat +++ b/src/installer/corehost/Windows/gen-buildsys-win.bat @@ -13,13 +13,14 @@ set __sourceDir=%~dp0.. set __VSString=%2 :: Remove quotes set __VSString=%__VSString:"=% +set __ExtraCmakeParams= :: Set the target architecture to a format cmake understands. ANYCPU defaults to x64 set __RIDArch=%3 if /i "%3" == "x86" (set cm_BaseRid=win7&&set cm_Arch=I386&&set __VSString=%__VSString%) if /i "%3" == "x64" (set cm_BaseRid=win7&&set cm_Arch=AMD64&&set __VSString=%__VSString% Win64) if /i "%3" == "arm" (set cm_BaseRid=win8&&set cm_Arch=ARM&&set __VSString=%__VSString% ARM) -if /i "%3" == "arm64" (set cm_BaseRid=win10&&set cm_Arch=ARM64&&set __VSString=%__VSString% Win64) +if /i "%3" == "arm64" (set cm_BaseRid=win10&&set cm_Arch=ARM64&&set __ExtraCmakeParams=%__ExtraCmakeParams% -A ARM64) set __LatestCommit=%4 set __HostVersion=%5 @@ -40,20 +41,20 @@ for /f "delims=" %%a in ('powershell -NoProfile -ExecutionPolicy ByPass "& .\Win popd :DoGen -echo "%CMakePath%" %__sourceDir% %__SDKVersion% "-DCLI_CMAKE_RUNTIME_ID:STRING=%cm_BaseRid%" "-DCLI_CMAKE_HOST_VER:STRING=%__HostVersion%" "-DCLI_CMAKE_APPHOST_VER:STRING=%__AppHostVersion%" "-DCLI_CMAKE_HOST_FXR_VER:STRING=%__HostResolverVersion%" "-DCLI_CMAKE_HOST_POLICY_VER:STRING=%__HostPolicyVersion%" "-DCLI_CMAKE_PKG_RID:STRING=%cm_BaseRid%" "-DCLI_CMAKE_COMMIT_HASH:STRING=%__LatestCommit%" "-DCLI_CMAKE_PLATFORM_ARCH_%cm_Arch%=1" "-DCMAKE_INSTALL_PREFIX=%__CMakeBinDir%" "-DCLI_CMAKE_RESOURCE_DIR:STRING=%__ResourcesDir%" -G "Visual Studio %__VSString%" -"%CMakePath%" %__sourceDir% %__SDKVersion% "-DCLI_CMAKE_RUNTIME_ID:STRING=%cm_BaseRid%" "-DCLI_CMAKE_HOST_VER:STRING=%__HostVersion%" "-DCLI_CMAKE_APPHOST_VER:STRING=%__AppHostVersion%" "-DCLI_CMAKE_HOST_FXR_VER:STRING=%__HostResolverVersion%" "-DCLI_CMAKE_HOST_POLICY_VER:STRING=%__HostPolicyVersion%" "-DCLI_CMAKE_PKG_RID:STRING=%cm_BaseRid%" "-DCLI_CMAKE_COMMIT_HASH:STRING=%__LatestCommit%" "-DCLI_CMAKE_PLATFORM_ARCH_%cm_Arch%=1" "-DCMAKE_INSTALL_PREFIX=%__CMakeBinDir%" "-DCLI_CMAKE_RESOURCE_DIR:STRING=%__ResourcesDir%" -G "Visual Studio %__VSString%" +echo "%CMakePath%" %__sourceDir% %__SDKVersion% "-DCLI_CMAKE_RUNTIME_ID:STRING=%cm_BaseRid%" "-DCLI_CMAKE_HOST_VER:STRING=%__HostVersion%" "-DCLI_CMAKE_APPHOST_VER:STRING=%__AppHostVersion%" "-DCLI_CMAKE_HOST_FXR_VER:STRING=%__HostResolverVersion%" "-DCLI_CMAKE_HOST_POLICY_VER:STRING=%__HostPolicyVersion%" "-DCLI_CMAKE_PKG_RID:STRING=%cm_BaseRid%" "-DCLI_CMAKE_COMMIT_HASH:STRING=%__LatestCommit%" "-DCLI_CMAKE_PLATFORM_ARCH_%cm_Arch%=1" "-DCMAKE_INSTALL_PREFIX=%__CMakeBinDir%" "-DCLI_CMAKE_RESOURCE_DIR:STRING=%__ResourcesDir%" -G "Visual Studio %__VSString%" %__ExtraCmakeParams% +"%CMakePath%" %__sourceDir% %__SDKVersion% "-DCLI_CMAKE_RUNTIME_ID:STRING=%cm_BaseRid%" "-DCLI_CMAKE_HOST_VER:STRING=%__HostVersion%" "-DCLI_CMAKE_APPHOST_VER:STRING=%__AppHostVersion%" "-DCLI_CMAKE_HOST_FXR_VER:STRING=%__HostResolverVersion%" "-DCLI_CMAKE_HOST_POLICY_VER:STRING=%__HostPolicyVersion%" "-DCLI_CMAKE_PKG_RID:STRING=%cm_BaseRid%" "-DCLI_CMAKE_COMMIT_HASH:STRING=%__LatestCommit%" "-DCLI_CMAKE_PLATFORM_ARCH_%cm_Arch%=1" "-DCMAKE_INSTALL_PREFIX=%__CMakeBinDir%" "-DCLI_CMAKE_RESOURCE_DIR:STRING=%__ResourcesDir%" -G "Visual Studio %__VSString%" %__ExtraCmakeParams% endlocal GOTO :DONE :USAGE echo "Usage..." echo "gen-buildsys-win.bat " - echo "Specify the path to the top level CMake file - /src/NDP" - echo "Specify the VSVersion to be used - VS2013 or VS2015" - echo "Specify the Target Architecture - x86, AnyCPU, ARM, or x64." + echo "Specify the path to the top level CMake file" + echo "Specify the VSVersion to be used - VS2015 or VS2017" + echo "Specify the Target Architecture - AnyCPU, x86, x64, ARM, or ARM64." echo "Specify latest commit hash" echo "Specify the host version, apphost version, hostresolver version, hostpolicy version" EXIT /B 1 :DONE - EXIT /B 0 \ No newline at end of file + EXIT /B 0 diff --git a/src/installer/corehost/build.cmd b/src/installer/corehost/build.cmd index 88810de..dc4a628 100644 --- a/src/installer/corehost/build.cmd +++ b/src/installer/corehost/build.cmd @@ -27,7 +27,7 @@ if /i [%1] == [x86] ( set __BuildArch=x86&&set __VCBuildArch=x86&&shift& if /i [%1] == [arm] ( set __BuildArch=arm&&set __VCBuildArch=x86_arm&&set __SDKVersion="-DCMAKE_SYSTEM_VERSION=10.0"&&shift&goto Arg_Loop) if /i [%1] == [x64] ( set __BuildArch=x64&&set __VCBuildArch=x86_amd64&&shift&goto Arg_Loop) if /i [%1] == [amd64] ( set __BuildArch=x64&&set __VCBuildArch=x86_amd64&&shift&goto Arg_Loop) -if /i [%1] == [arm64] ( set __BuildArch=arm64&&set __VCBuildArch=arm64&&shift&goto Arg_Loop) +if /i [%1] == [arm64] ( set __BuildArch=arm64&&set __VCBuildArch=x86_arm64&&shift&goto Arg_Loop) if /i [%1] == [portable] ( set __PortableBuild=1&&shift&goto Arg_Loop) if /i [%1] == [rid] ( set __TargetRid=%2&&shift&&shift&goto Arg_Loop) @@ -74,20 +74,16 @@ exit /b 1 :: Setup vars for VS2017 set __PlatformToolset=v141 set __VSVersion=15 2017 -if NOT "%__BuildArch%" == "arm64" ( - :: Set the environment for the native build - call "%VS150COMNTOOLS%..\..\VC\Auxiliary\Build\vcvarsall.bat" %__VCBuildArch% -) +:: Set the environment for the native build +call "%VS150COMNTOOLS%..\..\VC\Auxiliary\Build\vcvarsall.bat" %__VCBuildArch% goto :SetupDirs :VS2015 :: Setup vars for VS2015build set __PlatformToolset=v140 set __VSVersion=14 2015 -if NOT "%__BuildArch%" == "arm64" ( - :: Set the environment for the native build - call "%VS140COMNTOOLS%..\..\VC\vcvarsall.bat" %__VCBuildArch% -) +:: Set the environment for the native build +call "%VS140COMNTOOLS%..\..\VC\vcvarsall.bat" %__VCBuildArch% :SetupDirs :: Setup to cmake the native components @@ -126,12 +122,6 @@ exit /b 1 :GenVSSolution :: Regenerate the VS solution -if /i "%__BuildArch%" == "arm64" ( - REM arm64 builds currently use private toolset which has not been released yet - REM TODO, remove once the toolset is open. - call :PrivateToolSet -) - echo Calling "%__nativeWindowsDir%\gen-buildsys-win.bat %~dp0 "%__VSVersion%" %__BuildArch% %__CommitSha% %__HostVersion% %__AppHostVersion% %__HostResolverVersion% %__HostPolicyVersion%" pushd "%__IntermediatesDir%" call "%__nativeWindowsDir%\gen-buildsys-win.bat" %~dp0 "%__VSVersion%" %__BuildArch% %__CommitSha% %__HostVersion% %__AppHostVersion% %__HostResolverVersion% %__HostPolicyVersion% %__PortableBuild% @@ -144,11 +134,7 @@ goto :Failure :BuildNativeProj :: Build the project created by Cmake -if "%__BuildArch%" == "arm64" ( - set __msbuildArgs=/p:UseEnv=true -) else ( - set __msbuildArgs=/p:Platform=%__BuildArch% /p:PlatformToolset="%__PlatformToolset%" -) +set __msbuildArgs=/p:Platform=%__BuildArch% /p:PlatformToolset="%__PlatformToolset%" cd %__rootDir% @@ -167,26 +153,3 @@ exit /B 0 :: Build failed echo Failed to generate native component build project! exit /b 1 - -:PrivateToolSet -echo %__MsgPrefix% Setting Up the usage of __ToolsetDir:%__ToolsetDir% - -if /i "%__ToolsetDir%" == "" ( - echo %__MsgPrefix%Error: A toolset directory is required for the Arm64 Windows build. Use the toolsetDir argument. - exit /b 1 -) - -set PATH=%__ToolsetDir%\VC_sdk\bin;%PATH% -set LIB=%__ToolsetDir%\VC_sdk\lib\arm64;%__ToolsetDir%\sdpublic\sdk\lib\arm64 -set INCLUDE=^ -%__ToolsetDir%\VC_sdk\inc;^ -%__ToolsetDir%\sdpublic\sdk\inc;^ -%__ToolsetDir%\sdpublic\shared\inc;^ -%__ToolsetDir%\sdpublic\shared\inc\minwin;^ -%__ToolsetDir%\sdpublic\sdk\inc\ucrt;^ -%__ToolsetDir%\sdpublic\sdk\inc\minwin;^ -%__ToolsetDir%\sdpublic\sdk\inc\mincore;^ -%__ToolsetDir%\sdpublic\sdk\inc\abi;^ -%__ToolsetDir%\sdpublic\sdk\inc\clientcore;^ -%__ToolsetDir%\diasdk\include -exit /b 0 \ No newline at end of file diff --git a/src/installer/corehost/build.proj b/src/installer/corehost/build.proj index 313f371..1399921 100644 --- a/src/installer/corehost/build.proj +++ b/src/installer/corehost/build.proj @@ -72,12 +72,11 @@ $(ConfigurationGroup) $(TargetArchitecture) apphostver $(AppHostVersion) hostver $(HostVersion) fxrver $(HostResolverVersion) policyver $(HostPolicyVersion) commit $(LatestCommit) rid $(OutputRid) $(BuildArgs) portable $(BuildArgs) incremental-native-build - toolsetdir $(NativeToolsetDir) - + diff --git a/src/installer/settings.cmake b/src/installer/settings.cmake index 3784500..6569dec 100644 --- a/src/installer/settings.cmake +++ b/src/installer/settings.cmake @@ -235,18 +235,14 @@ elseif(CLI_CMAKE_PLATFORM_ARCH_ARM) add_definitions(-D_TARGET_ARM_=1) elseif(CLI_CMAKE_PLATFORM_ARCH_ARM64) add_definitions(-D_TARGET_ARM64_=1) - if(WIN32) - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /MACHINE:arm64") - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /MACHINE:arm64") - endif() else() message(FATAL_ERROR "Unknown target architecture") endif() # Specify the Windows SDK to be used for Arm builds -if (WIN32 AND CLI_CMAKE_PLATFORM_ARCH_ARM) +if (WIN32 AND (CLI_CMAKE_PLATFORM_ARCH_ARM OR CLI_CMAKE_PLATFORM_ARCH_ARM64)) if(NOT DEFINED CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION OR CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION STREQUAL "" ) - message(FATAL_ERROR "Windows SDK is required for the Arm32 build.") + message(FATAL_ERROR "Windows SDK is required for the Arm32 or Arm64 build.") else() message("Using Windows SDK version ${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}") endif()