2026-01-01 14:20:09 +00:00
|
|
|
@echo off
|
|
|
|
|
setlocal ENABLEDELAYEDEXPANSION
|
|
|
|
|
|
|
|
|
|
set ARCH=%1
|
|
|
|
|
if "%ARCH%"=="" set ARCH=x86_64
|
|
|
|
|
|
|
|
|
|
if not "%ARCH%"=="x86_64" ^
|
|
|
|
|
if not "%ARCH%"=="x86" ^
|
|
|
|
|
if not "%ARCH%"=="arm64" ^
|
|
|
|
|
if not "%ARCH%"=="arm-v6" ^
|
|
|
|
|
if not "%ARCH%"=="arm-v7" ^
|
|
|
|
|
if not "%ARCH%"=="all" (
|
|
|
|
|
echo Usage: %0 [x86_64^|x86^|arm64^|arm-v6^|arm-v7^|all]
|
|
|
|
|
exit /b 1
|
|
|
|
|
)
|
|
|
|
|
|
2025-11-12 23:29:48 +00:00
|
|
|
mkdir build\stencils
|
|
|
|
|
mkdir build\runner
|
2025-11-10 19:09:54 +00:00
|
|
|
|
2026-01-01 14:20:09 +00:00
|
|
|
python stencils/generate_stencils.py build\stencils\stencils.c
|
|
|
|
|
|
|
|
|
|
REM ============================================================
|
|
|
|
|
REM x86_64
|
|
|
|
|
REM ============================================================
|
|
|
|
|
if "%ARCH%"=="x86_64" goto BUILD_X86_64
|
|
|
|
|
if "%ARCH%"=="all" goto BUILD_X86_64
|
|
|
|
|
goto SKIP_X86_64
|
|
|
|
|
|
|
|
|
|
:BUILD_X86_64
|
2025-11-10 19:09:54 +00:00
|
|
|
echo -------------x86_64 - 64 bit-----------------
|
2026-01-01 14:20:09 +00:00
|
|
|
|
2025-11-09 14:45:37 +00:00
|
|
|
call "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" x64
|
2026-01-01 14:20:09 +00:00
|
|
|
|
2025-11-10 19:09:54 +00:00
|
|
|
echo - Compile stencil test...
|
2025-11-12 23:29:48 +00:00
|
|
|
cl /Zi /Od stencils\test.c /Fe:build\stencils\test.exe
|
2025-11-10 19:09:54 +00:00
|
|
|
|
2025-11-09 14:45:37 +00:00
|
|
|
echo - Build runner for Windows 64 bit...
|
2026-01-01 14:20:09 +00:00
|
|
|
cl /Zi /Od /DENABLE_BASIC_LOGGING ^
|
|
|
|
|
src\coparun\runmem.c ^
|
|
|
|
|
src\coparun\coparun.c ^
|
|
|
|
|
src\coparun\mem_man.c ^
|
|
|
|
|
/Fe:build\runner\coparun.exe
|
2025-11-03 14:01:42 +00:00
|
|
|
|
2026-01-01 14:20:09 +00:00
|
|
|
echo - Build stencils for x86_64...
|
2025-11-14 07:56:33 +00:00
|
|
|
wsl gcc -fno-pic -ffunction-sections -c build/stencils/stencils.c -O3 -o build/stencils/stencils.o
|
|
|
|
|
wsl ld -r build/stencils/stencils.o build/musl/musl_objects_x86_64.o -o src/copapy/obj/stencils_x86_64_O3.o
|
|
|
|
|
wsl objdump -d -x src/copapy/obj/stencils_x86_64_O3.o > build/stencils/stencils_x86_64_O3.asm
|
2025-11-03 14:01:42 +00:00
|
|
|
|
2026-01-01 14:20:09 +00:00
|
|
|
:SKIP_X86_64
|
|
|
|
|
|
|
|
|
|
REM ============================================================
|
|
|
|
|
REM x86 32-bit
|
|
|
|
|
REM ============================================================
|
|
|
|
|
if "%ARCH%"=="x86" goto BUILD_X86
|
|
|
|
|
if "%ARCH%"=="all" goto BUILD_X86
|
|
|
|
|
goto SKIP_X86
|
|
|
|
|
|
|
|
|
|
:BUILD_X86
|
|
|
|
|
echo ---------------x86 - 32 bit----------------
|
|
|
|
|
|
2025-11-09 14:45:37 +00:00
|
|
|
call "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" x86
|
|
|
|
|
|
|
|
|
|
echo - Build runner for Windows 32 bit...
|
2026-01-01 14:20:09 +00:00
|
|
|
cl /Zi /Od /DENABLE_LOGGING ^
|
|
|
|
|
src\coparun\runmem.c ^
|
|
|
|
|
src\coparun\coparun.c ^
|
|
|
|
|
src\coparun\mem_man.c ^
|
|
|
|
|
/Fe:build\runner\coparun-x86.exe
|
|
|
|
|
|
|
|
|
|
echo - Build runner for Linux x86 32 bit...
|
|
|
|
|
wsl i686-linux-gnu-gcc-12 -static -O3 -DENABLE_LOGGING ^
|
|
|
|
|
src/coparun/runmem.c ^
|
|
|
|
|
src/coparun/coparun.c ^
|
|
|
|
|
src/coparun/mem_man.c ^
|
|
|
|
|
-o build/runner/coparun-x86
|
2025-11-10 19:09:54 +00:00
|
|
|
|
|
|
|
|
echo - Build stencils x86 32 bit...
|
2025-11-14 07:56:33 +00:00
|
|
|
wsl i686-linux-gnu-gcc-12 -fno-pic -ffunction-sections -c build/stencils/stencils.c -O3 -o build/stencils/stencils.o
|
|
|
|
|
wsl i686-linux-gnu-ld -r build/stencils/stencils.o build/musl/musl_objects_x86.o -o src/copapy/obj/stencils_x86_O3.o
|
|
|
|
|
wsl i686-linux-gnu-objdump -d -x src/copapy/obj/stencils_x86_O3.o > build/stencils/stencils_x86_O3.asm
|
2025-11-09 14:45:37 +00:00
|
|
|
|
2026-01-01 14:20:09 +00:00
|
|
|
:SKIP_X86
|
|
|
|
|
|
|
|
|
|
REM ============================================================
|
|
|
|
|
REM ARM64
|
|
|
|
|
REM ============================================================
|
|
|
|
|
if "%ARCH%"=="arm64" goto BUILD_ARM64
|
|
|
|
|
if "%ARCH%"=="all" goto BUILD_ARM64
|
|
|
|
|
goto SKIP_ARM64
|
|
|
|
|
|
|
|
|
|
:BUILD_ARM64
|
|
|
|
|
echo --------------arm64 64 bit----------------
|
2025-11-09 14:45:37 +00:00
|
|
|
|
2025-11-14 07:56:33 +00:00
|
|
|
wsl aarch64-linux-gnu-gcc-12 -fno-pic -ffunction-sections -c build/stencils/stencils.c -O3 -o build/stencils/stencils.o
|
|
|
|
|
wsl aarch64-linux-gnu-ld -r build/stencils/stencils.o build/musl/musl_objects_arm64.o -o src/copapy/obj/stencils_arm64_O3.o
|
|
|
|
|
wsl aarch64-linux-gnu-objdump -d -x src/copapy/obj/stencils_arm64_O3.o > build/stencils/stencils_arm64_O3.asm
|
2025-11-17 08:03:27 +00:00
|
|
|
|
2026-01-01 14:20:09 +00:00
|
|
|
echo - Build runner for AArch64...
|
|
|
|
|
wsl aarch64-linux-gnu-gcc-12 -static -O3 -DENABLE_LOGGING ^
|
|
|
|
|
src/coparun/runmem.c ^
|
|
|
|
|
src/coparun/coparun.c ^
|
|
|
|
|
src/coparun/mem_man.c ^
|
|
|
|
|
-o build/runner/coparun-aarch64
|
|
|
|
|
|
|
|
|
|
:SKIP_ARM64
|
|
|
|
|
|
|
|
|
|
REM ============================================================
|
|
|
|
|
REM ARM v6
|
|
|
|
|
REM ============================================================
|
|
|
|
|
if "%ARCH%"=="arm-v6" goto BUILD_ARMV6
|
|
|
|
|
if "%ARCH%"=="all" goto BUILD_ARMV6
|
|
|
|
|
goto SKIP_ARMV6
|
|
|
|
|
|
|
|
|
|
:BUILD_ARMV6
|
|
|
|
|
echo --------------arm-v6 32 bit----------------
|
|
|
|
|
|
|
|
|
|
wsl arm-none-eabi-gcc -fno-pic -ffunction-sections -march=armv6 -mfpu=vfp -mfloat-abi=hard -marm ^
|
|
|
|
|
-c build/stencils/stencils.c -O3 -o build/stencils/stencils.o
|
|
|
|
|
|
|
|
|
|
wsl arm-none-eabi-ld -r build/stencils/stencils.o build/musl/musl_objects_armv6.o ^
|
|
|
|
|
$(arm-none-eabi-gcc -print-libgcc-file-name) ^
|
|
|
|
|
-o src/copapy/obj/stencils_armv6_O3.o
|
2025-11-17 08:03:27 +00:00
|
|
|
|
|
|
|
|
wsl arm-none-eabi-objdump -d -x src/copapy/obj/stencils_armv6_O3.o > build/stencils/stencils_armv6_O3.asm
|
|
|
|
|
|
2026-01-01 14:20:09 +00:00
|
|
|
:SKIP_ARMV6
|
2025-11-17 08:03:27 +00:00
|
|
|
|
2026-01-01 14:20:09 +00:00
|
|
|
REM ============================================================
|
|
|
|
|
REM ARM v7
|
|
|
|
|
REM ============================================================
|
|
|
|
|
if "%ARCH%"=="arm-v7" goto BUILD_ARMV7
|
|
|
|
|
if "%ARCH%"=="all" goto BUILD_ARMV7
|
|
|
|
|
goto END
|
2025-11-17 08:03:27 +00:00
|
|
|
|
2026-01-01 14:20:09 +00:00
|
|
|
:BUILD_ARMV7
|
|
|
|
|
echo --------------arm-v7 32 bit----------------
|
|
|
|
|
|
|
|
|
|
wsl arm-none-eabi-gcc -fno-pic -ffunction-sections -march=armv7-a -mfpu=neon-vfpv3 -mfloat-abi=hard -marm ^
|
|
|
|
|
-c build/stencils/stencils.c -O3 -o build/stencils/stencils.o
|
2025-12-06 14:15:33 +00:00
|
|
|
|
2026-01-01 14:20:09 +00:00
|
|
|
wsl arm-none-eabi-ld -r build/stencils/stencils.o build/musl/musl_objects_armv7.o ^
|
|
|
|
|
$(arm-none-eabi-gcc -print-libgcc-file-name) ^
|
|
|
|
|
-o src/copapy/obj/stencils_armv7_O3.o
|
|
|
|
|
|
|
|
|
|
wsl arm-none-eabi-objdump -d -x src/copapy/obj/stencils_armv7_O3.o > build/stencils/stencils_armv7_O3.asm
|
2025-12-06 14:15:33 +00:00
|
|
|
|
2026-01-01 14:20:09 +00:00
|
|
|
echo - Build runner for ARM v7...
|
|
|
|
|
wsl arm-linux-gnueabihf-gcc -static -O3 -DENABLE_LOGGING ^
|
|
|
|
|
src/coparun/runmem.c ^
|
|
|
|
|
src/coparun/coparun.c ^
|
|
|
|
|
src/coparun/mem_man.c ^
|
|
|
|
|
-o build/runner/coparun-armv7
|
2025-11-17 08:03:27 +00:00
|
|
|
|
2026-01-01 14:20:09 +00:00
|
|
|
:END
|
|
|
|
|
echo Build completed for %ARCH%
|
|
|
|
|
endlocal
|