Update build workflow to statically build Abseil and project dependencies
Some checks failed
Build / build (push) Failing after 2m4s

Modify GitHub Actions workflow to:
- Build Abseil from source statically
- Configure CMake for static linking
- Remove external Abseil library dependency
- Update build flags to support static compilation
This commit is contained in:
2025-01-28 07:23:54 +00:00
parent 5bfc44d46c
commit d8fcced921
3 changed files with 70 additions and 6 deletions

View File

@@ -9,6 +9,7 @@ on:
env:
PKG_VERSION: "2.1.0"
PKG_RELEASE: "1"
ABSEIL_VERSION: "20230125.3"
jobs:
build:
@@ -23,15 +24,34 @@ jobs:
- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential cmake libabsl-dev clang checkinstall
sudo apt-get install -y build-essential cmake clang checkinstall zlib1g-dev musl-tools
- name: Create build directory
run: mkdir build
- name: Build Static Abseil
run: |
git clone https://github.com/abseil/abseil-cpp.git
cd abseil-cpp
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
-DABSL_BUILD_TESTING=OFF \
-DABSL_USE_GOOGLETEST_HEAD=OFF \
-DCMAKE_CXX_STANDARD=17 \
-DBUILD_SHARED_LIBS=OFF \
..
make -j$(nproc)
make install
ldconfig
- name: Configure the project
run: |
cd build
CC=clang CXX=clang++ cmake -DCMAKE_BUILD_TYPE=Release -DUSE_CLANG=ON -DBUILD_STATIC=OFF ..
mkdir build; cd build
CC=clang CXX=clang++ cmake -DCMAKE_BUILD_TYPE=Release \
-DUSE_CLANG=ON \
-DBUILD_STATIC=ON \
-DCMAKE_EXE_LINKER_FLAGS="-static -static-libgcc -static-libstdc++" \
-DCMAKE_FIND_LIBRARY_SUFFIXES=".a" \
-DCMAKE_EXE_LINKER_FLAGS_INIT="-static" \
..
- name: Build the project
run: |
@@ -45,7 +65,7 @@ jobs:
--pkgversion=${{ env.PKG_VERSION }} \
--pkgrelease=${{ env.PKG_RELEASE }} \
--maintainer="maintainer@example.com" \
--requires="libabsl20220623t64" \
--requires="" \
--default \
--pakdir=. \
--backup=no \

43
.gitignore vendored Normal file
View File

@@ -0,0 +1,43 @@
# CMake build directories
build/
CMakeFiles/
CMakeCache.txt
cmake_install.cmake
compile_commands.json
CTestTestfile.cmake
Testing/
_deps/
# Compiled files
*.o
*.obj
*.exe
*.out
*.app
*.dll
*.so
*.dylib
# IDE specific files
.vscode/
.idea/
*.swp
*.swo
.DS_Store
# Generated files
Makefile
*.make
*.cmake
!CMakeLists.txt
# Dependencies
_deps/
vcpkg_installed/
# Debug symbols
*.pdb
*.dSYM/
# Generated documentation
docs/_build/

View File

@@ -16,6 +16,7 @@
#define UTILS_H_
#include <string>
#include <cstdint>
#include "absl/strings/string_view.h"