[libunwind] 0a22dfc - [runtimes][NFC] Remove dead code for Standalone builds

Louis Dionne via cfe-commits cfe-commits at lists.llvm.org
Fri May 13 11:37:39 PDT 2022


Author: Louis Dionne
Date: 2022-05-13T14:37:24-04:00
New Revision: 0a22dfcb11c05cbd4f654c8ef1868a4bc6085140

URL: https://github.com/llvm/llvm-project/commit/0a22dfcb11c05cbd4f654c8ef1868a4bc6085140
DIFF: https://github.com/llvm/llvm-project/commit/0a22dfcb11c05cbd4f654c8ef1868a4bc6085140.diff

LOG: [runtimes][NFC] Remove dead code for Standalone builds

Standalone builds have been deprecated and then removed for a while now.
Trying to use standalone builds leads to a fatal CMake error, so this
code is all dead. Remove it to clean things up.

Differential Revision: https://reviews.llvm.org/D125561

Added: 
    

Modified: 
    libcxx/CMakeLists.txt
    libcxx/benchmarks/CMakeLists.txt
    libcxx/test/CMakeLists.txt
    libcxxabi/CMakeLists.txt
    libcxxabi/test/CMakeLists.txt
    libunwind/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/libcxx/CMakeLists.txt b/libcxx/CMakeLists.txt
index a7f1684235e6..dc7512546376 100644
--- a/libcxx/CMakeLists.txt
+++ b/libcxx/CMakeLists.txt
@@ -1,10 +1,6 @@
 # See https://libcxx.llvm.org/docs/BuildingLibcxx.html for instructions on how
 # to build libcxx with CMake.
 
-if (NOT IS_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/../libcxxabi")
-  message(FATAL_ERROR "libc++ now requires being built in a monorepo layout with libcxxabi available")
-endif()
-
 #===============================================================================
 # Setup Project
 #===============================================================================
@@ -26,37 +22,8 @@ set(LIBCXX_SOURCE_DIR  ${CMAKE_CURRENT_SOURCE_DIR})
 set(LIBCXX_BINARY_DIR  ${CMAKE_CURRENT_BINARY_DIR})
 set(LIBCXX_BINARY_INCLUDE_DIR "${LIBCXX_BINARY_DIR}/include/c++build")
 
-if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR OR LIBCXX_STANDALONE_BUILD)
-  message(FATAL_ERROR "The Standalone build has been deprecated since LLVM 14, and it is not supported anymore. "
-                      "Please use one of the ways described at https://libcxx.llvm.org/BuildingLibcxx.html for "
-                      "building libc++.")
-  project(libcxx CXX C)
-
-  set(PACKAGE_NAME libcxx)
-  set(PACKAGE_VERSION 15.0.0git)
-  set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
-  set(PACKAGE_BUGREPORT "llvm-bugs at lists.llvm.org")
-
-  # In a standalone build, we don't have llvm to automatically generate the
-  # llvm-lit script for us.  So we need to provide an explicit directory that
-  # the configurator should write the script into.
-  set(LIBCXX_STANDALONE_BUILD TRUE)
-  set(LLVM_LIT_OUTPUT_DIR "${LIBCXX_BINARY_DIR}/bin")
-endif()
-
-# Must go below project(..)
 include(GNUInstallDirs)
 
-if (LIBCXX_STANDALONE_BUILD)
-  # Find the LLVM sources and simulate LLVM CMake options.
-  include(HandleOutOfTreeLLVM)
-
-  find_package(Python3 COMPONENTS Interpreter)
-  if(NOT Python3_Interpreter_FOUND)
-    message(SEND_ERROR "Python3 not found. Python3 is required")
-  endif()
-endif()
-
 # Require out of source build.
 include(MacroEnsureOutOfSourceBuild)
 MACRO_ENSURE_OUT_OF_SOURCE_BUILD(
@@ -524,11 +491,10 @@ endif()
 
 include(HandleLibCXXABI) # Setup the ABI library flags
 
-if (NOT LIBCXX_STANDALONE_BUILD)
-  # Remove flags that may have snuck in.
-  remove_flags(-DNDEBUG -UNDEBUG -D_DEBUG
-               -lc++abi)
-endif()
+# Remove flags that may have snuck in.
+# TODO: This shouldn't be necessary anymore since we don't support the Project
+#       build anymore, so the rest of LLVM can't pollute our flags.
+remove_flags(-DNDEBUG -UNDEBUG -D_DEBUG -lc++abi)
 remove_flags(--stdlib=libc++ -stdlib=libc++ --stdlib=libstdc++ -stdlib=libstdc++)
 
 # FIXME: Remove all debug flags and flags that change which Windows
@@ -754,16 +720,7 @@ function(get_sanitizer_flags OUT_VAR  USE_SANITIZER)
   set(${OUT_VAR} "${SANITIZER_FLAGS}" PARENT_SCOPE)
 endfunction()
 
-# Configure for sanitizers. If LIBCXX_STANDALONE_BUILD then we have to do
-# the flag translation ourselves. Othewise LLVM's CMakeList.txt will handle it.
-if (LIBCXX_STANDALONE_BUILD)
-  set(LLVM_USE_SANITIZER "" CACHE STRING
-      "Define the sanitizer used to build the library and tests")
-endif()
 get_sanitizer_flags(SANITIZER_FLAGS "${LLVM_USE_SANITIZER}")
-if (LIBCXX_STANDALONE_BUILD AND SANITIZER_FLAGS)
-  add_flags(${SANITIZER_FLAGS})
-endif()
 
 # Link system libraries =======================================================
 function(cxx_link_system_libraries target)
@@ -979,15 +936,6 @@ endif()
 if (LIBCXX_INCLUDE_TESTS)
   add_subdirectory(test)
   add_subdirectory(lib/abi)
-  if (LIBCXX_STANDALONE_BUILD)
-    include(AddLLVM) # for get_llvm_lit_path
-    # Make sure the llvm-lit script is generated into the bin directory, and
-    # do it after adding all tests, since the generated script will only work
-    # correctly discovered tests against test locations from the source tree
-    # that have already been discovered.
-    add_subdirectory(${LLVM_MAIN_SRC_DIR}/utils/llvm-lit
-                     ${CMAKE_CURRENT_BINARY_DIR}/llvm-lit)
-  endif()
 endif()
 
 if (LIBCXX_INCLUDE_DOCS)

diff  --git a/libcxx/benchmarks/CMakeLists.txt b/libcxx/benchmarks/CMakeLists.txt
index 95e28618b55e..e5f96aa88bd1 100644
--- a/libcxx/benchmarks/CMakeLists.txt
+++ b/libcxx/benchmarks/CMakeLists.txt
@@ -3,12 +3,6 @@ if (CMAKE_VERSION VERSION_LESS 3.17)
   return()
 endif()
 
-if (LIBCXX_STANDALONE_BUILD)
-  message(WARNING "The libc++ benchmarks are not available in a standalone build. Please migrate to an official build "
-                  "as documented in https://libcxx.llvm.org/BuildingLibcxx.html.")
-  return()
-endif()
-
 include(ExternalProject)
 include(CheckCXXCompilerFlag)
 

diff  --git a/libcxx/test/CMakeLists.txt b/libcxx/test/CMakeLists.txt
index 82231592ebcb..6a398e4afbec 100644
--- a/libcxx/test/CMakeLists.txt
+++ b/libcxx/test/CMakeLists.txt
@@ -71,8 +71,7 @@ pythonize_bool(LIBCXX_BUILD_EXTERNAL_THREAD_LIBRARY)
 pythonize_bool(LIBCXX_DEBUG_BUILD)
 pythonize_bool(LIBCXX_ENABLE_PARALLEL_ALGORITHMS)
 
-# By default, for non-standalone builds, libcxx and libcxxabi share a library
-# directory.
+# By default, libcxx and libcxxabi share a library directory.
 if (NOT LIBCXX_CXX_ABI_LIBRARY_PATH)
   set(LIBCXX_CXX_ABI_LIBRARY_PATH "${LIBCXX_LIBRARY_DIR}" CACHE PATH
       "The path to libc++abi library.")

diff  --git a/libcxxabi/CMakeLists.txt b/libcxxabi/CMakeLists.txt
index e7e29dd69937..42cb617992d1 100644
--- a/libcxxabi/CMakeLists.txt
+++ b/libcxxabi/CMakeLists.txt
@@ -1,9 +1,5 @@
 # See www/CMake.html for instructions on how to build libcxxabi with CMake.
 
-if (NOT IS_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/../libcxx")
-  message(FATAL_ERROR "libc++abi now requires being built in a monorepo layout with libcxx available")
-endif()
-
 #===============================================================================
 # Setup Project
 #===============================================================================
@@ -27,49 +23,8 @@ set(LIBCXXABI_BINARY_DIR  ${CMAKE_CURRENT_BINARY_DIR})
 set(LIBCXXABI_LIBCXX_PATH "${CMAKE_CURRENT_LIST_DIR}/../libcxx" CACHE PATH
         "Specify path to libc++ source.")
 
-if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR OR LIBCXXABI_STANDALONE_BUILD)
-  message(FATAL_ERROR "The Standalone build has been deprecated since LLVM 14, and it is not supported anymore. "
-                      "Please use one of the ways described at https://libcxx.llvm.org/BuildingLibcxx.html for "
-                      "building libc++abi.")
-
-  project(libcxxabi CXX C)
-
-  set(PACKAGE_NAME libcxxabi)
-  set(PACKAGE_VERSION 11.0.0git)
-  set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
-  set(PACKAGE_BUGREPORT "llvm-bugs at lists.llvm.org")
-
-  set(LIBCXXABI_STANDALONE_BUILD TRUE)
-
-  # In a standalone build, we don't have llvm to automatically generate the
-  # llvm-lit script for us.  So we need to provide an explicit directory that
-  # the configurator should write the script into.
-  set(LLVM_LIT_OUTPUT_DIR "${LIBCXXABI_BINARY_DIR}/bin")
-endif()
-
-# Must go below project(..)
 include(GNUInstallDirs)
 
-if (LIBCXXABI_STANDALONE_BUILD)
-  # Find the LLVM sources and simulate LLVM CMake options.
-  include(HandleOutOfTreeLLVM)
-
-  find_package(Python3 COMPONENTS Interpreter)
-  if(NOT Python3_Interpreter_FOUND)
-    message(WARNING "Python3 not found, using python2 as a fallback")
-    find_package(Python2 COMPONENTS Interpreter REQUIRED)
-    if(Python2_VERSION VERSION_LESS 2.7)
-      message(SEND_ERROR "Python 2.7 or newer is required")
-    endif()
-
-    # Treat python2 as python3
-    add_executable(Python3::Interpreter IMPORTED)
-    set_target_properties(Python3::Interpreter PROPERTIES
-      IMPORTED_LOCATION ${Python2_EXECUTABLE})
-    set(Python3_EXECUTABLE ${Python2_EXECUTABLE})
-  endif()
-endif()
-
 # Require out of source build.
 include(MacroEnsureOutOfSourceBuild)
 MACRO_ENSURE_OUT_OF_SOURCE_BUILD(
@@ -138,11 +93,9 @@ result in the library being named libc++abi.x.y.dylib, along with the \
 usual symlinks pointing to that.")
 
 # Default to building a shared library so that the default options still test
-# the libc++abi that is being built. There are two problems with testing a
-# static libc++abi. In the case of a standalone build, the tests will link the
-# system's libc++, which might not have been built against our libc++abi. In the
-# case of an in tree build, libc++ will prefer a dynamic libc++abi from the
-# system over a static libc++abi from the output directory.
+# the libc++abi that is being built. The problem with testing a static libc++abi
+# is that libc++ will prefer a dynamic libc++abi from the system over a static
+# libc++abi from the output directory.
 option(LIBCXXABI_ENABLE_SHARED "Build libc++abi as a shared library." ON)
 option(LIBCXXABI_ENABLE_STATIC "Build libc++abi as a static library." ON)
 
@@ -171,23 +124,10 @@ if (NOT LIBCXXABI_ENABLE_SHARED AND NOT LIBCXXABI_ENABLE_STATIC)
   message(FATAL_ERROR "libc++abi must be built as either a shared or static library.")
 endif()
 
-# TODO: This is a workaround for the fact that Standalone builds can't use
-# targets from the other runtimes (so the cxx-headers target doesn't exist).
+# TODO: Remove this, which shouldn't be necessary since we know we're being built
+#       side-by-side with libc++.
 set(LIBCXXABI_LIBCXX_INCLUDES "" CACHE PATH
     "Specify path to libc++ includes.")
-if (LIBCXXABI_STANDALONE_BUILD)
-  if (NOT IS_DIRECTORY ${LIBCXXABI_LIBCXX_INCLUDES})
-    message(FATAL_ERROR
-      "LIBCXXABI_LIBCXX_INCLUDES=${LIBCXXABI_LIBCXX_INCLUDES} is not a valid directory. "
-      "Please provide the path to where the libc++ headers have been installed.")
-  endif()
-  add_library(cxx-headers INTERFACE)
-  if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC" OR "${CMAKE_CXX_SIMULATE_ID}" STREQUAL "MSVC")
-    target_compile_options(cxx-headers INTERFACE /I "${LIBCXXABI_LIBCXX_INCLUDES}")
-  else()
-    target_compile_options(cxx-headers INTERFACE -I "${LIBCXXABI_LIBCXX_INCLUDES}")
-  endif()
-endif()
 
 option(LIBCXXABI_HERMETIC_STATIC_LIBRARY
   "Do not export any symbols from the static library." OFF)
@@ -241,8 +181,7 @@ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LIBCXXABI_LIBRARY_DIR})
 set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LIBCXXABI_LIBRARY_DIR})
 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${LIBCXXABI_LIBRARY_DIR})
 
-# By default, for non-standalone builds, libcxx and libcxxabi share a library
-# directory.
+# By default, libcxx and libcxxabi share a library directory.
 if (NOT LIBCXXABI_LIBCXX_LIBRARY_PATH)
   set(LIBCXXABI_LIBCXX_LIBRARY_PATH "${LIBCXXABI_LIBRARY_DIR}" CACHE PATH
       "The path to libc++ library." FORCE)

diff  --git a/libcxxabi/test/CMakeLists.txt b/libcxxabi/test/CMakeLists.txt
index c695069e64e4..0a4541b9443c 100644
--- a/libcxxabi/test/CMakeLists.txt
+++ b/libcxxabi/test/CMakeLists.txt
@@ -61,11 +61,9 @@ if (LIBCXXABI_BUILD_EXTERNAL_THREAD_LIBRARY)
   list(APPEND LIBCXXABI_TEST_DEPS cxx_external_threads)
 endif()
 
-if (NOT LIBCXXABI_STANDALONE_BUILD)
-  list(APPEND LIBCXXABI_TEST_DEPS cxx)
-  if (LIBCXXABI_USE_LLVM_UNWINDER AND TARGET unwind)
-    list(APPEND LIBCXXABI_TEST_DEPS unwind)
-  endif()
+list(APPEND LIBCXXABI_TEST_DEPS cxx)
+if (LIBCXXABI_USE_LLVM_UNWINDER AND TARGET unwind)
+  list(APPEND LIBCXXABI_TEST_DEPS unwind)
 endif()
 
 set(AUTO_GEN_COMMENT "## Autogenerated by libcxxabi configuration.\n# Do not edit!")

diff  --git a/libunwind/CMakeLists.txt b/libunwind/CMakeLists.txt
index eabb55256b27..4d1f7be659fa 100644
--- a/libunwind/CMakeLists.txt
+++ b/libunwind/CMakeLists.txt
@@ -1,7 +1,3 @@
-if (NOT IS_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/../libcxx")
-  message(FATAL_ERROR "libunwind requires being built in a monorepo layout with libcxx available")
-endif()
-
 #===============================================================================
 # Setup Project
 #===============================================================================
@@ -23,41 +19,8 @@ set(LIBUNWIND_BINARY_DIR  ${CMAKE_CURRENT_BINARY_DIR})
 set(LIBUNWIND_LIBCXX_PATH "${CMAKE_CURRENT_LIST_DIR}/../libcxx" CACHE PATH
         "Specify path to libc++ source.")
 
-if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR OR LIBUNWIND_STANDALONE_BUILD)
-  message(FATAL_ERROR "The Standalone build has been deprecated since LLVM 14, and it is not supported anymore. "
-                      "Please use one of the ways described at https://libcxx.llvm.org/BuildingLibcxx.html for "
-                      "building libunwind.")
-
-  # We may have an incomplete toolchain - do language support tests without
-  # linking.
-  include(EnableLanguageNolink)
-  project(libunwind LANGUAGES NONE)
-
-  set(PACKAGE_NAME libunwind)
-  set(PACKAGE_VERSION 15.0.0git)
-  set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
-  set(PACKAGE_BUGREPORT "llvm-bugs at lists.llvm.org")
-
-  set(LIBUNWIND_STANDALONE_BUILD TRUE)
-endif()
-
-# Must go below project(..)
 include(GNUInstallDirs)
 
-if(LIBUNWIND_STANDALONE_BUILD)
-  llvm_enable_language_nolink(C CXX ASM)
-
-  # Find the LLVM sources and simulate LLVM CMake options.
-  include(HandleOutOfTreeLLVM)
-
-  # In a standalone build, we don't have llvm to automatically generate the
-  # llvm-lit script for us.  So we need to provide an explicit directory that
-  # the configurator should write the script into.
-  set(LLVM_LIT_OUTPUT_DIR "${LIBUNWIND_BINARY_DIR}/bin")
-else()
-  set(LLVM_LIT "${CMAKE_SOURCE_DIR}/utils/lit/lit.py")
-endif()
-
 #===============================================================================
 # Setup CMake Options
 #===============================================================================


        


More information about the cfe-commits mailing list