Linking against legacy libc <= 2.15

This commit is contained in:
s1lentq 2024-07-14 23:41:13 +07:00
parent 30572ef0b6
commit 79cfd7103a
3 changed files with 21 additions and 17 deletions

View File

@ -25,12 +25,12 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v1.1.3
uses: microsoft/setup-msbuild@v2
with:
vs-version: '16.8'
@ -58,13 +58,14 @@ jobs:
move msvc\${{ env.buildRelease }}\mp.pdb publish\debug\mp.pdb
- name: Deploy artifacts
uses: actions/upload-artifact@v3.1.1
uses: actions/upload-artifact@v4
with:
name: win32
path: publish/*
testdemos:
name: 'Test demos'
if: false # TODO: FIXME!!
name: 'Test demos (FIXME)'
runs-on: ubuntu-20.04
container: s1lentq/testdemos:latest
needs: [windows]
@ -80,7 +81,7 @@ jobs:
steps:
- name: Deploying windows artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v2
with:
name: win32
@ -136,7 +137,7 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true
@ -173,7 +174,7 @@ jobs:
- name: Build using Clang C++ Compiler
run: |
rm -rf build && CC=clang CXX=clang++ cmake -B build && cmake --build build -j8
rm -rf build && CC=clang CXX=clang++ cmake -DUSE_LEGACY_LIBC=ON -B build && cmake --build build -j8
- name: Prepare CSSDK
run: |
@ -199,7 +200,7 @@ jobs:
shell: bash
- name: Deploy artifacts
uses: actions/upload-artifact@v3.1.1
uses: actions/upload-artifact@v4
id: upload-job
with:
name: linux32
@ -213,17 +214,17 @@ jobs:
publish:
name: 'Publish'
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
needs: [windows, testdemos, linux]
steps:
- name: Deploying linux artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v6
with:
name: linux32
- name: Deploying windows artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v6
with:
name: win32
@ -253,7 +254,7 @@ jobs:
7z a -tzip regamedll-bin-${{ env.APP_VERSION }}.zip bin/ cssdk/
- name: Publish artifacts
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v2
id: publish-job
if: |
startsWith(github.ref, 'refs/tags/') &&

View File

@ -22,6 +22,7 @@ project(regamedll CXX)
option(DEBUG "Build with debug information." OFF)
option(USE_STATIC_LIBSTDC "Enables static linking libstdc++." OFF)
option(USE_LEGACY_LIBC "Enables linking against legacy libc (<= 2.15) for compat with older distros (Debian 8/Ubuntu 16.04/Centos 7)." OFF)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
@ -32,6 +33,7 @@ set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
set(COMPILE_FLAGS "-m32 -U_FORTIFY_SOURCE")
set(LINK_FLAGS "-m32 -s")
set(LINK_LIBS dl aelf32)
set(COMPILE_FLAGS "${COMPILE_FLAGS} -Wall -fno-exceptions -fno-builtin -Wno-unknown-pragmas")
@ -362,12 +364,13 @@ target_sources(regamedll PRIVATE
${UNITTESTS_SRCS}>
)
target_link_libraries(regamedll PRIVATE
dl
aelf32
if (CMAKE_BUILD_TYPE MATCHES Unittests)
list(APPEND LINK_LIBS cppunitlite)
elseif (USE_LEGACY_LIBC)
list(APPEND LINK_LIBS libc-2.15.so)
endif()
$<$<CONFIG:Unittests>:cppunitlite>
)
target_link_libraries(regamedll PRIVATE ${LINK_LIBS})
if (USE_STATIC_LIBSTDC)
target_compile_definitions(regamedll PRIVATE BUILD_STATIC_LIBSTDC)

Binary file not shown.