BLAZINGLY FAST BUILD
Some checks failed
demo.yaml / BLAZINGLY FAST BUILD (push) Failing after 0s

This commit is contained in:
Jorijn van der Graaf 2026-03-02 17:29:03 +01:00
commit d98738fe68
4 changed files with 88 additions and 146 deletions

110
build.ps1
View file

@ -1,77 +1,59 @@
mkdir build
mkdir bin
mkdir bin/executable
mkdir bin\executable-windows-msvc
# Get the path of Visual Studio Installer
$vsPath = & "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" -latest -property installationPath
git clone https:\\github.com\KhronosGroup\glslang.git .\build\glslang
# Set the directory path for MSVC tools
$directoryPath = Join-Path -Path $vsPath -ChildPath "VC\Tools\MSVC"
cd .\build\glslang
$directoryPath2 = Join-Path -Path $vsPath -ChildPath "VC\Redist\MSVC"
$buildDir = "$($PWD.Path)\build"
cmake -B build `
-DCMAKE_C_COMPILER=clang `
-DCMAKE_CXX_COMPILER=clang++ `
-DCMAKE_CXX_FLAGS="-stdlib=libc++" `
-DCMAKE_EXE_LINKER_FLAGS="-stdlib=libc++" `
-DCMAKE_SHARED_LINKER_FLAGS="-stdlib=libc++" `
-DCMAKE_BUILD_TYPE=Release `
-DCMAKE_ARCHIVE_OUTPUT_DIRECTORY="$buildDir" `
-DCMAKE_LIBRARY_OUTPUT_DIRECTORY="$buildDir" `
-DENABLE_OPT=OFF
# Get all folders (assumes version format like 14.50.35717)
$folders = Get-ChildItem -Path $directoryPath -Directory
cmake --build build --config Release
cd ..\..\
# Sort the folders by version and select the latest one
$latestVersionFolder = $folders | Sort-Object { [Version]$_.Name } -Descending | Select-Object -First 1
$common_options = @(
"-stdlib=libc++"
"-I.\build"
"-std=c++26"
"-O3"
"-march=native"
"-mtune=native"
"-fprebuilt-module-path=.\build"
"-DCRAFTER_BUILD_CONFIGURATION_TARGET_x86_64_pc_linux_gnu"
"-DCRAFTER_BUILD_CONFIGURATION_TYPE_EXECUTABLE"
"-c"
)
clang++ -std=c++26 -stdlib=libc++ -Wno-reserved-identifier -Wno-reserved-module-identifier --precompile \usr\share\libc++\v1\std.cppm -o .\build\std.pcm
# Store the latest version folder name
$msvcVersion = $latestVersionFolder.Name
clang++ @common_options -fmodule-output interfaces\Crafter.Build-CompileStatus.cppm -o .\build\Crafter.Build-CompileStatus.o
clang++ @common_options -fmodule-output interfaces\Crafter.Build-Command.cppm -o .\build\Crafter.Build-Command.o
clang++ @common_options -fmodule-output interfaces\Crafter.Build-Shader.cppm -o .\build\Crafter.Build-Shader.o
clang++ @common_options -fmodule-output interfaces\Crafter.Build-Module.cppm -o .\build\Crafter.Build-Module.o
clang++ @common_options -fmodule-output interfaces\Crafter.Build-Implementation.cppm -o .\build\Crafter.Build-Implementation.o
clang++ @common_options -fmodule-output interfaces\Crafter.Build-Configuration.cppm -o .\build\Crafter.Build-Configuration.o
clang++ @common_options -fmodule-output interfaces\Crafter.Build-Test.cppm -o .\build\Crafter.Build-Test.o
clang++ @common_options -fmodule-output interfaces\Crafter.Build-Project.cppm -o .\build\Crafter.Build-Project.o
clang++ @common_options -fmodule-output interfaces\Crafter.Build.cppm -o .\build\Crafter.Build.o
# 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
clang++ @common_options .\implementations\Crafter.Build-Command.cpp -o .\build\Crafter.Build-Command_impl.o
clang++ @common_options .\implementations\Crafter.Build-Test.cpp -o .\build\Crafter.Build-Test_impl.o
clang++ @common_options .\implementations\Crafter.Build-Implementation.cpp -o .\build\Crafter.Build-Implementation_impl.o
clang++ @common_options .\implementations\Crafter.Build-Shader.cpp -o .\build\Crafter.Build-Shader_impl.o
clang++ @common_options .\implementations\Crafter.Build-Module.cpp -o .\build\Crafter.Build-Module_impl.o
clang++ @common_options .\implementations\Crafter.Build-Configuration.cpp -o .\build\Crafter.Build-Configuration_impl.o
clang++ @common_options .\implementations\Crafter.Build-Project.cpp -o .\build\Crafter.Build
$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")
cd build
cl /std:c++latest /EHsc /nologo /W4 /MD /c "$sourceFilePath"
clang-cl --target=x86_64-pc-windows-msvc /std:c++latest /EHsc /MD -Wno-include-angled-in-module-purview -Wno-reserved-identifier -Wno-reserved-module-identifier --precompile .\std.cppm -o .\std.pcm
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 -I"$vulkanSDKPath" --precompile -fprebuilt-module-path=".\" ..\interfaces\Crafter.Build-CompileStatus.cppm -o Crafter.Build-CompileStatus.pcm
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 -I"$vulkanSDKPath" --precompile -fprebuilt-module-path=".\" ..\interfaces\Crafter.Build-Command.cppm -o Crafter.Build-Command.pcm
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 -I"$vulkanSDKPath" --precompile -fprebuilt-module-path=".\" ..\interfaces\Crafter.Build-Shader.cppm -o Crafter.Build-Shader.pcm
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 -I"$vulkanSDKPath" --precompile -fprebuilt-module-path=".\" ..\interfaces\Crafter.Build-Module.cppm -o Crafter.Build-Module.pcm
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 -I"$vulkanSDKPath" --precompile -fprebuilt-module-path=".\" ..\interfaces\Crafter.Build-Implementation.cppm -o Crafter.Build-Implementation.pcm
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 -I"$vulkanSDKPath" --precompile -fprebuilt-module-path=".\" ..\interfaces\Crafter.Build-Configuration.cppm -o Crafter.Build-Configuration.pcm
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 -I"$vulkanSDKPath" --precompile -fprebuilt-module-path=".\" ..\interfaces\Crafter.Build-Test.cppm -o Crafter.Build-Test.pcm
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 -I"$vulkanSDKPath" --precompile -fprebuilt-module-path=".\" ..\interfaces\Crafter.Build-Project.cppm -o Crafter.Build-Project.pcm
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 -I"$vulkanSDKPath" --precompile -fprebuilt-module-path=".\" ..\interfaces\Crafter.Build.cppm -o Crafter.Build.pcm
cd ..
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.obj
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.obj
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.obj
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.obj
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.obj
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.obj
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.obj
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.obj
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.obj
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.obj
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.obj
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.obj
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.obj
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.obj
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.obj
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.obj
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.obj
link /LIBPATH:"$vulkanSDKPathLib" msvcrt.lib kernel32.lib user32.lib SPIRV-Tools.lib SPIRV-Tools-opt.lib vulkan-1.lib MachineIndependent.lib OSDependent.lib GenericCodeGen.lib glslang.lib glslang-default-resource-limits.lib SPIRV.lib .\build\Crafter.Build-Command.obj .\build\Crafter.Build-CompileStatus.obj .\build\Crafter.Build-Shader.obj .\build\Crafter.Build-Module.obj .\build\Crafter.Build-Configuration.obj .\build\Crafter.Build-Project.obj .\build\Crafter.Build.obj .\build\Crafter.Build-Command_impl.obj .\build\Crafter.Build-Shader_impl.obj .\build\Crafter.Build-Module_impl.obj .\build\Crafter.Build-Configuration_impl.obj .\build\Crafter.Build-Project_impl.obj .\build\Crafter.Build-Implementation.obj .\build\Crafter.Build-Implementation_impl.obj .\build\Crafter.Build-Test_impl.obj .\build\Crafter.Build-Test.obj .\build\main.obj .\build\std.obj /OUT:.\bin\executable\Crafter-build.exe
clang++ -std=c++26 -stdlib=libc++ -O3 -march=native -mtune=native -L.\build -fuse-ld=lld -lSPIRV -GenericCodeGen -lglslang -lOSDependent -lMachineIndependent -lglslang-default-resource-limits .\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-linux-gnu\crafter-build
Copy-Item -Path "binlib\*" -Destination "bin\" -Recurse
Remove-Item -Path "build" -Recurse -Force