Skip to content

Commit

Permalink
Strip linux binary
Browse files Browse the repository at this point in the history
  • Loading branch information
complexlogic committed Dec 23, 2023
1 parent 0554ce0 commit ec7b328
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -166,13 +166,13 @@ jobs:
- name: "Install dependencies"
run: |
if [[ "${{matrix.config.name}}" == "Debian" ]]; then
apt update && apt install -y curl zip unzip tar build-essential git cmake pkg-config libavcodec-dev libavformat-dev libavutil-dev libswresample-dev libebur128-dev libinih-dev
apt update && apt install -y curl zip unzip tar build-essential git cmake pkg-config libavcodec-dev libavformat-dev libavutil-dev libswresample-dev libebur128-dev libinih-dev binutils
fi
if [[ "${{matrix.config.name}}" == "Fedora" ]]; then
dnf install -y curl zip unzip tar git make pkg-config gcc-c++ fedora-packager rpmdevtools cmake libavcodec-free-devel libavformat-free-devel libswresample-free-devel libavutil-free-devel libebur128-devel inih-devel
fi
if [[ "${{matrix.config.name}}" == "Static" ]]; then
apt update && apt install -y curl zip unzip tar build-essential git cmake pkg-config python3 nasm
apt update && apt install -y curl zip unzip tar build-essential git cmake pkg-config python3 nasm binutils
fi
- name: Setup vcpkg
Expand All @@ -198,6 +198,7 @@ jobs:
-DCMAKE_BUILD_TYPE=${{env.CMAKE_BUILD_TYPE}}
-DCMAKE_INSTALL_PREFIX=/usr
-DPACKAGE=${{matrix.config.package_type}}
-DSTRIP_BINARY=ON

- name: Build
run: |
Expand Down
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ elseif (UNIX)
pkg_check_modules(TAGLIB REQUIRED IMPORTED_TARGET taglib>=1.11.1)
pkg_check_modules(LIBEBUR128 REQUIRED IMPORTED_TARGET libebur128>=1.2.4)
pkg_check_modules(INIH REQUIRED IMPORTED_TARGET inih)
if (STRIP_BINARY)
find_program(STRIP strip REQUIRED)
endif ()
if (NOT USE_STD_FORMAT)
pkg_check_modules(FMT REQUIRED IMPORTED_TARGET fmt)
endif ()
Expand Down
6 changes: 6 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ elseif (UNIX)
if (NOT USE_STD_FORMAT)
target_link_libraries(${EXECUTABLE_TITLE} PkgConfig::FMT)
endif ()
if (STRIP)
add_custom_command(TARGET ${EXECUTABLE_TITLE}
POST_BUILD
COMMAND "${STRIP}" "${PROJECT_BINARY_DIR}/${EXECUTABLE_TITLE}"
)
endif ()
endif()
set (EXECUTABLE_OUTPUT_PATH "${PROJECT_BINARY_DIR}")
string(TIMESTAMP BUILD_DATE "%Y-%m-%d")
Expand Down

0 comments on commit ec7b328

Please sign in to comment.