mirror of https://github.com/libAthena/athena.git
Attempt static build on Alpine
This commit is contained in:
parent
5c697c006f
commit
4f8927d95c
|
@ -12,7 +12,9 @@ env:
|
||||||
jobs:
|
jobs:
|
||||||
build-linux-x86_64:
|
build-linux-x86_64:
|
||||||
name: Build Linux (GCC x86_64)
|
name: Build Linux (GCC x86_64)
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-latest
|
||||||
|
container:
|
||||||
|
image: alpine:3.17
|
||||||
|
|
||||||
env:
|
env:
|
||||||
LLVM_MAJOR: 15
|
LLVM_MAJOR: 15
|
||||||
|
@ -26,34 +28,20 @@ jobs:
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get -y update
|
apk add --no-cache git cmake ninja clang-dev clang-static llvm-dev llvm-static musl-dev \
|
||||||
sudo apt-get -y install cmake ninja-build llvm-$LLVM_MAJOR-dev libclang-$LLVM_MAJOR-dev clang-$LLVM_MAJOR zlib1g-dev
|
gcc g++ libxml2-dev libxml2-static zlib-dev zlib-static
|
||||||
|
|
||||||
# setup buildcache
|
|
||||||
curl -LSfs https://github.com/mbitsnbites/buildcache/releases/download/$BUILDCACHE_VERSION/buildcache-linux.tar.gz | tar xz -C "$RUNNER_WORKSPACE"
|
|
||||||
echo "$RUNNER_WORKSPACE"/buildcache/bin >> $GITHUB_PATH
|
|
||||||
|
|
||||||
- name: Restore buildcache
|
|
||||||
uses: actions/cache@v2
|
|
||||||
with:
|
|
||||||
path: ${{env.BUILDCACHE_DIR}}
|
|
||||||
key: buildcache-ubuntu-20.04-x86_64
|
|
||||||
|
|
||||||
- name: Configure CMake
|
- name: Configure CMake
|
||||||
run: |
|
run: |
|
||||||
cmake -B build . -GNinja \
|
cmake -B build . -GNinja \
|
||||||
-DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo \
|
-DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo \
|
||||||
-DATDNA_DYNAMIC_LLVM=OFF \
|
-DATDNA_DYNAMIC_LLVM:BOOL=OFF \
|
||||||
-DClang_DIR:PATH=/usr/lib/cmake/clang-$LLVM_MAJOR \
|
-DATDNA_STATIC:BOOL=ON \
|
||||||
-DCMAKE_C_COMPILER_LAUNCHER:STRING=buildcache \
|
-DCMAKE_CXX_FLAGS:STRING="-I/usr/lib/llvm15/include -Dstat64=stat"
|
||||||
-DCMAKE_CXX_COMPILER_LAUNCHER:STRING=buildcache
|
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: cmake --build build --target package --verbose
|
run: cmake --build build --target package --verbose
|
||||||
|
|
||||||
- name: Print buildcache stats
|
|
||||||
run: buildcache -s
|
|
||||||
|
|
||||||
- name: Test
|
- name: Test
|
||||||
working-directory: build
|
working-directory: build
|
||||||
run: ./atdna-test
|
run: ./atdna-test
|
||||||
|
@ -82,18 +70,19 @@ jobs:
|
||||||
name: Build & test
|
name: Build & test
|
||||||
with:
|
with:
|
||||||
arch: aarch64
|
arch: aarch64
|
||||||
distro: ubuntu20.04
|
base_image: --platform=linux/arm64/v8 alpine:3.17
|
||||||
githubToken: ${{github.token}}
|
githubToken: ${{github.token}}
|
||||||
dockerRunArgs: |
|
dockerRunArgs: |
|
||||||
--volume "${PWD}:/workspace"
|
--volume "${PWD}:/workspace"
|
||||||
install: |
|
install: |
|
||||||
apt-get -y update
|
apk add --no-cache git cmake ninja clang-dev clang-static llvm-dev llvm-static musl-dev \
|
||||||
apt-get -y install build-essential cmake ninja-build llvm-$LLVM_MAJOR-dev libclang-$LLVM_MAJOR-dev clang-$LLVM_MAJOR zlib1g-dev
|
gcc g++ libxml2-dev libxml2-static zlib-dev zlib-static
|
||||||
run: |
|
run: |
|
||||||
cmake -B build . -GNinja \
|
cmake -B build . -GNinja \
|
||||||
-DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo \
|
-DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo \
|
||||||
-DATDNA_DYNAMIC_LLVM:BOOL=OFF \
|
-DATDNA_DYNAMIC_LLVM:BOOL=OFF \
|
||||||
-DClang_DIR:PATH=/usr/lib/cmake/clang-$LLVM_MAJOR
|
-DATDNA_STATIC:BOOL=ON \
|
||||||
|
-DCMAKE_CXX_FLAGS:STRING="-I/usr/lib/llvm15/include -Dstat64=stat"
|
||||||
cmake --build build --target package --verbose
|
cmake --build build --target package --verbose
|
||||||
build/atdna-test
|
build/atdna-test
|
||||||
|
|
||||||
|
|
|
@ -69,6 +69,11 @@ endif()
|
||||||
|
|
||||||
project(athena VERSION ${ATHENA_VERSION} LANGUAGES C CXX)
|
project(athena VERSION ${ATHENA_VERSION} LANGUAGES C CXX)
|
||||||
|
|
||||||
|
if (ATDNA_STATIC)
|
||||||
|
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
|
||||||
|
add_link_options(-static)
|
||||||
|
endif ()
|
||||||
|
|
||||||
if (MSVC)
|
if (MSVC)
|
||||||
# Shaddup MSVC
|
# Shaddup MSVC
|
||||||
add_compile_definitions(UNICODE=1 _UNICODE=1 __SSE__=1
|
add_compile_definitions(UNICODE=1 _UNICODE=1 __SSE__=1
|
||||||
|
|
|
@ -73,6 +73,13 @@ else()
|
||||||
list(TRANSFORM target_dependencies REPLACE ".*diaguids.*" "${DIASDK_GUIDS_LIBRARY}")
|
list(TRANSFORM target_dependencies REPLACE ".*diaguids.*" "${DIASDK_GUIDS_LIBRARY}")
|
||||||
set_property(TARGET LLVMDebugInfoPDB PROPERTY INTERFACE_LINK_LIBRARIES "${target_dependencies}")
|
set_property(TARGET LLVMDebugInfoPDB PROPERTY INTERFACE_LINK_LIBRARIES "${target_dependencies}")
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
|
# Allow static linking against zstd
|
||||||
|
if (ATDNA_STATIC)
|
||||||
|
get_target_property(target_dependencies LLVMSupport INTERFACE_LINK_LIBRARIES)
|
||||||
|
list(TRANSFORM target_dependencies REPLACE "zstd::libzstd_shared" "zstd::libzstd_static")
|
||||||
|
set_property(TARGET LLVMSupport PROPERTY INTERFACE_LINK_LIBRARIES "${target_dependencies}")
|
||||||
|
endif ()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Offer the user the choice of overriding the installation directories
|
# Offer the user the choice of overriding the installation directories
|
||||||
|
|
Loading…
Reference in New Issue