Skip to content

Commit

Permalink
Fix linux build
Browse files Browse the repository at this point in the history
  • Loading branch information
s1lentq committed Jul 14, 2024
1 parent 30572ef commit 2953ca9
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 17 deletions.
25 changes: 13 additions & 12 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down Expand Up @@ -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]
Expand All @@ -80,7 +81,7 @@ jobs:

steps:
- name: Deploying windows artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v2
with:
name: win32

Expand Down Expand Up @@ -136,7 +137,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true
Expand Down Expand Up @@ -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: |
Expand All @@ -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
Expand All @@ -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

Expand Down Expand Up @@ -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/') &&
Expand Down
13 changes: 8 additions & 5 deletions regamedll/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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")

Expand Down Expand Up @@ -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)
Expand Down
Binary file added regamedll/lib/linux32/libc-2.15.so
Binary file not shown.

0 comments on commit 2953ca9

Please sign in to comment.