mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
CI: add Windows MSVC builds
This commit is contained in:
parent
cc61daa3d5
commit
9a5c5dc35c
2 changed files with 126 additions and 42 deletions
45
.github/scripts/dependencies.sh
vendored
45
.github/scripts/dependencies.sh
vendored
|
@ -3,24 +3,28 @@
|
|||
set -ex
|
||||
|
||||
install_gnustep_make() {
|
||||
cd $DEP_SRC
|
||||
echo "::group::GNUstep Make"
|
||||
cd $DEPS_PATH
|
||||
git clone https://github.com/gnustep/tools-make.git
|
||||
cd tools-make
|
||||
if [ -n "$RUNTIME_VERSION" ]
|
||||
then
|
||||
WITH_RUNTIME_ABI="--with-runtime-abi=${RUNTIME_VERSION}"
|
||||
else
|
||||
WITH_RUNTIME_ABI=""
|
||||
MAKE_OPTS=
|
||||
if [ -n "$HOST" ]; then
|
||||
MAKE_OPTS="$MAKE_OPTS --host=$HOST"
|
||||
fi
|
||||
./configure --prefix=$DEP_ROOT --with-library-combo=$LIBRARY_COMBO $WITH_RUNTIME_ABI
|
||||
if [ -n "$RUNTIME_VERSION" ]; then
|
||||
MAKE_OPTS="$MAKE_OPTS --with-runtime-abi=$RUNTIME_VERSION"
|
||||
fi
|
||||
./configure --prefix=$INSTALL_PATH --with-library-combo=$LIBRARY_COMBO $MAKE_OPTS
|
||||
make install
|
||||
|
||||
echo Objective-C build flags:
|
||||
$DEP_ROOT/bin/gnustep-config --objc-flags
|
||||
$INSTALL_PATH/bin/gnustep-config --objc-flags
|
||||
echo "::endgroup::"
|
||||
}
|
||||
|
||||
install_ng_runtime() {
|
||||
cd $DEP_SRC
|
||||
install_libobjc2() {
|
||||
echo "::group::libobjc2"
|
||||
cd $DEPS_PATH
|
||||
git clone https://github.com/gnustep/libobjc2.git
|
||||
cd libobjc2
|
||||
git submodule sync
|
||||
|
@ -31,13 +35,15 @@ install_ng_runtime() {
|
|||
-DTESTS=off \
|
||||
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
|
||||
-DGNUSTEP_INSTALL_TYPE=NONE \
|
||||
-DCMAKE_INSTALL_PREFIX:PATH=$DEP_ROOT \
|
||||
-DCMAKE_INSTALL_PREFIX:PATH=$INSTALL_PATH \
|
||||
../
|
||||
make install
|
||||
echo "::endgroup::"
|
||||
}
|
||||
|
||||
install_libdispatch() {
|
||||
cd $DEP_SRC
|
||||
echo "::group::libdispatch"
|
||||
cd $DEPS_PATH
|
||||
# will reference upstream after https://github.com/apple/swift-corelibs-libdispatch/pull/534 is merged
|
||||
git clone -b system-blocksruntime https://github.com/ngrewe/swift-corelibs-libdispatch.git libdispatch
|
||||
mkdir libdispatch/build
|
||||
|
@ -46,20 +52,21 @@ install_libdispatch() {
|
|||
cmake \
|
||||
-DBUILD_TESTING=off \
|
||||
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
|
||||
-DCMAKE_INSTALL_PREFIX:PATH=$DEP_ROOT \
|
||||
-DCMAKE_INSTALL_PREFIX:PATH=$INSTALL_PATH \
|
||||
-DCMAKE_C_FLAGS="-Wno-error=void-pointer-to-int-cast" \
|
||||
-DINSTALL_PRIVATE_HEADERS=1 \
|
||||
-DBlocksRuntime_INCLUDE_DIR=$DEP_ROOT/include \
|
||||
-DBlocksRuntime_LIBRARIES=$DEP_ROOT/lib/libobjc.so \
|
||||
-DBlocksRuntime_INCLUDE_DIR=$INSTALL_PATH/include \
|
||||
-DBlocksRuntime_LIBRARIES=$INSTALL_PATH/lib/libobjc.so \
|
||||
../
|
||||
make install
|
||||
echo "::endgroup::"
|
||||
}
|
||||
|
||||
mkdir -p $DEP_SRC
|
||||
mkdir -p $DEPS_PATH
|
||||
|
||||
if [ "$LIBRARY_COMBO" = 'ng-gnu-gnu' ]
|
||||
then
|
||||
install_ng_runtime
|
||||
# Windows MSVC toolchain uses tools-windows-msvc scripts to install non-GNUstep dependencies
|
||||
if [ "$LIBRARY_COMBO" = "ng-gnu-gnu" -a "$IS_WINDOWS_MSVC" != "true" ]; then
|
||||
install_libobjc2
|
||||
install_libdispatch
|
||||
fi
|
||||
|
||||
|
|
123
.github/workflows/main.yml
vendored
123
.github/workflows/main.yml
vendored
|
@ -5,55 +5,85 @@ on: [push, pull_request, workflow_dispatch]
|
|||
jobs:
|
||||
ci:
|
||||
name: ${{ matrix.name }}
|
||||
runs-on: ${{ matrix.os || 'ubuntu-latest' }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- name: Ubuntu GCC
|
||||
os: ubuntu-latest
|
||||
library-combo: gnu-gnu-gnu
|
||||
CC: gcc
|
||||
CXX: g++
|
||||
|
||||
- name: Ubuntu Clang gnustep-1.9
|
||||
os: ubuntu-latest
|
||||
library-combo: ng-gnu-gnu
|
||||
runtime-version: gnustep-1.9
|
||||
CC: clang
|
||||
CXX: clang++
|
||||
|
||||
- name: Ubuntu Clang gnustep-2.0
|
||||
os: ubuntu-latest
|
||||
library-combo: ng-gnu-gnu
|
||||
runtime-version: gnustep-2.0
|
||||
CC: clang
|
||||
CXX: clang++
|
||||
|
||||
- name: Windows GCC MinGW-w64 i686
|
||||
- name: Windows MinGW GCC i686
|
||||
allow-test-failures: true
|
||||
library-combo: gnu-gnu-gnu
|
||||
os: windows-latest
|
||||
arch: i686
|
||||
msystem: mingw32
|
||||
shell: msys2 {0}
|
||||
msystem: MINGW32
|
||||
library-combo: gnu-gnu-gnu
|
||||
CC: gcc
|
||||
CXX: g++
|
||||
|
||||
- name: Windows GCC MinGW-w64 x86_64
|
||||
- name: Windows MinGW GCC x86_64
|
||||
allow-test-failures: true
|
||||
library-combo: gnu-gnu-gnu
|
||||
os: windows-latest
|
||||
arch: x86_64
|
||||
msystem: mingw64
|
||||
shell: msys2 {0}
|
||||
msystem: MINGW64
|
||||
library-combo: gnu-gnu-gnu
|
||||
CC: gcc
|
||||
CXX: g++
|
||||
|
||||
- name: Windows MSVC Clang gnustep-2.0 i686
|
||||
allow-test-failures: true
|
||||
os: windows-latest
|
||||
arch: x86
|
||||
host: i686-pc-windows
|
||||
library-combo: ng-gnu-gnu
|
||||
runtime-version: gnustep-2.0
|
||||
configure-opts: --disable-tls
|
||||
CC: clang
|
||||
CXX: clang++
|
||||
LDFLAGS: -fuse-ld=lld
|
||||
|
||||
- name: Windows MSVC Clang gnustep-2.0 x86_64
|
||||
allow-test-failures: true
|
||||
os: windows-latest
|
||||
arch: x64
|
||||
host: x86_64-pc-windows
|
||||
library-combo: ng-gnu-gnu
|
||||
runtime-version: gnustep-2.0
|
||||
configure-opts: --disable-tls
|
||||
CC: clang
|
||||
CXX: clang++
|
||||
LDFLAGS: -fuse-ld=lld
|
||||
|
||||
env:
|
||||
SRC: ${{ github.workspace }}/source
|
||||
DEP_SRC: ${{ github.workspace }}/dependency_source
|
||||
DEP_ROOT: ${{ github.workspace }}/staging
|
||||
SRC_PATH: ${{ github.workspace }}${{ startsWith(matrix.os, 'windows') && '\' || '/' }}source
|
||||
DEPS_PATH: ${{ github.workspace }}${{ startsWith(matrix.os, 'windows') && '\' || '/' }}dependencies
|
||||
INSTALL_PATH: ${{ github.workspace }}${{ startsWith(matrix.os, 'windows') && '\' || '/' }}build
|
||||
IS_WINDOWS_MINGW: ${{ startsWith(matrix.os, 'windows') && startsWith(matrix.msystem, 'MINGW') }}
|
||||
IS_WINDOWS_MSVC: ${{ startsWith(matrix.os, 'windows') && endsWith(matrix.host, '-pc-windows') }}
|
||||
CC: ${{ matrix.CC }}
|
||||
CXX: ${{ matrix.CXX }}
|
||||
LDFLAGS: ${{ matrix.LDFLAGS }}
|
||||
HOST: ${{ matrix.host }}
|
||||
ARCH: ${{ matrix.arch }}
|
||||
LIBRARY_COMBO: ${{ matrix.library-combo }}
|
||||
RUNTIME_VERSION: ${{ matrix.runtime-version }}
|
||||
CONFIGURE_OPTS: ${{ matrix.configure-opts }}
|
||||
|
@ -63,13 +93,13 @@ jobs:
|
|||
|
||||
defaults:
|
||||
run:
|
||||
shell: ${{ matrix.shell || 'bash' }}
|
||||
working-directory: ${{ env.SRC }}
|
||||
shell: ${{ startsWith(matrix.os, 'windows') && 'msys2 {0}' || 'bash' }}
|
||||
working-directory: ${{ env.SRC_PATH }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
path: ${{ env.SRC }}
|
||||
path: ${{ env.SRC_PATH }}
|
||||
|
||||
- name: Install packages (Linux)
|
||||
if: runner.os == 'Linux'
|
||||
|
@ -93,9 +123,9 @@ jobs:
|
|||
sudo apt-get update
|
||||
sudo apt-get install $PACKAGES
|
||||
|
||||
- name: Set up MSYS2 (Windows)
|
||||
- name: Set up MSYS2 (Windows MinGW)
|
||||
uses: msys2/setup-msys2@v2
|
||||
if: runner.os == 'Windows'
|
||||
if: env.IS_WINDOWS_MINGW == 'true'
|
||||
with:
|
||||
msystem: ${{ matrix.msystem }}
|
||||
install: >
|
||||
|
@ -115,12 +145,52 @@ jobs:
|
|||
mingw-w64-${{matrix.arch}}-gnutls
|
||||
mingw-w64-${{matrix.arch}}-icu
|
||||
|
||||
- name: Set up MSYS2 (Windows MSVC)
|
||||
uses: msys2/setup-msys2@v2
|
||||
if: env.IS_WINDOWS_MSVC == 'true'
|
||||
with:
|
||||
msystem: MSYS
|
||||
install: make autoconf automake libtool
|
||||
# make Windows packages like Clang available in MSYS
|
||||
path-type: inherit
|
||||
|
||||
- name: Delete MinGW gmake (Windows MSVC)
|
||||
if: env.IS_WINDOWS_MSVC == 'true'
|
||||
# delete /c/Strawberry/c/bin/gmake built for MinGW that is found on runners, because we must use make built for MSYS
|
||||
run: if GMAKE_PATH=`which gmake`; then rm -f "$GMAKE_PATH"; fi
|
||||
|
||||
- name: Install Windows packages (Windows MSVC)
|
||||
if: env.IS_WINDOWS_MSVC == 'true'
|
||||
shell: cmd
|
||||
run: choco install ninja
|
||||
|
||||
- name: Set up VS Developer Command Prompt (Windows MSVC)
|
||||
if: env.IS_WINDOWS_MSVC == 'true'
|
||||
uses: ilammy/msvc-dev-cmd@v1
|
||||
with:
|
||||
arch: ${{ matrix.arch }}
|
||||
|
||||
- name: Install dependencies (Windows MSVC)
|
||||
if: env.IS_WINDOWS_MSVC == 'true'
|
||||
shell: cmd
|
||||
run: |
|
||||
mkdir %DEPS_PATH% & cd %DEPS_PATH%
|
||||
git clone https://github.com/gnustep/tools-windows-msvc.git || exit /b 1
|
||||
cd tools-windows-msvc
|
||||
:: use msys2.cmd from setup-msys2 as Bash shell, as it doesn't have msys2_shell.cmd used normally by build.bat
|
||||
set "BASH=msys2 -c"
|
||||
build.bat --prefix=%INSTALL_PATH% --type Release --only-dependencies
|
||||
|
||||
- name: Set environment variables (Windows)
|
||||
if: runner.os == 'Windows'
|
||||
run: |
|
||||
# MSVC: update install path to include [x86|x64]/Release subdir used by build.bat above
|
||||
if [ "$IS_WINDOWS_MSVC" = "true" ]; then
|
||||
INSTALL_PATH=$INSTALL_PATH\\$ARCH\\Release
|
||||
fi
|
||||
# convert Windows paths to Unix paths for MSYS2 shell
|
||||
echo "DEP_SRC=`cygpath -u $DEP_SRC`" >> $GITHUB_ENV
|
||||
echo "DEP_ROOT=`cygpath -u $DEP_ROOT`" >> $GITHUB_ENV
|
||||
echo "INSTALL_PATH=`cygpath -u $INSTALL_PATH`" >> $GITHUB_ENV
|
||||
echo "DEPS_PATH=`cygpath -u $DEPS_PATH`" >> $GITHUB_ENV
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
|
@ -128,14 +198,21 @@ jobs:
|
|||
|
||||
- name: Build source
|
||||
run: |
|
||||
. $DEP_ROOT/share/GNUstep/Makefiles/GNUstep.sh
|
||||
. $INSTALL_PATH/share/GNUstep/Makefiles/GNUstep.sh
|
||||
if [ -n "$HOST" ]; then
|
||||
CONFIGURE_OPTS="$CONFIGURE_OPTS --host=$HOST"
|
||||
fi
|
||||
./configure $CONFIGURE_OPTS
|
||||
make && make install
|
||||
|
||||
- name: Run tests
|
||||
continue-on-error: ${{ matrix.allow-test-failures || false }}
|
||||
run: |
|
||||
. $DEP_ROOT/share/GNUstep/Makefiles/GNUstep.sh
|
||||
. $INSTALL_PATH/share/GNUstep/Makefiles/GNUstep.sh
|
||||
# MSVC: build tests for release to match CRT of DLLs
|
||||
if [ "$IS_WINDOWS_MSVC" = "true" ]; then
|
||||
sed -i -e 's/ debug=yes//g' `which gnustep-tests`
|
||||
fi
|
||||
make check
|
||||
|
||||
- name: Upload logs
|
||||
|
@ -144,5 +221,5 @@ jobs:
|
|||
with:
|
||||
name: Logs - ${{ matrix.name }}
|
||||
path: |
|
||||
$SRC/config.log
|
||||
$SRC/Tests/tests.log
|
||||
${{ env.SRC_PATH }}/config.log
|
||||
${{ env.SRC_PATH }}/Tests/tests.log
|
||||
|
|
Loading…
Reference in a new issue