2026-03-02 21:05:18 +01:00
|
|
|
@echo OFF
|
2026-04-27 07:04:42 +02:00
|
|
|
mkdir build 2>nul
|
|
|
|
|
mkdir bin 2>nul
|
|
|
|
|
mkdir share\crafter-build 2>nul
|
2026-03-02 20:01:41 +01:00
|
|
|
|
2026-04-27 07:04:42 +02:00
|
|
|
copy /Y interfaces\Crafter.Build.cppm share\crafter-build\
|
|
|
|
|
copy /Y interfaces\Crafter.Build-Shader.cppm share\crafter-build\
|
|
|
|
|
copy /Y interfaces\Crafter.Build-Platform.cppm share\crafter-build\
|
|
|
|
|
copy /Y interfaces\Crafter.Build-Interface.cppm share\crafter-build\
|
|
|
|
|
copy /Y interfaces\Crafter.Build-Implementation.cppm share\crafter-build\
|
|
|
|
|
copy /Y interfaces\Crafter.Build-External.cppm share\crafter-build\
|
|
|
|
|
copy /Y interfaces\Crafter.Build-Clang.cppm share\crafter-build\
|
|
|
|
|
|
|
|
|
|
if not exist .\build\glslang\NUL git clone https://github.com/KhronosGroup/glslang.git .\build\glslang
|
2026-03-02 20:01:41 +01:00
|
|
|
|
2026-03-02 20:38:47 +01:00
|
|
|
set useLibcCommon=-nostdinc++ -nostdlib++
|
|
|
|
|
set useLibcLinker=-L %LIBCXX_DIR%\lib -lc++ %useLibcCommon%
|
|
|
|
|
set useLibcSource=-isystem %LIBCXX_DIR%\include\c++\v1 %useLibcCommon%
|
2026-03-02 20:01:41 +01:00
|
|
|
set buildDir=%CD%\build
|
|
|
|
|
|
2026-04-27 07:04:42 +02:00
|
|
|
if "%CRAFTER_BUILD_MARCH%"=="" set CRAFTER_BUILD_MARCH=native
|
|
|
|
|
if "%CRAFTER_BUILD_MTUNE%"=="" set CRAFTER_BUILD_MTUNE=native
|
2026-03-02 20:08:09 +01:00
|
|
|
|
2026-04-27 07:04:42 +02:00
|
|
|
cd .\build\glslang
|
|
|
|
|
cmake -G Ninja -B build ^
|
|
|
|
|
-DCMAKE_C_COMPILER=clang ^
|
|
|
|
|
-DCMAKE_CXX_COMPILER=clang++ ^
|
|
|
|
|
-DCMAKE_CXX_FLAGS="%useLibcSource%" ^
|
|
|
|
|
-DCMAKE_EXE_LINKER_FLAGS="%useLibcLinker%" ^
|
|
|
|
|
-DCMAKE_SHARED_LINKER_FLAGS="%useLibcLinker%" ^
|
|
|
|
|
-DCMAKE_BUILD_TYPE=Release ^
|
|
|
|
|
-DCMAKE_ARCHIVE_OUTPUT_DIRECTORY="%buildDir%" ^
|
|
|
|
|
-DCMAKE_LIBRARY_OUTPUT_DIRECTORY="%buildDir%" ^
|
|
|
|
|
-DENABLE_OPT=OFF
|
2026-03-02 20:01:41 +01:00
|
|
|
cmake --build build --config Release
|
|
|
|
|
cd ..\..\
|
|
|
|
|
|
2026-04-27 07:04:42 +02:00
|
|
|
set common_options=-I.\build\glslang -std=c++26 -O3 -march=%CRAFTER_BUILD_MARCH% -mtune=%CRAFTER_BUILD_MTUNE% -fprebuilt-module-path=.\build -D CRAFTER_BUILD_CONFIGURATION_TARGET_x86_64_pc_windows_msvc -D CRAFTER_BUILD_CONFIGURATION_TYPE_EXECUTABLE -D _CRT_SECURE_NO_WARNINGS %useLibcSource% -c
|
2026-03-02 20:01:41 +01:00
|
|
|
|
2026-04-27 07:04:42 +02:00
|
|
|
clang++ %useLibcSource% -std=c++26 -march=%CRAFTER_BUILD_MARCH% -mtune=%CRAFTER_BUILD_MTUNE% -O3 -Wno-reserved-identifier -Wno-reserved-module-identifier --precompile %LIBCXX_DIR%\modules\c++\v1\std.cppm -o .\build\std.pcm
|
2026-03-02 20:01:41 +01:00
|
|
|
|
|
|
|
|
clang++ %common_options% -fmodule-output interfaces\Crafter.Build-Shader.cppm -o .\build\Crafter.Build-Shader.o
|
2026-04-27 07:04:42 +02:00
|
|
|
clang++ %common_options% -fmodule-output interfaces\Crafter.Build-Platform.cppm -o .\build\Crafter.Build-Platform.o
|
|
|
|
|
clang++ %common_options% -fmodule-output interfaces\Crafter.Build-Interface.cppm -o .\build\Crafter.Build-Interface.o
|
2026-03-02 20:01:41 +01:00
|
|
|
clang++ %common_options% -fmodule-output interfaces\Crafter.Build-Implementation.cppm -o .\build\Crafter.Build-Implementation.o
|
2026-04-27 07:04:42 +02:00
|
|
|
clang++ %common_options% -fmodule-output interfaces\Crafter.Build-External.cppm -o .\build\Crafter.Build-External.o
|
|
|
|
|
clang++ %common_options% -fmodule-output interfaces\Crafter.Build-Clang.cppm -o .\build\Crafter.Build-Clang.o
|
|
|
|
|
clang++ %common_options% -fmodule-output interfaces\Crafter.Build.cppm -o .\build\Crafter.Build.o
|
2026-03-02 20:01:41 +01:00
|
|
|
|
|
|
|
|
clang++ %common_options% .\implementations\Crafter.Build-Shader.cpp -o .\build\Crafter.Build-Shader_impl.o
|
2026-04-27 07:04:42 +02:00
|
|
|
clang++ %common_options% .\implementations\Crafter.Build-Platform.cpp -o .\build\Crafter.Build-Platform_impl.o
|
|
|
|
|
clang++ %common_options% .\implementations\Crafter.Build-Interface.cpp -o .\build\Crafter.Build-Interface_impl.o
|
|
|
|
|
clang++ %common_options% .\implementations\Crafter.Build-Implementation.cpp -o .\build\Crafter.Build-Implementation_impl.o
|
|
|
|
|
clang++ %common_options% .\implementations\Crafter.Build-External.cpp -o .\build\Crafter.Build-External_impl.o
|
|
|
|
|
clang++ %common_options% .\implementations\Crafter.Build-Clang.cpp -o .\build\Crafter.Build-Clang_impl.o
|
2026-03-02 21:27:25 +01:00
|
|
|
clang++ %common_options% .\implementations\main.cpp -o .\build\main.o
|
2026-03-02 20:01:41 +01:00
|
|
|
|
2026-04-27 07:04:42 +02:00
|
|
|
REM Step 1: link all impl .o files into crafter-build.dll, generating crafter-build.lib import lib
|
|
|
|
|
clang++ %useLibcLinker% -shared -std=c++26 -O3 -march=%CRAFTER_BUILD_MARCH% -mtune=%CRAFTER_BUILD_MTUNE% -L.\build -fuse-ld=lld ^
|
|
|
|
|
-Wl,-export-all-symbols ^
|
|
|
|
|
-Wl,/IMPLIB:.\bin\crafter-build.lib ^
|
|
|
|
|
-lSPIRV -lGenericCodeGen -lglslang -lOSDependent -lMachineIndependent -lglslang-default-resource-limits ^
|
|
|
|
|
.\build\Crafter.Build-Shader.o ^
|
|
|
|
|
.\build\Crafter.Build-Platform.o ^
|
|
|
|
|
.\build\Crafter.Build-Interface.o ^
|
|
|
|
|
.\build\Crafter.Build-Implementation.o ^
|
|
|
|
|
.\build\Crafter.Build-External.o ^
|
|
|
|
|
.\build\Crafter.Build-Clang.o ^
|
|
|
|
|
.\build\Crafter.Build.o ^
|
|
|
|
|
.\build\Crafter.Build-Shader_impl.o ^
|
|
|
|
|
.\build\Crafter.Build-Platform_impl.o ^
|
|
|
|
|
.\build\Crafter.Build-Interface_impl.o ^
|
|
|
|
|
.\build\Crafter.Build-Implementation_impl.o ^
|
|
|
|
|
.\build\Crafter.Build-External_impl.o ^
|
|
|
|
|
.\build\Crafter.Build-Clang_impl.o ^
|
|
|
|
|
-o .\bin\crafter-build.dll
|
2026-03-02 20:01:41 +01:00
|
|
|
|
2026-04-27 07:04:42 +02:00
|
|
|
REM Step 2: link the launcher exe against crafter-build.lib
|
|
|
|
|
clang++ %useLibcLinker% -std=c++26 -O3 -march=%CRAFTER_BUILD_MARCH% -mtune=%CRAFTER_BUILD_MTUNE% -L.\bin -fuse-ld=lld ^
|
|
|
|
|
.\build\main.o ^
|
|
|
|
|
.\bin\crafter-build.lib ^
|
|
|
|
|
-o .\bin\crafter-build.exe
|
|
|
|
|
|
|
|
|
|
copy /Y "%LIBCXX_DIR%\lib\c++.dll" ".\bin\c++.dll"
|