diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 21dc0a0fb3..a379d4a634 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,27 +7,21 @@ jobs: max-parallel: 1 matrix: config: - - { name: "Linux-x86_64-Release", type: "release", cmake_args: "-DBUILD_STEAMLIB=1 -DUSE_GRAPHICS_NRI=1" } - - { name: "Linux-x86_64-Debug", type: "debug", cmake_args: "-DBUILD_STEAMLIB=1 -DUSE_GRAPHICS_NRI=1"} + - { + name: "Linux-x86_64-Release", + type: "release", + cmake_args: "-DBUILD_STEAMLIB=1 -DUSE_GRAPHICS_NRI=1 -DUSE_SYSTEM_ZLIB=1 -DUSE_SYSTEM_OPENAL=1 -DUSE_SYSTEM_CURL=1 -DUSE_SYSTEM_FREETYPE=1", + } + - { + name: "Linux-x86_64-Debug", + type: "debug", + cmake_args: "-DBUILD_STEAMLIB=1 -DUSE_GRAPHICS_NRI=1 -DUSE_SYSTEM_ZLIB=1 -DUSE_SYSTEM_OPENAL=1 -DUSE_SYSTEM_CURL=1 -DUSE_SYSTEM_FREETYPE=1", + } name: ${{ matrix.config.name }} runs-on: ubuntu-20.04 container: - image: ubuntu:20.04 - env: - DEBIAN_FRONTEND: noninteractive - DEBCONF_NONINTERACTIVE_SEEN: true + image: registry.gitlab.steamos.cloud/steamrt/sniper/sdk:latest steps: - - name: Add CMake APT repo - glslang requires newer Cmake than provided by 20.04 - uses: gerlero/add-apt-repository@v1 - with: - uri: https://apt.kitware.com/ubuntu/ - key: https://apt.kitware.com/keys/kitware-archive-latest.asc - - - name: Install deps - uses: gerlero/apt-install@v1 - with: - packages: kitware-archive-keyring git curl clang-18 cmake build-essential git zip unzip python3 autoconf libtool meson automake libtool pkg-config python3-jinja2 python3-setuptools libx11-dev libwayland-dev libxkbcommon-dev libegl1-mesa-dev libibus-1.0-dev libxft-dev libxext-dev - - name: Checkout repo uses: actions/checkout@v4 with: @@ -45,7 +39,7 @@ jobs: if: matrix.config.type == 'release' working-directory: ./source run: | - export CC=clang-18 CXX=clang++-18 + export CC=clang-11 CXX=clang++-11 cmake -B ./build ${{matrix.config.cmake_args}} -DBUILD_UNIT_TEST=1 -DCMAKE_BUILD_TYPE=Release cd build make -j8 @@ -54,7 +48,7 @@ jobs: if: matrix.config.type == 'debug' working-directory: ./source run: | - export CC=clang-18 CXX=clang++-18 + export CC=clang-11 CXX=clang++-11 cmake -B ./build ${{matrix.config.cmake_args}} -DBUILD_UNIT_TEST=1 -DCMAKE_BUILD_TYPE=Debug cd build make -j8 @@ -76,19 +70,32 @@ jobs: uses: actions/upload-artifact@v3 with: name: ${{matrix.config.name}} - path: source/${{matrix.config.name}}.tar.gz + path: source/build/${{matrix.config.name}}.tar.gz osx: strategy: max-parallel: 1 matrix: config: - - { agent: "macos-13", name: "OSX-x86_64-Release", xcode-version: "15.0.1", type: "release", cmake_args: "-DBUILD_STEAMLIB=1 -DUSE_SYSTEM_CURL=1", build_folder: "Release" } - - { agent: "macos-13", name: "OSX-x86_64-Debug", xcode-version: "15.0.1", type: "debug", cmake_args: "-DBUILD_STEAMLIB=1 -DWF_BUILD_DSYM=ON -DUSE_SYSTEM_CURL=1", build_folder: "Debug" } + - { + agent: "macos-13", + name: "OSX-x86_64-Release", + xcode-version: "15.0.1", + type: "release", + cmake_args: "-DBUILD_STEAMLIB=1 -DUSE_SYSTEM_CURL=1", + build_folder: "Release", + } + - { + agent: "macos-13", + name: "OSX-x86_64-Debug", + xcode-version: "15.0.1", + type: "debug", + cmake_args: "-DBUILD_STEAMLIB=1 -DWF_BUILD_DSYM=ON -DUSE_SYSTEM_CURL=1", + build_folder: "Debug", + } name: ${{ matrix.config.name }} runs-on: ${{ matrix.config.agent }} steps: - - name: Replace problem-causing python installation - https://github.com/TeamForbiddenLLC/warfork-qfusion/pull/325 - Fixed in macos-14 shell: bash run: | @@ -146,20 +153,33 @@ jobs: uses: actions/upload-artifact@v3 with: name: ${{matrix.config.name}} - path: source/${{matrix.config.name}}.tar.gz + path: source/build/${{matrix.config.name}}.tar.gz windows: strategy: max-parallel: 1 matrix: config: - - { agent: "windows-2019", name: "win-x86_64-Release", vs_version: "Visual Studio 16 2019", type: "release", cmake_args: "-DBUILD_STEAMLIB=1", build_folder: "Release" } - - { agent: "windows-2019", name: "win-x86_64-Debug", vs_version: "Visual Studio 16 2019", type: "debug", cmake_args: "-DBUILD_STEAMLIB=1 -DWF_BUILD_DSYM=ON", build_folder: "Debug" } + - { + agent: "windows-2019", + name: "win-x86_64-Release", + vs_version: "Visual Studio 16 2019", + type: "release", + cmake_args: "-DBUILD_STEAMLIB=1", + build_folder: "Release", + } + - { + agent: "windows-2019", + name: "win-x86_64-Debug", + vs_version: "Visual Studio 16 2019", + type: "debug", + cmake_args: "-DBUILD_STEAMLIB=1 -DWF_BUILD_DSYM=ON", + build_folder: "Debug", + } name: ${{ matrix.config.name }} runs-on: ${{ matrix.config.agent }} steps: - - name: Checkout repo uses: actions/checkout@v4 with: @@ -205,4 +225,4 @@ jobs: uses: actions/upload-artifact@v3 with: name: ${{matrix.config.name}} - path: source\${{matrix.config.name}}.zip \ No newline at end of file + path: source\build\${{matrix.config.name}}.zip diff --git a/Dockerfile b/Dockerfile index 00c405d4d5..024d3924a4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,13 +1,6 @@ # Run the following command and a build archive will be produced in the build/ directory: # docker build --output build . -FROM ubuntu:20.04 AS build -ARG DEBIAN_FRONTEND=noninteractive -ARG DEBCONF_NONINTERACTIVE_SEEN=true -RUN apt update -RUN apt install -y curl clang cmake build-essential \ - libsdl2-dev libopenal-dev libvorbis-dev libtheora-dev \ - libfreetype6-dev libcurl4-gnutls-dev git zip unzip \ - && rm -rf /var/lib/apt/lists/* +FROM registry.gitlab.steamos.cloud/steamrt/sniper/sdk:latest AS build RUN mkdir -p /root/warfork WORKDIR /root/warfork COPY .clang-format . @@ -18,9 +11,13 @@ COPY .git . COPY source source RUN curl https://warfork.com/downloads/sdk/ --output third-party/steamworks/sdk.zip RUN unzip third-party/steamworks/sdk.zip -d third-party/steamworks -RUN export CC=clang CXX=clang++ -RUN cmake -DCMAKE_BUILD_TYPE=DEBUG -DBUILD_STEAMLIB=1 ./source +RUN export CC=clang-11 CXX=clang++-11 +WORKDIR /root/warfork/source +RUN cmake -B ./build -DBUILD_STEAMLIB=1 -DUSE_GRAPHICS_NRI=1 -DUSE_SYSTEM_ZLIB=1 -DUSE_SYSTEM_OPENAL=1 -DUSE_SYSTEM_CURL=1 -DUSE_SYSTEM_FREETYPE=1 -DBUILD_UNIT_TEST=1 -DCMAKE_BUILD_TYPE=Debug +WORKDIR /root/warfork/source/build RUN make -j8 -RUN tar -czvf ./source/Linux-x86_64-Debug.tar.gz ./source/build/* +WORKDIR /root/warfork/source/build/warfork-qfusion +RUN set -e; for exc in ./test/*; do $exc; done +RUN tar --exclude='*.a' --exclude='base*/*.a' --exclude='libs/*.a' --exclude='test' -zcvf ../Linux-x86_64-Debug.tar.gz * FROM scratch AS export -COPY --from=build /root/warfork/source/Linux-x86_64-Debug.tar.gz . \ No newline at end of file +COPY --from=build /root/warfork/source/build/Linux-x86_64-Debug.tar.gz . \ No newline at end of file diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 7617d16d75..72cdb99e67 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -16,11 +16,14 @@ set(CMAKE_SKIP_BUILD_RPATH FALSE) # (but later on when installing) set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) set(CMAKE_INSTALL_RPATH $ORIGIN/libs) - +set(CMAKE_BUILD_RPATH $ORIGIN/libs:$ORIGIN) + # add the automatically determined parts of the RPATH # which point to directories outside the build tree to the install RPATH set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) +set(CMAKE_POSITION_INDEPENDENT_CODE ON) + set(QFUSION_GAME Warfork) if (QFUSION_GAME) if (${QFUSION_GAME} MATCHES "Warfork") diff --git a/source/extern/CMakeLists.txt b/source/extern/CMakeLists.txt index 28cd3c1bf1..7648b7a353 100644 --- a/source/extern/CMakeLists.txt +++ b/source/extern/CMakeLists.txt @@ -11,9 +11,8 @@ if (NOT GAME_MODULES_ONLY) endif() if(USE_SYSTEM_ZLIB) - find_package(ZLIB REQUIRED) - - add_library(ZLIB::ZLIB INTERFACE IMPORTED GLOBAL) + find_package(ZLIB REQUIRED GLOBAL) + add_library(zlib ALIAS ZLIB::ZLIB) target_link_libraries(ZLIB::ZLIB INTERFACE ZLIB::ZLIB) else() option(ZLIB_BUILD_EXAMPLES "" OFF) @@ -22,10 +21,7 @@ endif() if (USE_SDL2) if (USE_SYSTEM_SDL2) - find_package(SDL2 REQUIRED) - - add_library(SDL2 INTERFACE IMPORTED GLOBAL) - target_link_libraries(SDL2 INTERFACE SDL2::SDL2) + find_package(SDL2 REQUIRED GLOBAL) else() option(SDL_RPATH "" OFF) option(SDL_SHARED "" ON) @@ -39,7 +35,6 @@ if (USE_SDL2) endif() endif() - if(USE_SYSTEM_OGG) find_package(Ogg REQUIRED GLOBAL) else() @@ -49,18 +44,15 @@ endif() if(USE_SYSTEM_FREETYPE) find_package(Freetype REQUIRED GLOBAL) + target_link_libraries(Freetype::Freetype INTERFACE freetype) else() add_subdirectory(freetype) add_library(Freetype::Freetype INTERFACE IMPORTED GLOBAL) target_link_libraries(Freetype::Freetype INTERFACE freetype) endif() - if(USE_SYSTEM_VORBIS) - find_package(Vorbis REQUIRED GLOBAL) - - # add_library(Vorbis::Vorbis INTERFACE IMPORTED GLOBAL) - # target_link_libraries(Vorbis::Vorbis INTERFACE Vorbis::Vorbis) + find_package(Vorbis REQUIRED GLOBAL) else() if(NOT USE_SYSTEM_OGG) set(OGG_LIBRARY ogg) @@ -69,7 +61,6 @@ else() add_subdirectory(vorbis) endif() - if (USE_SYSTEM_OPENAL) find_package(OpenAL REQUIRED GLOBAL) else() @@ -91,8 +82,6 @@ else() target_compile_definitions(OpenAL PUBLIC AL_LIBTYPE_STATIC) endif() - - if(USE_SYSTEM_CURL) find_package(CURL REQUIRED GLOBAL) else() @@ -120,4 +109,3 @@ endif() endif() set(STB_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/stb PARENT_SCOPE) - diff --git a/source/server/CMakeLists.txt b/source/server/CMakeLists.txt index 634da5aa7b..09d5b291be 100644 --- a/source/server/CMakeLists.txt +++ b/source/server/CMakeLists.txt @@ -84,7 +84,7 @@ else() "../null/sys_vfs_null.c" ) - set(SERVER_PLATFORM_LIBRARIES "-ldl") + set(SERVER_PLATFORM_LIBRARIES "-ldl" "pthread") set(SERVER_BINARY_TYPE "") endif()