mirror of https://github.com/Nonannet/copapy.git
manual stencil build scripts updated with cl arguments and x86_64 default
This commit is contained in:
parent
43465a690c
commit
df5b4c19f1
150
tools/build.bat
150
tools/build.bat
|
|
@ -1,68 +1,156 @@
|
|||
@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
|
||||
)
|
||||
|
||||
mkdir build\stencils
|
||||
mkdir build\runner
|
||||
python stencils/generate_stencils.py build/stencils/stencils.c
|
||||
|
||||
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
|
||||
echo -------------x86_64 - 64 bit-----------------
|
||||
|
||||
call "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" x64
|
||||
|
||||
echo - Compile stencil test...
|
||||
cl /Zi /Od stencils\test.c /Fe:build\stencils\test.exe
|
||||
|
||||
echo - Build runner for Windows 64 bit...
|
||||
cl /Zi /Od /DENABLE_BASIC_LOGGING src\coparun\runmem.c src\coparun\coparun.c src\coparun\mem_man.c /Fe:build\runner\coparun.exe
|
||||
cl /Zi /Od /DENABLE_BASIC_LOGGING ^
|
||||
src\coparun\runmem.c ^
|
||||
src\coparun\coparun.c ^
|
||||
src\coparun\mem_man.c ^
|
||||
/Fe:build\runner\coparun.exe
|
||||
|
||||
REM Optimized:
|
||||
REM cl /O2 src\coparun\runmem.c src\coparun\coparun.c src\coparun\mem_man.c /Fe:build\runner\coparun.exe
|
||||
|
||||
echo - Build stencils for 64 bit...
|
||||
REM ../copapy/tools/cross_compiler_unix/packobjs.sh gcc ld ../copapy/build/musl/musl_objects_x86_64.o
|
||||
echo - Build stencils for x86_64...
|
||||
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
|
||||
|
||||
echo ---------------x86 - 32 bit---------------
|
||||
: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----------------
|
||||
|
||||
call "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" x86
|
||||
|
||||
echo - Build runner for Windows 32 bit...
|
||||
cl /Zi /Od /DENABLE_LOGGING src\coparun\runmem.c src\coparun\coparun.c src\coparun\mem_man.c /Fe:build\runner\coparun-x86.exe
|
||||
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 -Wall -Wextra -Wconversion -Wsign-conversion -Wshadow -Wstrict-overflow -O3 -DENABLE_LOGGING src/coparun/runmem.c src/coparun/coparun.c src/coparun/mem_man.c -o build/runner/coparun-x86
|
||||
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
|
||||
|
||||
echo - Build stencils x86 32 bit...
|
||||
REM sh ../copapy/tools/cross_compiler_unix/packobjs.sh i686-linux-gnu-gcc-12 i686-linux-gnu-ld ../copapy/build/musl/musl_objects_x86.o -fno-pic
|
||||
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
|
||||
|
||||
: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----------------
|
||||
|
||||
echo --------------arm64 64 bit----------------
|
||||
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
|
||||
echo ------------------------------
|
||||
echo - Build runner for Aarch64...
|
||||
wsl aarch64-linux-gnu-gcc-12 -static -Wall -Wextra -Wconversion -Wsign-conversion -Wshadow -Wstrict-overflow -O3 -DENABLE_LOGGING src/coparun/runmem.c src/coparun/coparun.c src/coparun/mem_man.c -o build/runner/coparun-aarch64
|
||||
|
||||
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
|
||||
|
||||
echo --------------arm-v6 32 bit----------------
|
||||
REM sh ../copapy/tools/cross_compiler_unix/packobjs.sh arm-none-eabi-gcc arm-none-eabi-ld ../copapy/build/musl/musl_objects_armv6.o "-march=armv6 -mfpu=vfp -marm"
|
||||
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
|
||||
wsl arm-none-eabi-objdump -d -x src/copapy/obj/stencils_armv6_O3.o > build/stencils/stencils_armv6_O3.asm
|
||||
echo ------------------------------
|
||||
REM echo - Build runner
|
||||
REM wsl arm-linux-gnueabihf-gcc -march=armv6 -mfpu=vfp -marm -static -Wall -Wextra -Wconversion -Wsign-conversion -Wshadow -Wstrict-overflow -O3 -DENABLE_LOGGING src/coparun/runmem.c src/coparun/coparun.c src/coparun/mem_man.c -o build/runner/coparun-armv6
|
||||
|
||||
:SKIP_ARMV6
|
||||
|
||||
REM ============================================================
|
||||
REM ARM v7
|
||||
REM ============================================================
|
||||
if "%ARCH%"=="arm-v7" goto BUILD_ARMV7
|
||||
if "%ARCH%"=="all" goto BUILD_ARMV7
|
||||
goto END
|
||||
|
||||
: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
|
||||
|
||||
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
|
||||
|
||||
echo --------------arm-v7 32 bit----------------
|
||||
REM sh ../copapy/tools/cross_compiler_unix/packobjs.sh arm-none-eabi-gcc arm-none-eabi-ld ../copapy/build/musl/musl_objects_armv7.o "-march=armv7-a -mfpu=neon-vfpv3 -marm"
|
||||
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
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
echo ------------------------------
|
||||
echo - Build runner
|
||||
wsl arm-linux-gnueabihf-gcc -march=armv7-a -mfpu=neon-vfpv3 -marm -static -Wall -Wextra -Wconversion -Wsign-conversion -Wshadow -Wstrict-overflow -O3 -DENABLE_LOGGING src/coparun/runmem.c src/coparun/coparun.c src/coparun/mem_man.c -o build/runner/coparun-armv7
|
||||
|
||||
:END
|
||||
echo Build completed for %ARCH%
|
||||
endlocal
|
||||
|
|
|
|||
118
tools/build.sh
118
tools/build.sh
|
|
@ -1,6 +1,16 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
set -v
|
||||
set -eux
|
||||
|
||||
ARCH=${1:-x86_64}
|
||||
|
||||
case "$ARCH" in
|
||||
(x86_64|arm-v6|arm-v7|all)
|
||||
;;
|
||||
(*)
|
||||
echo "Usage: $0 [x86_64|arm-v6|arm-v7|all]"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
mkdir -p build/stencils
|
||||
mkdir -p build/runner
|
||||
|
|
@ -10,34 +20,90 @@ DEST=src/copapy/obj
|
|||
python3 stencils/generate_stencils.py $SRC
|
||||
mkdir -p $DEST
|
||||
|
||||
gcc -fno-pic -ffunction-sections -c $SRC -O3 -o build/stencils/stencils.o
|
||||
ld -r build/stencils/stencils.o build/musl/musl_objects_x86_64.o -o $DEST/stencils_x86_64_O3.o
|
||||
objdump -d -x $DEST/stencils_x86_64_O3.o > build/stencils/stencils_x86_64_O3.asm
|
||||
#######################################
|
||||
# x86_64
|
||||
#######################################
|
||||
if [[ "$ARCH" == "x86_64" || "$ARCH" == "all" ]]; then
|
||||
echo "--------------x86_64----------------"
|
||||
|
||||
mkdir bin -p
|
||||
gcc -Wall -Wextra -Wconversion -Wsign-conversion \
|
||||
-Wshadow -Wstrict-overflow -Werror -g -O3 \
|
||||
-DENABLE_LOGGING \
|
||||
src/coparun/runmem.c src/coparun/coparun.c src/coparun/mem_man.c -o build/runner/coparun
|
||||
gcc -fno-pic -ffunction-sections -c $SRC -O3 -o build/stencils/stencils.o
|
||||
ld -r build/stencils/stencils.o build/musl/musl_objects_x86_64.o \
|
||||
-o $DEST/stencils_x86_64_O3.o
|
||||
objdump -d -x $DEST/stencils_x86_64_O3.o \
|
||||
> build/stencils/stencils_x86_64_O3.asm
|
||||
|
||||
mkdir -p bin
|
||||
gcc -Wall -Wextra -Wconversion -Wsign-conversion \
|
||||
-Wshadow -Wstrict-overflow -Werror -g -O3 \
|
||||
-DENABLE_LOGGING \
|
||||
src/coparun/runmem.c \
|
||||
src/coparun/coparun.c \
|
||||
src/coparun/mem_man.c \
|
||||
-o build/runner/coparun
|
||||
fi
|
||||
|
||||
echo "--------------arm-v6 32 bit----------------"
|
||||
LIBGCC=$(arm-none-eabi-gcc -print-libgcc-file-name)
|
||||
#LIBM=$(arm-none-eabi-gcc -print-file-name=libm.a)
|
||||
#LIBC=$(arm-none-eabi-gcc -print-file-name=libc.a)
|
||||
#######################################
|
||||
# ARM v6
|
||||
#######################################
|
||||
if [[ "$ARCH" == "arm-v6" || "$ARCH" == "all" ]]; then
|
||||
echo "--------------arm-v6 32 bit----------------"
|
||||
|
||||
arm-none-eabi-gcc -fno-pic -ffunction-sections -march=armv6 -mfpu=vfp -mfloat-abi=hard -marm -c $SRC -O3 -o build/stencils/stencils.o
|
||||
arm-none-eabi-ld -r build/stencils/stencils.o build/musl/musl_objects_armv6.o $LIBGCC -o $DEST/stencils_armv6_O3.o
|
||||
arm-none-eabi-objdump -d -x $DEST/stencils_armv6_O3.o > build/stencils/stencils_armv6_O3.asm
|
||||
arm-linux-gnueabihf-gcc -march=armv6 -mfpu=vfp -mfloat-abi=hard -marm -static -Wall -Wextra -Wconversion -Wsign-conversion -Wshadow -Wstrict-overflow -O3 -DENABLE_LOGGING src/coparun/runmem.c src/coparun/coparun.c src/coparun/mem_man.c -o build/runner/coparun-armv6
|
||||
LIBGCC=$(arm-none-eabi-gcc -print-libgcc-file-name)
|
||||
|
||||
arm-none-eabi-gcc -fno-pic -ffunction-sections \
|
||||
-march=armv6 -mfpu=vfp -mfloat-abi=hard -marm \
|
||||
-c $SRC -O3 -o build/stencils/stencils.o
|
||||
|
||||
echo "--------------arm-v7 32 bit----------------"
|
||||
LIBGCC=$(arm-none-eabi-gcc -print-libgcc-file-name)
|
||||
#LIBM=$(arm-none-eabi-gcc -print-file-name=libm.a)
|
||||
#LIBC=$(arm-none-eabi-gcc -print-file-name=libc.a)
|
||||
arm-none-eabi-ld -r \
|
||||
build/stencils/stencils.o \
|
||||
build/musl/musl_objects_armv6.o \
|
||||
$LIBGCC \
|
||||
-o $DEST/stencils_armv6_O3.o
|
||||
|
||||
arm-none-eabi-gcc -fno-pic -ffunction-sections -march=armv7-a -mfpu=neon-vfpv3 -mfloat-abi=hard -marm -c $SRC -O3 -o build/stencils/stencils.o
|
||||
arm-none-eabi-ld -r build/stencils/stencils.o build/musl/musl_objects_armv7.o $LIBGCC -o $DEST/stencils_armv7_O3.o
|
||||
arm-none-eabi-objdump -d -x $DEST/stencils_armv7_O3.o > build/stencils/stencils_armv7_O3.asm
|
||||
arm-linux-gnueabihf-gcc -march=armv7-a -mfpu=neon-vfpv3 -mfloat-abi=hard -marm -static -Wall -Wextra -Wconversion -Wsign-conversion -Wshadow -Wstrict-overflow -O3 -DENABLE_LOGGING src/coparun/runmem.c src/coparun/coparun.c src/coparun/mem_man.c -o build/runner/coparun-armv7
|
||||
arm-none-eabi-objdump -d -x \
|
||||
$DEST/stencils_armv6_O3.o \
|
||||
> build/stencils/stencils_armv6_O3.asm
|
||||
|
||||
arm-linux-gnueabihf-gcc \
|
||||
-march=armv6 -mfpu=vfp -mfloat-abi=hard -marm -static \
|
||||
-Wall -Wextra -Wconversion -Wsign-conversion \
|
||||
-Wshadow -Wstrict-overflow -O3 \
|
||||
-DENABLE_LOGGING \
|
||||
src/coparun/runmem.c \
|
||||
src/coparun/coparun.c \
|
||||
src/coparun/mem_man.c \
|
||||
-o build/runner/coparun-armv6
|
||||
fi
|
||||
|
||||
#######################################
|
||||
# ARM v7
|
||||
#######################################
|
||||
if [[ "$ARCH" == "arm-v7" || "$ARCH" == "all" ]]; then
|
||||
echo "--------------arm-v7 32 bit----------------"
|
||||
|
||||
LIBGCC=$(arm-none-eabi-gcc -print-libgcc-file-name)
|
||||
|
||||
arm-none-eabi-gcc -fno-pic -ffunction-sections \
|
||||
-march=armv7-a -mfpu=neon-vfpv3 -mfloat-abi=hard -marm \
|
||||
-c $SRC -O3 -o build/stencils/stencils.o
|
||||
|
||||
arm-none-eabi-ld -r \
|
||||
build/stencils/stencils.o \
|
||||
build/musl/musl_objects_armv7.o \
|
||||
$LIBGCC \
|
||||
-o $DEST/stencils_armv7_O3.o
|
||||
|
||||
arm-none-eabi-objdump -d -x \
|
||||
$DEST/stencils_armv7_O3.o \
|
||||
> build/stencils/stencils_armv7_O3.asm
|
||||
|
||||
arm-linux-gnueabihf-gcc \
|
||||
-march=armv7-a -mfpu=neon-vfpv3 -mfloat-abi=hard -marm -static \
|
||||
-Wall -Wextra -Wconversion -Wsign-conversion \
|
||||
-Wshadow -Wstrict-overflow -O3 \
|
||||
-DENABLE_LOGGING \
|
||||
src/coparun/runmem.c \
|
||||
src/coparun/coparun.c \
|
||||
src/coparun/mem_man.c \
|
||||
-o build/runner/coparun-armv7
|
||||
fi
|
||||
|
|
|
|||
Loading…
Reference in New Issue