[libc++] Make the from-scratch config work on macOS out-of-the-box

This commit is contained in:
Louis Dionne 2021-02-26 13:11:00 -05:00
parent 7820518d55
commit 27f9ed7850
2 changed files with 37 additions and 11 deletions

View File

@ -4,6 +4,7 @@ LIBCXX_ROOT = "@LIBCXX_SOURCE_DIR@"
INSTALL_ROOT = "@CMAKE_BINARY_DIR@"
COMPILER = "@CMAKE_CXX_COMPILER@"
EXEC_ROOT = "@LIBCXX_BINARY_DIR@"
CMAKE_OSX_SYSROOT = "@CMAKE_OSX_SYSROOT@";
import os
import pipes
@ -25,11 +26,23 @@ config.test_exec_root = EXEC_ROOT
# Configure basic substitutions
runPy = os.path.join(LIBCXX_ROOT, 'utils', 'run.py')
config.substitutions.append(('%{cxx}', COMPILER))
config.substitutions.append(('%{flags}', ''))
config.substitutions.append(('%{compile_flags}', '-nostdinc++ -isystem {} -I {}'.format(os.path.join(INSTALL_ROOT, 'include', 'c++', 'v1'),
os.path.join(LIBCXX_ROOT, 'test', 'support'))))
config.substitutions.append(('%{link_flags}', '-nostdlib++ -L {0} -lc++ -Wl,-rpath,{0}'.format(os.path.join(INSTALL_ROOT, 'lib'))))
config.substitutions.append(('%{exec}', '{} {} --execdir %T -- '.format(pipes.quote(sys.executable), pipes.quote(runPy))))
config.substitutions.append(('%{flags}',
'-isysroot {}'.format(CMAKE_OSX_SYSROOT) if CMAKE_OSX_SYSROOT else ''
))
config.substitutions.append(('%{compile_flags}',
'-nostdinc++ -isystem {} -I {}'.format(
os.path.join(INSTALL_ROOT, 'include', 'c++', 'v1'),
os.path.join(LIBCXX_ROOT, 'test', 'support'))
))
config.substitutions.append(('%{link_flags}',
'-nostdlib++ -L {0} -lc++ -Wl,-rpath,{0}'.format(
os.path.join(INSTALL_ROOT, 'lib'))
))
config.substitutions.append(('%{exec}',
'{} {} --execdir %T -- '.format(
pipes.quote(sys.executable),
pipes.quote(runPy))
))
# Add parameters and features to the config
libcxx.test.newconfig.configure(

View File

@ -4,6 +4,7 @@ LIBCXX_ROOT = "@LIBCXX_SOURCE_DIR@"
INSTALL_ROOT = "@CMAKE_BINARY_DIR@"
COMPILER = "@CMAKE_CXX_COMPILER@"
EXEC_ROOT = "@LIBCXX_BINARY_DIR@"
CMAKE_OSX_SYSROOT = "@CMAKE_OSX_SYSROOT@";
import os
import pipes
@ -25,12 +26,24 @@ config.test_exec_root = EXEC_ROOT
# Configure basic substitutions
runPy = os.path.join(LIBCXX_ROOT, 'utils', 'run.py')
config.substitutions.append(('%{cxx}', COMPILER))
config.substitutions.append(('%{flags}', ''))
config.substitutions.append(('%{compile_flags}', '-nostdinc++ -isystem {} -I {}'.format(os.path.join(INSTALL_ROOT, 'include', 'c++', 'v1'),
os.path.join(LIBCXX_ROOT, 'test', 'support'))))
config.substitutions.append(('%{link_flags}', '-nostdlib++ {} {}'.format(os.path.join(INSTALL_ROOT, 'lib', 'libc++.a'),
os.path.join(INSTALL_ROOT, 'lib', 'libc++abi.a'))))
config.substitutions.append(('%{exec}', '{} {} --execdir %T -- '.format(pipes.quote(sys.executable), pipes.quote(runPy))))
config.substitutions.append(('%{flags}',
'-isysroot {}'.format(CMAKE_OSX_SYSROOT) if CMAKE_OSX_SYSROOT else ''
))
config.substitutions.append(('%{compile_flags}',
'-nostdinc++ -isystem {} -I {}'.format(
os.path.join(INSTALL_ROOT, 'include', 'c++', 'v1'),
os.path.join(LIBCXX_ROOT, 'test', 'support'))
))
config.substitutions.append(('%{link_flags}',
'-nostdlib++ {} {}'.format(
os.path.join(INSTALL_ROOT, 'lib', 'libc++.a'),
os.path.join(INSTALL_ROOT, 'lib', 'libc++abi.a'))
))
config.substitutions.append(('%{exec}',
'{} {} --execdir %T -- '.format(
pipes.quote(sys.executable),
pipes.quote(runPy))
))
# Add parameters and features to the config
libcxx.test.newconfig.configure(