Skip to content

Commit

Permalink
[CMake] Provide an option to disable runtimes build
Browse files Browse the repository at this point in the history
This could be used to either disable the runtimes build altogether
or avoid building them but still generate the build targets.

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

llvm-svn: 298653
  • Loading branch information
petrhosek committed Mar 23, 2017
1 parent 17bcb43 commit 2705226
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
8 changes: 7 additions & 1 deletion llvm/CMakeLists.txt
Expand Up @@ -483,6 +483,10 @@ option(LLVM_INCLUDE_UTILS "Generate build targets for the LLVM utils." ON)
option(LLVM_BUILD_UTILS
"Build LLVM utility binaries. If OFF, just generate build targets." ON)

option(LLVM_INCLUDE_RUNTIMES "Generate build targets for the LLVM runtimes." ON)
option(LLVM_BUILD_RUNTIMES
"Build the LLVM runtimes. If OFF, just generate build targets." ON)

option(LLVM_BUILD_RUNTIME
"Build the LLVM runtime libraries." ON)
option(LLVM_BUILD_EXAMPLES
Expand Down Expand Up @@ -862,7 +866,9 @@ if( LLVM_INCLUDE_TOOLS )
add_subdirectory(tools)
endif()

add_subdirectory(runtimes)
if( LLVM_INCLUDE_RUNTIMES )
add_subdirectory(runtimes)
endif()

if( LLVM_INCLUDE_EXAMPLES )
add_subdirectory(examples)
Expand Down
13 changes: 10 additions & 3 deletions llvm/runtimes/CMakeLists.txt
Expand Up @@ -145,6 +145,10 @@ else() # if this is included from LLVM's CMake
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${LLVM_BINARY_DIR}/runtimes/Components.cmake)
include(LLVMExternalProjectUtils)

if(NOT LLVM_BUILD_RUNTIMES)
set(EXTRA_ARGS EXCLUDE_FROM_ALL)
endif()

# If compiler-rt is present we need to build the builtin libraries first. This
# is required because the other runtimes need the builtin libraries present
# before the just-built compiler can pass the configuration tests.
Expand All @@ -157,7 +161,8 @@ else() # if this is included from LLVM's CMake
-DCMAKE_C_COMPILER_TARGET=${TARGET_TRIPLE}
-DCMAKE_ASM_COMPILER_TARGET=${TARGET_TRIPLE}
PASSTHROUGH_PREFIXES COMPILER_RT
USE_TOOLCHAIN)
USE_TOOLCHAIN
${EXTRA_ARGS})
else()
get_cmake_property(variableNames VARIABLES)
add_custom_target(builtins)
Expand All @@ -179,7 +184,8 @@ else() # if this is included from LLVM's CMake
-DCOMPILER_RT_DEFAULT_TARGET_ONLY=On
${${target}_extra_args}
PASSTHROUGH_PREFIXES COMPILER_RT
USE_TOOLCHAIN)
USE_TOOLCHAIN
${EXTRA_ARGS})
add_dependencies(builtins builtins-${target})
endforeach()
endif()
Expand Down Expand Up @@ -238,7 +244,8 @@ else() # if this is included from LLVM's CMake
${SUB_COMPONENTS}
${SUB_COMPONENT_CHECK_TARGETS}
${SUB_INSTALL_TARGETS}
USE_TOOLCHAIN)
USE_TOOLCHAIN
${EXTRA_ARGS})

# TODO: This is a hack needed because the libcxx headers are copied into the
# build directory during configuration. Without that step the clang in the
Expand Down

0 comments on commit 2705226

Please sign in to comment.