[cfe-dev] [PATCH] Allow libc++ to be built in the LLVM tree under the "runtime" subdir

Ruben Van Boxem vanboxem.ruben at gmail.com
Sun Mar 18 08:29:18 PDT 2012


Hi,

Attached are patched to LLVM and libcxx to allow libc++ to be built with
CMake from within the LLVM tree.

The libc++ part is just some renaming as the variable ${headers} was
already in use, conflicting with something else in the LLVM tree.

The LLVM part copied the directory scanning code in the "projects" subdir
to add all existing subdirectories to the build.

Please comment or apply, thanks!

Ruben

PS: I'm not subscribed to the list, so please CC me when replying, thank
you.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20120318/4dc3bcb9/attachment.html>
-------------- next part --------------
Index: test/CMakeLists.txt
===================================================================
--- test/CMakeLists.txt	(revision 153013)
+++ test/CMakeLists.txt	(working copy)
@@ -32,7 +32,7 @@
     ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
     @ONLY)
 
-  add_custom_target(check
+  add_custom_target(check-libcxx
     COMMAND ${PYTHON_EXECUTABLE}
             ${LIT_EXECUTABLE}
             ${LIT_ARGS}
Index: lib/CMakeLists.txt
===================================================================
--- lib/CMakeLists.txt	(revision 153013)
+++ lib/CMakeLists.txt	(working copy)
@@ -1,33 +1,33 @@
 # Get sources
-file(GLOB sources ../src/*.cpp)
+file(GLOB LIBCXX_SOURCES ../src/*.cpp)
 if(WIN32)
-  file(GLOB win32_sources ../src/support/win32/*.cpp)
-  list(APPEND sources ${win32_sources})
+  file(GLOB LIBCXX_WIN32_SOURCES ../src/support/win32/*.cpp)
+  list(APPEND LIBCXX_SOURCES ${LIBCXX_WIN32_SOURCES})
 endif()
 
 # Add all the headers to the project for IDEs.
 if (MSVC_IDE OR XCODE)
-  file(GLOB_RECURSE headers ../include/*)
+  file(GLOB_RECURSE LIBCXX_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/../include/*)
   if(WIN32)
-    file( GLOB win32_headers ../include/support/win32/*.h)
-    list(APPEND headers ${win32_headers})
+    file( GLOB LIBCXX_WIN32_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/../include/support/win32/*.h)
+    list(APPEND LIBCXX_HEADERS ${LIBCXX_WIN32_HEADERS})
   endif()
   # Force them all into the headers dir on MSVC, otherwise they end up at
   # project scope because they don't have extensions.
   if (MSVC_IDE)
-    source_group("Header Files" FILES ${headers})
+    source_group("Header Files" FILES ${LIBCXX_HEADERS})
   endif()
 endif()
 
 if (LIBCXX_ENABLE_SHARED)
   add_library(cxx SHARED
-    ${sources}
-    ${headers}
+    ${LIBCXX_SOURCES}
+    ${LIBCXX_HEADERS}
     )
 else()
   add_library(cxx STATIC
-    ${sources}
-    ${headers}
+    ${LIBCXX_SOURCES}
+    ${LIBCXX_HEADERS}
     )
 endif()
 
-------------- next part --------------
Index: runtime/CMakeLists.txt
===================================================================
--- runtime/CMakeLists.txt	(revision 152936)
+++ runtime/CMakeLists.txt	(working copy)
@@ -2,4 +2,9 @@
   set(EXCLUDE_FROM_ALL ON)
 endif()
 
-add_subdirectory(libprofile)
+file(GLOB entries *)
+foreach(entry ${entries})
+  if(IS_DIRECTORY ${entry} AND EXISTS ${entry}/CMakeLists.txt)
+    add_subdirectory(${entry})
+  endif()
+endforeach(entry)


More information about the cfe-dev mailing list