Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: universal2 build #90

Merged
merged 1 commit into from
Nov 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -111,6 +135,7 @@ else()
USES_TERMINAL_CONFIGURE 1
USES_TERMINAL_BUILD 1
INSTALL_COMMAND ""
CMAKE_CACHE_ARGS ${_cache_args}
DEPENDS
download_ninja_source
)
Expand Down
10 changes: 10 additions & 0 deletions scripts/repair_wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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}"
Expand Down