From 5dcc3a0a38c4ae6c0eac46d1c39b058fbc0a773e Mon Sep 17 00:00:00 2001 From: Anil Mahtani <929854+Anilm3@users.noreply.github.com> Date: Mon, 21 Oct 2024 15:58:50 +0100 Subject: [PATCH] Revert "Upgrade runners to macos-14 and fix deployment target" (#348) * Revert "Upgrade runners to macos-14 and fix deployment target (#344)" This reverts commit cd93e86b7f07a76bd97b9c70b6694d58adce89ab. --- .github/workflows/build.yml | 58 ++++++++++++++++++++------------ CMakeLists.txt | 20 +++-------- cmake/objects.cmake | 6 ---- cmake/package.cmake | 2 +- cmake/try_mem_resource_ftm.cpp | 8 ----- cmake/try_monotonic_resource.cpp | 7 ---- tests/CMakeLists.txt | 6 ---- 7 files changed, 42 insertions(+), 65 deletions(-) delete mode 100644 cmake/try_mem_resource_ftm.cpp delete mode 100644 cmake/try_monotonic_resource.cpp diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ccc91c300..3b9afeb61 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -54,13 +54,7 @@ jobs: ${{ github.workspace }}/packages/*.sha256 macos-build: - runs-on: macos-14 - strategy: - fail-fast: false - matrix: - arch: - - x86_64 - - arm64 + runs-on: macos-12 steps: - uses: actions/checkout@v4 with: @@ -68,10 +62,10 @@ jobs: - name: Create Build Directory run: cmake -E make_directory ${{ github.workspace }}/build ${{ github.workspace }}/packages - name: Generating Build Scripts - run: cmake -DCMAKE_OSX_ARCHITECTURES=${{ matrix.arch }} -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=${{ github.workspace }} -DCPACK_PACKAGE_DIRECTORY=${{ github.workspace }}/packages ${{ github.workspace }} + run: cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DMACOSX_DEPLOYMENT_TARGET=10.9 -DCMAKE_INSTALL_PREFIX=${{ github.workspace }} -DCPACK_PACKAGE_DIRECTORY=${{ github.workspace }}/packages ${{ github.workspace }} working-directory: ${{ github.workspace }}/build - name: Build Binaries - run: cmake --build . --config RelWithDebInfo --verbose --target all --target waf_test -j $(getconf _NPROCESSORS_ONLN) + run: cmake --build . --config RelWithDebInfo --verbose --target all --target waf_test -j working-directory: ${{ github.workspace }}/build - name: Test run: ${{ github.workspace }}/build/tests/waf_test @@ -87,14 +81,44 @@ jobs: run: for file in *.tar.gz; do shasum -a 256 "$file" > "$file.sha256"; done - uses: actions/upload-artifact@v4 with: - name: libddwaf-macos-${{ matrix.arch }} + name: libddwaf-macos-x86_64 + path: | + ${{ github.workspace }}/packages/*.tar.gz + ${{ github.workspace }}/packages/*.sha256 + + macos-cross-build: + runs-on: macos-12 + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + - name: Create Build Directory + run: cmake -E make_directory ${{ github.workspace }}/build ${{ github.workspace }}/packages + - name: Generating Build Scripts + run: cmake -DCMAKE_OSX_ARCHITECTURES=arm64 -DCMAKE_BUILD_TYPE=RelWithDebInfo -DMACOSX_DEPLOYMENT_TARGET=10.9 -DCMAKE_INSTALL_PREFIX=${{ github.workspace }} -DCPACK_PACKAGE_DIRECTORY=${{ github.workspace }}/packages ${{ github.workspace }} + working-directory: ${{ github.workspace }}/build + - name: Build Binaries + run: cmake --build . --config RelWithDebInfo --verbose --target all -j + working-directory: ${{ github.workspace }}/build + - name: Build Packages + run: cmake --build . --target package --config RelWithDebInfo --verbose + working-directory: ${{ github.workspace }}/build + - name: Remove Temporary Files + run: cmake -E remove_directory _CPack_Packages + working-directory: ${{ github.workspace }}/packages + - name: Generate Package sha256 + working-directory: ${{ github.workspace }}/packages + run: for file in *.tar.gz; do shasum -a 256 "$file" > "$file.sha256"; done + - uses: actions/upload-artifact@v4 + with: + name: libddwaf-macos-arm64 path: | ${{ github.workspace }}/packages/*.tar.gz ${{ github.workspace }}/packages/*.sha256 macos-universal-package: - runs-on: macos-14 - needs: [macos-build] + runs-on: macos-12 + needs: [macos-build, macos-cross-build] steps: - uses: actions/checkout@v4 - uses: actions/download-artifact@v4 @@ -123,14 +147,6 @@ jobs: # Change the current folder name with the universal name mv ./pack-temp/osx/libddwaf-*-darwin-* ./pack-temp/osx/$universalName - echo "--- x86_64 target ---" - file ./pack-temp/osx-x64/$x64Name/lib/libddwaf.dylib - otool -l ./pack-temp/osx-x64/$x64Name/lib/libddwaf.dylib | egrep "(minos|sdk)" - - echo "--- arm64 target ---" - file ./pack-temp/osx-arm64/$arm64Name/lib/libddwaf.dylib - otool -l ./pack-temp/osx-arm64/$arm64Name/lib/libddwaf.dylib | egrep "(minos|sdk)" - # Create the universal binary for the shared library: libddwaf.dylib lipo ./pack-temp/osx-x64/$x64Name/lib/libddwaf.dylib ./pack-temp/osx-arm64/$arm64Name/lib/libddwaf.dylib -create -output ./pack-temp/osx/$universalName/lib/libddwaf.dylib # Check the universal binary @@ -301,7 +317,7 @@ jobs: path: ${{ github.workspace }}/output-packages release: - needs: [ windows-builds, macos-build, docker-builds, linux-musl-build, package-nuget] + needs: [ windows-builds, macos-build, macos-cross-build, docker-builds, linux-musl-build, package-nuget] runs-on: ubuntu-latest if: startsWith(github.ref, 'refs/tags/') permissions: diff --git a/CMakeLists.txt b/CMakeLists.txt index 79986d955..0d34722e5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,10 +4,6 @@ file(READ "version" version) string(REGEX REPLACE "-(alpha|beta)[0-9]*$" "" mmp_version ${version}) -if (APPLE) - set(CMAKE_OSX_DEPLOYMENT_TARGET "12.7" CACHE STRING "Minimum OS X deployment version") -endif() - project(libddwaf VERSION "${mmp_version}") # Resetting the version allows for alpha and beta suffix releases @@ -39,6 +35,10 @@ option(LIBDDWAF_VECTORIZED_TRANSFORMERS "Enable vectorization for transformers" option(LIBDDWAF_ENABLE_LTO "Enable link-time optimisation" OFF) if(NOT MSVC) + if (APPLE) + set(CMAKE_OSX_DEPLOYMENT_TARGET "10.12" CACHE STRING "Minimum OS X deployment version") + endif() + add_compile_options(-Wall -Wextra -Wno-narrowing) if (CMAKE_BUILD_TYPE MATCHES Debug OR CMAKE_BUILD_TYPE MATCHES RelWithDebInfo) add_compile_options(-ggdb) @@ -65,18 +65,6 @@ try_compile(STDLIB_MAP_RECURSIVE ${CMAKE_CURRENT_BINARY_DIR} SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/cmake/try_rec_map.cpp CXX_STANDARD 20) -try_compile(STDLIB_MEMORY_RESOURCE_FTM ${CMAKE_CURRENT_BINARY_DIR} - SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/cmake/try_mem_resource_ftm.cpp - CXX_STANDARD 20) - -try_compile(STDLIB_MONOTONIC_RESOURCE ${CMAKE_CURRENT_BINARY_DIR} - SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/cmake/try_monotonic_resource.cpp - CXX_STANDARD 20) - -message(STATUS "Has recursive unordered_map : ${STDLIB_MAP_RECURSIVE}") -message(STATUS "Has memory_resource test macro : ${STDLIB_MEMORY_RESOURCE_FTM}") -message(STATUS "Has monotonic_resource : ${STDLIB_MONOTONIC_RESOURCE}") - # System dependencies set(LIBDDWAF_INTERFACE_LIBRARIES "") if(LINUX) diff --git a/cmake/objects.cmake b/cmake/objects.cmake index b8c028d5f..efc8011de 100644 --- a/cmake/objects.cmake +++ b/cmake/objects.cmake @@ -132,12 +132,6 @@ function(gen_objects target_name) target_compile_definitions(${target_name} PRIVATE HAS_NONRECURSIVE_UNORDERED_MAP) endif() - if (NOT STDLIB_MEMORY_RESOURCE_FTM AND STDLIB_MONOTONIC_RESOURCE) - # For some reason __cpp_lib_memory_resource seems to be missing in macos-14 when - # using the correct CMAKE_OSX_DEPLOYMENT_TARGET - target_compile_definitions(${target_name} PRIVATE __cpp_lib_memory_resource) - endif() - if (LIBDDWAF_VECTORIZED_TRANSFORMERS) target_compile_definitions(${target_name} PRIVATE LIBDDWAF_VECTORIZED_TRANSFORMERS) endif() diff --git a/cmake/package.cmake b/cmake/package.cmake index bdfd0fa84..9c39c398c 100644 --- a/cmake/package.cmake +++ b/cmake/package.cmake @@ -3,7 +3,7 @@ install(FILES ${libddwaf_SOURCE_DIR}/include/ddwaf.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) install(EXPORT libddwaf-config DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/cmake/libddwaf) -if(APPLE AND CMAKE_OSX_ARCHITECTURES MATCHES "x86_64") +if(APPLE AND CMAKE_OSX_ARCHITECTURES MATCHES "arm64") set(LIBDDWAF_PACKAGE_PROCESSOR ${CMAKE_OSX_ARCHITECTURES} CACHE STRING "Alternative processor for packaging purposes") else() set(LIBDDWAF_PACKAGE_PROCESSOR ${CMAKE_SYSTEM_PROCESSOR} CACHE STRING "Alternative processor for packaging purposes") diff --git a/cmake/try_mem_resource_ftm.cpp b/cmake/try_mem_resource_ftm.cpp deleted file mode 100644 index b62127277..000000000 --- a/cmake/try_mem_resource_ftm.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include -#include - -#if !defined(__cpp_lib_memory_resource) -# error "No memory resource available" -#endif - -int main() {} diff --git a/cmake/try_monotonic_resource.cpp b/cmake/try_monotonic_resource.cpp deleted file mode 100644 index 93ccafe73..000000000 --- a/cmake/try_monotonic_resource.cpp +++ /dev/null @@ -1,7 +0,0 @@ -#include - -int main() -{ - std::pmr::monotonic_buffer_resource mr; - return 0; -} diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 60b376dd8..5c3a9364f 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -14,12 +14,6 @@ if(NOT STDLIB_MAP_RECURSIVE) target_compile_definitions(waf_test PRIVATE HAS_NONRECURSIVE_UNORDERED_MAP) endif() -if (NOT STDLIB_MEMORY_RESOURCE_FTM AND STDLIB_MONOTONIC_RESOURCE) - # For some reason __cpp_lib_memory_resource seems to be missing in macos-14 when - # using the correct CMAKE_OSX_DEPLOYMENT_TARGET - target_compile_definitions(waf_test PRIVATE __cpp_lib_memory_resource) -endif() - if (LIBDDWAF_VECTORIZED_TRANSFORMERS) target_compile_definitions(waf_test PRIVATE LIBDDWAF_VECTORIZED_TRANSFORMERS) endif()