Skip to content

Commit

Permalink
CI: Add FreeBSD (#302)
Browse files Browse the repository at this point in the history
  • Loading branch information
andy5995 authored Feb 3, 2025
1 parent e3d03d0 commit bd19a87
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 19 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,48 @@ on:
- '**/appimage.yml'

jobs:
freebsd:
runs-on: ubuntu-latest
name: FreeBSD
steps:
- uses: actions/checkout@v4
- name: Test in FreeBSD
id: test
uses: vmactions/freebsd-vm@v1
with:
usesh: true
prepare: |
pkg install -y \
bash \
cmake \
cppunit \
curl \
freetype2 \
fribidi \
ftgl \
git \
glew \
jpeg-turbo \
libGLU \
libircclient \
libogg \
libvorbis \
libX11 \
libxml2 \
lua53 \
mesa-libs \
miniupnpc \
openal-soft \
pkgconf \
png \
sdl2 \
wx30-gtk3
run: |
git config --global --add safe.directory /home/runner/work/megaglest-source/megaglest-source
cd mk/linux
./build-mg.sh -f -d
build-linux:
strategy:
fail-fast: false
Expand Down
17 changes: 2 additions & 15 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -187,21 +187,6 @@ IF(CMAKE_COMPILER_IS_GNUCXX OR MINGW OR MSVC)
ADD_DEFINITIONS("-DUNICODE")
ENDIF()

# CLang specific Compiler Options
IF ("${CMAKE_CXX_COMPILER_ID}" MATCHES "(Apple)?Clang")

ELSEIF(MSVC)

# GCC specific Compiler Options
ELSE()
ADD_DEFINITIONS("-frounding-math -fsignaling-nans")

# IF(NOT MINGW)
# set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -rdynamic")
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -rdynamic")
# ENDIF()
ENDIF()

if(DEFINED ENV{CFLAGS})
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} $ENV{CFLAGS}")
endif()
Expand All @@ -220,6 +205,8 @@ set(EXTRA_FLAGS
"-Werror=odr"
"-Werror=lto-type-mismatch"
"-Werror=strict-aliasing"
"-frounding-math"
"-fsignaling-nans"
)

# Loop through each flag and check for both C++ and C compilers
Expand Down
16 changes: 14 additions & 2 deletions mk/linux/build-mg.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh
# Use this script to build MegaGlest using cmake
# ----------------------------------------------------------------------------
# Written by Mark Vejvoda <[email protected]>
Expand Down Expand Up @@ -133,7 +133,19 @@ EXTRA_CMAKE_OPTIONS=

# Build threads
# By default we use all physical CPU cores to build.
NUMCORES=`lscpu -p | grep -cv '^#'`
# Detect number of CPU cores for Linux, macOS, and BSD-based systems

if command -v lscpu >/dev/null 2>&1; then
# Linux-specific (using lscpu)
NUMCORES=$(lscpu -p | grep -cv '^#')
elif uname | grep -iq bsd; then
# macOS and any BSD-based system (using sysctl)
NUMCORES=$(sysctl -n hw.ncpu)
else
# Unsupported OS, set NUMCORES to 1
NUMCORES=1
fi

echo "CPU cores detected: $NUMCORES"
if [ "$NUMCORES" = '' ]; then NUMCORES=1; fi
if [ $CPU_COUNT != -1 ]; then NUMCORES=$CPU_COUNT; fi
Expand Down
4 changes: 2 additions & 2 deletions mk/linux/mg_shared.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
#
# Copyright (c) 2013-2016 MegaGlest Team under GNU GPL v3.0+

function detect_system {
detect_system() {
# Determine distro title, release, codename
#
# Input:
# Input:
# -/-
#
# Output:
Expand Down

0 comments on commit bd19a87

Please sign in to comment.