Index: libcxx/docs/BuildingLibcxx.rst =================================================================== --- libcxx/docs/BuildingLibcxx.rst +++ libcxx/docs/BuildingLibcxx.rst @@ -72,10 +72,11 @@ Experimental Support for Windows -------------------------------- -The Windows support requires building with clang-cl as cl does not support one -required extension: `#include_next`. Furthermore, VS 2015 or newer (19.00) is -required. In the case of clang-cl, we need to specify the "MS Compatibility -Version" as it defaults to 2014 (18.00). +libcxx supports being built with clang-cl, but not with MSVC's cl.exe, as +cl doesn't support the `#include_next` extension. Furthermore, VS 2015 or +newer (19.00) is required. + +libcxx also supports being built with clang targeting MinGW environments. CMake + Visual Studio ~~~~~~~~~~~~~~~~~~~~~ @@ -93,32 +94,62 @@ \path\to\libcxx > cmake --build . -CMake + ninja -~~~~~~~~~~~~~ +CMake + ninja (MSVC) +~~~~~~~~~~~~~~~~~~~~ Building with ninja is required for development to enable tests. -Unfortunately, doing so requires additional configuration as we cannot -just specify a toolset. + +It can be built with CMake + ninja directly in a Windows Command Prompt, +however running the tests require being run in an environment with a bash +shell available, which can be provided e.g. by the MSYS2 project. + +This can be set up e.g. by starting a Visual Studio Tools Command Prompt +(for getting the environment variables pointing to the headers and +import libraries), and making sure that clang-cl is available in the +path. From there, launch an MSYS2 shell via e.g. +`\msys64\msys2_shell.cmd -full-path -mingw64` (preserving the earlier +environment, allowing the MSVC headers/libraries and clang-cl to be found). .. code-block:: batch > cmake -G Ninja ^ - -DCMAKE_MAKE_PROGRAM=/path/to/ninja ^ - -DCMAKE_SYSTEM_NAME=Windows ^ -DCMAKE_C_COMPILER=clang-cl ^ - -DCMAKE_C_FLAGS="-fms-compatibility-version=19.00 --target=i686--windows" ^ - -DCMAKE_CXX_COMPILER=clang-cl ^ - -DCMAKE_CXX_FLAGS="-fms-compatibility-version=19.00 --target=i686--windows" ^ - -DLLVM_PATH=/path/to/llvm/tree ^ - -DLIBCXX_ENABLE_SHARED=YES ^ - -DLIBCXX_ENABLE_STATIC=NO ^ + -DCMAKE_CXX_COMPILER=clang-cl ^ + -DLLVM_PATH=/path/to/llvm-project/llvm ^ -DLIBCXX_ENABLE_EXPERIMENTAL_LIBRARY=NO ^ \path\to\libcxx - > /path/to/ninja cxx - > /path/to/ninja check-cxx + > ninja cxx + > ninja check-cxx + +(Note that if the MSYS2 provided mingw-w64-x86_64-clang package is +installed and is the first one in the path, that one ends up picked up +when running tests. As that one defaults to a non-MSVC target, add +`-DLIBCXX_TARGET_TRIPLE=x86_64-windows-msvc` to the cmake configuration +in this case.) + +CMake + ninja (MinGW) +~~~~~~~~~~~~~~~~~~~~~ -Note that the paths specified with backward slashes must use the `\\` as the -directory separator as clang-cl may otherwise parse the path as an argument. +libcxx can also be built in MinGW environments, e.g. in MSYS2. +This requires clang to be available (installed from the +`mingw-w64-x86_64-clang` package), together with CMake and ninja. + +.. code-block:: batch + + > cmake -G Ninja ^ + + -DCMAKE_C_COMPILER=clang ^ + -DCMAKE_CXX_COMPILER=clang++ ^ + -DLLVM_PATH=/path/to/llvm-project/llvm ^ + -DLIBCXX_ENABLE_EXPERIMENTAL_LIBRARY=NO ^ + -DLIBCXX_HAS_WIN32_THREAD_API=ON ^ + -DLIBCXX_CXX_ABI=libstdc++ ^ + /path/to/libcxx + > ninja cxx + > ninja check-cxx + +(In this configurations, tests don't currently work quite as well +out of the box.) .. _`libc++abi`: http://libcxxabi.llvm.org/ Index: libcxx/www/index.html =================================================================== --- libcxx/www/index.html +++ libcxx/www/index.html @@ -129,6 +129,12 @@
  • Linux x86_64
  • +

    + The library also does work for Windows (both MSVC style environments, + built with clang-cl, and MinGW environments), although that platform + support is less mature than the platforms above. +

    +

    Current Status