diff --git a/CMakeLists.txt b/CMakeLists.txt index 0e7a1e9..7674943 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -102,6 +102,30 @@ if(UNIX AND NOT APPLE) ) else() set(Ninja_BINARY_DIR ${CMAKE_BINARY_DIR}/Ninja-build) + # cache arguments + set(_cache_args ) + foreach(var_name IN ITEMS + CMAKE_BUILD_TYPE + CMAKE_TOOLCHAIN_FILE + CMAKE_BUILD_PARALLEL_LEVEL + CMAKE_JOB_POOLS + CMAKE_JOB_POOL_COMPILE + CMAKE_JOB_POOL_LINK + CMAKE_OSX_DEPLOYMENT_TARGET + CMAKE_OSX_ARCHITECTURES + CMAKE_OSX_SYSROOT + ) + if(DEFINED ${var_name}) + list(APPEND _cache_args + -D${var_name}:STRING=${${var_name}} + ) + message(STATUS "SuperBuild - ${var_name}: ${${var_name}}") + endif() + endforeach() + # _cache_args should not be empty + list(APPEND _cache_args + -DNINJA_SUPERBUILD:BOOL=true + ) ExternalProject_add(build_ninja SOURCE_DIR ${Ninja_SOURCE_DIR} BINARY_DIR ${Ninja_BINARY_DIR} @@ -111,6 +135,7 @@ else() USES_TERMINAL_CONFIGURE 1 USES_TERMINAL_BUILD 1 INSTALL_COMMAND "" + CMAKE_CACHE_ARGS ${_cache_args} DEPENDS download_ninja_source ) diff --git a/scripts/repair_wheel.py b/scripts/repair_wheel.py index bba62b2..7338383 100644 --- a/scripts/repair_wheel.py +++ b/scripts/repair_wheel.py @@ -5,6 +5,7 @@ import subprocess import sys import tempfile +import zipfile from pathlib import Path from convert_to_generic_platform_wheel import convert_to_generic_platform_wheel @@ -58,6 +59,15 @@ def main(): # we need to handle macOS x86_64 & arm64 here for now, let's use additional_platforms for this. additional_platforms = [] if os_ == "macos": + # delocate-wheel --require-archs does not seem to check executables... + with tempfile.TemporaryDirectory() as tmpdir2_: + tmpdir2 = Path(tmpdir2_) + with zipfile.ZipFile(file, 'r') as zip_ref: + zip_ref.extractall(tmpdir2) + exe = list(tmpdir2.glob("**/bin/ninja")) + assert len(exe) == 1, exe + subprocess.run(["lipo", str(exe[0]), "-verify_arch", "x86_64", "arm64"], check=True, stdout=subprocess.PIPE) + # first, get the target macOS deployment target from the wheel match = re.match(r"^.*-macosx_(\d+)_(\d+)_.*\.whl$", file.name) assert match is not None, f"Couldn't match on {file.name}"