Skip to content

move windows cross-compile env vars from global to user-host scope #89

move windows cross-compile env vars from global to user-host scope

move windows cross-compile env vars from global to user-host scope #89

Workflow file for this run

name: CMake Errors
on: [push, pull_request]
jobs:
ci-cmake:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- name: Ubuntu GCC
os: ubuntu-latest
compiler: gcc
cflags: -Werror -Wall -Wextra
- name: Ubuntu GCC -O3
os: ubuntu-latest
compiler: gcc
cflags: -O3 -Werror -Wall -Wextra
- name: Ubuntu Clang
os: ubuntu-latest
compiler: clang
cflags: -Werror -Wall -Wextra
- name: Ubuntu Clang Debug
os: ubuntu-latest
compiler: clang
cflags: -Werror -Wall -Wextra
build-config: Debug
- name: Windows MSVC Win32
os: windows-latest
compiler: cl
cflags: /WX /W3
cmake-args: -A Win32
- name: Windows MSVC Win64
os: windows-latest
compiler: cl
cflags: /WX /W3 /wd4244 # fixes some warnings in http_parser.c which is not my code
cmake-args: -A x64
- name: Windows GCC
os: windows-latest
compiler: gcc
cflags: -Werror -Wall -Wextra
cmake-args: -G Ninja
- name: macOS Clang
os: macos-latest
compiler: clang
cflags: -Werror -Wall -Wextra
- name: macOS GCC
os: macos-latest
compiler: gcc
cflags: -Werror -Wall -Wextra
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
# Set installation directory based on OS
- name: Set install directory
id: set-install-dir
shell: bash
run: |
if [ "$RUNNER_OS" == "Windows" ]
then
INSTALL_DIR="$GITHUB_WORKSPACE\\usr"
CMAKE_INSTALL_DIR="$(sed 's/\\/\//g' <<< "$INSTALL_DIR")" # sic, cygpath no good for cmake
MULLE_CORE_SRC_DIR="$GITHUB_WORKSPACE\\stash\\mulle-core"
MULLE_CORE_ALL_LOAD_SRC_DIR="$GITHUB_WORKSPACE\\stash\\mulle-core-all-load"
else
INSTALL_DIR="$GITHUB_WORKSPACE/usr"
CMAKE_INSTALL_DIR="${INSTALL_DIR}"
MULLE_CORE_SRC_DIR="$GITHUB_WORKSPACE/stash/mulle-core"
MULLE_CORE_ALL_LOAD_SRC_DIR="$GITHUB_WORKSPACE/stash/mulle-core-all-load"
fi
echo "INSTALL_DIR=$INSTALL_DIR" >> $GITHUB_OUTPUT
echo "CMAKE_INSTALL_DIR=$CMAKE_INSTALL_DIR" >> $GITHUB_OUTPUT
echo "MULLE_CORE_SRC_DIR=$MULLE_CORE_SRC_DIR" >> $GITHUB_OUTPUT
echo "MULLE_CORE_ALL_LOAD_SRC_DIR=$MULLE_CORE_ALL_LOAD_SRC_DIR" >> $GITHUB_OUTPUT
mkdir -p "$INSTALL_DIR"
- name: Configure, build and install mulle-core with CMake
working-directory: "${{steps.set-install-dir.outputs.MULLE_CORE_SRC_DIR}}"
env:
CC: ${{ matrix.compiler }}
CFLAGS: ${{ matrix.cflags }}
run: |
cmake ${{ matrix.cmake-args }} -B build -DMULLE_SDK_PATH="${{ steps.set-install-dir.outputs.CMAKE_INSTALL_DIR }}" -DCMAKE_INSTALL_PREFIX="${{ steps.set-install-dir.outputs.CMAKE_INSTALL_DIR }}" -DCMAKE_PREFIX_PATH="${{ steps.set-install-dir.outputs.CMAKE_INSTALL_DIR }}" -DCMAKE_BUILD_TYPE="${{ matrix.build-config || 'Release' }}"
cmake --build build --config "${{ matrix.build-config || 'Release' }}"
cmake --install build --config "${{ matrix.build-config || 'Release' }}"
- name: Configure, build and install mulle-core-all-load with CMake
working-directory: "${{steps.set-install-dir.outputs.MULLE_CORE_ALL_LOAD_SRC_DIR}}"
env:
CC: ${{ matrix.compiler }}
CFLAGS: ${{ matrix.cflags }}
run: |
cmake ${{ matrix.cmake-args }} -B build -DMULLE_SDK_PATH="${{ steps.set-install-dir.outputs.CMAKE_INSTALL_DIR }}" -DCMAKE_INSTALL_PREFIX="${{ steps.set-install-dir.outputs.CMAKE_INSTALL_DIR }}" -DCMAKE_PREFIX_PATH="${{ steps.set-install-dir.outputs.CMAKE_INSTALL_DIR }}" -DCMAKE_BUILD_TYPE="${{ matrix.build-config || 'Release' }}"
cmake --build build --config "${{ matrix.build-config || 'Release' }}"
cmake --install build --config "${{ matrix.build-config || 'Release' }}"
- name: Install packages (Windows)
if: runner.os == 'Windows'
run: |
choco install --no-progress ninja ${{ matrix.packages }}
- name: Generate project files
env:
CC: ${{ matrix.compiler }}
CFLAGS: ${{ matrix.cflags }}
run: |
cmake ${{ matrix.cmake-args }} -B build -DMULLE_SDK_PATH="${{ steps.set-install-dir.outputs.CMAKE_INSTALL_DIR }}" -DCMAKE_INSTALL_PREFIX="${{ steps.set-install-dir.outputs.CMAKE_INSTALL_DIR }}" -DCMAKE_PREFIX_PATH="${{ steps.set-install-dir.outputs.CMAKE_INSTALL_DIR }}" -DCMAKE_BUILD_TYPE="${{ matrix.build-config || 'Release' }}"
- name: Compile source code
shell: bash
run: |
cmake --build "${{ matrix.build-dir || 'build' }}" --config "${{ matrix.build-config || 'Release' }}"