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

Port utils #254

Draft
wants to merge 11 commits into
base: master
Choose a base branch
from
Draft
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
199 changes: 100 additions & 99 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,111 +1,112 @@
name: Build

on: [push, pull_request]
env:
WAF_FLAGS: -T release --no-warns --prefix=build_hl2

jobs:
build-linux-i386:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Build linux-i386
run: |
scripts/build-ubuntu-i386.sh

build-linux-amd64:
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v2
- name: Build linux-amd64
run: |
scripts/build-ubuntu-amd64.sh

build-android-armv7a:
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v2
- name: Build android-armv7a
run: |
scripts/build-android-armv7a.sh

build-windows-i386:
runs-on: windows-2019

steps:
- uses: actions/checkout@v2
- name: Build windows-i386
run: |
git submodule init && git submodule update
./waf.bat configure -T debug
./waf.bat build

build-windows-amd64:
runs-on: windows-2019

steps:
- uses: actions/checkout@v2
- name: Build windows-amd64
run: |
git submodule init && git submodule update
./waf.bat configure -T debug -8
./waf.bat build

build-dedicated-windows-i386:
runs-on: windows-2019

steps:
- uses: actions/checkout@v2
- name: Build dedicated windows-i386
run: |
git submodule init && git submodule update
./waf.bat configure -T debug -d
./waf.bat build

build-dedicated-windows-amd64:
runs-on: windows-2019

steps:
- uses: actions/checkout@v2
- name: Build dedicated windows-amd64
run: |
git submodule init && git submodule update
./waf.bat configure -T debug -d -8
./waf.bat build

build-dedicated-linux-i386:
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v2
- name: Build dedicated linux-i386
run: |
scripts/build-ubuntu-i386.sh -d

build-dedicated-linux-amd64:
runs-on: ubuntu-20.04

build-linux:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
bits: ['', '--64bits']
android: ['']
flags: ['', '-dl', '-u']
include:
- os: ubuntu-20.04
bits: ''
android: '--android=armeabi-v7a-hard,4.9,21 --use-togles'
flags: ''
runs-on: ${{ matrix.os }}
env:
DEPS: libopenal-dev libpng-dev libjpeg-dev libfreetype6-dev libfontconfig1-dev libcurl4-gnutls-dev libsdl2-dev zlib1g-dev libbz2-dev libedit-dev
steps:
- uses: actions/checkout@v2
- name: Build dedicated linux-amd64
run: |
scripts/build-ubuntu-amd64.sh -d
- uses: actions/checkout@v3
with:
submodules: recursive

- name: Install common dependencies
run: sudo apt-get update && sudo apt-get install -y g++-multilib gcc-multilib
- name: Install 32bit dependencies
if: ${{ matrix.bits == '' && !matrix.android }}
run: |
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install -y aptitude
sudo aptitude install -y $(echo $DEPS | sed -r 's/[a-z0-9_\-]+/&:i386/g')
- name: Install Android dependencies
if: ${{ matrix.android != '' }}
run: |
wget https://dl.google.com/android/repository/android-ndk-r10e-linux-x86_64.zip -o /dev/null
unzip android-ndk-r10e-linux-x86_64.zip
export NDK_HOME=$PWD/android-ndk-r10e/
echo "NDK_HOME=$NDK_HOME" >> $GITHUB_ENV
echo "ANDROID_NDK_HOME=$NDK_HOME" >> $GITHUB_ENV
- name: Install 64bit dependencies
if: ${{ matrix.bits != '' }}
run: |
sudo apt-get install -y $DEPS

- if: ${{ matrix.bits == '' && !matrix.android }}
name: Set PKG_CONFIG_PATH
run: echo "PKG_CONFIG_PATH=/usr/lib/i386-linux-gnu/pkgconfig" >> $GITHUB_ENV

- name: Configure
run: ./waf configure ${{ matrix.bits }} ${{ matrix.android }} ${{ matrix.flags }} $WAF_FLAGS
- name: Build ${{ matrix.os }}
run: ./waf install
- name: Tar binaries
run: tar cvf build.tar build_hl2
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: Linux${{matrix.bits}}${{matrix.flags}}${{matrix.android}}.tar
path: build.tar

build-macos:
strategy:
fail-fast: false
matrix:
flags: ['', '-dl', '-u']

build-macos-amd64:
runs-on: macos-latest

steps:
- uses: actions/checkout@v2
- name: Build macos-amd64
run: |
scripts/build-macos-amd64.sh
- uses: actions/checkout@v3
with:
submodules: recursive

- name: Install dependencies
run: brew install sdl2

- name: Configure
run: ./waf configure --64bits ${{ matrix.flags }} $WAF_FLAGS
- name: Build macos-amd64
run: ./waf install
- name: Tar binaries
run: tar cvf build.tar build_hl2
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: macOS--64bits${{matrix.flags}}.tar
path: build.tar

build-windows:
strategy:
fail-fast: false
matrix:
os: [windows-2019]
bits: ['', '--64bits']
flags: ['', '-dl', '-u']
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
with:
submodules: recursive

build-dedicated-macos-amd64:
runs-on: macos-latest
- name: Configure
run: ./waf configure ${{ matrix.bits }} ${{ matrix.flags }} ${{ env.WAF_FLAGS }}
- name: Build ${{ matrix.os }}
run: ./waf install

steps:
- uses: actions/checkout@v2
- name: Build dedicated macos-amd64
run: |
scripts/build-macos-amd64.sh -d
114 changes: 71 additions & 43 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,59 +1,87 @@
name: Tests

on: [push, pull_request]
env:
WAF_FLAGS: -T release --no-warns --prefix=build_tests -lt --sanitize=address,undefined

jobs:
tests-linux-i386:
runs-on: ubuntu-20.04

tests-linux:
strategy:
matrix:
os: [ubuntu-latest, ubuntu-20.04]
bits: ['', '--64bits']
android: ['']
runs-on: ${{ matrix.os }}
env:
DEPS: libbz2-dev
steps:
- uses: actions/checkout@v2
- name: Run tests linux-i386
run: |
scripts/tests-ubuntu-i386.sh
- uses: actions/checkout@v3
with:
submodules: recursive

tests-linux-amd64:
runs-on: ubuntu-20.04
- name: Install common dependencies
run: sudo apt-get update && sudo apt-get install -y g++-multilib gcc-multilib
- name: Install 32bit dependencies
if: ${{ matrix.bits == '' && !matrix.android }}
run: |
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install aptitude
sudo aptitude install -y $(echo $DEPS | sed -r 's/[a-z0-9_\-]+/&:i386/g')
- name: Install 64bit dependencies
if: ${{ matrix.bits != '' }}
run: |
sudo apt-get install -y $DEPS

steps:
- uses: actions/checkout@v2
- name: Run tests linux-amd64
run: |
scripts/tests-ubuntu-amd64.sh
- if: ${{ matrix.bits == '' && !matrix.android }}
name: Set PKG_CONFIG_PATH
run: echo "PKG_CONFIG_PATH=/usr/lib/i386-linux-gnu/pkgconfig" >> $GITHUB_ENV

- name: Configure
run: ./waf configure ${{ matrix.bits }} $WAF_FLAGS
- name: Build ${{ matrix.os }}
run: ./waf install
- name: Run tests
run: |
cd build_tests
LD_LIBRARY_PATH=bin/ ./unittest

tests-macos-amd64:
tests-macos:
runs-on: macos-latest

steps:
- uses: actions/checkout@v2
- name: Run tests macos-amd64
run: |
scripts/tests-macos-amd64.sh
- uses: actions/checkout@v3
with:
submodules: recursive

tests-windows-i386:
runs-on: windows-2019
- name: Configure
run: ./waf configure --64bits $WAF_FLAGS
- name: Build macos-amd64
run: ./waf install
- name: Run tests
run: |
cd build_tests
DYLD_LIBRARY_PATH=bin/ ./unittest

tests-windows:
strategy:
matrix:
os: [windows-2019]
bits: ['', '--64bits']
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Run tests windows-i386
run: |
git submodule init && git submodule update
./waf.bat configure -T release --tests --prefix=out/
./waf.bat install
cd out
$env:Path = "bin";
./unittest.exe

tests-windows-amd64:
runs-on: windows-2019
- uses: actions/checkout@v3
with:
submodules: recursive

- name: Configure
run: ./waf configure ${{ matrix.bits }} ${{ env.WAF_FLAGS }}

- name: Build ${{ matrix.os }}
run: ./waf install
- name: Run tests
run: |
cd build_tests
$env:Path = "bin";
./unittest.exe

steps:
- uses: actions/checkout@v2
- name: Run tests windows-amd64
run: |
git submodule init && git submodule update
./waf.bat configure -T release --tests --prefix=out/ -8
./waf.bat install
cd out
$env:Path = "bin";
./unittest.exe
2 changes: 1 addition & 1 deletion appframework/glmrendererinfo_osx.mm
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include "tier1/utllinkedlist.h"
#include "togl/rendermechanism.h"
#include "appframework/ilaunchermgr.h" // gets pulled in from glmgr.h
#include "appframework/iappsystemgroup.h"
#include "appframework/IAppSystemGroup.h"
#include "inputsystem/ButtonCode.h"


Expand Down
13 changes: 9 additions & 4 deletions fgdlib/gamedata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@
//
//=============================================================================

#ifndef POSIX
#include <windows.h>
#include <tier0/dbg.h>
#include <io.h>
#include <WorldSize.h>
#include "fgdlib/GameData.h"
#include "fgdlib/HelperInfo.h"
#endif

#include "worldsize.h"
#include "fgdlib/gamedata.h"
#include "fgdlib/helperinfo.h"
#include "KeyValues.h"
#include "filesystem_tools.h"
#include "tier1/strtools.h"
Expand Down Expand Up @@ -276,12 +279,14 @@ void GameData::ClearData(void)
// Input : pszFilename -
// Output : Returns TRUE on success, FALSE on failure.
//-----------------------------------------------------------------------------
BOOL GameData::Load(const char *pszFilename)
bool GameData::Load(const char *pszFilename)
{
TokenReader tr;

#ifndef POSIX
if(GetFileAttributes(pszFilename) == 0xffffffff)
return FALSE;
#endif

if(!tr.Open(pszFilename))
return FALSE;
Expand Down
4 changes: 2 additions & 2 deletions fgdlib/gdclass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
//
//=============================================================================

#include "fgdlib/GameData.h" // FGDLIB: eliminate dependency
#include "fgdlib/GDClass.h"
#include "fgdlib/gamedata.h" // FGDLIB: eliminate dependency
#include "fgdlib/gdclass.h"

// memdbgon must be the last include file in a .cpp file!!!
#include <tier0/memdbgon.h>
Expand Down
Loading