mirror of
https://github.com/mhx/dwarfs.git
synced 2025-08-04 02:06:22 -04:00
build: add size-optimized release build
This commit is contained in:
parent
b082fcb4d9
commit
cb883f6df4
@ -121,6 +121,13 @@ case "-$BUILD_TYPE-" in
|
||||
CMAKE_ARGS="${CMAKE_ARGS} -DCMAKE_BUILD_TYPE=Release"
|
||||
CMAKE_ARGS="${CMAKE_ARGS} -DWITH_BENCHMARKS=1"
|
||||
;;
|
||||
*-relsize-*)
|
||||
CMAKE_ARGS="${CMAKE_ARGS} -DCMAKE_BUILD_TYPE=MinSizeRel"
|
||||
CMAKE_ARGS="${CMAKE_ARGS} -DWITH_BENCHMARKS=1"
|
||||
export CFLAGS="-ffunction-sections -fdata-sections -fvisibility=hidden -fmerge-all-constants"
|
||||
export CXXFLAGS="$CFLAGS"
|
||||
export LDFLAGS="-Wl,--gc-sections"
|
||||
;;
|
||||
*-reldbg-*)
|
||||
CMAKE_ARGS="${CMAKE_ARGS} -DCMAKE_BUILD_TYPE=RelWithDebInfo"
|
||||
;;
|
||||
@ -296,7 +303,10 @@ else
|
||||
|
||||
$RUN_TESTS
|
||||
fi
|
||||
fi
|
||||
|
||||
# for release and resize builds, strip the binaries
|
||||
if [[ "-$BUILD_TYPE-" =~ -(release|relsize)- ]]; then
|
||||
$BUILD_TOOL strip
|
||||
fi
|
||||
|
||||
|
12
.github/workflows/build.yml
vendored
12
.github/workflows/build.yml
vendored
@ -332,6 +332,18 @@ jobs:
|
||||
- arch: arm64v8
|
||||
dist: alpine
|
||||
build_type: clang-release-ninja-static
|
||||
- arch: amd64
|
||||
dist: alpine
|
||||
build_type: gcc-relsize-ninja-static
|
||||
- arch: arm64v8
|
||||
dist: alpine
|
||||
build_type: gcc-relsize-ninja-static
|
||||
- arch: amd64
|
||||
dist: alpine
|
||||
build_type: clang-relsize-ninja-static
|
||||
- arch: arm64v8
|
||||
dist: alpine
|
||||
build_type: clang-relsize-ninja-static
|
||||
- arch: amd64
|
||||
dist: alpine
|
||||
build_type: clang-reldbg-stacktrace-ninja-static
|
||||
|
@ -920,7 +920,7 @@ add_custom_target(
|
||||
USES_TERMINAL)
|
||||
|
||||
if(STATIC_BUILD_DO_NOT_USE OR APPLE)
|
||||
if(CMAKE_BUILD_TYPE STREQUAL "Release")
|
||||
if(CMAKE_BUILD_TYPE MATCHES "Release|MinSizeRel")
|
||||
foreach(tgt ${BINARY_TARGETS})
|
||||
list(APPEND FILES_TO_STRIP $<TARGET_FILE:${tgt}>)
|
||||
endforeach()
|
||||
|
Loading…
x
Reference in New Issue
Block a user