endif()
endif()
+option(LLVM_DEPENDENCY_DEBUGGING "Dependency debugging mode to verify correctly expressed library dependencies (Darwin only)" OFF)
+
+# Some features of the LLVM build may be disallowed when dependency debugging is
+# enabled. In particular you cannot use ccache because we want to force compile
+# operations to always happen.
+if(LLVM_DEPENDENCY_DEBUGGING)
+ if(NOT CMAKE_HOST_APPLE)
+ message(FATAL_ERROR "Dependency debugging is only currently supported on Darwin hosts.")
+ endif()
+ if(LLVM_CCACHE_BUILD)
+ message(FATAL_ERROR "Cannot enable dependency debugging while using ccache.")
+ endif()
+endif()
+
option(LLVM_BUILD_GLOBAL_ISEL "Experimental: Build GlobalISel" OFF)
if(LLVM_BUILD_GLOBAL_ISEL)
add_definitions(-DLLVM_BUILD_GLOBAL_ISEL)
endif()
endif()
+ setup_dependency_debugging(${name} ${LLVM_COMMON_DEPENDS})
+
# Generate objlib
if((ARG_SHARED AND ARG_STATIC) OR ARG_OBJECT)
# Generate an obj library for both targets.
macro(add_llvm_executable name)
- cmake_parse_arguments(ARG "DISABLE_LLVM_LINK_LLVM_DYLIB;IGNORE_EXTERNALIZE_DEBUGINFO;NO_INSTALL_RPATH" "" "" ${ARGN})
+ cmake_parse_arguments(ARG "DISABLE_LLVM_LINK_LLVM_DYLIB;IGNORE_EXTERNALIZE_DEBUGINFO;NO_INSTALL_RPATH" "" "DEPENDS" ${ARGN})
llvm_process_sources( ALL_FILES ${ARG_UNPARSED_ARGUMENTS} )
+ list(APPEND LLVM_COMMON_DEPENDS ${ARG_DEPENDS})
+
# Generate objlib
if(LLVM_ENABLE_OBJLIB)
# Generate an obj library for both targets.
list(APPEND ALL_FILES "${LLVM_MAIN_SRC_DIR}/cmake/dummy.cpp")
endif()
+ setup_dependency_debugging(${name} ${LLVM_COMMON_DEPENDS})
+
if( EXCLUDE_FROM_ALL )
add_executable(${name} EXCLUDE_FROM_ALL ${ALL_FILES})
else()
INSTALL_RPATH "${_install_rpath}"
${_install_name_dir})
endfunction()
+
+function(setup_dependency_debugging name)
+ if(NOT LLVM_DEPENDENCY_DEBUGGING)
+ return()
+ endif()
+
+ if("intrinsics_gen" IN_LIST ARGN)
+ return()
+ endif()
+
+ set(deny_attributes_gen "(deny file* (literal \"${LLVM_BINARY_DIR}/include/llvm/IR/Attributes.gen\"))")
+ set(deny_intrinsics_gen "(deny file* (literal \"${LLVM_BINARY_DIR}/include/llvm/IR/Intrinsics.gen\"))")
+
+ set(sandbox_command "sandbox-exec -p '(version 1) (allow default) ${deny_attributes_gen} ${deny_intrinsics_gen}'")
+ set_property(DIRECTORY PROPERTY RULE_LAUNCH_COMPILE ${sandbox_command})
+endfunction()