Skip to content
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
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ if(CMAKE_HOST_APPLE AND (NOT CMAKE_OSX_SYSROOT OR CMAKE_OSX_SYSROOT STREQUAL "")

set(CMAKE_OSX_SYSROOT "${SDK_PATH}" CACHE PATH "SDK path" FORCE)
else()
message(WARNING "The CMAKE_OSX_SYSROOT variable is not set and the 'xcrun' executable is not available. "
"This build of ROOT might not be able to find the correct MacOS SDK.")
message(FATAL_ERROR "The CMAKE_OSX_SYSROOT variable is not set and the 'xcrun' executable is not available. "
"This build of ROOT cannot find the correct MacOS SDK.")
endif()
endif()

Expand Down
18 changes: 5 additions & 13 deletions cmake/scripts/std_modulemap_darwin_fix.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,9 @@
#!/usr/bin/env python3
import os
import re
import subprocess

Check failure on line 4 in cmake/scripts/std_modulemap_darwin_fix.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (F401)

cmake/scripts/std_modulemap_darwin_fix.py:4:8: F401 `subprocess` imported but unused
import sys

Check failure on line 5 in cmake/scripts/std_modulemap_darwin_fix.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (I001)

cmake/scripts/std_modulemap_darwin_fix.py:2:1: I001 Import block is un-sorted or un-formatted


def get_sdk_path():
result = subprocess.run(["xcrun", "--show-sdk-path"], capture_output=True, text=True)
if result.returncode != 0:
raise RuntimeError("Could not resolve SDK path")
return os.path.realpath(result.stdout.strip())


def remove_ctype_module(content):
# Break cyclic module dependencies
# See: https://github.com/root-project/root/commit/8045591a17125b49c1007787c586868dea764479
Expand All @@ -20,11 +12,11 @@


def main():
if len(sys.argv) < 2:
raise ValueError("Usage: std_modulemap_darwin_fix.py <output_path>")
output_path = sys.argv[1]
sdk = get_sdk_path()
cpp_modulemap = os.path.join(sdk, "usr/include/c++/v1/module.modulemap")
if len(sys.argv) < 3:
raise ValueError("Usage: std_modulemap_darwin_fix.py <sdk_path> <output_path>")
sdk_path = sys.argv[1]
output_path = sys.argv[2]
cpp_modulemap = os.path.join(sdk_path, "usr/include/c++/v1/module.modulemap")
if not os.path.exists(cpp_modulemap):
# Try again if we are running a conda build. conda-forge ships the MacOS SDK stripped of libc++.
# Instead, the standard libraries are shipped as a separate package which must be declared as a build
Expand Down
2 changes: 1 addition & 1 deletion core/clingutils/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ if (runtime_cxxmodules)

add_custom_command(
OUTPUT ${GENERATED_MODULEMAP}
COMMAND ${Python3_EXECUTABLE} ${PROJECT_SOURCE_DIR}/cmake/scripts/std_modulemap_darwin_fix.py ${GENERATED_MODULEMAP}
COMMAND ${Python3_EXECUTABLE} ${PROJECT_SOURCE_DIR}/cmake/scripts/std_modulemap_darwin_fix.py ${CMAKE_OSX_SYSROOT} ${GENERATED_MODULEMAP}
DEPENDS ${PROJECT_SOURCE_DIR}/cmake/scripts/std_modulemap_darwin_fix.py
COMMENT "Generating wrapped std modulemap for macOS SDK"
)
Expand Down
Loading