From 571c0db1904370c1d06c7bee9b6b2ce114597b4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20=C5=A0imek?= Date: Thu, 2 Jun 2022 10:31:03 +0200 Subject: [PATCH] Fix linux build (#25) Co-authored-by: Alexander Batalov --- .github/workflows/Build.yml | 41 ++++++++++++++++++++++++++++++------- CMakeLists.txt | 2 +- src/core.cc | 2 ++ 3 files changed, 37 insertions(+), 8 deletions(-) diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml index 53b9d20..5355592 100644 --- a/.github/workflows/Build.yml +++ b/.github/workflows/Build.yml @@ -4,13 +4,13 @@ on: push: paths: - '.github/workflows/Build.yml' - - 'src/**.c' + - 'src/**.cc' - 'src/**.h' - '**/CMakeLists.txt' pull_request: paths: - '.github/workflows/Build.yml' - - 'src/**.c' + - 'src/**.cc' - 'src/**.h' - '**/CMakeLists.txt' @@ -20,7 +20,7 @@ defaults: jobs: - Build: + build-windows: runs-on: windows-latest steps: @@ -28,15 +28,42 @@ jobs: uses: actions/checkout@v2 - name: Prepare - run: cmake -B Build -A Win32 + run: cmake -B build/x86-windows -A Win32 - name: Release build - run: cmake --build Build --config Release + run: cmake --build build/x86-windows --config Release - name: Artifact uses: actions/upload-artifact@v3 with: - name: fallout2-ce + name: x86-windows-fallout2-ce path: | - Build/*/fallout2-ce.exe + build/x86-windows/Release/fallout2-ce.exe + retention-days: 7 + + build-linux32: + runs-on: ubuntu-22.04 + steps: + + - name: Clone + uses: actions/checkout@v2 + + - name: Install dependencies + run: | + sudo dpkg --add-architecture i386 + sudo apt update + sudo apt install g++-multilib libsdl2-dev:i386 zlib1g-dev:i386 + + - name: Prepare + run: cmake -DCMAKE_C_FLAGS="-m32" -DCMAKE_CXX_FLAGS="-m32" -B build/x86-linux + + - name: Release build + run: cmake --build build/x86-linux --config Release + + - name: Artifact + uses: actions/upload-artifact@v3 + with: + name: x86-linux-fallout2-ce + path: | + build/x86-linux/fallout2-ce retention-days: 7 diff --git a/CMakeLists.txt b/CMakeLists.txt index 549d470..c32dc26 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -259,7 +259,7 @@ add_subdirectory("third_party/fpattern") target_link_libraries(${EXECUTABLE_NAME} ${FPATTERN_LIBRARY}) target_include_directories(${EXECUTABLE_NAME} PRIVATE ${FPATTERN_INCLUDE_DIR}) -if(NOT APPLE) +if(NOT APPLE AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "Linux") add_subdirectory("third_party/zlib") add_subdirectory("third_party/sdl2") else() diff --git a/src/core.cc b/src/core.cc index b2a7be2..61a86be 100644 --- a/src/core.cc +++ b/src/core.cc @@ -15,7 +15,9 @@ #include #include #include +#if _WIN32 #include +#endif // NOT USED. void (*_idle_func)() = NULL;