diff --git a/.github/workflows/build-matrix.yaml b/.github/workflows/build-matrix.yaml index ed78b1f66f..d86eba372f 100644 --- a/.github/workflows/build-matrix.yaml +++ b/.github/workflows/build-matrix.yaml @@ -42,3 +42,11 @@ jobs: cmakePreset: "Release-linux-gcc" cachePrefix: "" secrets: inherit + + # MacOS + build_macos_clang: + name: "🍎 MacOS" + uses: ./.github/workflows/macos-build-clang.yaml + with: + cmakePreset: "Release-macos-clang" + cachePrefix: "" diff --git a/.github/workflows/linux-build-clang.yaml b/.github/workflows/linux-build-clang.yaml index 163fdefbc7..10dee0dd1b 100644 --- a/.github/workflows/linux-build-clang.yaml +++ b/.github/workflows/linux-build-clang.yaml @@ -50,7 +50,7 @@ jobs: -DCMAKE_CXX_COMPILER_LAUNCHER=${{ github.workspace }}/buildcache/bin/buildcache - name: Build Project - run: cmake --build build -j$((`nproc`+1)) + run: cmake --build build --parallel $((`nproc`)) - name: Run Tests env: diff --git a/.github/workflows/linux-build-gcc.yaml b/.github/workflows/linux-build-gcc.yaml index ce47ca9609..1d37cbe153 100644 --- a/.github/workflows/linux-build-gcc.yaml +++ b/.github/workflows/linux-build-gcc.yaml @@ -51,7 +51,7 @@ jobs: -DCMAKE_CXX_COMPILER_LAUNCHER=${{ github.workspace }}/buildcache/bin/buildcache - name: Build Project - run: cmake --build build -j$((`nproc`+1)) -- -w dupbuild=warn + run: cmake --build build --parallel $((`nproc`)) -- -w dupbuild=warn - name: Run Tests - With Coverage working-directory: ./build diff --git a/.github/workflows/macos-build-clang.yaml b/.github/workflows/macos-build-clang.yaml new file mode 100644 index 0000000000..6d34e41eab --- /dev/null +++ b/.github/workflows/macos-build-clang.yaml @@ -0,0 +1,76 @@ +name: MacOS Build Clang + +on: + workflow_call: + inputs: + cmakePreset: + required: true + type: string + cachePrefix: + required: true + type: string + +jobs: + build: + name: Clang + runs-on: macos-12 + timeout-minutes: 120 + + env: # overrides: https://github.com/mbitsnbites/buildcache/blob/master/doc/configuration.md + BUILDCACHE_MAX_CACHE_SIZE: 1000000000 # 1gb + BUILDCACHE_COMPRESS_FORMAT: ZSTD + BUILDCACHE_COMPRESS_LEVEL: 19 + BUILDCACHE_DIRECT_MODE: true + BUILDCACHE_LOG_FILE: ${{ github.workspace }}/buildcache.log + + steps: + - name: Checkout Repository + uses: actions/checkout@v3 + + - name: Install Package Dependencies + run: brew install cmake nasm ninja + + - name: Setup Buildcache + uses: mikehardy/buildcache-action@v2.1.0 + with: + cache_key: macos-12-${{ inputs.cachePrefix }}-${{ inputs.cmakePreset }} + buildcache_tag: v0.28.1 + + - name: CMake Generation + env: + CC: clang + CXX: clang++ + run: | + cmake -B build --preset=${{ inputs.cmakePreset }} \ + -DCMAKE_C_COMPILER_LAUNCHER=${{ github.workspace }}/buildcache/bin/buildcache \ + -DCMAKE_CXX_COMPILER_LAUNCHER=${{ github.workspace }}/buildcache/bin/buildcache + + # Disabled for now, not all build targets are valid + # - name: Build Project + # run: cmake --build build --parallel $((`sysctl -n hw.logicalcpu`)) + + # Temporary, selectively build those that work + - name: Build Working Targets + run: | + cmake --build build --target extractor --parallel $((`sysctl -n hw.logicalcpu`)) && \ + cmake --build build --target offline-test --parallel $((`sysctl -n hw.logicalcpu`)) && \ + cmake --build build --target decompiler --parallel $((`sysctl -n hw.logicalcpu`)) && \ + cmake --build build --target lsp --parallel $((`sysctl -n hw.logicalcpu`)) && \ + cmake --build build --target goalc --parallel $((`sysctl -n hw.logicalcpu`)) + + - name: Run Tests + continue-on-error: true # until macOS is stable + env: + GTEST_OUTPUT: "xml:opengoal-test-report.xml" + run: ./test.sh + + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: opengoal-macos-${{ inputs.cachePrefix }} + if-no-files-found: error + path: | + ./build/goalc/goalc + ./build/decompiler/extractor + ./build/game/gk + ./build/lsp/lsp diff --git a/.github/workflows/windows-build-clang.yaml b/.github/workflows/windows-build-clang.yaml index 7b934c05c1..fcfec40b91 100644 --- a/.github/workflows/windows-build-clang.yaml +++ b/.github/workflows/windows-build-clang.yaml @@ -44,7 +44,7 @@ jobs: - name: Build Project shell: cmd - run: cmake --build build -j 2 + run: cmake --build build --parallel %NUMBER_OF_PROCESSORS% - name: Run Tests timeout-minutes: 10 diff --git a/.github/workflows/windows-build-msvc.yaml b/.github/workflows/windows-build-msvc.yaml index 60c09fb165..4d0cfefe60 100644 --- a/.github/workflows/windows-build-msvc.yaml +++ b/.github/workflows/windows-build-msvc.yaml @@ -45,7 +45,7 @@ jobs: shell: cmd run: | set CL=/MP - cmake --build build -j 2 + cmake --build build --parallel %NUMBER_OF_PROCESSORS% - name: Run Tests timeout-minutes: 10 diff --git a/CMakeLists.txt b/CMakeLists.txt index c0c3caf097..ef4266035b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -98,6 +98,7 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") message(STATUS "AppleClang detected - Setting Defaults") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} \ + -march=native \ -Wall \ -Winit-self \ -ggdb \ diff --git a/CMakePresets.json b/CMakePresets.json index 509d757aea..10e00011b2 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -57,6 +57,16 @@ "CMAKE_INSTALL_PREFIX": "${sourceDir}/build/install/${presetName}" } }, + { + "name": "base-macos-release", + "hidden": true, + "inherits": "base", + "binaryDir": "${sourceDir}/build/Release/bin", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Release", + "CMAKE_INSTALL_PREFIX": "${sourceDir}/build/install/${presetName}" + } + }, { "name": "base-clang", "hidden": true, @@ -127,6 +137,12 @@ "description": "Build with Clang as Release without Debug Symbols", "inherits": ["base-linux-release", "base-clang"] }, + { + "name": "Release-macos-clang", + "displayName": "MacOS Release (clang)", + "description": "Build with Clang as Release without Debug Symbols", + "inherits": ["base-macos-release", "base-clang"] + }, { "name": "Release-linux-clang-asan", "displayName": "Linux Release (clang-asan)", diff --git a/README.md b/README.md index fcb5c55882..dfb47fff56 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@
-
+
diff --git a/common/goos/Interpreter.cpp b/common/goos/Interpreter.cpp
index 03a3597d4d..bc1b927347 100644
--- a/common/goos/Interpreter.cpp
+++ b/common/goos/Interpreter.cpp
@@ -9,9 +9,9 @@
#include "ParseHelpers.h"
+#include "common/log/log.h"
#include "common/util/FileUtil.h"
#include "common/util/unicode_util.h"
-#include