mirror of
https://github.com/openmoh/openmohaa.git
synced 2025-04-28 21:57:57 +03:00
Using libsdl-org/setup-sdl Github Actions
This commit is contained in:
parent
028a7d6125
commit
8fc64cd1b1
3 changed files with 31 additions and 42 deletions
66
.github/workflows/build-cmake.yml
vendored
66
.github/workflows/build-cmake.yml
vendored
|
@ -27,19 +27,6 @@ jobs:
|
|||
name: "Building for platform linux-${{matrix.architecture.name}}"
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
# container:
|
||||
# image: ubuntu:22.04
|
||||
# volumes:
|
||||
# - ${{github.workspace}}:${{github.workspace}}
|
||||
#
|
||||
# steps:
|
||||
# - name: Install required packages
|
||||
# run: apt update && apt install -y clang-15 cmake ninja-build flex bison git
|
||||
#
|
||||
# - name: Install required cross-platform packages (${{ matrix.architecture.triple }})
|
||||
# if: matrix.architecture.name != 'amd64'
|
||||
# run: apt install -y gcc-12-${{ matrix.architecture.triple }} g++-12-${{ matrix.architecture.triple }}
|
||||
|
||||
steps:
|
||||
- name: Settings
|
||||
working-directory: ${{github.workspace}}
|
||||
|
@ -54,22 +41,18 @@ jobs:
|
|||
- name: Install required cross-platform packages (${{ matrix.architecture.triple }})
|
||||
if: matrix.architecture.name != 'amd64'
|
||||
run: sudo apt install -y gcc-12-${{ matrix.architecture.triple }} g++-12-${{ matrix.architecture.triple }}
|
||||
|
||||
- name: Install dependencies
|
||||
working-directory: ${{github.workspace}}
|
||||
run: |
|
||||
echo Using triple: ${{ matrix.architecture.triple }}
|
||||
mkdir -p thirdparties && cd thirdparties
|
||||
git clone --depth 1 --single-branch --branch SDL2 https://github.com/libsdl-org/SDL.git
|
||||
cmake -B SDL-build \
|
||||
-DCMAKE_C_COMPILER=clang \
|
||||
-DCMAKE_CXX_COMPILER=clang++ \
|
||||
-DCMAKE_C_FLAGS=--target=${{ matrix.architecture.triple }} \
|
||||
-DCMAKE_CXX_FLAGS=--target=${{ matrix.architecture.triple }} \
|
||||
-DCMAKE_INSTALL_PREFIX='${{github.workspace}}/thirdparties/SDL-install' \
|
||||
./SDL
|
||||
cmake --build SDL-build --config Release
|
||||
cmake --install SDL-build
|
||||
|
||||
# Setup SDL
|
||||
- name: Set up SDL
|
||||
id: sdl
|
||||
uses: libsdl-org/setup-sdl@main
|
||||
with:
|
||||
version: sdl2-latest
|
||||
build-type: Release
|
||||
cmake-arguments: "-DCMAKE_C_COMPILER=clang
|
||||
-DCMAKE_CXX_COMPILER=clang++
|
||||
-DCMAKE_C_FLAGS=--target=${{ matrix.architecture.triple }}
|
||||
-DCMAKE_CXX_FLAGS=--target=${{ matrix.architecture.triple }}"
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
|
@ -84,8 +67,7 @@ jobs:
|
|||
-DCMAKE_CXX_COMPILER=clang++ \
|
||||
-DCMAKE_C_FLAGS=--target=${{ matrix.architecture.triple }} \
|
||||
-DCMAKE_CXX_FLAGS=--target=${{ matrix.architecture.triple }} \
|
||||
-DGIT_REVISION_BUILD_NUMBER=${{ github.run_number }} \
|
||||
-DSDL2_DIR='${{github.workspace}}/thirdparties/SDL-install/lib/cmake/SDL2'" >> $GITHUB_ENV
|
||||
-DGIT_REVISION_BUILD_NUMBER=${{ github.run_number }}" >> $GITHUB_ENV
|
||||
|
||||
- name: Configure CMake
|
||||
working-directory: ${{github.workspace}}
|
||||
|
@ -110,7 +92,7 @@ jobs:
|
|||
# Install to the directory defined in CMAKE_INSTALL_PREFIX
|
||||
run: |
|
||||
cmake --install ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
|
||||
cp '${{github.workspace}}/thirdparties/SDL-install/lib/libSDL2.so' '${{github.workspace}}/install'
|
||||
cp '${{steps.sdl.outputs.prefix}}/lib/libSDL2.so' '${{github.workspace}}/install'
|
||||
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
|
@ -137,14 +119,19 @@ jobs:
|
|||
run: |
|
||||
echo "CMAKE_BUILD_PARALLEL_LEVEL=$((Get-CimInstance Win32_ComputerSystem).NumberOfLogicalProcessors * 16)" >> $GITHUB_ENV
|
||||
|
||||
- name: Install required packages
|
||||
# Setup SDL
|
||||
- name: Set up SDL
|
||||
id: sdl
|
||||
uses: libsdl-org/setup-sdl@main
|
||||
with:
|
||||
version: sdl2-latest
|
||||
build-type: Release
|
||||
cmake-arguments: "-A ${{ matrix.architecture.config }}"
|
||||
|
||||
- name: Install Flex/Bison
|
||||
working-directory: ${{github.workspace}}
|
||||
run: |
|
||||
mkdir thirdparties && cd thirdparties
|
||||
git clone --depth 1 --single-branch --branch SDL2 https://github.com/libsdl-org/SDL.git
|
||||
cmake -B SDL-build -A ${{ matrix.architecture.config }} -DCMAKE_INSTALL_PREFIX='${{github.workspace}}/thirdparties/SDL-install' ./SDL
|
||||
cmake --build SDL-build --config Release --parallel
|
||||
cmake --install SDL-build
|
||||
git clone --depth 1 --single-branch --branch v2.5.25 https://github.com/lexxmark/winflexbison.git
|
||||
cmake -B winflexbison-build -DCMAKE_INSTALL_PREFIX='${{github.workspace}}/thirdparties/winflexbison-install' ./winflexbison
|
||||
cmake --build winflexbison-build --config Release --parallel
|
||||
|
@ -160,10 +147,7 @@ jobs:
|
|||
--log-level=VERBOSE `
|
||||
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} `
|
||||
-DCMAKE_INSTALL_PREFIX='${{github.workspace}}/install' `
|
||||
-DCMAKE_C_COMPILER=clang `
|
||||
-DCMAKE_CXX_COMPILER=clang++ `
|
||||
-DGIT_REVISION_BUILD_NUMBER=${{ github.run_number }} `
|
||||
-DSDL2_DIR='${{github.workspace}}/thirdparties/SDL-install/cmake' `
|
||||
-DBISON_EXECUTABLE='${{github.workspace}}/thirdparties/winflexbison-install/win_bison.exe' `
|
||||
-DFLEX_EXECUTABLE='${{github.workspace}}/thirdparties/winflexbison-install/win_flex.exe'".Replace("`r", "").Replace("`n", "") >> $env:GITHUB_ENV
|
||||
|
||||
|
@ -190,7 +174,7 @@ jobs:
|
|||
# Install to the directory defined in CMAKE_INSTALL_PREFIX
|
||||
run: |
|
||||
cmake --install ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
|
||||
Copy-Item "${{github.workspace}}/thirdparties/SDL-install/bin/*.dll" -Destination "${{github.workspace}}/install"
|
||||
Copy-Item '${{steps.sdl.outputs.prefix}}/bin/*.dll' -Destination '${{github.workspace}}/install'
|
||||
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
|
|
2
.github/workflows/codeql.yml
vendored
2
.github/workflows/codeql.yml
vendored
|
@ -46,7 +46,7 @@ jobs:
|
|||
# Setup SDL
|
||||
- name: Set up SDL
|
||||
id: sdl
|
||||
uses: libsdl-org/setup-sdl@v1
|
||||
uses: libsdl-org/setup-sdl@main
|
||||
with:
|
||||
version: sdl2-latest
|
||||
|
||||
|
|
|
@ -7,6 +7,11 @@ add_library(omohsdl STATIC ${SOURCES_SDL})
|
|||
target_compile_features(omohsdl PUBLIC c_variadic_macros)
|
||||
target_link_libraries(omohsdl PRIVATE qcommon qcommon_standalone)
|
||||
|
||||
|
||||
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.12.0")
|
||||
cmake_policy(SET CMP0074 NEW)
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
find_package(SDL2)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue