[libcxx-commits] [PATCH] D99178: [libcxx] Disable c++experimental by default in DLL builds
Martin Storsjö via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Apr 7 12:37:27 PDT 2021
mstorsjo updated this revision to Diff 335907.
mstorsjo added a comment.
Removed the lit.local.cfg changes that aren't needed, as we shouldn't end up with the experimental library enabled at all in those configurations now.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D99178/new/
https://reviews.llvm.org/D99178
Files:
libcxx/CMakeLists.txt
libcxx/docs/BuildingLibcxx.rst
libcxx/utils/ci/run-buildbot
Index: libcxx/utils/ci/run-buildbot
===================================================================
--- libcxx/utils/ci/run-buildbot
+++ libcxx/utils/ci/run-buildbot
@@ -475,13 +475,6 @@
# the "clang-cl" driver for compiling). When the CI runner runs
# Clang 12, the "-loldnames" option can be dropped.
- # TODO: Currently, building with the experimental library breaks running
- # tests (the test linking look for the c++experimental library with the
- # wrong name, and the statically linked c++experimental can't be linked
- # correctly when libc++ visibility attributes indicate dllimport linkage
- # anyway), thus just disable the experimental library. Remove this
- # setting when cmake and the test driver does the right thing automatically.
-
echo "--- Generating CMake"
cmake -S "${MONOREPO_ROOT}/libcxx" \
-B "${BUILD_DIR}" \
@@ -490,7 +483,6 @@
-DCMAKE_C_COMPILER=clang-cl \
-DCMAKE_CXX_COMPILER=clang-cl \
-DLLVM_LIT_ARGS="-sv --show-unsupported --xunit-xml-output test-results.xml" \
- -DLIBCXX_ENABLE_EXPERIMENTAL_LIBRARY=NO \
-DLIBCXX_ENABLE_FILESYSTEM=YES \
-DCMAKE_CXX_FLAGS="-D_LIBCPP_HAS_NO_INT128" \
-DLIBCXX_TEST_COMPILER_FLAGS="-D_LIBCPP_HAS_NO_INT128" \
Index: libcxx/docs/BuildingLibcxx.rst
===================================================================
--- libcxx/docs/BuildingLibcxx.rst
+++ libcxx/docs/BuildingLibcxx.rst
@@ -90,7 +90,6 @@
-T "ClangCL" ^
-DLIBCXX_ENABLE_SHARED=YES ^
-DLIBCXX_ENABLE_STATIC=NO ^
- -DLIBCXX_ENABLE_EXPERIMENTAL_LIBRARY=NO ^
\path\to\libcxx
> cmake --build .
@@ -120,7 +119,6 @@
-DCMAKE_BUILD_TYPE=Release ^
-DCMAKE_C_COMPILER=clang-cl ^
-DCMAKE_CXX_COMPILER=clang-cl ^
- -DLIBCXX_ENABLE_EXPERIMENTAL_LIBRARY=NO ^
path/to/libcxx
> ninja cxx
> ninja check-cxx
Index: libcxx/CMakeLists.txt
===================================================================
--- libcxx/CMakeLists.txt
+++ libcxx/CMakeLists.txt
@@ -88,7 +88,13 @@
option(LIBCXX_ENABLE_ASSERTIONS "Enable assertions independent of build mode." OFF)
option(LIBCXX_ENABLE_SHARED "Build libc++ as a shared library." ON)
option(LIBCXX_ENABLE_STATIC "Build libc++ as a static library." ON)
-option(LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY "Build libc++experimental.a" ON)
+set(ENABLE_EXPERIMENTAL_DEFAULT ON)
+if (WIN32 AND LIBCXX_ENABLE_SHARED)
+ # When libc++ is built as a DLL, all headers indicate DLL linkage, while
+ # libc++experimental always is linked statically.
+ set(ENABLE_EXPERIMENTAL_DEFAULT OFF)
+endif()
+option(LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY "Build libc++experimental.a" ${ENABLE_EXPERIMENTAL_DEFAULT})
set(ENABLE_FILESYSTEM_DEFAULT ON)
if (WIN32 AND NOT MINGW)
# Filesystem is buildable for windows, but it requires __int128 helper
@@ -399,6 +405,14 @@
message(FATAL_ERROR "Only one of LIBCXX_ABI_FORCE_ITANIUM and LIBCXX_ABI_FORCE_MICROSOFT can be specified.")
endif ()
+if (WIN32 AND LIBCXX_ENABLE_SHARED AND LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY)
+ message(FATAL_ERROR "LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY can't be enabled"
+ " when LIBCXX_ENABLE_SHARED also is enabled for Windows."
+ " The c++experimental library is only built as a"
+ " static library, while the headers signal dllimport"
+ " linkage.")
+endif()
+
#===============================================================================
# Configure System
#===============================================================================
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D99178.335907.patch
Type: text/x-patch
Size: 3919 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20210407/e16f331f/attachment.bin>
More information about the libcxx-commits
mailing list