[libc++] Overhaul how we select the ABI library

This patch overhauls how we pick up the ABI library. Instead of setting
ad-hoc flags, it creates interface targets that can be linked against by
the rest of the build, which is easier to follow and extend to support
new ABI libraries.

This is intended to be a NFC change, however there are some additional
simplifications and improvements we can make in the future that would
require a slight behavior change.

Differential Revision: https://reviews.llvm.org/D120727

GitOrigin-RevId: a80e65e00ada7a9c16acf17a5fd40b4f12ced3a8
diff --git a/test/configs/apple-libc++abi-backdeployment.cfg.in b/test/configs/apple-libc++abi-backdeployment.cfg.in
index 5839b82..510ab8a 100644
--- a/test/configs/apple-libc++abi-backdeployment.cfg.in
+++ b/test/configs/apple-libc++abi-backdeployment.cfg.in
@@ -45,7 +45,7 @@
     '-isysroot {}'.format('@CMAKE_OSX_SYSROOT@') if '@CMAKE_OSX_SYSROOT@' else ''
 ))
 config.substitutions.append(('%{compile_flags}',
-    '-nostdinc++ -I %{include} -DLIBCXXABI_NO_TIMER -D_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS ' +
+    '-nostdinc++ -I %{include} -I %{cxx-include} -I %{cxx-target-include} -DLIBCXXABI_NO_TIMER -D_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS ' +
     '-I %{libcxx}/test/support -I %{libcxx}/src'
 ))
 config.substitutions.append(('%{link_flags}',
diff --git a/test/configs/apple-libc++abi-shared.cfg.in b/test/configs/apple-libc++abi-shared.cfg.in
index 17428b9..3a744db 100644
--- a/test/configs/apple-libc++abi-shared.cfg.in
+++ b/test/configs/apple-libc++abi-shared.cfg.in
@@ -6,7 +6,7 @@
     '-isysroot {}'.format('@CMAKE_OSX_SYSROOT@') if '@CMAKE_OSX_SYSROOT@' else ''
 ))
 config.substitutions.append(('%{compile_flags}',
-    '-nostdinc++ -I %{include} -DLIBCXXABI_NO_TIMER -D_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS ' +
+    '-nostdinc++ -I %{include} -I %{cxx-include} -I %{cxx-target-include} -DLIBCXXABI_NO_TIMER -D_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS ' +
     '-I %{libcxx}/test/support -I %{libcxx}/src'
 ))
 config.substitutions.append(('%{link_flags}',
diff --git a/test/configs/cmake-bridge.cfg.in b/test/configs/cmake-bridge.cfg.in
index eb3caf0..4c37681 100644
--- a/test/configs/cmake-bridge.cfg.in
+++ b/test/configs/cmake-bridge.cfg.in
@@ -28,7 +28,8 @@
 
 config.substitutions.append(('%{cxx}', '@CMAKE_CXX_COMPILER@'))
 config.substitutions.append(('%{libcxx}', '@LIBCXXABI_LIBCXX_PATH@'))
-config.substitutions.append(('%{include}', '@LIBCXXABI_HEADER_DIR@/include/c++/v1'))
-config.substitutions.append(('%{target-include}', '@LIBCXXABI_HEADER_DIR@/%{triple}/include/c++/v1'))
+config.substitutions.append(('%{include}', '@LIBCXXABI_SOURCE_DIR@/include'))
+config.substitutions.append(('%{cxx-include}', '@LIBCXXABI_HEADER_DIR@/include/c++/v1'))
+config.substitutions.append(('%{cxx-target-include}', '@LIBCXXABI_HEADER_DIR@/%{triple}/include/c++/v1'))
 config.substitutions.append(('%{lib}', '@LIBCXXABI_LIBRARY_DIR@'))
 config.substitutions.append(('%{executor}', '@LIBCXXABI_EXECUTOR@'))
diff --git a/test/configs/ibm-libc++abi-shared.cfg.in b/test/configs/ibm-libc++abi-shared.cfg.in
index 439d250..874e735 100644
--- a/test/configs/ibm-libc++abi-shared.cfg.in
+++ b/test/configs/ibm-libc++abi-shared.cfg.in
@@ -4,7 +4,7 @@
 
 config.substitutions.append(('%{flags}',''))
 config.substitutions.append(('%{compile_flags}',
-    '-nostdinc++ -I %{include} ' +
+    '-nostdinc++ -I %{include} -I %{cxx-include} -I %{cxx-target-include} ' +
     '-D__LIBC_NO_CPP_MATH_OVERLOADS__ -DLIBCXXABI_NO_TIMER ' +
     '-D_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS ' +
     '-I %{libcxx}/test/support -I %{libcxx}/src'