[libcxx] r275759 - Rework libatomic handling in CMake and LIT.
Eric Fiselier via cfe-commits
cfe-commits at lists.llvm.org
Sun Jul 17 23:01:51 PDT 2016
Author: ericwf
Date: Mon Jul 18 01:01:50 2016
New Revision: 275759
URL: http://llvm.org/viewvc/llvm-project?rev=275759&view=rev
Log:
Rework libatomic handling in CMake and LIT.
This patch updates the way libc++ handles checking for libatomic, in part
to prepare for https://reviews.llvm.org/D22073.
Changes:
* 'LIBCXX_HAS_ATOMIC_LIB' is now set whenever libatomic is available even libc++
doesn't need to manually link it.
* 'LIBCXX_HAVE_CXX_ATOMICS_WITH_LIB' is now used to detect when libatomic
needs to be manually linked.
* 'LIBCXX_HAS_ATOMIC_LIB' now adds 'libatomic' as a available feature in the
test suite.
Modified:
libcxx/trunk/cmake/Modules/CheckLibcxxAtomic.cmake
libcxx/trunk/lib/CMakeLists.txt
libcxx/trunk/test/CMakeLists.txt
libcxx/trunk/test/libcxx/test/config.py
libcxx/trunk/test/lit.site.cfg.in
Modified: libcxx/trunk/cmake/Modules/CheckLibcxxAtomic.cmake
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/cmake/Modules/CheckLibcxxAtomic.cmake?rev=275759&r1=275758&r2=275759&view=diff
==============================================================================
--- libcxx/trunk/cmake/Modules/CheckLibcxxAtomic.cmake (original)
+++ libcxx/trunk/cmake/Modules/CheckLibcxxAtomic.cmake Mon Jul 18 01:01:50 2016
@@ -26,9 +26,9 @@ int main() {
endfunction(check_cxx_atomics)
check_cxx_atomics(LIBCXX_HAVE_CXX_ATOMICS_WITHOUT_LIB)
+check_library_exists(atomic __atomic_fetch_add_8 "" LIBCXX_HAS_ATOMIC_LIB)
# If not, check if the library exists, and atomics work with it.
if(NOT LIBCXX_HAVE_CXX_ATOMICS_WITHOUT_LIB)
- check_library_exists(atomic __atomic_fetch_add_8 "" LIBCXX_HAS_ATOMIC_LIB)
if(LIBCXX_HAS_ATOMIC_LIB)
list(APPEND CMAKE_REQUIRED_LIBRARIES "atomic")
check_cxx_atomics(LIBCXX_HAVE_CXX_ATOMICS_WITH_LIB)
Modified: libcxx/trunk/lib/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/lib/CMakeLists.txt?rev=275759&r1=275758&r2=275759&view=diff
==============================================================================
--- libcxx/trunk/lib/CMakeLists.txt (original)
+++ libcxx/trunk/lib/CMakeLists.txt Mon Jul 18 01:01:50 2016
@@ -79,7 +79,7 @@ add_library_flags_if(LIBCXX_HAS_C_LIB c)
add_library_flags_if(LIBCXX_HAS_M_LIB m)
add_library_flags_if(LIBCXX_HAS_RT_LIB rt)
add_library_flags_if(LIBCXX_HAS_GCC_S_LIB gcc_s)
-add_library_flags_if(LIBCXX_HAS_ATOMIC_LIB atomic)
+add_library_flags_if(LIBCXX_HAVE_CXX_ATOMICS_WITH_LIB atomic)
# Setup flags.
add_flags_if_supported(-fPIC)
Modified: libcxx/trunk/test/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/CMakeLists.txt?rev=275759&r1=275758&r2=275759&view=diff
==============================================================================
--- libcxx/trunk/test/CMakeLists.txt (original)
+++ libcxx/trunk/test/CMakeLists.txt Mon Jul 18 01:01:50 2016
@@ -19,6 +19,7 @@ pythonize_bool(LIBCXX_GENERATE_COVERAGE)
pythonize_bool(LIBCXXABI_ENABLE_SHARED)
pythonize_bool(LIBCXXABI_USE_LLVM_UNWINDER)
pythonize_bool(LIBCXX_HAS_ATOMIC_LIB)
+pythonize_bool(LIBCXX_HAVE_CXX_ATOMICS_WITH_LIB)
# The tests shouldn't link to any ABI library when it has been linked into
# libc++ statically or via a linker script.
Modified: libcxx/trunk/test/libcxx/test/config.py
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/test/config.py?rev=275759&r1=275758&r2=275759&view=diff
==============================================================================
--- libcxx/trunk/test/libcxx/test/config.py (original)
+++ libcxx/trunk/test/libcxx/test/config.py Mon Jul 18 01:01:50 2016
@@ -290,6 +290,9 @@ class Configuration(object):
if self.cxx.hasCompileFlag('-fsized-deallocation'):
self.config.available_features.add('fsized-deallocation')
+ if self.get_lit_bool('has_libatomic', False):
+ self.config.available_features.add('libatomic')
+
def configure_compile_flags(self):
no_default_flags = self.get_lit_bool('no_default_flags', False)
if not no_default_flags:
Modified: libcxx/trunk/test/lit.site.cfg.in
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/lit.site.cfg.in?rev=275759&r1=275758&r2=275759&view=diff
==============================================================================
--- libcxx/trunk/test/lit.site.cfg.in (original)
+++ libcxx/trunk/test/lit.site.cfg.in Mon Jul 18 01:01:50 2016
@@ -22,7 +22,9 @@ config.generate_coverage = "@LIBC
config.target_info = "@LIBCXX_TARGET_INFO@"
config.executor = "@LIBCXX_EXECUTOR@"
config.llvm_unwinder = "@LIBCXXABI_USE_LLVM_UNWINDER@"
-config.use_libatomic = "@LIBCXX_HAS_ATOMIC_LIB@"
+config.has_libatomic = "@LIBCXX_HAS_ATOMIC_LIB@"
+config.use_libatomic = "@LIBCXX_HAVE_CXX_ATOMICS_WITH_LIB@"
+
config.libcxxabi_shared = "@LIBCXXABI_ENABLE_SHARED@"
# Let the main config do the real work.
More information about the cfe-commits
mailing list