Replace MSVC with MinGW GCC

This commit is contained in:
Luciano Ciccariello 2024-10-06 13:16:05 +01:00
parent 50b8135531
commit 7e7613b9a3
9 changed files with 18 additions and 10 deletions

View File

@ -110,6 +110,7 @@ jobs:
mkdir C:\temp-sdl2
powershell Invoke-WebRequest 'https://github.com/libsdl-org/SDL/releases/download/release-2.28.5/SDL2-devel-2.28.5-VC.zip' -OutFile C:\temp-sdl2\SDL2-devel-2.28.5-VC.zip
7z x C:\temp-sdl2\SDL2-devel-2.28.5-VC.zip -oC:\temp-sdl2
choco install ninja
- name: Clone repo
uses: actions/checkout@v4
with:
@ -130,7 +131,7 @@ jobs:
& make -j build_assets SOTNASSETS=$SOTN_ASSETS
- name: Build
run: |
cmake -B ${{github.workspace}}/pc -DCMAKE_BUILD_TYPE=Release -DSDL2_PATH=C:\temp-sdl2\SDL2-2.28.5
cmake -B ${{github.workspace}}/pc -G "Ninja" -DCMAKE_C_COMPILER=gcc -DCMAKE_BUILD_TYPE=Release -DSDL2_PATH=C:\temp-sdl2\SDL2-2.28.5
cmake --build ${{github.workspace}}/pc --config Release
build-linux-lle:

View File

@ -11,9 +11,12 @@ endif()
if (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|AppleClang")
set(CMAKE_BUILD_TYPE Debug)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address")
set(CMAKE_LINKER_FLAGS "${CMAKE_LINKER_FLAGS} -fsanitize=address")
if (NOT WIN32)
# asan is not supported on Windows
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address")
set(CMAKE_LINKER_FLAGS "${CMAKE_LINKER_FLAGS} -fsanitize=address")
endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-implicit-function-declaration")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-incompatible-pointer-types")

View File

@ -18,7 +18,7 @@ typedef unsigned int size_t;
#include <sys/types.h>
#endif
#ifdef _MSC_VER
#if defined(_MSC_VER) || defined(__MINGW32__)
typedef unsigned char u_char;
typedef unsigned short u_short;
typedef unsigned long long u_long;

View File

@ -6,7 +6,7 @@
extern "C" {
#endif
#ifdef _MSC_VER
#if defined(_MSC_VER) || defined(__MINGW32__)
typedef unsigned int uint;
typedef unsigned short ushort;
#endif

View File

@ -27,7 +27,11 @@ long TestEvent(unsigned long event) {
return 1;
}
#if !defined(_MSC_VER) && !defined(__MINGW32__)
// needs to be disabled on Windows as it overlaps with the kernel32 API:
// https://learn.microsoft.com/en-us/windows/win32/api/synchapi/nf-synchapi-entercriticalsection
void EnterCriticalSection(void) { NOT_IMPLEMENTED; }
#endif
void ExitCriticalSection(void) { NOT_IMPLEMENTED; }

View File

@ -3,7 +3,7 @@
#include <log.h>
#include <game.h>
#include <stdlib.h>
#ifdef _MSC_VER
#if defined(_MSC_VER) || defined(__MINGW32__)
#define SDL_MAIN_HANDLED
#include <SDL.h>
#else

View File

@ -3,7 +3,7 @@
#include <log.h>
#include <game.h>
#include <stdlib.h>
#ifdef _MSC_VER
#if defined(_MSC_VER) || defined(__MINGW32__)
#define SDL_MAIN_HANDLED
#include <SDL.h>
#else

View File

@ -3,7 +3,7 @@
#include <log.h>
#include <game.h>
#include <stdlib.h>
#ifdef _MSC_VER
#if defined(_MSC_VER) || defined(__MINGW32__)
#define SDL_MAIN_HANDLED
#include <SDL.h>
#else

View File

@ -1,6 +1,6 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
#include <game.h>
#ifdef _MSC_VER
#if defined(_MSC_VER) || defined(__MINGW32__)
#define SDL_MAIN_HANDLED
#include <SDL.h>
#else