Hmm, can't build crosstool-ng yet.
This commit is contained in:
21
test/cmake/aarch64-linux-gnu.cmake
Normal file
21
test/cmake/aarch64-linux-gnu.cmake
Normal file
@ -0,0 +1,21 @@
|
||||
set(CMAKE_SYSTEM_NAME Linux)
|
||||
set(CMAKE_SYSTEM_PROCESSOR aarch64)
|
||||
|
||||
# Specify the cross compilers
|
||||
set(CMAKE_C_COMPILER /opt/cross/bin/aarch64-unknown-linux-musl-gcc)
|
||||
set(CMAKE_CXX_COMPILER /opt/cross/bin/aarch64-unknown-linux-musl-g++)
|
||||
|
||||
# Where is the target environment
|
||||
set(CMAKE_FIND_ROOT_PATH /opt/cross/aarch64-unknown-linux-musl)
|
||||
|
||||
# Search for programs in the build host directories
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
|
||||
# Search for libraries and headers in the target directories
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
|
||||
|
||||
# Set compiler flags
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=armv8-a")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=armv8-a")
|
34
test/crossbuild.sh
Executable file
34
test/crossbuild.sh
Executable file
@ -0,0 +1,34 @@
|
||||
#!/bin/bash
|
||||
|
||||
TARGET_ARCH="aarch64"
|
||||
OUTDIR="output-${TARGET_ARCH}"
|
||||
|
||||
# Create volume if it doesn't exist
|
||||
docker volume create cppbuild-cache-${TARGET_ARCH}
|
||||
|
||||
# Build command to run in the container
|
||||
BUILD_COMMAND="mkdir -p /app/build && \
|
||||
cd /app/build && \
|
||||
cmake -G Ninja \
|
||||
-DCMAKE_TOOLCHAIN_FILE=/app/src/cmake/${TARGET_ARCH}-linux-gnu.cmake \
|
||||
/app/src && \
|
||||
ninja -j$(nproc) && \
|
||||
mkdir -p /app/src/$OUTDIR && \
|
||||
cp /app/build/ipdemo /app/src/$OUTDIR/ipdemo && \
|
||||
chown -R $(id -u):$(id -g) /app/src/$OUTDIR"
|
||||
|
||||
# Run the build in the container
|
||||
docker run --rm \
|
||||
-v cppbuild-cache-${TARGET_ARCH}:/app/build \
|
||||
-v $(pwd):/app/src \
|
||||
-w /app/src \
|
||||
-e CCACHE_DIR=/app/build/.ccache \
|
||||
-e CC="ccache /opt/cross/bin/aarch64-unknown-linux-musl-gcc" \
|
||||
-e CXX="ccache /opt/cross/bin/aarch64-unknown-linux-musl-g++" \
|
||||
-e LD=mold \
|
||||
-e CMAKE_BUILD_PARALLEL_LEVEL=$(nproc) \
|
||||
-e NINJA_STATUS="[%f/%t] " \
|
||||
cpp-httplib-builder:latest \
|
||||
-c "$BUILD_COMMAND"
|
||||
|
||||
echo "Build completed. Output is in $OUTDIR directory"
|
Reference in New Issue
Block a user