Skip to content

Commit a0ec0c0

Browse files
committed
build: inline single use add_swift_executable
Inline the single use of this function and remove the extra parameter handling around it, letting `_add_swift_executable_single` do the heavy lifting.
1 parent 837385c commit a0ec0c0

File tree

1 file changed

+3
-78
lines changed

1 file changed

+3
-78
lines changed

cmake/modules/AddSwift.cmake

Lines changed: 3 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -2201,83 +2201,6 @@ function(_add_swift_executable_single name)
22012201
PROPERTIES FOLDER "Swift executables")
22022202
endfunction()
22032203

2204-
# Add an executable for the host machine.
2205-
#
2206-
# Usage:
2207-
# add_swift_executable(name
2208-
# [DEPENDS dep1 ...]
2209-
# [LLVM_COMPONENT_DEPENDS comp1 ...]
2210-
# [FILE_DEPENDS target1 ...]
2211-
# [LINK_LIBRARIES target1 ...]
2212-
# [EXCLUDE_FROM_ALL]
2213-
# [DONT_STRIP_NON_MAIN_SYMBOLS]
2214-
# [DISABLE_ASLR]
2215-
# source1 [source2 source3 ...])
2216-
#
2217-
# name
2218-
# Name of the executable (e.g., swift).
2219-
#
2220-
# LIBRARIES
2221-
# Libraries this executable depends on, without variant suffixes.
2222-
#
2223-
# LLVM_COMPONENT_DEPENDS
2224-
# LLVM components this executable depends on.
2225-
#
2226-
# FILE_DEPENDS
2227-
# Additional files this executable depends on.
2228-
#
2229-
# LINK_LIBRARIES
2230-
# Libraries to link with.
2231-
#
2232-
# EXCLUDE_FROM_ALL
2233-
# Whether to exclude this executable from the ALL_BUILD target.
2234-
#
2235-
# DONT_STRIP_NON_MAIN_SYMBOLS
2236-
# Should we not strip non main symbols.
2237-
#
2238-
# DISABLE_ASLR
2239-
# Should we compile with -Wl,-no_pie so that ASLR is disabled?
2240-
#
2241-
# source1 ...
2242-
# Sources to add into this executable.
2243-
#
2244-
# Note:
2245-
# Host executables are not given a variant suffix. To build an executable for
2246-
# each SDK and ARCH variant, use add_swift_target_executable.
2247-
function(add_swift_executable name)
2248-
# Parse the arguments we were given.
2249-
cmake_parse_arguments(SWIFTEXE
2250-
"EXCLUDE_FROM_ALL;DONT_STRIP_NON_MAIN_SYMBOLS;DISABLE_ASLR"
2251-
""
2252-
"DEPENDS;LLVM_COMPONENT_DEPENDS;LINK_LIBRARIES;COMPILE_FLAGS"
2253-
${ARGN})
2254-
2255-
translate_flag(${SWIFTEXE_EXCLUDE_FROM_ALL}
2256-
"EXCLUDE_FROM_ALL"
2257-
SWIFTEXE_EXCLUDE_FROM_ALL_FLAG)
2258-
translate_flag(${SWIFTEXE_DONT_STRIP_NON_MAIN_SYMBOLS}
2259-
"DONT_STRIP_NON_MAIN_SYMBOLS"
2260-
SWIFTEXE_DONT_STRIP_NON_MAIN_SYMBOLS_FLAG)
2261-
translate_flag(${SWIFTEXE_DISABLE_ASLR}
2262-
"DISABLE_ASLR"
2263-
SWIFTEXE_DISABLE_ASLR_FLAG)
2264-
2265-
set(SWIFTEXE_SOURCES ${SWIFTEXE_UNPARSED_ARGUMENTS})
2266-
2267-
_add_swift_executable_single(
2268-
${name}
2269-
${SWIFTEXE_SOURCES}
2270-
DEPENDS ${SWIFTEXE_DEPENDS}
2271-
LLVM_COMPONENT_DEPENDS ${SWIFTEXE_LLVM_COMPONENT_DEPENDS}
2272-
LINK_LIBRARIES ${SWIFTEXE_LINK_LIBRARIES}
2273-
SDK ${SWIFT_HOST_VARIANT_SDK}
2274-
ARCHITECTURE ${SWIFT_HOST_VARIANT_ARCH}
2275-
COMPILE_FLAGS ${SWIFTEXE_COMPILE_FLAGS}
2276-
${SWIFTEXE_EXCLUDE_FROM_ALL_FLAG}
2277-
${SWIFTEXE_DONT_STRIP_NON_MAIN_SYMBOLS_FLAG}
2278-
${SWIFTEXE_DISABLE_ASLR_FLAG})
2279-
endfunction()
2280-
22812204
macro(add_swift_tool_subdirectory name)
22822205
add_llvm_subdirectory(SWIFT TOOL ${name})
22832206
endmacro()
@@ -2301,7 +2224,9 @@ function(add_swift_host_tool executable)
23012224
MESSAGE "Swift Component is required to add a host tool")
23022225

23032226
# Create the executable rule.
2304-
add_swift_executable(${executable}
2227+
_add_swift_executable_single(${executable}
2228+
SDK ${SWIFT_HOST_VARIANT_SDK}
2229+
ARCHITECTURE ${SWIFT_HOST_VARIANT_ARCH}
23052230
${ASHT_UNPARSED_ARGUMENTS})
23062231

23072232
swift_install_in_component(${ASHT_SWIFT_COMPONENT}

0 commit comments

Comments
 (0)