|
| 1 | +name: CMake Errors |
| 2 | +on: [push, pull_request] |
| 3 | + |
| 4 | +jobs: |
| 5 | + ci-cmake: |
| 6 | + name: ${{ matrix.name }} |
| 7 | + runs-on: ${{ matrix.os }} |
| 8 | + strategy: |
| 9 | + fail-fast: false |
| 10 | + matrix: |
| 11 | + include: |
| 12 | + - name: Ubuntu GCC |
| 13 | + os: ubuntu-latest |
| 14 | + compiler: gcc |
| 15 | + cflags: -Werror -Wall -Wextra |
| 16 | + |
| 17 | + - name: Ubuntu GCC -O3 |
| 18 | + os: ubuntu-latest |
| 19 | + compiler: gcc |
| 20 | + cflags: -O3 -Werror -Wall -Wextra |
| 21 | + |
| 22 | + - name: Ubuntu Clang |
| 23 | + os: ubuntu-latest |
| 24 | + compiler: clang |
| 25 | + cflags: -Werror -Wall -Wextra |
| 26 | + |
| 27 | + - name: Ubuntu Clang Debug |
| 28 | + os: ubuntu-latest |
| 29 | + compiler: clang |
| 30 | + cflags: -Werror -Wall -Wextra |
| 31 | + build-config: Debug |
| 32 | + |
| 33 | + - name: Windows MSVC Win32 |
| 34 | + os: windows-latest |
| 35 | + compiler: cl |
| 36 | + cflags: /WX /W3 |
| 37 | + cmake-args: -A Win32 |
| 38 | + |
| 39 | + - name: Windows MSVC Win64 |
| 40 | + os: windows-latest |
| 41 | + compiler: cl |
| 42 | + cflags: /WX /W3 /wd4244 # fixes some warnings in http_parser.c which is not my code |
| 43 | + cmake-args: -A x64 |
| 44 | + |
| 45 | + - name: Windows GCC |
| 46 | + os: windows-latest |
| 47 | + compiler: gcc |
| 48 | + cflags: -Werror -Wall -Wextra |
| 49 | + cmake-args: -G Ninja |
| 50 | + |
| 51 | + - name: macOS Clang |
| 52 | + os: macos-latest |
| 53 | + compiler: clang |
| 54 | + cflags: -Werror -Wall -Wextra |
| 55 | + |
| 56 | + - name: macOS GCC |
| 57 | + os: macos-latest |
| 58 | + compiler: gcc-12 |
| 59 | + cflags: -Werror -Wall -Wextra |
| 60 | + |
| 61 | + steps: |
| 62 | + - name: Checkout repository |
| 63 | + uses: actions/checkout@v4 |
| 64 | + |
| 65 | + # Set installation directory based on OS |
| 66 | + - name: Set install directory |
| 67 | + id: set-install-dir |
| 68 | + shell: bash |
| 69 | + run: | |
| 70 | + if [ "$RUNNER_OS" == "Windows" ] |
| 71 | + then |
| 72 | + INSTALL_DIR="$GITHUB_WORKSPACE\\usr" |
| 73 | + CMAKE_INSTALL_DIR="$(sed 's/\\/\//g' <<< "$INSTALL_DIR")" # sic, cygpath no good for cmake |
| 74 | + SRC_DIR="$GITHUB_WORKSPACE\\tmp" |
| 75 | + MULLE_CORE_SRC_DIR="$SRC_DIR\\mulle-core" |
| 76 | + MULLE_ATINIT_SRC_DIR="$SRC_DIR\\mulle-atinit" |
| 77 | + MULLE_ATEXIT_SRC_DIR="$SRC_DIR\\mulle-atexit" |
| 78 | + else |
| 79 | + INSTALL_DIR="$GITHUB_WORKSPACE/usr" |
| 80 | + CMAKE_INSTALL_DIR="${INSTALL_DIR}" |
| 81 | + SRC_DIR="$GITHUB_WORKSPACE/tmp" |
| 82 | + MULLE_CORE_SRC_DIR="$SRC_DIR/mulle-core" |
| 83 | + MULLE_ATINIT_SRC_DIR="$SRC_DIR/mulle-atinit" |
| 84 | + MULLE_ATEXIT_SRC_DIR="$SRC_DIR/mulle-atexit" |
| 85 | + fi |
| 86 | + echo "INSTALL_DIR=$INSTALL_DIR" >> $GITHUB_OUTPUT |
| 87 | + echo "CMAKE_INSTALL_DIR=$CMAKE_INSTALL_DIR" >> $GITHUB_OUTPUT |
| 88 | + echo "MULLE_CORE_SRC_DIR=$MULLE_CORE_SRC_DIR" >> $GITHUB_OUTPUT |
| 89 | + echo "MULLE_ATINIT_SRC_DIR=$MULLE_ATINIT_SRC_DIR" >> $GITHUB_OUTPUT |
| 90 | + echo "MULLE_ATEXIT_SRC_DIR=$MULLE_ATEXIT_SRC_DIR" >> $GITHUB_OUTPUT |
| 91 | + mkdir -p "$SRC_DIR" |
| 92 | + mkdir -p "$INSTALL_DIR" |
| 93 | + |
| 94 | + - name: Clone mulle-core repository |
| 95 | + run: | |
| 96 | + git clone https://github.com/mulle-core/mulle-core.git "${{steps.set-install-dir.outputs.MULLE_CORE_SRC_DIR}}" |
| 97 | + |
| 98 | + - name: Configure, build and install mulle-core with CMake |
| 99 | + working-directory: "${{steps.set-install-dir.outputs.MULLE_CORE_SRC_DIR}}" |
| 100 | + env: |
| 101 | + CC: ${{ matrix.compiler }} |
| 102 | + CFLAGS: ${{ matrix.cflags }} |
| 103 | + run: | |
| 104 | + 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' }}" |
| 105 | + cmake --build build --config "${{ matrix.build-config || 'Release' }}" |
| 106 | + cmake --install build --config "${{ matrix.build-config || 'Release' }}" |
| 107 | + |
| 108 | + - name: Clone mulle-atinit repository |
| 109 | + run: | |
| 110 | + git clone https://github.com/mulle-core/mulle-atinit.git "${{steps.set-install-dir.outputs.MULLE_ATINIT_SRC_DIR}}" |
| 111 | + |
| 112 | + - name: Configure, build and install mulle-atinit with CMake |
| 113 | + working-directory: "${{steps.set-install-dir.outputs.MULLE_ATINIT_SRC_DIR}}" |
| 114 | + env: |
| 115 | + CC: ${{ matrix.compiler }} |
| 116 | + CFLAGS: ${{ matrix.cflags }} |
| 117 | + run: | |
| 118 | + 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' }}" |
| 119 | + cmake --build build --config "${{ matrix.build-config || 'Release' }}" |
| 120 | + cmake --install build --config "${{ matrix.build-config || 'Release' }}" |
| 121 | + |
| 122 | + - name: Clone mulle-atexit repository |
| 123 | + run: | |
| 124 | + git clone https://github.com/mulle-core/mulle-atexit.git "${{steps.set-install-dir.outputs.MULLE_ATEXIT_SRC_DIR}}" |
| 125 | + |
| 126 | + - name: Configure, build and install mulle-atexit with CMake |
| 127 | + working-directory: "${{steps.set-install-dir.outputs.MULLE_ATEXIT_SRC_DIR}}" |
| 128 | + env: |
| 129 | + CC: ${{ matrix.compiler }} |
| 130 | + CFLAGS: ${{ matrix.cflags }} |
| 131 | + run: | |
| 132 | + 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' }}" |
| 133 | + cmake --build build --config "${{ matrix.build-config || 'Release' }}" |
| 134 | + cmake --install build --config "${{ matrix.build-config || 'Release' }}" |
| 135 | +
|
| 136 | + - name: Install packages (Windows) |
| 137 | + if: runner.os == 'Windows' |
| 138 | + run: | |
| 139 | + choco install --no-progress ninja ${{ matrix.packages }} |
| 140 | + |
| 141 | + - name: Generate project files |
| 142 | + env: |
| 143 | + CC: ${{ matrix.compiler }} |
| 144 | + CFLAGS: ${{ matrix.cflags }} |
| 145 | + run: | |
| 146 | + 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' }}" |
| 147 | + |
| 148 | + - name: Compile source code |
| 149 | + shell: bash |
| 150 | + run: | |
| 151 | + cmake --build "${{ matrix.build-dir || 'build' }}" --config "${{ matrix.build-config || 'Release' }}" |
| 152 | +
|
0 commit comments