Skip to content

Commit

Permalink
Merge pull request #19 from Jupeyy/pr_update_ci
Browse files Browse the repository at this point in the history
Fix Windows CI
  • Loading branch information
Jupeyy authored Jan 21, 2025
2 parents 328123b + 2fe5f58 commit e40af64
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 7 deletions.
17 changes: 15 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,18 @@ jobs:
build-args: --parallel
package-file: fng-*-linux_x86_64.tar.xz
- os: windows-latest
cmake-args: -G "Visual Studio 16 2019" -A x64
cmake-args: -G "Ninja"
package-file: fng-*-win64.zip

defaults:
run:
shell: ${{ matrix.os == 'windows-latest' && 'msys2 {0}' || 'bash {0}' }}
steps:
- name: Prepare Windows (msys2)
uses: msys2/setup-msys2@v2
if: contains(matrix.os, 'windows')
with:
msystem: MINGW64

- uses: actions/checkout@v4
with:
submodules: true
Expand All @@ -35,6 +43,11 @@ jobs:
sudo apt-get update -y
sudo apt-get install pkg-config cmake -y
- name: Prepare msys dependencies
if: contains(matrix.os, 'windows')
run: |
pacman --noconfirm -S git mingw-w64-x86_64-toolchain cmake ninja mingw-w64-x86_64-gcc
- name: Build in release mode
run: |
mkdir release
Expand Down
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ else()
set(TARGET_BITS "64")
endif()

if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
if((CMAKE_SYSTEM_NAME STREQUAL "Windows") OR (CMAKE_SYSTEM_NAME STREQUAL "MSYS"))
set(TARGET_OS "windows")
elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
set(TARGET_OS "linux")
Expand Down Expand Up @@ -355,7 +355,7 @@ if(NOT(GTEST_FOUND))
endif()
endif()

if(TARGET_OS STREQUAL "windows")
if((TARGET_OS STREQUAL "windows") OR MINGW)
set(PLATFORM_LIBS ws2_32) # Windows sockets
elseif(TARGET_OS STREQUAL "mac")
find_library(CARBON Carbon)
Expand Down
1 change: 0 additions & 1 deletion src/base/system.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@

#elif defined(CONF_FAMILY_WINDOWS)
#define WIN32_LEAN_AND_MEAN
#define _WIN32_WINNT 0x0501 /* required for mingw to get getaddrinfo to work */
#include <windows.h>
#include <winsock2.h>
#include <ws2tcpip.h>
Expand Down
1 change: 0 additions & 1 deletion src/engine/client/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
#include "client.h"

#if defined(CONF_FAMILY_WINDOWS)
#define _WIN32_WINNT 0x0501
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#endif
Expand Down
1 change: 0 additions & 1 deletion src/engine/server/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
#include "server.h"

#if defined(CONF_FAMILY_WINDOWS)
#define _WIN32_WINNT 0x0501
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#endif
Expand Down

0 comments on commit e40af64

Please sign in to comment.