Fix build issues with XboxOne and clang (#137)

This commit is contained in:
Chuck Walbourn 2024-05-04 14:48:01 -05:00 коммит произвёл GitHub
Родитель 3a6d83f950
Коммит 717377d9d3
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
12 изменённых файлов: 327 добавлений и 7 удалений

Просмотреть файл

@ -107,16 +107,14 @@
{
"name": "Scarlett",
"cacheVariables": {
"XBOX_CONSOLE_TARGET": "scarlett",
"BUILD_TESTING": false
"XBOX_CONSOLE_TARGET": "scarlett"
},
"hidden": true
},
{
"name": "XboxOne",
"cacheVariables": {
"XBOX_CONSOLE_TARGET": "xboxone",
"BUILD_TESTING": false
"XBOX_CONSOLE_TARGET": "xboxone"
},
"hidden": true
},
@ -227,6 +225,12 @@
{ "name": "x86-Debug-Win7-Clang" , "description": "Clang/LLVM for x86 (Debug) for Windows 7", "inherits": [ "base", "x86", "Debug", "Clang", "Win7" ], "environment": { "CXXFLAGS": "-m32" } },
{ "name": "x86-Release-Win7-Clang" , "description": "Clang/LLVM for x86 (Release) for Windows 7", "inherits": [ "base", "x86", "Release", "Clang", "Win7" ], "environment": { "CXXFLAGS": "-m32" } },
{ "name": "x64-Debug-Scarlett-Clang" , "description": "Clang/LLVM for x64 (Debug) for Xbox Series X|S", "inherits": [ "base", "x64", "Debug", "Clang", "Scarlett" ] },
{ "name": "x64-Release-Scarlett-Clang", "description": "Clang/LLVM for x64 (Release) for Xbox Series X|S", "inherits": [ "base", "x64", "Release", "Clang", "Scarlett" ] },
{ "name": "x64-Debug-XboxOne-Clang" , "description": "Clang/LLVM for x64 (Debug) for Xbox One", "inherits": [ "base", "x64", "Debug", "Clang", "XboxOne" ] },
{ "name": "x64-Release-XboxOne-Clang" , "description": "Clang/LLVM for x64 (Release) for Xbox One", "inherits": [ "base", "x64", "Release", "Clang", "XboxOne" ] },
{ "name": "x64-Debug-MinGW" , "description": "MinG-W64 (Debug)", "inherits": [ "base", "x64", "Debug", "GNUC", "VCPKG", "MinGW64" ] },
{ "name": "x64-Release-MinGW", "description": "MinG-W64 (Release)", "inherits": [ "base", "x64", "Release", "GNUC", "VCPKG", "MinGW64" ] },
{ "name": "x86-Debug-MinGW" , "description": "MinG-W32 (Debug)", "inherits": [ "base", "x86", "Debug", "GNUC", "VCPKG", "MinGW32" ] },

Просмотреть файл

@ -57,7 +57,7 @@ endif()
#--- Target architecture switches
if(XBOX_CONSOLE_TARGET STREQUAL "scarlett")
list(APPEND COMPILER_SWITCHES $<IF:$<CXX_COMPILER_ID:MSVC>,/favor:AMD64 /arch:AVX2,-march=znver2>)
elseif(XBOX_CONSOLE_TARGET STREQUAL "xboxone|durago")
elseif(XBOX_CONSOLE_TARGET MATCHES "xboxone|durango")
list(APPEND COMPILER_SWITCHES $<IF:$<CXX_COMPILER_ID:MSVC>,/favor:AMD64 /arch:AVX,-march=btver2>)
elseif(NOT (${DIRECTX_ARCH} MATCHES "^arm"))
if((${DIRECTX_ARCH} MATCHES "x86") OR (CMAKE_SIZEOF_VOID_P EQUAL 4))

Просмотреть файл

@ -21,6 +21,7 @@ trigger:
- '*.md'
- LICENSE
- '.nuget/*'
- build/*.cmd
- build/*.props
- build/*.ps1
- build/*.targets
@ -34,6 +35,7 @@ pr:
- '*.md'
- LICENSE
- '.nuget/*'
- build/*.cmd
- build/*.props
- build/*.ps1
- build/*.targets

Просмотреть файл

@ -21,6 +21,7 @@ trigger:
- '*.md'
- LICENSE
- '.nuget/*'
- build/*.cmd
- build/*.props
- build/*.ps1
- build/*.targets
@ -34,6 +35,7 @@ pr:
- '*.md'
- LICENSE
- '.nuget/*'
- build/*.cmd
- build/*.props
- build/*.ps1
- build/*.targets

Просмотреть файл

@ -20,7 +20,11 @@ pr:
- main
paths:
include:
- CMakeList.txt
- build/DirectXMesh-GitHub-GDK-Dev17.yml
- build/*.in
- build/*.cmake
- build/SetupBWOI.*
resources:
repositories:
@ -38,8 +42,8 @@ variables:
EXTRACTED_FOLDER: $(ExtractedFolder)
GDK_EDITION: $(GDKEditionNumber)
GDKEnableBWOI: true
GITHUB_PAT: $(GITHUBPUBLICTOKEN)
URL_FEED: $(ADOFeedURL)
VC_PATH: 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC'
skipNugetSecurityAnalysis: true # We explicitly call this task so we don't need it to be auto-injected
jobs:
@ -102,6 +106,7 @@ jobs:
msbuildArchitecture: x64
- task: VSBuild@1
displayName: Build solution DirectXMesh_GDK_2022 pcdbg
continueOnError: True
inputs:
solution: DirectXMesh_GDK_2022.sln
vsVersion: 17.0
@ -110,6 +115,7 @@ jobs:
msbuildArchitecture: x64
- task: VSBuild@1
displayName: Build solution DirectXMesh_GDK_2022 pcrel
continueOnError: True
inputs:
solution: DirectXMesh_GDK_2022.sln
vsVersion: 17.0
@ -118,6 +124,7 @@ jobs:
msbuildArchitecture: x64
- task: VSBuild@1
displayName: Build solution DirectXMesh_GDK_2022 xbdbg
continueOnError: True
inputs:
solution: DirectXMesh_GDK_2022.sln
vsVersion: 17.0
@ -126,6 +133,7 @@ jobs:
msbuildArchitecture: x64
- task: VSBuild@1
displayName: Build solution DirectXMesh_GDK_2022 xbrel
continueOnError: True
inputs:
solution: DirectXMesh_GDK_2022.sln
vsVersion: 17.0
@ -134,6 +142,7 @@ jobs:
msbuildArchitecture: x64
- task: VSBuild@1
displayName: Build solution DirectXMesh_GDK_2022 scardbg
continueOnError: True
inputs:
solution: DirectXMesh_GDK_2022.sln
vsVersion: 17.0
@ -142,9 +151,222 @@ jobs:
msbuildArchitecture: x64
- task: VSBuild@1
displayName: Build solution DirectXMesh_GDK_2022 scarrel
continueOnError: True
inputs:
solution: DirectXMesh_GDK_2022.sln
vsVersion: 17.0
platform: Gaming.Xbox.Scarlett.x64
configuration: Release
msbuildArchitecture: x64
- job: BUILD_GDK_CMAKE_SCAR
displayName: 'Microsoft Game Development Kit (GDK) using CMake (Scarlett)'
timeoutInMinutes: 120
cancelTimeoutInMinutes: 1
steps:
- checkout: self
clean: true
fetchTags: false
- task: NuGetToolInstaller@1
displayName: 'Use NuGet'
inputs:
versionSpec: '6.5.x'
- task: PowerShell@2
displayName: 'Create nuget.config with single source'
inputs:
targetType: inline
script: |
$xml = @'
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear />
</packageSources>
</configuration>
'@
$xml | Set-Content -Path "$(Build.SourcesDirectory)\NuGet.config"
- task: NuGetCommand@2
# We have to use a nuget.config to provide the feed for the 'nuget install' option.
displayName: 'NuGet set package source to ADO feed'
inputs:
command: custom
arguments: sources add -Name xboxgdk -Source $(URL_FEED) -ConfigFile $(Build.SourcesDirectory)\NuGet.config
- task: nuget-security-analysis@0
displayName: 'Secure Supply Chain Analysis'
- task: NuGetCommand@2
displayName: NuGet install PGDK
inputs:
command: custom
arguments: install -prerelease Microsoft.GDK.PC.$(GDK_EDITION) -ExcludeVersion -OutputDirectory $(EXTRACTED_FOLDER)\GDK
- task: NuGetCommand@2
displayName: NuGet install GDKX
inputs:
command: custom
arguments: install -prerelease Microsoft.GDK.Xbox.$(GDK_EDITION) -ExcludeVersion -OutputDirectory $(EXTRACTED_FOLDER)\GDK
- task: CmdLine@2
displayName: Setup BWOI for GDK command-line
inputs:
script: |
call "$(VC_PATH)\Auxiliary\Build\vcvars64.bat"
echo ##vso[task.setvariable variable=WindowsSdkVerBinPath;]%WindowsSdkVerBinPath%
echo ##vso[task.prependpath]%VSINSTALLDIR%Common7\IDE\CommonExtensions\Microsoft\CMake\Ninja
echo ##vso[task.prependpath]%VCINSTALLDIR%Tools\Llvm\x64\bin
echo ##vso[task.prependpath]%WindowsSdkBinPath%x64
echo ##vso[task.prependpath]%WindowsSdkVerBinPath%x64
echo ##vso[task.prependpath]%VCToolsInstallDir%bin\HostX64\x64
call $(Build.SourcesDirectory)\build\SetupBWOI.cmd $(EXTRACTED_FOLDER)\GDK $(GDK_EDITION) Scarlett
echo ##vso[task.setvariable variable=GameDKLatest;]%GameDKLatest%
echo ##vso[task.setvariable variable=GRDKLatest;]%GRDKLatest%
echo ##vso[task.setvariable variable=GXDKLatest;]%GXDKLatest%
echo ##vso[task.setvariable variable=INCLUDE;]%INCLUDE%
echo ##vso[task.setvariable variable=LIB;]%LIB%
echo ##vso[task.prependpath]%ADDBIN%
failOnStderr: true
- task: CMake@1
displayName: 'CMake (MSVC): Config Scarlett Debug'
inputs:
cwd: '$(Build.SourcesDirectory)'
cmakeArgs: --preset=x64-Debug-Scarlett
- task: CMake@1
displayName: 'CMake (MSVC): Build Scarlett Debug'
inputs:
cwd: '$(Build.SourcesDirectory)'
cmakeArgs: --build out\build\x64-Debug-Scarlett
- task: CMake@1
displayName: 'CMake (MSVC): Config Scarlett Release'
inputs:
cwd: '$(Build.SourcesDirectory)'
cmakeArgs: --preset=x64-Release-Scarlett
- task: CMake@1
displayName: 'CMake (MSVC): Build Scarlett Release'
inputs:
cwd: '$(Build.SourcesDirectory)'
cmakeArgs: --build out\build\x64-Release-Scarlett
- task: CMake@1
displayName: 'CMake (Clang): Config Scarlett Debug'
inputs:
cwd: '$(Build.SourcesDirectory)'
cmakeArgs: --preset=x64-Debug-Scarlett-Clang
- task: CMake@1
displayName: 'CMake (Clang): Build Scarlett Debug'
inputs:
cwd: '$(Build.SourcesDirectory)'
cmakeArgs: --build out\build\x64-Debug-Scarlett-Clang
- task: CMake@1
displayName: 'CMake (Clang): Config Scarlett Release'
inputs:
cwd: '$(Build.SourcesDirectory)'
cmakeArgs: --preset=x64-Release-Scarlett-Clang
- task: CMake@1
displayName: 'CMake (Clang): Build Scarlett Release'
inputs:
cwd: '$(Build.SourcesDirectory)'
cmakeArgs: --build out\build\x64-Release-Scarlett-Clang
- job: BUILD_GDK_CMAKE_XBONE
displayName: 'Microsoft Game Development Kit (GDK) using CMake (XboxOne)'
timeoutInMinutes: 120
cancelTimeoutInMinutes: 1
steps:
- checkout: self
clean: true
fetchTags: false
- task: NuGetToolInstaller@1
displayName: 'Use NuGet'
inputs:
versionSpec: '6.5.x'
- task: PowerShell@2
displayName: 'Create nuget.config with single source'
inputs:
targetType: inline
script: |
$xml = @'
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear />
</packageSources>
</configuration>
'@
$xml | Set-Content -Path "$(Build.SourcesDirectory)\NuGet.config"
- task: NuGetCommand@2
# We have to use a nuget.config to provide the feed for the 'nuget install' option.
displayName: 'NuGet set package source to ADO feed'
inputs:
command: custom
arguments: sources add -Name xboxgdk -Source $(URL_FEED) -ConfigFile $(Build.SourcesDirectory)\NuGet.config
- task: nuget-security-analysis@0
displayName: 'Secure Supply Chain Analysis'
- task: NuGetCommand@2
displayName: NuGet install PGDK
inputs:
command: custom
arguments: install -prerelease Microsoft.GDK.PC.$(GDK_EDITION) -ExcludeVersion -OutputDirectory $(EXTRACTED_FOLDER)\GDK
- task: NuGetCommand@2
displayName: NuGet install GDKX
inputs:
command: custom
arguments: install -prerelease Microsoft.GDK.Xbox.$(GDK_EDITION) -ExcludeVersion -OutputDirectory $(EXTRACTED_FOLDER)\GDK
- task: CmdLine@2
displayName: Setup BWOI for GDK command-line
inputs:
script: |
call "$(VC_PATH)\Auxiliary\Build\vcvars64.bat"
echo ##vso[task.setvariable variable=WindowsSdkVerBinPath;]%WindowsSdkVerBinPath%
echo ##vso[task.prependpath]%VSINSTALLDIR%Common7\IDE\CommonExtensions\Microsoft\CMake\Ninja
echo ##vso[task.prependpath]%VCINSTALLDIR%Tools\Llvm\x64\bin
echo ##vso[task.prependpath]%WindowsSdkBinPath%x64
echo ##vso[task.prependpath]%WindowsSdkVerBinPath%x64
echo ##vso[task.prependpath]%VCToolsInstallDir%bin\HostX64\x64
call $(Build.SourcesDirectory)\build\SetupBWOI.cmd $(EXTRACTED_FOLDER)\GDK $(GDK_EDITION) XboxOne
echo ##vso[task.setvariable variable=GameDKLatest;]%GameDKLatest%
echo ##vso[task.setvariable variable=GRDKLatest;]%GRDKLatest%
echo ##vso[task.setvariable variable=GXDKLatest;]%GXDKLatest%
echo ##vso[task.setvariable variable=INCLUDE;]%INCLUDE%
echo ##vso[task.setvariable variable=LIB;]%LIB%
echo ##vso[task.prependpath]%ADDBIN%
failOnStderr: true
- task: CMake@1
displayName: 'CMake (MSVC): Config XboxOne Debug'
inputs:
cwd: '$(Build.SourcesDirectory)'
cmakeArgs: --preset=x64-Debug-XboxOne
- task: CMake@1
displayName: 'CMake (MSVC): Build XboxOne Debug'
inputs:
cwd: '$(Build.SourcesDirectory)'
cmakeArgs: --build out\build\x64-Debug-XboxOne
- task: CMake@1
displayName: 'CMake (MSVC): Config XboxOne Release'
inputs:
cwd: '$(Build.SourcesDirectory)'
cmakeArgs: --preset=x64-Release-XboxOne
- task: CMake@1
displayName: 'CMake (MSVC): Build XboxOne Release'
inputs:
cwd: '$(Build.SourcesDirectory)'
cmakeArgs: --build out\build\x64-Release-XboxOne
- task: CMake@1
displayName: 'CMake (Clang): Config XboxOne Debug'
inputs:
cwd: '$(Build.SourcesDirectory)'
cmakeArgs: --preset=x64-Debug-XboxOne-Clang
- task: CMake@1
displayName: 'CMake (Clang): Build XboxOne Debug'
inputs:
cwd: '$(Build.SourcesDirectory)'
cmakeArgs: --build out\build\x64-Debug-XboxOne-Clang
- task: CMake@1
displayName: 'CMake (Clang): Config XboxOne Release'
inputs:
cwd: '$(Build.SourcesDirectory)'
cmakeArgs: --preset=x64-Release-XboxOne-Clang
- task: CMake@1
displayName: 'CMake (Clang): Build XboxOne Release'
inputs:
cwd: '$(Build.SourcesDirectory)'
cmakeArgs: --build out\build\x64-Release-XboxOne-Clang

Просмотреть файл

@ -25,6 +25,7 @@ trigger:
- CMake*
- '.nuget/*'
- build/*.cmake
- build/*.cmd
- build/*.in
- build/*.ps1
@ -39,6 +40,7 @@ pr:
- CMake*
- '.nuget/*'
- build/*.cmake
- build/*.cmd
- build/*.in
- build/*.ps1
drafts: false
@ -58,7 +60,6 @@ variables:
EXTRACTED_FOLDER: $(ExtractedFolder)
GDK_EDITION: $(GDKEditionNumber)
GDKEnableBWOI: true
GITHUB_PAT: $(GITHUBPUBLICTOKEN)
URL_FEED: $(ADOFeedURL)
skipNugetSecurityAnalysis: true # We explicitly call this task so we don't need it to be auto-injected

Просмотреть файл

@ -21,6 +21,7 @@ trigger:
- '*.md'
- LICENSE
- '.nuget/*'
- build/*.cmd
- build/*.props
- build/*.ps1
- build/*.targets
@ -34,6 +35,7 @@ pr:
- '*.md'
- LICENSE
- '.nuget/*'
- build/*.cmd
- build/*.props
- build/*.ps1
- build/*.targets

Просмотреть файл

@ -23,6 +23,7 @@ trigger:
- CMake*
- '.nuget/*'
- build/*.cmake
- build/*.cmd
- build/*.in
- build/*.props
- build/*.ps1
@ -39,6 +40,7 @@ pr:
- CMake*
- '.nuget/*'
- build/*.cmake
- build/*.cmd
- build/*.in
- build/*.props
- build/*.ps1

Просмотреть файл

@ -21,6 +21,7 @@ trigger:
- '*.md'
- LICENSE
- '.nuget/*'
- build/*.cmd
- build/*.props
- build/*.ps1
- build/*.targets
@ -34,6 +35,7 @@ pr:
- '*.md'
- LICENSE
- '.nuget/*'
- build/*.cmd
- build/*.props
- build/*.ps1
- build/*.targets

Просмотреть файл

@ -23,6 +23,7 @@ trigger:
- CMake*
- '.nuget/*'
- build/*.cmake
- build/*.cmd
- build/*.in
- build/*.props
- build/*.ps1
@ -39,6 +40,7 @@ pr:
- CMake*
- '.nuget/*'
- build/*.cmake
- build/*.cmd
- build/*.in
- build/*.props
- build/*.ps1

76
build/SetupBWOI.cmd Normal file
Просмотреть файл

@ -0,0 +1,76 @@
@echo off
rem Copyright (c) Microsoft Corporation.
rem Licensed under the MIT License.
if %1.==. goto needpackage
if %2.==. goto needgdk
if %3.==PC. goto haveparams
if %3.==XboxOne. goto haveparams
if %3.==Scarlett. goto haveparams
goto needconsole
:haveparams
set GXDKEDITION=%2
echo GXDKEDITION: %GXDKEDITION%
set PCNUGET=%1\Microsoft.GDK.PC.%GXDKEDITION%\
if NOT EXIST %PCNUGET% goto missingpcnuget
set GRDKLatest=%PCNUGET%native\%GXDKEDITION%\GRDK\
echo GRDKLatest: %GRDKLatest%
if %3.==PC. goto grdkonly
set XBOXNUGET=%1\Microsoft.gdk.xbox.%GXDKEDITION%\
if NOT EXIST %XBOXNUGET% goto missingxboxnuget
set GXDKLatest=%XBOXNUGET%native\%GXDKEDITION%\GXDK\
echo GXDKLatest: %GXDKLatest%
set GameDK=%XBOXNUGET%native\
set GameDKLatest=%XBOXNUGET%native\%GXDKEDITION%\
set ADDBIN=%GXDKLatest%bin\%3;%PCNUGET%native\bin;%XBOXNUGET%native\bin
set ADDINCLUDE=%GXDKLatest%gamekit\include\%3;%GXDKLatest%gamekit\include;%GRDKLatest%gamekit\include
set ADDLIB=%GXDKLatest%gamekit\lib\amd64\%3;%GXDKLatest%gamekit\lib\amd64;%GRDKLatest%gamekit\lib\amd64
goto continue
:grdkonly
set GameDK=%PCNUGET%native\
set GameDKLatest=%PCNUGET%native\%GXDKEDITION%\
set ADDBIN=%PCNUGET%native\bin
set ADDINCLUDE=%GRDKLatest%gamekit\include
set ADDLIB=%GRDKLatest%gamekit\lib\amd64
:continue
echo GameDK: %GameDK%
echo GameDKLatest: %GameDKLatest%
echo ADDBIN: %ADDBIN%
echo ADDINCLUDE: %ADDINCLUDE%
echo ADDLIB: %ADDLIB%
set PATH=%ADDBIN%;%PATH%
set INCLUDE=%INCLUDE%;%ADDINCLUDE%
set LIB=%LIB%;%ADDLIB%
exit /b 0
:needpackage
echo Usage: This script requires the path to the installed NuGet packages as the first parameter.
exit /b 1
:needgdk
echo Usage: This script requires the GDK edition number in YYMMQQ format as the second parameter
exit /b 1
:needconsole
echo Usage: This script requires the target type of PC, Scarlett, or XboxOne in the third parameter
exit /b 1
:missingpcnuget
echo ERROR - Cannot find Microsoft.GDK.PC.<edition> installed at '%1'
exit /b 1
:missingxboxnuget
echo ERROR - Cannot find Microsoft.GDK.Xbox.<edition> installed at '%1'
exit /b 1

Просмотреть файл

@ -1,6 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="SetupVCTargets" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!--
Copyright (c) Microsoft Corporation.
Licensed under the MIT License.
-->
<PropertyGroup>
<ExtractedFolder Condition="'$(ExtractedFolder)'==''">C:\xtracted\</ExtractedFolder>
<ExtractedFolder Condition="!HasTrailingSlash('$(ExtractedFolder)')">$(ExtractedFolder)\</ExtractedFolder>