From 18ced3b5c6b2ae5c512d18e3cfddc477a7fe7763 Mon Sep 17 00:00:00 2001 From: Frederik Carlier Date: Mon, 18 Nov 2024 11:01:52 +0100 Subject: [PATCH] Windows: Support building with strict compatibility --- .github/workflows/main.yml | 7 ++++--- CMakeLists.txt | 5 +++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4ed8230..862c914 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -199,6 +199,7 @@ jobs: os: [ windows-2019 ] msystem: [ ucrt64, mingw64, clang64 ] build-type: [ Release, Debug ] + strict-apple-compatibility: [ ON, OFF ] include: - msystem: ucrt64 package-prefix: ucrt-x86_64 @@ -213,7 +214,7 @@ jobs: # Don't abort runners if a single one fails fail-fast: false runs-on: ${{ matrix.os }} - name: ${{ matrix.os }} ${{ matrix.msystem }} ${{ matrix.build-type}} + name: ${{ matrix.os }} ${{ matrix.msystem }} ${{ matrix.build-type}} (Strict Apple compatibility ${{ matrix.strict-apple-compatibility }}) defaults: run: shell: msys2 {0} @@ -228,7 +229,7 @@ jobs: run: | mkdir build cd build - ${{ matrix.cmake-flags }} cmake .. -DTESTS=ON -DCMAKE_C_COMPILER="clang" -DCMAKE_CXX_COMPILER="clang++" -DCMAKE_BUILD_TYPE=${{ matrix.build-type }} + ${{ matrix.cmake-flags }} cmake .. -DTESTS=ON -DCMAKE_C_COMPILER="clang" -DCMAKE_CXX_COMPILER="clang++" -DCMAKE_BUILD_TYPE=${{ matrix.build-type }} -DSTRICT_APPLE_COMPATIBILITY=${{ matrix.strict-apple-compatibility }} - name: Build working-directory: build run: | @@ -243,7 +244,7 @@ jobs: cmake --install . --prefix=../dist - uses: actions/upload-artifact@v4 with: - name: ${{ matrix.msystem }}-${{ matrix.build-type }} + name: ${{ matrix.msystem }}-${{ matrix.build-type }}-compat-${{ matrix.strict-apple-compatibility }} path: dist/ # Fake check that can be used as a branch-protection rule. diff --git a/CMakeLists.txt b/CMakeLists.txt index 4d7e41b..945da02 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -44,7 +44,7 @@ endif() message(STATUS "Architecture as detected by CMake: ${CMAKE_SYSTEM_PROCESSOR}") # Build configuration -add_compile_definitions(GNUSTEP __OBJC_RUNTIME_INTERNAL__=1) +add_compile_definitions(GNUSTEP __OBJC_RUNTIME_INTERNAL__=1 __OBJC_BOOL) set(CMAKE_CXX_STANDARD 17) @@ -143,7 +143,7 @@ option(DEBUG_ARC_COMPAT "Log warnings for classes that don't hit ARC fast paths" OFF) option(ENABLE_OBJCXX "Enable support for Objective-C++" ON) option(TESTS "Enable building the tests") - +option(STRICT_APPLE_COMPATIBILITY "Use strict Apple compatibility, always defining BOOL as signed char" OFF) # For release builds, we disable spamming the terminal with warnings about # selector type mismatches @@ -151,6 +151,7 @@ add_compile_definitions($<$:NO_SELECTOR_MISMATCH_WARNINGS>) add_compile_definitions($<$:TYPE_DEPENDENT_DISPATCH>) add_compile_definitions($<$:WITH_TRACING=1>) add_compile_definitions($<$:DEBUG_ARC_COMPAT>) +add_compile_definitions($<$:STRICT_APPLE_COMPATIBILITY>) if (OLDABI_COMPAT) list(APPEND libobjc_C_SRCS legacy.c abi_version.c statics_loader.c) -- 2.47.0.windows.1