Skip to content

Commit

Permalink
Enable compilation via MINGW, upload all artifacts
Browse files Browse the repository at this point in the history
  • Loading branch information
MotoLegacy committed Nov 21, 2023
1 parent ef409b1 commit 1464adf
Show file tree
Hide file tree
Showing 5 changed files with 116 additions and 44 deletions.
83 changes: 57 additions & 26 deletions .github/workflows/.github.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,40 +3,71 @@ name: build
on: [push, pull_request]

jobs:
linux_builds:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
cxx: [g++, clang++]
linux_build:
runs-on: ubuntu-latest
env:
CXX: ${{ matrix.cxx }}
CXX: g++
steps:
- name: Install 32-bit libraries
run: |
sudo apt update && sudo apt install -y g++-multilib
- name: Checkout
uses: actions/checkout@v3
- name: Build
- name: Build 64 bit
run: |
make
windows_build:
runs-on: windows-latest
make -j8
- name: Archive vhlt Linux64 tools
uses: actions/upload-artifact@v3
with:
name: vhlt-linux64-tools
path: ./bin/*
- name: Build 32 bit
run: |
make clean
make -j8 USER_FLAGS="-m32"
- name: Archive vhlt Linux32 tools
uses: actions/upload-artifact@v3
with:
name: vhlt-linux32-tools
path: ./bin/*

macos_build:
runs-on: macos-latest
env:
SOLUTION_FILE_PATH: .
BUILD_CONFIGURATION: Release

CXX: clang++
steps:
- uses: actions/checkout@v3

- name: Add MSBuild to PATH
uses: microsoft/setup-msbuild@v1.1

- name: Build vhlt Windows tools
working-directory: ${{env.GITHUB_WORKSPACE}}
run: msbuild /m /p:Configuration=${{env.BUILD_CONFIGURATION}} ${{env.SOLUTION_FILE_PATH}}
- name: Checkout
uses: actions/checkout@v3
- name: Build
run: |
make -j8
- name: Archive vhlt macOS tools
uses: actions/upload-artifact@v3
with:
name: vhlt-macos-tools
path: ./bin/*

- name: Archive vhlt Windows tools
windows_build:
runs-on: ubuntu-latest
steps:
- name: Install mingw64
run: |
sudo apt update && sudo apt install -y build-essential g++-multilib mingw-w64
- name: Checkout
uses: actions/checkout@v3
- name: Build 32 bit
run: |
make -j8 CXX="i686-w64-mingw32-g++" USER_FLAGS="-w -static"
- name: Archive vhlt Windows32 tools
uses: actions/upload-artifact@v3
with:
name: vhlt-windows32-tools
path: ./bin/*
- name: Build 64 bit
run: |
make clean && make -j8 CXX="x86_64-w64-mingw32-g++" USER_FLAGS="-w -static"
- name: Archive vhlt Windows64 tools
uses: actions/upload-artifact@v3
with:
name: vhlt-windows-tools
path: D:\a\vhlt\bin\*
name: vhlt-windows64-tools
path: ./bin/*
68 changes: 52 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,53 @@ COMMON_INCLUDEFILES = \
common/win32fix.h \
common/winding.h \

COMMON_DEFINITIONS = \
VERSION_LINUX \
SYSTEM_POSIX \
NDEBUG \
STDC_HEADERS \
HAVE_FCNTL_H \
HAVE_PTHREAD_H \
HAVE_SYS_RESOURCE_H \
HAVE_SYS_STAT_H \
HAVE_SYS_TIME_H \
HAVE_UNISTD_H \
ifeq ($(CXX),x86_64-w64-mingw32-g++)
HLCSG_NAME = hlcsg.exe
HLBSP_NAME = hlbsp.exe
HLRAD_NAME = hlrad.exe
HLVIS_NAME = hlvis.exe
RIPENT_NAME = ripent.exe

COMMON_DEFINITIONS = \
VERSION_64BIT \
NDEBUG \
WIN32 \
_CONSOLE \
SYSTEM_WIN32 \
STDC_HEADERS
else ifeq ($(CXX),i686-w64-mingw32-g++)
HLCSG_NAME = hlcsg.exe
HLBSP_NAME = hlbsp.exe
HLRAD_NAME = hlrad.exe
HLVIS_NAME = hlvis.exe
RIPENT_NAME = ripent.exe

COMMON_DEFINITIONS = \
VERSION_32BIT \
NDEBUG \
WIN32 \
_CONSOLE \
SYSTEM_WIN32 \
STDC_HEADERS
else
HLCSG_NAME = hlcsg
HLBSP_NAME = hlbsp
HLRAD_NAME = hlrad
HLVIS_NAME = hlvis
RIPENT_NAME = ripent

COMMON_DEFINITIONS = \
VERSION_LINUX \
SYSTEM_POSIX \
NDEBUG \
STDC_HEADERS \
HAVE_FCNTL_H \
HAVE_PTHREAD_H \
HAVE_SYS_RESOURCE_H \
HAVE_SYS_STAT_H \
HAVE_SYS_TIME_H \
HAVE_UNISTD_H
endif

COMMON_FLAGS = -Wall -Wno-deprecated-declarations -O2 -fno-strict-aliasing -pthread -pipe $(USER_FLAGS)

Expand Down Expand Up @@ -246,7 +282,7 @@ bin/hlcsg : $(HLCSG_CPPFILES:%.cpp=hlcsg/release/%.o) printusage
mkdir -p hlcsg/release/bin
$(CXX) $(COMMON_FLAGS) -o hlcsg/release/bin/hlcsg $(addprefix -I,$(HLCSG_INCLUDEDIRS)) $(addprefix -D,$(HLCSG_DEFINITIONS)) $(HLCSG_CPPFILES:%.cpp=hlcsg/release/%.o)
mkdir -p bin
cp hlcsg/release/bin/hlcsg bin/hlcsg
cp hlcsg/release/bin/$(HLCSG_NAME) bin/$(HLCSG_NAME)

$(HLCSG_CPPFILES:%.cpp=hlcsg/release/%.o) : hlcsg/release/%.o : %.cpp $(HLCSG_INCLUDEFILES) printusage
@echo ======== hlcsg : compiling $< ========
Expand All @@ -258,7 +294,7 @@ bin/hlbsp : $(HLBSP_CPPFILES:%.cpp=hlbsp/release/%.o) printusage
mkdir -p hlbsp/release/bin
$(CXX) $(COMMON_FLAGS) -o hlbsp/release/bin/hlbsp $(addprefix -I,$(HLBSP_INCLUDEDIRS)) $(addprefix -D,$(HLBSP_DEFINITIONS)) $(HLBSP_CPPFILES:%.cpp=hlbsp/release/%.o)
mkdir -p bin
cp hlbsp/release/bin/hlbsp bin/hlbsp
cp hlbsp/release/bin/$(HLBSP_NAME) bin/$(HLBSP_NAME)

$(HLBSP_CPPFILES:%.cpp=hlbsp/release/%.o) : hlbsp/release/%.o : %.cpp $(HLBSP_INCLUDEFILES) printusage
@echo ======== hlbsp : compiling $< ========
Expand All @@ -270,7 +306,7 @@ bin/hlvis : $(HLVIS_CPPFILES:%.cpp=hlvis/release/%.o) printusage
mkdir -p hlvis/release/bin
$(CXX) $(COMMON_FLAGS) -o hlvis/release/bin/hlvis $(addprefix -I,$(HLVIS_INCLUDEDIRS)) $(addprefix -D,$(HLVIS_DEFINITIONS)) $(HLVIS_CPPFILES:%.cpp=hlvis/release/%.o)
mkdir -p bin
cp hlvis/release/bin/hlvis bin/hlvis
cp hlvis/release/bin/$(HLVIS_NAME) bin/$(HLVIS_NAME)

$(HLVIS_CPPFILES:%.cpp=hlvis/release/%.o) : hlvis/release/%.o : %.cpp $(HLVIS_INCLUDEFILES) printusage
@echo ======== hlvis : compiling $< ========
Expand All @@ -282,7 +318,7 @@ bin/hlrad : $(HLRAD_CPPFILES:%.cpp=hlrad/release/%.o) printusage
mkdir -p hlrad/release/bin
$(CXX) $(COMMON_FLAGS) -o hlrad/release/bin/hlrad $(addprefix -I,$(HLRAD_INCLUDEDIRS)) $(addprefix -D,$(HLRAD_DEFINITIONS)) $(HLRAD_CPPFILES:%.cpp=hlrad/release/%.o)
mkdir -p bin
cp hlrad/release/bin/hlrad bin/hlrad
cp hlrad/release/bin/$(HLRAD_NAME) bin/$(HLRAD_NAME)

$(HLRAD_CPPFILES:%.cpp=hlrad/release/%.o) : hlrad/release/%.o : %.cpp $(HLRAD_INCLUDEFILES) printusage
@echo ======== hlrad : compiling $< ========
Expand All @@ -294,7 +330,7 @@ bin/ripent : $(RIPENT_CPPFILES:%.cpp=ripent/release/%.o) printusage
mkdir -p ripent/release/bin
$(CXX) $(COMMON_FLAGS) -o ripent/release/bin/ripent $(addprefix -I,$(RIPENT_INCLUDEDIRS)) $(addprefix -D,$(RIPENT_DEFINITIONS)) $(RIPENT_CPPFILES:%.cpp=ripent/release/%.o)
mkdir -p bin
cp ripent/release/bin/ripent bin/ripent
cp ripent/release/bin/$(RIPENT_NAME) bin/$(RIPENT_NAME)

$(RIPENT_CPPFILES:%.cpp=ripent/release/%.o) : ripent/release/%.o : %.cpp $(RIPENT_INCLUDEFILES) printusage
@echo ======== ripent : compiling $< ========
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Custom Zoner's Half-Life Tools created by vluzacn. This is not my project, I jus

If you want to pass additional flags to make:

make USER_FLAGS="your flags"
make USER_FLAGS="your-flags"

Example:

Expand Down
2 changes: 2 additions & 0 deletions common/cmdlib.h
Original file line number Diff line number Diff line change
Expand Up @@ -600,13 +600,15 @@
#endif
//=====================================================================

#ifndef __MINGW32__
#if _MSC_VER <1400
#define strcpy_s strcpy //--vluzacn
#define sprintf_s sprintf //--vluzacn
#endif
#if _MSC_VER >= 1400
#pragma warning(disable: 4996)
#endif
#endif //--cypress

#ifdef __MINGW32__
#include <io.h>
Expand Down
5 changes: 4 additions & 1 deletion common/threads.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
#endif
#endif

// --cypress
#include <cstdint>

#include "hlassert.h"

q_threadpriority g_threadpriority = DEFAULT_THREAD_PRIORITY;
Expand Down Expand Up @@ -349,7 +352,7 @@ q_threadfunction q_entry;

static DWORD WINAPI ThreadEntryStub(LPVOID pParam)
{
q_entry((int)pParam);
q_entry((intptr_t)pParam);
return 0;
}

Expand Down

0 comments on commit 1464adf

Please sign in to comment.