[cfe-commits] [libcxx] r171316 - in /libcxx/trunk: CMakeLists.txt lib/CMakeLists.txt www/index.html

Howard Hinnant hhinnant at apple.com
Wed Feb 6 15:22:40 PST 2013


Because of:

http://llvm.org/bugs/show_bug.cgi?id=15182

I am asking for a review of the CMake building instructions on the libcxx website:

http://libcxx.llvm.org

I have no clue if our website is right or wrong.  I just want somebody in the know to double check.

Thanks much.

Howard

On Dec 31, 2012, at 2:34 PM, Michael J. Spencer <bigcheesegs at gmail.com> wrote:

> Author: mspencer
> Date: Mon Dec 31 13:34:21 2012
> New Revision: 171316
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=171316&view=rev
> Log:
> [CMake] Fix c++ abi library configuration on Linux.
> 
> You can now configure from the command line using:
> -DLIBCXX_CXX_ABI=libsupc++
> -DLIBCXX_LIBSUPCXX_INCLUDE_PATHS="path;path
> 
> Also documents how to build on Linux.
> 
> Modified:
>    libcxx/trunk/CMakeLists.txt
>    libcxx/trunk/lib/CMakeLists.txt
>    libcxx/trunk/www/index.html
> 
> Modified: libcxx/trunk/CMakeLists.txt
> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/CMakeLists.txt?rev=171316&r1=171315&r2=171316&view=diff
> ==============================================================================
> --- libcxx/trunk/CMakeLists.txt (original)
> +++ libcxx/trunk/CMakeLists.txt Mon Dec 31 13:34:21 2012
> @@ -40,6 +40,9 @@
> option(LIBCXX_ENABLE_SHARED "Build libc++ as a shared library." ON)
> 
> set(CXXABIS none libcxxabi libcxxrt libsupc++)
> +if (NOT DEFINED LIBCXX_CXX_ABI)
> +  set(LIBCXX_CXX_ABI "none")
> +endif()
> set(LIBCXX_CXX_ABI "${LIBCXX_CXX_ABI}" CACHE STRING
>     "Specify C++ ABI library to use." FORCE)
> set_property(CACHE LIBCXX_CXX_ABI PROPERTY STRINGS "";${CXXABIS})
> @@ -63,9 +66,10 @@
>   )
> set(LIBCXX_TARGET_TRIPLE ${LIBCXX_TARGET_TRIPLE} CACHE STRING "Target triple.")
> 
> -if (${LIBCXX_CXX_ABI} STREQUAL "libsupc++")
> -  set(LIBCXX_LIBSUPCXX_INCLUDE_PATHS "" CACHE STRINGS
> -      "Paths to libsupc++ include directories. Separate by system separator")
> +if ("${LIBCXX_CXX_ABI}" STREQUAL "libsupc++")
> +  set(LIBCXX_LIBSUPCXX_INCLUDE_PATHS "${LIBCXX_LIBSUPCXX_INCLUDE_PATHS}"
> +      CACHE STRINGS
> +      "Paths to libsupc++ include directories separate by ';'.")
>   set(LIBCXX_CXX_ABI_LIBRARIES stdc++)
>   set(LIBCXX_LIBSUPCXX_FILES
>       cxxabi.h
> @@ -75,6 +79,9 @@
>       bits/cxxabi_tweaks.h
>       bits/cxxabi_forced.h
>       )
> +  # Create include directories.
> +  file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/include")
> +  file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/include/bits")
>   set(LIBCXX_LIBSUPCXX_FILE_PATHS)
>   foreach(path ${LIBCXX_LIBSUPCXX_FILES})
>     set(found FALSE)
> @@ -106,7 +113,7 @@
>     FILES_MATCHING
>     PATTERN "*"
>     )
> -elseif (${LIBCXX_CXX_ABI} NOT STREQUAL "none")
> +elseif (NOT "${LIBCXX_CXX_ABI}" STREQUAL "none")
>   message(FATAL_ERROR
>           "Currently only none and libsupc++ are supported for c++ abi.")
> endif ()
> 
> Modified: libcxx/trunk/lib/CMakeLists.txt
> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/lib/CMakeLists.txt?rev=171316&r1=171315&r2=171316&view=diff
> ==============================================================================
> --- libcxx/trunk/lib/CMakeLists.txt (original)
> +++ libcxx/trunk/lib/CMakeLists.txt Mon Dec 31 13:34:21 2012
> @@ -31,7 +31,9 @@
>     )
> endif()
> 
> -add_dependencies(cxx ${LIBCXX_CXX_ABI_DEPS})
> +if (DEFINED LIBCXX_CXX_ABI_DEPS)
> +  add_dependencies(cxx ${LIBCXX_CXX_ABI_DEPS})
> +endif()
> 
> # Generate library list.
> set(libraries ${LIBCXX_CXX_ABI_LIBRARIES})
> 
> Modified: libcxx/trunk/www/index.html
> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/index.html?rev=171316&r1=171315&r2=171316&view=diff
> ==============================================================================
> --- libcxx/trunk/www/index.html (original)
> +++ libcxx/trunk/www/index.html Mon Dec 31 13:34:21 2012
> @@ -116,6 +116,7 @@
>   <!--=====================================================================-->
> 
>    <p>libc++ is a 100% complete C++11 implementation on Apple's OS X. </p>
> +   <p>LLVM and Clang can self host in C++ and C++11 mode with libc++ on Linux.</p>
> 
>    <p>
>    Ports to other platforms are underway. Here are recent test
> @@ -205,6 +206,60 @@
>   (<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev">clang mailing list</a>).</p>
> 
>   <!--=====================================================================-->
> +  <h2>Build on Linux using CMake and libsupc++.</h2>
> +  <!--=====================================================================-->
> +
> +  <p>
> +     You will need libstdc++ in order to provide libsupc++.
> +  </p>
> +  
> +  <p>
> +     Figure out where the libsupc++ headers are on your system. On Ubuntu this
> +     is <code>/usr/include/c++/<version></code> and
> +     <code>/usr/include/c++/<version>/<target-triple></code>
> +  </p>
> +  
> +  <p>
> +     You can also figure this out by running
> +     <pre>
> +$ echo | g++ -Wp,-v -x c++ - -fsyntax-only
> +ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"
> +ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../x86_64-linux-gnu/include"
> +#include "..." search starts here:
> +#include <...> search starts here:
> + /usr/include/c++/4.7
> + /usr/include/c++/4.7/x86_64-linux-gnu
> + /usr/include/c++/4.7/backward
> + /usr/lib/gcc/x86_64-linux-gnu/4.7/include
> + /usr/local/include
> + /usr/lib/gcc/x86_64-linux-gnu/4.7/include-fixed
> + /usr/include/x86_64-linux-gnu
> + /usr/include
> +End of search list.
> +     </pre>
> +
> +      Note the first two entries happen to be what we are looking for. This
> +      may not be correct on other platforms.
> +  </p>
> +  
> +  <p>
> +     We can now run CMake:
> +     <ul>
> +       <li><code>CC=clang CXX=clang++ cmake -G "Unix Makefiles"
> +                -DLIBCXX_CXX_ABI=libsupc++
> +                -DLIBCXX_LIBSUPCXX_INCLUDE_PATHS="/usr/include/c++/4.7/;/usr/include/c++/4.7/x86_64-linux-gnu/"
> +                -DCMAKE_BUILD_TYPE=Release
> +                -DCMAKE_INSTALL_PREFIX=/usr
> +                <libc++-source-dir></code></li>
> +       <li><code>make</code></li>
> +       <li><code>sudo make install</code></li>
> +     </ul>
> +     <p>
> +        You can now run clang with -stdlib=libc++.
> +     </p>
> +  </p>
> +
> +  <!--=====================================================================-->
>   <h2>Design Documents</h2>
>   <!--=====================================================================-->
> 
> 
> 
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits




More information about the cfe-commits mailing list