Crafter.Build/build.ps1
Jorijn van der Graaf 6a7106586a
Some checks failed
demo.yaml / windows build (push) Failing after 0s
windows build
2026-03-01 11:57:57 +01:00

93 lines
No EOL
11 KiB
PowerShell

mkdir build
mkdir bin
mkdir bin/executable
# Get the path of Visual Studio Installer
$vsPath = & "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" -latest -property installationPath
# Set the directory path for MSVC tools
$directoryPath = Join-Path -Path $vsPath -ChildPath "VC\Tools\MSVC"
$directoryPath2 = Join-Path -Path $vsPath -ChildPath "VC\Redist\MSVC"
# Get all folders (assumes version format like 14.50.35717)
$folders = Get-ChildItem -Path $directoryPath -Directory
# Sort the folders by version and select the latest one
$latestVersionFolder = $folders | Sort-Object { [Version]$_.Name } -Descending | Select-Object -First 1
# Store the latest version folder name
$msvcVersion = $latestVersionFolder.Name
# Copy std.ixx to the build directory
$sourceFilePath = Join-Path -Path $directoryPath -ChildPath "$msvcVersion\modules\std.ixx"
$destinationFilePath = ".\build\std.cppm"
Copy-Item -Path $sourceFilePath -Destination $destinationFilePath
$msvcRtPath = Join-Path -Path $directoryPath2 -ChildPath "$msvcVersion\x64\Microsoft.VC145.CRT"
$vulkanBasePath = "C:\VulkanSDK"
# Get all folders (assumes version format like 14.50.35717)
$folders = Get-ChildItem -Path $vulkanBasePath -Directory
# Sort the folders by version and select the latest one
$latestVulkanVersion = $folders | Sort-Object { [Version]$_.Name } -Descending | Select-Object -First 1
# Store the latest version folder name and combine it with the base path to get the full path to Include
$vulkanSDKPath = Join-Path -Path $vulkanBasePath -ChildPath (Join-Path -Path $latestVulkanVersion.Name -ChildPath "Include")
$vulkanSDKPathLib = Join-Path -Path $vulkanBasePath -ChildPath (Join-Path -Path $latestVulkanVersion.Name -ChildPath "Lib")
clang-cl --target=x86_64-pc-windows-msvc /std:c++latest /EHsc -Wno-include-angled-in-module-purview -Wno-reserved-identifier -Wno-reserved-module-identifier --precompile .\build\std.cppm -o .\build\std.pcm
Move-Item -Path ".\std.pcm" -Destination ".\build\std.pcm"
clang-cl --target=x86_64-pc-windows-msvc /std:c++latest /EHsc /D CRAFTER_BUILD_CONFIGURATION_TARGET_x86_64_pc_windows_msvc /D CRAFTER_BUILD_CONFIGURATION_TYPE_EXECUTABLE -I"$vulkanSDKPath" --precompile -fprebuilt-module-path=".\build" interfaces\Crafter.Build-CompileStatus.cppm -o .\build\Crafter.Build-CompileStatus.pcm
Move-Item -Path ".\Crafter.Build-CompileStatus.pcm" -Destination ".\build\Crafter.Build-CompileStatus.pcm"
clang-cl --target=x86_64-pc-windows-msvc /std:c++latest /EHsc /D CRAFTER_BUILD_CONFIGURATION_TARGET_x86_64_pc_windows_msvc /D CRAFTER_BUILD_CONFIGURATION_TYPE_EXECUTABLE -I"$vulkanSDKPath" --precompile -fprebuilt-module-path=".\build" interfaces\Crafter.Build-Command.cppm -o .\build\Crafter.Build-Command.pcm
Move-Item -Path ".\Crafter.Build-Command.pcm" -Destination ".\build\Crafter.Build-Command.pcm"
clang-cl --target=x86_64-pc-windows-msvc /std:c++latest /EHsc /D CRAFTER_BUILD_CONFIGURATION_TARGET_x86_64_pc_windows_msvc /D CRAFTER_BUILD_CONFIGURATION_TYPE_EXECUTABLE -I"$vulkanSDKPath" --precompile -fprebuilt-module-path=".\build" interfaces\Crafter.Build-Shader.cppm -o .\build\Crafter.Build-Shader.pcm
Move-Item -Path ".\Crafter.Build-Shader.pcm" -Destination ".\build\Crafter.Build-Shader.pcm"
clang-cl --target=x86_64-pc-windows-msvc /std:c++latest /EHsc /D CRAFTER_BUILD_CONFIGURATION_TARGET_x86_64_pc_windows_msvc /D CRAFTER_BUILD_CONFIGURATION_TYPE_EXECUTABLE -I"$vulkanSDKPath" --precompile -fprebuilt-module-path=".\build" interfaces\Crafter.Build-Module.cppm -o .\build\Crafter.Build-Module.pcm
Move-Item -Path ".\Crafter.Build-Module.pcm" -Destination ".\build\Crafter.Build-Module.pcm"
clang-cl --target=x86_64-pc-windows-msvc /std:c++latest /EHsc /D CRAFTER_BUILD_CONFIGURATION_TARGET_x86_64_pc_windows_msvc /D CRAFTER_BUILD_CONFIGURATION_TYPE_EXECUTABLE -I"$vulkanSDKPath" --precompile -fprebuilt-module-path=".\build" interfaces\Crafter.Build-Implementation.cppm -o .\build\Crafter.Build-Implementation.pcm
Move-Item -Path ".\Crafter.Build-Implementation.pcm" -Destination ".\build\Crafter.Build-Implementation.pcm"
clang-cl --target=x86_64-pc-windows-msvc /std:c++latest /EHsc /D CRAFTER_BUILD_CONFIGURATION_TARGET_x86_64_pc_windows_msvc /D CRAFTER_BUILD_CONFIGURATION_TYPE_EXECUTABLE -I"$vulkanSDKPath" --precompile -fprebuilt-module-path=".\build" interfaces\Crafter.Build-Configuration.cppm -o .\build\Crafter.Build-Configuration.pcm
Move-Item -Path ".\Crafter.Build-Configuration.pcm" -Destination ".\build\Crafter.Build-Configuration.pcm"
clang-cl --target=x86_64-pc-windows-msvc /std:c++latest /EHsc /D CRAFTER_BUILD_CONFIGURATION_TARGET_x86_64_pc_windows_msvc /D CRAFTER_BUILD_CONFIGURATION_TYPE_EXECUTABLE -I"$vulkanSDKPath" --precompile -fprebuilt-module-path=".\build" interfaces\Crafter.Build-Test.cppm -o .\build\Crafter.Build-Test.pcm
Move-Item -Path ".\Crafter.Build-Test.pcm" -Destination ".\build\Crafter.Build-Test.pcm"
clang-cl --target=x86_64-pc-windows-msvc /std:c++latest /EHsc /D CRAFTER_BUILD_CONFIGURATION_TARGET_x86_64_pc_windows_msvc /D CRAFTER_BUILD_CONFIGURATION_TYPE_EXECUTABLE -I"$vulkanSDKPath" --precompile -fprebuilt-module-path=".\build" interfaces\Crafter.Build-Project.cppm -o .\build\Crafter.Build-Project.pcm
Move-Item -Path ".\Crafter.Build-Project.pcm" -Destination ".\build\Crafter.Build-Project.pcm"
clang-cl --target=x86_64-pc-windows-msvc /std:c++latest /EHsc /D CRAFTER_BUILD_CONFIGURATION_TARGET_x86_64_pc_windows_msvc /D CRAFTER_BUILD_CONFIGURATION_TYPE_EXECUTABLE -I"$vulkanSDKPath" --precompile -fprebuilt-module-path=".\build" /D CRAFTER_BUILD_CONFIGURATION_TYPE_EXECUTABLE interfaces\Crafter.Build.cppm -o .\build\Crafter.Build.pcm
Move-Item -Path ".\Crafter.Build.pcm" -Destination ".\build\Crafter.Build.pcm"
clang-cl --target=x86_64-pc-windows-msvc /std:c++latest /EHsc /MD -march=native -mtune=native /Ot -fprebuilt-module-path=".\build" -c .\build\Crafter.Build-Command.pcm -o .\build\Crafter.Build-Command.o
clang-cl --target=x86_64-pc-windows-msvc /std:c++latest /EHsc /MD -march=native -mtune=native /Ot -fprebuilt-module-path=".\build" -c .\build\Crafter.Build-Shader.pcm -o .\build\Crafter.Build-Shader.o
clang-cl --target=x86_64-pc-windows-msvc /std:c++latest /EHsc /MD -march=native -mtune=native /Ot -fprebuilt-module-path=".\build" -c .\build\Crafter.Build-Module.pcm -o .\build\Crafter.Build-Module.o
clang-cl --target=x86_64-pc-windows-msvc /std:c++latest /EHsc /MD -march=native -mtune=native /Ot -fprebuilt-module-path=".\build" -c .\build\Crafter.Build-Implementation.pcm -o .\build\Crafter.Build-Implementation.o
clang-cl --target=x86_64-pc-windows-msvc /std:c++latest /EHsc /MD -march=native -mtune=native /Ot -fprebuilt-module-path=".\build" -c .\build\Crafter.Build-Configuration.pcm -o .\build\Crafter.Build-Configuration.o
clang-cl --target=x86_64-pc-windows-msvc /std:c++latest /EHsc /MD -march=native -mtune=native /Ot -fprebuilt-module-path=".\build" -c .\build\Crafter.Build-Project.pcm -o .\build\Crafter.Build-Project.o
clang-cl --target=x86_64-pc-windows-msvc /std:c++latest /EHsc /MD -march=native -mtune=native /Ot -fprebuilt-module-path=".\build" -c .\build\Crafter.Build-Test.pcm -o .\build\Crafter.Build-Test.o
clang-cl --target=x86_64-pc-windows-msvc /std:c++latest /EHsc /MD -march=native -mtune=native /Ot -fprebuilt-module-path=".\build" -c .\build\Crafter.Build-CompileStatus.pcm -o .\build\Crafter.Build-CompileStatus.o
clang-cl --target=x86_64-pc-windows-msvc /std:c++latest /EHsc /MD -march=native -mtune=native /Ot -fprebuilt-module-path=".\build" -c .\build\Crafter.Build.pcm -o .\build\Crafter.Build.o
clang-cl --target=x86_64-pc-windows-msvc /std:c++latest /EHsc /MD /D CRAFTER_BUILD_CONFIGURATION_TARGET_x86_64_pc_windows_msvc /D CRAFTER_BUILD_CONFIGURATION_TYPE_EXECUTABLE -march=native -mtune=native -I"$vulkanSDKPath" /Ot -fprebuilt-module-path=".\build" -c .\implementations\Crafter.Build-Command.cpp -o .\build\Crafter.Build-Command_impl.o
clang-cl --target=x86_64-pc-windows-msvc /std:c++latest /EHsc /MD /D CRAFTER_BUILD_CONFIGURATION_TARGET_x86_64_pc_windows_msvc /D CRAFTER_BUILD_CONFIGURATION_TYPE_EXECUTABLE -march=native -mtune=native -I"$vulkanSDKPath" /Ot -fprebuilt-module-path=".\build" -c .\implementations\Crafter.Build-Test.cpp -o .\build\Crafter.Build-Test_impl.o
clang-cl --target=x86_64-pc-windows-msvc /std:c++latest /EHsc /MD /D CRAFTER_BUILD_CONFIGURATION_TARGET_x86_64_pc_windows_msvc /D CRAFTER_BUILD_CONFIGURATION_TYPE_EXECUTABLE -march=native -mtune=native -I"$vulkanSDKPath" /Ot -fprebuilt-module-path=".\build" -c .\implementations\Crafter.Build-Implementation.cpp -o .\build\Crafter.Build-Implementation_impl.o
clang-cl --target=x86_64-pc-windows-msvc /std:c++latest /EHsc /MD /D CRAFTER_BUILD_CONFIGURATION_TARGET_x86_64_pc_windows_msvc /D CRAFTER_BUILD_CONFIGURATION_TYPE_EXECUTABLE -march=native -mtune=native -I"$vulkanSDKPath" /Ot -fprebuilt-module-path=".\build" -c .\implementations\Crafter.Build-Shader.cpp -o .\build\Crafter.Build-Shader_impl.o
clang-cl --target=x86_64-pc-windows-msvc /std:c++latest /EHsc /MD /D CRAFTER_BUILD_CONFIGURATION_TARGET_x86_64_pc_windows_msvc /D CRAFTER_BUILD_CONFIGURATION_TYPE_EXECUTABLE -march=native -mtune=native -I"$vulkanSDKPath" /Ot -fprebuilt-module-path=".\build" -c .\implementations\Crafter.Build-Module.cpp -o .\build\Crafter.Build-Module_impl.o
clang-cl --target=x86_64-pc-windows-msvc /std:c++latest /EHsc /MD /D CRAFTER_BUILD_CONFIGURATION_TARGET_x86_64_pc_windows_msvc /D CRAFTER_BUILD_CONFIGURATION_TYPE_EXECUTABLE -march=native -mtune=native -I"$vulkanSDKPath" /Ot -fprebuilt-module-path=".\build" -c .\implementations\Crafter.Build-Configuration.cpp -o .\build\Crafter.Build-Configuration_impl.o
clang-cl --target=x86_64-pc-windows-msvc /std:c++latest /EHsc /MD /D CRAFTER_BUILD_CONFIGURATION_TARGET_x86_64_pc_windows_msvc /D CRAFTER_BUILD_CONFIGURATION_TYPE_EXECUTABLE -march=native -mtune=native -I"$vulkanSDKPath" /Ot -fprebuilt-module-path=".\build" -c .\implementations\Crafter.Build-Project.cpp -o .\build\Crafter.Build-Project_impl.o
clang-cl --target=x86_64-pc-windows-msvc /std:c++latest /EHsc /MD /D CRAFTER_BUILD_CONFIGURATION_TARGET_x86_64_pc_windows_msvc /D CRAFTER_BUILD_CONFIGURATION_TYPE_EXECUTABLE -march=native -mtune=native -I"$vulkanSDKPath" /Ot -fprebuilt-module-path=".\build" -c .\implementations\main.cpp -o .\build\main.o
clang-cl --target=x86_64-pc-windows-msvc /std:c++latest /Ot /MD -march=native -mtune=native -Xlinker /LIBPATH:"$vulkanSDKPathLib" vulkan-1.lib MachineIndependent.lib OSDependent.lib GenericCodeGen.lib glslang.lib glslang.lib glslang-default-resource-limits.lib SPIRV.lib .\build\Crafter.Build-Command.o .\build\Crafter.Build-CompileStatus.o .\build\Crafter.Build-Shader.o .\build\Crafter.Build-Module.o .\build\Crafter.Build-Configuration.o .\build\Crafter.Build-Project.o .\build\Crafter.Build.o .\build\Crafter.Build-Command_impl.o .\build\Crafter.Build-Shader_impl.o .\build\Crafter.Build-Module_impl.o .\build\Crafter.Build-Configuration_impl.o .\build\Crafter.Build-Project_impl.o .\build\Crafter.Build-Implementation.o .\build\Crafter.Build-Implementation_impl.o .\build\Crafter.Build-Test_impl.o .\build\Crafter.Build-Test.o .\build\main.o -o .\bin/executable\Crafter-build
Copy-Item -Path "binlib\*" -Destination "bin\" -Recurse
Remove-Item -Path "build" -Recurse -Force