diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index b839236..6956296 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.10) -project(cppstaticbuild) +project(ipdemo) set(CMAKE_CXX_STANDARD 23) set(CMAKE_CXX_STANDARD_REQUIRED ON) @@ -10,5 +10,5 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static") include_directories(/usr/local/include) -add_executable(main main.cpp) -target_link_libraries(main pthread assert cpptrace dwarf z zstd) +add_executable(ipdemo main.cpp) +target_link_libraries(ipdemo pthread assert cpptrace dwarf z zstd) diff --git a/test/build.sh b/test/build.sh index 38aa7f6..1fb5082 100755 --- a/test/build.sh +++ b/test/build.sh @@ -1,16 +1,29 @@ #!/bin/bash -rm -f build/main -docker run --rm -v $(pwd):/app -w /app \ - -e CCACHE_DIR=/app/.ccache \ +# Create volume if it doesn't exist +docker volume create cppbuild-cache + +OUTDIR="output" + +docker run --rm \ + -v cppbuild-cache:/app/build \ + -v $(pwd):/app/src \ + -w /app/src \ + -e CCACHE_DIR=/app/build/.ccache \ -e CC="ccache gcc" \ -e CXX="ccache g++" \ -e LD=mold \ -e CMAKE_BUILD_PARALLEL_LEVEL=$(nproc) \ -e NINJA_STATUS="[%f/%t] " \ cpp-httplib-builder:latest \ - -c "mkdir -p build && cd build && cmake -G Ninja .. && ninja -j$(nproc)" + -c "mkdir -p /app/build && \ + cd /app/build && \ + cmake -G Ninja /app/src && \ + ninja -j$(nproc) && \ + mkdir /app/src/$OUTDIR && \ + cp /app/build/ipdemo /app/src/$OUTDIR/ipdemo && \ + chown -R $(id -u):$(id -g) /app/src/$OUTDIR" -if [ -f build/main ]; then - build/main +if [ -f $OUTDIR/ipdemo ]; then + $OUTDIR/ipdemo fi diff --git a/test/output/ipdemo b/test/output/ipdemo new file mode 100755 index 0000000..87fe073 Binary files /dev/null and b/test/output/ipdemo differ