Lines Matching +full:libunwind +full:- +full:build
1 # This file handles building LLVM runtime sub-projects.
4 # This file can be used in two ways: the bootstrapping build calls it from
5 # llvm/runtimes/CMakeLists.txt where we reuse the build tree of the top-level
6 # build or it can be directly invoked in this directory. In the latter case we
7 # might be building against a LLVM install tree and might not have a valid build
8 # tree set up yet. We can detect whether we are using the bootstrapping build
12 message(STATUS "Performing bootstrapping runtimes build.")
14 message(STATUS "Performing standalone runtimes build.")
16 # Add path for custom and the LLVM build's modules to the CMake module path.
36 # We order libraries to mirror roughly how they are layered, except that compiler-rt can depend
38 set(LLVM_DEFAULT_RUNTIMES "libc;libunwind;libcxxabi;pstl;libcxx;compiler-rt;openmp;offload")
39 set(LLVM_SUPPORTED_RUNTIMES "${LLVM_DEFAULT_RUNTIMES};llvm-libgcc")
41 "Semicolon-separated list of runtimes to build, or \"all\" (${LLVM_DEFAULT_RUNTIMES}). Supported runtimes are ${LLVM_SUPPORTED_RUNTIMES}.")
56 STRING(REGEX REPLACE "-" "_" canon_name ${canon_name})
67 set(LLVM_THIRD_PARTY_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../third-party")
81 # Setting these variables will allow the sub-build to put their outputs into
82 # the library and bin directories of the top-level build.
86 # This variable makes sure that e.g. llvm-lit is found.
95 # CMake omits default compiler include paths, but in runtimes build, we use
96 # -nostdinc and -nostdinc++ and control include paths manually so this behavior
98 # paths that are inside the build directory disables this behavior.
100 # See https://gitlab.kitware.com/cmake/cmake/-/issues/19227 for further details.
116 # The compiler driver may be implicitly trying to link against libunwind,
117 # which might not work if libunwind doesn't exist yet. Try to check if
118 # --unwindlib=none is supported, and use that if possible.
122 # -fsanitize=... --unwindlib=none will always result in a linking error.
123 # Currently, we counteract this issue by adding -fno-sanitize=all flag in
124 # the project specific code within */cmake/config-ix.cmake files but that's
126 llvm_check_compiler_linker_flag(C "--unwindlib=none" CXX_SUPPORTS_UNWINDLIB_EQ_NONE_FLAG)
129 set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} --unwindlib=none")
135 # when testing whether -Werror works, that test fails (due to the
139 # can use --start-no-unused-arguments to silence the warnings about
140 # --unwindlib=none during compilation.
142 # We must first add --unwindlib=none to CMAKE_REQUIRED_FLAGS above, to
145 check_c_compiler_flag("--start-no-unused-arguments" C_SUPPORTS_START_NO_UNUSED_ARGUMENTS)
147 set(CMAKE_REQUIRED_FLAGS "${ORIG_CMAKE_REQUIRED_FLAGS} --start-no-unused-arguments --unwindlib=none --end-no-unused-arguments")
152 # Check for -nostdlib++ first; if there's no C++ standard library yet,
153 # all check_cxx_compiler_flag commands will fail until we add -nostdlib++
154 # (or -nodefaultlibs).
155 llvm_check_compiler_linker_flag(CXX "-nostdlib++" CXX_SUPPORTS_NOSTDLIBXX_FLAG)
157 set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -nostdlib++")
159 check_cxx_compiler_flag(-nostdinc++ CXX_SUPPORTS_NOSTDINCXX_FLAG)
161 set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -nostdinc++")
177 # Loot at the PATH first to avoid a version mismatch between the command-line
178 # python and the CMake-found version
200 set(print_target_triple ${CMAKE_C_COMPILER} ${option_prefix}--target=${LLVM_DEFAULT_TARGET_TRIPLE} ${option_prefix}-print-target-triple)
214 option(LLVM_INCLUDE_TESTS "Generate build targets for the runtimes unit tests." ON)
215 option(LLVM_INCLUDE_DOCS "Generate build targets for the runtimes documentation." ON)
223 # This can be used to detect whether we're in the runtimes build.
230 string(REPLACE "-" "_" canon_name ${projName})
233 # TODO: compiler-rt has to use standalone build for now. We tried to remove
234 # this in D57992 but this broke the build because compiler-rt assumes that
235 # LLVM and Clang are configured in the same build to set up dependencies. We
236 # should clean up the compiler-rt build and remove this eventually.
245 # Setting a variable to let sub-projects detect which other projects
251 # If built with the runtimes build (rooted at runtimes/CMakeLists.txt), we
252 # won't have llvm-lit. If built with the bootstrapping build (rooted at
253 # llvm/CMakeLists.txt), the top-level llvm CMake invocation already generated
254 # the llvm-lit script.
258 # present. This ensures that the testsuites use a local lit from the build
259 # dir rather than ${LLVM_INSTALL_DIR}/bin/llvm-lit (which may not exist if
260 # LLVM_BINARY_DIR points at an installed LLVM tree rather than a build tree).
264 # Avoid warning about missing llvm-lit from runtimes CMake files. This is
265 # fine since we call configure_file() to create llvm-lit at the end of this
270 set(LIT_ARGS_DEFAULT "-sv --show-xfail --show-unsupported")
272 set(LIT_ARGS_DEFAULT "${LIT_ARGS_DEFAULT} --no-progress-bar")
276 umbrella_lit_testsuite_begin(check-runtimes)
287 # Define runtimes-test-depends so the parent build can use it unconditionally.
288 add_custom_target(runtimes-test-depends)
297 add_dependencies(runtimes-test-depends ${LLVM_RUNTIMES_LIT_DEPENDS})
301 umbrella_lit_testsuite_end(check-runtimes)
305 # llvm-lit. If invoked via llvm/runtimes, the toplevel llvm cmake
306 # invocation already generated the llvm-lit script.
308 # otherwise the generated llvm-lit does not have all required path mappings.
309 add_subdirectory(${LLVM_MAIN_SRC_DIR}/utils/llvm-lit
310 ${CMAKE_CURRENT_BINARY_DIR}/llvm-lit)
317 # Create empty files so the parent build can use these unconditionally.
330 if(TARGET check-${component})
331 list(APPEND SUB_CHECK_TARGETS check-${component})
334 if(TARGET install-${component})
335 list(APPEND SUB_INSTALL_TARGETS install-${component})
355 COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_BINARY_DIR}/compile_commands.json)
357 file(TO_NATIVE_PATH "${LLVM_MAIN_SRC_DIR}/utils/merge-json.py" MERGE_JSON_PATH)
359 COMMAND ${CMAKE_COMMAND} -E touch ${LLVM_BINARY_DIR}/compile_commands.json
363 -o ${LLVM_BINARY_DIR}/compile_commands.json