Skip to content

Commit 8da36bd

Browse files
committed
[build] Fix script for conda MacOS
1 parent 8213295 commit 8da36bd

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

cmake/scripts/std_modulemap_darwin_fix.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,13 @@ def main():
2525
output_path = sys.argv[1]
2626
sdk = get_sdk_path()
2727
cpp_modulemap = os.path.join(sdk, "usr/include/c++/v1/module.modulemap")
28+
if not os.path.exists(cpp_modulemap):
29+
# Try again if we are running a conda build. conda-forge ships the MacOS SDK stripped of libc++.
30+
# Instead, the standard libraries are shipped as a separate package which must be declared as a build
31+
# dependency and thus ends up in the $BUILD_PREFIX path. For explanation, see
32+
# https://conda-forge.zulipchat.com/#narrow/channel/516932-compilers/topic/Organisation.20of.20libc.2B.2B.20and.20SDKs.20on.20MacOS
33+
if (os.environ.get("CONDA_BUILD", "0") == "1") and (os.environ.get("BUILD_PREFIX", None) is not None):
34+
cpp_modulemap = os.path.join(os.environ["BUILD_PREFIX"], "include/c++/v1/module.modulemap")
2835

2936
if not os.path.exists(cpp_modulemap):
3037
raise FileNotFoundError(f"Cannot find libc++ modulemap at {cpp_modulemap}")

0 commit comments

Comments
 (0)