llvm.org GIT mirror llvm / 3e8e88e
[CMake] Add support for exposing runtime targets This patch adds support to the runtimes build for exposing sub-project targets through the high-level configuration. This will enable exposing the build, check and install targets for sub-project components (i.e. asan, check-asan, install-asan...). This patch requires minor changes to the runtime projects to take advantage of it, and I'll phase those changes into Compiler-RT shortly. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279776 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Bieneman 4 years ago
2 changed file(s) with 44 addition(s) and 11 deletion(s). Raw diff Collapse all Expand all
1717 # If this file is acting as a top-level CMake invocation, this code path is
1818 # triggered by the external project call for the runtimes target below.
1919 if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR})
20
21 function(runtime_register_component name)
22 set_property(GLOBAL APPEND PROPERTY SUB_COMPONENTS ${name})
23 endfunction()
2024
2125 cmake_minimum_required(VERSION 3.4.3)
2226
7074 list(APPEND RUNTIMES_LIT_EXTRA_ARGS ${LLVM_LIT_EXTRA_ARGS})
7175 endforeach()
7276
73 # Add a global check rule now that all subdirectories have been traversed
74 # and we know the total set of lit testsuites.
75
76 add_lit_target(check-runtimes
77 "Running all regression tests"
78 ${RUNTIMES_LIT_TESTSUITES}
79 PARAMS ${RUNTIMES_LIT_PARAMS}
80 DEPENDS ${RUNTIMES_LIT_DEPENDS}
81 ARGS ${RUNTIMES_LIT_EXTRA_ARGS}
82 )
83 add_custom_target(test-depends-runtimes DEPENDS ${RUNTIMES_LIT_DEPENDS})
77 if(LLVM_INCLUDE_TESTS)
78 # Add a global check rule now that all subdirectories have been traversed
79 # and we know the total set of lit testsuites.
80
81 add_lit_target(check-runtimes
82 "Running all regression tests"
83 ${RUNTIMES_LIT_TESTSUITES}
84 PARAMS ${RUNTIMES_LIT_PARAMS}
85 DEPENDS ${RUNTIMES_LIT_DEPENDS}
86 ARGS ${RUNTIMES_LIT_EXTRA_ARGS}
87 )
88 add_custom_target(test-depends-runtimes DEPENDS ${RUNTIMES_LIT_DEPENDS})
89 endif()
90
91 get_property(SUB_COMPONENTS GLOBAL PROPERTY SUB_COMPONENTS)
92 list(REMOVE_DUPLICATES SUB_COMPONENTS)
93 foreach(component ${SUB_COMPONENTS})
94 if(NOT TARGET ${component})
95 message(SEND_ERROR "Missing target for runtime component ${component}!")
96 continue()
97 endif()
98 if(LLVM_INCLUDE_TESTS AND NOT TARGET check-${component})
99 message(SEND_ERROR "Missing check target for runtime component ${component}!")
100 continue()
101 endif()
102
103 if(TARGET install-${component})
104 list(APPEND SUB_INSTALL_TARGETS install-${component})
105 endif()
106 endforeach()
107
108 configure_file(
109 ${CMAKE_CURRENT_SOURCE_DIR}/Components.cmake.in
110 ${LLVM_BINARY_DIR}/runtimes/Components.cmake)
84111
85112 else() # if this is included from LLVM's CMake
113 include(${LLVM_BINARY_DIR}/runtimes/Components.cmake OPTIONAL)
114 set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${LLVM_BINARY_DIR}/runtimes/Components.cmake)
86115 include(LLVMExternalProjectUtils)
87116
88117 # If compiler-rt is present we need to build the builtin libraries first. This
133162 EXTRA_TARGETS ${extra_targets}
134163 test-depends-runtimes
135164 check-runtimes
165 ${SUB_COMPONENTS}
166 ${SUB_INSTALL_TARGETS}
136167 USE_TOOLCHAIN)
137168 set_property(GLOBAL APPEND PROPERTY LLVM_LIT_DEPENDS test-depends-runtimes)
138169
0 set(SUB_COMPONENTS @SUB_COMPONENTS@)
1 set(SUB_INSTALL_TARGETS @SUB_INSTALL_TARGETS@)