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

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Fri Feb 26 10:12:08 PST 2021


Author: Louis Dionne
Date: 2021-02-26T13:11:49-05:00
New Revision: 27f9ed78506329cbf14b91eb545ca7419a983e00

URL: https://github.com/llvm/llvm-project/commit/27f9ed78506329cbf14b91eb545ca7419a983e00
DIFF: https://github.com/llvm/llvm-project/commit/27f9ed78506329cbf14b91eb545ca7419a983e00.diff

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

Added: 
    

Modified: 
    libcxx/test/configs/libcxx-trunk-shared.cfg.in
    libcxx/test/configs/libcxx-trunk-static.cfg.in

Removed: 
    


################################################################################
diff  --git a/libcxx/test/configs/libcxx-trunk-shared.cfg.in b/libcxx/test/configs/libcxx-trunk-shared.cfg.in
index c2ea900c680b..13ebde990fbe 100644
--- a/libcxx/test/configs/libcxx-trunk-shared.cfg.in
+++ b/libcxx/test/configs/libcxx-trunk-shared.cfg.in
@@ -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(

diff  --git a/libcxx/test/configs/libcxx-trunk-static.cfg.in b/libcxx/test/configs/libcxx-trunk-static.cfg.in
index 11fba98f64f3..8b39a6650726 100644
--- a/libcxx/test/configs/libcxx-trunk-static.cfg.in
+++ b/libcxx/test/configs/libcxx-trunk-static.cfg.in
@@ -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(


        


More information about the libcxx-commits mailing list