Use __config_site when building libc++. Also cleanup ABI versioning doc
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@250261 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e75ab2d..e70f869 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -321,6 +321,9 @@
include/__config_site.in
${LIBCXX_BINARY_DIR}/__config_site
@ONLY)
+ # Provide the config definitions by included the generated __config_site
+ # file at compile time.
+ add_compile_flags("-include ${LIBCXX_BINARY_DIR}/__config_site")
endif()
#===============================================================================
diff --git a/cmake/Modules/HandleLibcxxFlags.cmake b/cmake/Modules/HandleLibcxxFlags.cmake
index 3206505..bb886fa 100644
--- a/cmake/Modules/HandleLibcxxFlags.cmake
+++ b/cmake/Modules/HandleLibcxxFlags.cmake
@@ -49,10 +49,12 @@
endif()
endmacro()
+# Add a macro definition to the __config_site file if the specified condition
+# is 'true'. Note that '-D${def}' is not added. Instead it is expected that
+# the build include the '__config_site' header.
macro(config_define_if condition def)
if (${condition})
set(${def} ON)
- add_definitions(-D${def})
set(LIBCXX_NEEDS_SITE_CONFIG ON)
endif()
endmacro()
@@ -60,14 +62,12 @@
macro(config_define_if_not condition def)
if (NOT ${condition})
set(${def} ON)
- add_definitions(-D${def})
set(LIBCXX_NEEDS_SITE_CONFIG ON)
endif()
endmacro()
macro(config_define value def)
set(${def} ${value})
- add_definitions(-D${def}=${value})
set(LIBCXX_NEEDS_SITE_CONFIG ON)
endmacro()
diff --git a/docs/Abi.rst b/docs/DesignDocs/ABIVersioning.rst
similarity index 100%
rename from docs/Abi.rst
rename to docs/DesignDocs/ABIVersioning.rst
diff --git a/docs/index.rst b/docs/index.rst
index f34979f..7887611 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -128,6 +128,7 @@
:maxdepth: 1
DesignDocs/CapturingConfigInfo
+ DesignDocs/ABIVersioning
* `<atomic> design <http://libcxx.llvm.org/atomic_design.html>`_
diff --git a/test/libcxx/test/config.py b/test/libcxx/test/config.py
index 3cc1d3b..fd9b476 100644
--- a/test/libcxx/test/config.py
+++ b/test/libcxx/test/config.py
@@ -444,7 +444,9 @@
def configure_compile_flags_abi_version(self):
abi_version = self.get_lit_conf('abi_version', '').strip()
abi_unstable = self.get_lit_bool('abi_unstable')
- if abi_version:
+ # Only add the ABI version when it is non-default.
+ # FIXME(EricWF): Get the ABI version from the "__config_site".
+ if abi_version and abi_version != '1':
self.cxx.compile_flags += ['-D_LIBCPP_ABI_VERSION=' + abi_version]
if abi_unstable:
self.config.available_features.add('libcpp-abi-unstable')