Enable compilation via MINGW, upload all artifacts

This commit is contained in:
cypress 2023-11-21 15:14:50 -05:00
parent ef409b1373
commit 1464adf1de
5 changed files with 119 additions and 47 deletions

View file

@ -3,40 +3,71 @@ name: build
on: [push, pull_request] on: [push, pull_request]
jobs: jobs:
linux_builds: linux_build:
runs-on: ${{ matrix.os }} runs-on: ubuntu-latest
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
cxx: [g++, clang++]
env: 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 64 bit
run: |
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:
CXX: clang++
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: Build - name: Build
run: | run: |
make make -j8
- name: Archive vhlt macOS tools
windows_build:
runs-on: windows-latest
env:
SOLUTION_FILE_PATH: .
BUILD_CONFIGURATION: Release
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: Archive vhlt Windows tools
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
name: vhlt-windows-tools name: vhlt-macos-tools
path: D:\a\vhlt\bin\* path: ./bin/*
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-windows64-tools
path: ./bin/*

View file

@ -75,6 +75,41 @@ COMMON_INCLUDEFILES = \
common/win32fix.h \ common/win32fix.h \
common/winding.h \ common/winding.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 = \ COMMON_DEFINITIONS = \
VERSION_LINUX \ VERSION_LINUX \
SYSTEM_POSIX \ SYSTEM_POSIX \
@ -85,7 +120,8 @@ COMMON_DEFINITIONS = \
HAVE_SYS_RESOURCE_H \ HAVE_SYS_RESOURCE_H \
HAVE_SYS_STAT_H \ HAVE_SYS_STAT_H \
HAVE_SYS_TIME_H \ HAVE_SYS_TIME_H \
HAVE_UNISTD_H \ HAVE_UNISTD_H
endif
COMMON_FLAGS = -Wall -Wno-deprecated-declarations -O2 -fno-strict-aliasing -pthread -pipe $(USER_FLAGS) COMMON_FLAGS = -Wall -Wno-deprecated-declarations -O2 -fno-strict-aliasing -pthread -pipe $(USER_FLAGS)
@ -246,7 +282,7 @@ bin/hlcsg : $(HLCSG_CPPFILES:%.cpp=hlcsg/release/%.o) printusage
mkdir -p hlcsg/release/bin 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) $(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 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 $(HLCSG_CPPFILES:%.cpp=hlcsg/release/%.o) : hlcsg/release/%.o : %.cpp $(HLCSG_INCLUDEFILES) printusage
@echo ======== hlcsg : compiling $< ======== @echo ======== hlcsg : compiling $< ========
@ -258,7 +294,7 @@ bin/hlbsp : $(HLBSP_CPPFILES:%.cpp=hlbsp/release/%.o) printusage
mkdir -p hlbsp/release/bin 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) $(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 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 $(HLBSP_CPPFILES:%.cpp=hlbsp/release/%.o) : hlbsp/release/%.o : %.cpp $(HLBSP_INCLUDEFILES) printusage
@echo ======== hlbsp : compiling $< ======== @echo ======== hlbsp : compiling $< ========
@ -270,7 +306,7 @@ bin/hlvis : $(HLVIS_CPPFILES:%.cpp=hlvis/release/%.o) printusage
mkdir -p hlvis/release/bin 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) $(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 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 $(HLVIS_CPPFILES:%.cpp=hlvis/release/%.o) : hlvis/release/%.o : %.cpp $(HLVIS_INCLUDEFILES) printusage
@echo ======== hlvis : compiling $< ======== @echo ======== hlvis : compiling $< ========
@ -282,7 +318,7 @@ bin/hlrad : $(HLRAD_CPPFILES:%.cpp=hlrad/release/%.o) printusage
mkdir -p hlrad/release/bin 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) $(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 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 $(HLRAD_CPPFILES:%.cpp=hlrad/release/%.o) : hlrad/release/%.o : %.cpp $(HLRAD_INCLUDEFILES) printusage
@echo ======== hlrad : compiling $< ======== @echo ======== hlrad : compiling $< ========
@ -294,7 +330,7 @@ bin/ripent : $(RIPENT_CPPFILES:%.cpp=ripent/release/%.o) printusage
mkdir -p ripent/release/bin 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) $(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 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 $(RIPENT_CPPFILES:%.cpp=ripent/release/%.o) : ripent/release/%.o : %.cpp $(RIPENT_INCLUDEFILES) printusage
@echo ======== ripent : compiling $< ======== @echo ======== ripent : compiling $< ========

View file

@ -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: If you want to pass additional flags to make:
make USER_FLAGS="your flags" make USER_FLAGS="your-flags"
Example: Example:

View file

@ -600,6 +600,7 @@
#endif #endif
//===================================================================== //=====================================================================
#ifndef __MINGW32__
#if _MSC_VER <1400 #if _MSC_VER <1400
#define strcpy_s strcpy //--vluzacn #define strcpy_s strcpy //--vluzacn
#define sprintf_s sprintf //--vluzacn #define sprintf_s sprintf //--vluzacn
@ -607,6 +608,7 @@
#if _MSC_VER >= 1400 #if _MSC_VER >= 1400
#pragma warning(disable: 4996) #pragma warning(disable: 4996)
#endif #endif
#endif //--cypress
#ifdef __MINGW32__ #ifdef __MINGW32__
#include <io.h> #include <io.h>

View file

@ -27,6 +27,9 @@
#endif #endif
#endif #endif
// --cypress
#include <cstdint>
#include "hlassert.h" #include "hlassert.h"
q_threadpriority g_threadpriority = DEFAULT_THREAD_PRIORITY; q_threadpriority g_threadpriority = DEFAULT_THREAD_PRIORITY;
@ -349,7 +352,7 @@ q_threadfunction q_entry;
static DWORD WINAPI ThreadEntryStub(LPVOID pParam) static DWORD WINAPI ThreadEntryStub(LPVOID pParam)
{ {
q_entry((int)pParam); q_entry((intptr_t)pParam);
return 0; return 0;
} }