[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 11:08:58 PDT 2021


mstorsjo added a comment.

In D99178#2674471 <https://reviews.llvm.org/D99178#2674471>, @ldionne wrote:

> In D99178#2669567 <https://reviews.llvm.org/D99178#2669567>, @mstorsjo wrote:
>
>> Can you elaborate on which defaults you'd like to have there? While having example setups as cmake caches can be useful, use of the cmake caches is very much optional, so logic for disabling it by default needs to be in the main CMakeLists.txt instead of in an optional cmake cache to me.
>
> What we're trying to achieve with the libc++/libc++abi CMakes is to slowly divorce them from platform-specific logic. Instead, we use CMake caches to configure the library properly for a given use/platform. For example, I'd rather have a Windows.cmake cache that sets the following:
>
>   set(LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY OFF CACHE BOOL "") # optionally explain why
>
> That way, you don't need any of the CMake or Lit logic added by this patch, you only need to use the right cache file when building.
>
> Essentially, I'd like the libc++ CMake to be simple and contain generic platform agnostic knobs, which can then be turned on/off as needed on different platforms and for different use cases. WDYT?

I agree that avoiding platform specific logic in the main cmakefiles would be nice, but I disagree that cmake cache files are the solution here.

Cmake caches capture individual possible ways that you _can_ configure and build the library, but they aren't the only allowed way to do it, as there's far more possible configurations than is sensible to enumerate.

For this particular case, procedural logic in cmake captures it much better.

If building for windows as a DLL, the experimental library should be implicitly disabled if the user expressed no opinion on the matter. If the user requested the library to be enabled, we should tell him why that can't be done. If building for windows but as a static library only, the experimental library works fine and can be enabled by default.

I'm quite against trying to shoehorn all allowed build configurations into a fixed list of configurations. Sure, we can't guarantee that any random configuration not covered by CI will work though, but building without a presupplied cmake cache should definitely be ok and work.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D99178/new/

https://reviews.llvm.org/D99178



More information about the libcxx-commits mailing list