Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: GPU basic rendering support, renderer lib #517

Merged
merged 1 commit into from
Jan 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 38 additions & 1 deletion .github/workflows/vangers_linux_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,58 @@ name: Vangers Linux Build

on: [push, pull_request]

env:
VANGE_RS_REF: 950a5dd30e374c5e8cd28d7742eec814301c4ed2

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: vange-rs -- cache build
uses: actions/cache@v2
id: vange-rs-cache-build
with:
path: vange-rs/target/release/libvangers_ffi.a
key: ${{ env.VANGE_RS_REF }}

- name: install rustup toolchain
if: steps.vange-rs-cache-build.outputs.cache-hit != 'true'
uses: actions-rs/toolchain@v1
with:
toolchain: stable

- name: vange-rs -- download
if: steps.vange-rs-cache-build.outputs.cache-hit != 'true'
uses: actions/checkout@v2
with:
repository: kvark/vange-rs
ref: ${{ env.VANGE_RS_REF }}
path: vange-rs

- name: vange-rs -- build
if: steps.vange-rs-cache-build.outputs.cache-hit != 'true'
run: cargo build --release
working-directory: vange-rs/lib/ffi

- name: vange-rs -- copy artifacts to prefix
run: sudo cp target/release/libvangers_ffi.a /usr/lib/
working-directory: vange-rs/

- name: update repos
run: sudo apt-get update
- name: install libs
run: sudo apt-get install cmake libsdl2-dev libsdl2-net-dev libogg-dev libvorbis-dev libavcodec-dev libavformat-dev libavutil-dev
run: sudo apt-get install -yq cmake libsdl2-dev libsdl2-net-dev libogg-dev libvorbis-dev libavcodec-dev libavformat-dev libavutil-dev

- name: clunk download lib
run: git clone --depth 1 https://github.com/stalkerg/clunk.git clunk
working-directory: /tmp

- name: clunk build and install
run: cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_C_COMPILER=/usr/bin/gcc-9 -DCMAKE_CXX_COMPILER=/usr/bin/g++-9 . && make && sudo make install
working-directory: /tmp/clunk

- name: configure
run: mkdir build && cd build && cmake -DCMAKE_C_COMPILER=/usr/bin/gcc-9 -DCMAKE_CXX_COMPILER=/usr/bin/g++-9 ..
- name: make
Expand Down
31 changes: 30 additions & 1 deletion .github/workflows/vangers_macos_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,34 @@ jobs:
brew reinstall -s ./formulas/libvorbis.rb
brew install -s ./formulas/sdl2.rb
brew install -s ./formulas/sdl2_net.rb

- name: install rustup toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable

# TODO
# - name: vange-rs -- cache build
# uses: actions/cache@v2
# id: vange-rs-cache-build
# with:
# path: vange-rs/target/release/libvangers_ffi.a
# key: ${{ env.VANGE_RS_REF }}

- name: vange-rs -- download
uses: actions/checkout@v2
with:
repository: kvark/vange-rs
ref: ${{ env.VANGE_RS_REF }}
path: vange-rs

- name: vange-rs -- build
run: cargo build --release
working-directory: vange-rs/lib/ffi

- name: vange-rs -- copy artifacts to prefix
run: sudo cp vange-rs/target/release/libvangers_ffi.a /usr/local/lib/

- name: clunk -- download lib
run: git clone --depth 1 https://github.com/stalkerg/clunk.git clunk
- name: clunk -- create build dir
Expand Down Expand Up @@ -79,7 +107,8 @@ jobs:
cp -L /usr/local/lib/libogg.0.dylib Vangers.app/Contents/Libs/
cp -L /usr/local/lib/libvorbis.0.dylib Vangers.app/Contents/Libs/
cp -L /usr/local/lib/libvorbisfile.3.dylib Vangers.app/Contents/Libs/
cp clunk/build/libclunk.dylib Vangers.app/Contents/Libs/

cp clunk/build/libclunk.dylib Vangers.app/Contents/Libs/
cp build/src/vangers Vangers.app/Contents/MacOS/Vangers
dylibbundler -x Vangers.app/Contents/MacOS/Vangers
strip Vangers.app/Contents/MacOS/Vangers
Expand Down
55 changes: 54 additions & 1 deletion .github/workflows/vangers_windows_64_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ name: Vangers Windows 64bit Build

on: [push, pull_request]

env:
VANGE_RS_REF: 950a5dd30e374c5e8cd28d7742eec814301c4ed2

jobs:
build:
runs-on: windows-latest
Expand All @@ -20,8 +23,50 @@ jobs:
mingw-w64-x86_64-libvorbis
mingw-w64-x86_64-nasm
mingw-w64-x86_64-yasm
mingw-w64-x86_64-make'
mingw-w64-x86_64-make
mingw-w64-x86_64-dlfcn'
- uses: actions/checkout@v1

# TODO: enable cache
# - name: vange-rs -- cache build
# uses: actions/cache@v2
# id: vange-rs-cache-build
# with:
# path: vange-rs/target/release/libvangers_ffi.a
# key: ${{ env.VANGE_RS_REF }}

- name: vange-rs -- install rustup
if: steps.vange-rs-cache-build.outputs.cache-hit != 'true'
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: x86_64-pc-windows-gnu
default: true

- name: vange-rs -- configure rustup
if: steps.vange-rs-cache-build.outputs.cache-hit != 'true'
run: rustup default stable-x86_64-pc-windows-gnu

- name: vange-rs -- download
uses: actions/checkout@v2
with:
repository: kvark/vange-rs
ref: ${{ env.VANGE_RS_REF }}
path: vange-rs

- name: vange-rs -- build
if: steps.vange-rs-cache-build.outputs.cache-hit != 'true'
run: cargo build --release
working-directory: vange-rs/lib/ffi

- name: vange-rs -- copy artifacts to prefix
run: msys2 -c 'cp vange-rs/target/release/libvangers_ffi.a /mingw64/lib/'

- name: ANGLE/GLES2 -- download
run: |
msys2 -c 'wget -O /mingw64/lib/libGLESv2.dll "https://github.com/lpenguin/libGLESv2-angle/releases/download/v2/libGLESv2.dll"'
msys2 -c 'wget -O /mingw64/lib/libEGL.dll "https://github.com/lpenguin/libGLESv2-angle/releases/download/v2/libEGL.dll"'

- name: clunk -- download
run: git clone --depth 1 https://github.com/stalkerg/clunk.git clunk
- name: clunk -- create build dir
Expand Down Expand Up @@ -53,6 +98,8 @@ jobs:
msys2 -c 'mingw32-make -j4'
msys2 -c 'mingw32-make install'
working-directory: ffmpeg


- name: vangers -- create build dir
run: msys2 -c 'mkdir build'
- name: vangers -- configure
Expand Down Expand Up @@ -85,6 +132,12 @@ jobs:
cp build/server/vangers_server.exe vangers/bin/vangers_server_debug.exe
msys2 -c 'strip vangers/bin/vangers_server.exe'
cp build/surmap/surmap.exe vangers/bin/

msys2 -c 'cp /mingw64/lib/libGLESv2.dll vangers/bin'
msys2 -c 'cp /mingw64/lib/libEGL.dll vangers/bin'
msys2 -c 'cp -r data/ vangers'
msys2 -c 'cp -r vange-rs/res vangers/data'

- uses: actions/upload-artifact@v1
with:
name: Vangers-Release-64
Expand Down
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ FIND_PACKAGE(Clunk REQUIRED)

FIND_PACKAGE(FFMPEG REQUIRED)
FIND_PACKAGE(ZLIB REQUIRED)

FIND_PACKAGE(RustVangers REQUIRED)
set(WINDOWS_RES "../vangers.res")

IF(BINARY_SCRIPT)
Expand Down Expand Up @@ -83,6 +85,8 @@ endif()

# subdirs
ADD_SUBDIRECTORY("src")
ADD_SUBDIRECTORY("lib/glad")
ADD_SUBDIRECTORY("lib/renderer")
ADD_SUBDIRECTORY("lib/xgraph")
ADD_SUBDIRECTORY("lib/xsound")
ADD_SUBDIRECTORY("lib/xtool")
Expand Down
32 changes: 32 additions & 0 deletions cmake/FindRustVangers.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
IF(MINGW)
SET(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
ENDIF()

FIND_LIBRARY(RUSTVANGERS_LIBRARY
NAMES
vangers_ffi
PATHS
${RUSTVANGERS_ROOT}
/usr/lib
/usr/local/lib
/opt/local/lib
/sw/lib
/local/lib
/mingw/lib
/local/bin
/mingw/bin
/usr/local/lib
)
IF(RUSTVANGERS_LIBRARY)
SET(RUSTVANGERS_FOUND TRUE)
ENDIF(RUSTVANGERS_LIBRARY)

IF(RUSTVANGERS_FOUND)
IF(NOT RUSTVANGERS_FIND_QUIETLY)
MESSAGE(STATUS "Found vange-rs ffi library: ${RUSTVANGERS_LIBRARY}")
ENDIF(NOT RUSTVANGERS_FIND_QUIETLY)
ELSE(RUSTVANGERS_FOUND)
IF(RUSTVANGERS_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Could not find vange-rs ffi library")
ENDIF(RUSTVANGERS_FIND_REQUIRED)
ENDIF(RUSTVANGERS_FOUND)
17 changes: 17 additions & 0 deletions lib/glad/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
SET(glad_SRCS
src/glad.c
include/glad/glad.h
)


ADD_LIBRARY(glad STATIC ${glad_SRCS})

include_directories(
"${PROJECT_SOURCE_DIR}/lib/glad/include"
)

target_include_directories(
glad
INTERFACE "${PROJECT_SOURCE_DIR}/lib/glad/include"
)

Loading