Skip to content

Commit d4598ec

Browse files
authored
Merge pull request #22002 from compnerd/nx
build: inline single use `add_swift_executable`
2 parents 314742e + a0ec0c0 commit d4598ec

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
@@ -2195,83 +2195,6 @@ function(_add_swift_executable_single name)
21952195
PROPERTIES FOLDER "Swift executables")
21962196
endfunction()
21972197

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

22972220
# Create the executable rule.
2298-
add_swift_executable(${executable}
2221+
_add_swift_executable_single(${executable}
2222+
SDK ${SWIFT_HOST_VARIANT_SDK}
2223+
ARCHITECTURE ${SWIFT_HOST_VARIANT_ARCH}
22992224
${ASHT_UNPARSED_ARGUMENTS})
23002225

23012226
swift_install_in_component(${ASHT_SWIFT_COMPONENT}

0 commit comments

Comments
 (0)