Skip to content

Commit

Permalink
lit: Add -isysroot as extra configurable compiler flag
Browse files Browse the repository at this point in the history
  • Loading branch information
antoniofrighetto committed Nov 29, 2024
1 parent f9913dd commit f1d9aa7
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/test/lit.cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from lit.llvm import llvm_config

config.name = "O-MVLL Tests"
config.suffixes = ['.c', '.cpp', '.ll']
config.suffixes = ['.c', '.cpp', '.ll', '.m']
config.test_format = lit.formats.ShTest(True)
config.test_source_root = os.path.dirname(__file__)

Expand Down Expand Up @@ -60,17 +60,20 @@
print("Available features are:", config.available_features)

extra_linker_flags = ''
extra_cc_flags = ''
if sys.platform == 'darwin':
try:
cmd = ["xcrun", "--show-sdk-path", "--sdk", "macosx"]
cmd = ["xcrun", "--show-sdk-path", "--sdk", "iphoneos"]
sdk_path = subprocess.check_output(cmd, stderr=subprocess.PIPE).strip().decode()
print("Using SDKROOT:", sdk_path)
extra_linker_flags = '-Wl,-L{}/usr/lib -Wl,-lSystem'.format(sdk_path)
extra_cc_flags = '-isysroot {}'.format(sdk_path)
except (subprocess.CalledProcessError, OSError):
print("xcrun not found. Please run command: xcode-select --install")
exit(1)

config.substitutions.append(('%EXTRA_LINKER_FLAGS', extra_linker_flags))
config.substitutions.append(('%EXTRA_CC_FLAGS', extra_cc_flags))

# We need this to find the Python standard library
if 'OMVLL_PYTHONPATH' in os.environ:
Expand Down

0 comments on commit f1d9aa7

Please sign in to comment.