Skip to content

Commit e92c2a2

Browse files
committed
add_swift_host_library: make a trivial wrapper around add_llvm_library
1 parent 1bb88b7 commit e92c2a2

File tree

1 file changed

+7
-59
lines changed

1 file changed

+7
-59
lines changed

cmake/modules/AddSwift.cmake

Lines changed: 7 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1319,49 +1319,12 @@ endfunction()
13191319
#
13201320
# Usage:
13211321
# add_swift_host_library(name
1322-
# [SHARED]
1323-
# [STATIC]
1324-
# [DEPENDS dep1 ...]
1325-
# [LINK_LIBS lib1 ...]
1326-
# [SWIFT_MODULE_DEPENDS dep1 ...]
1327-
# [LINK_COMPONENTS comp1 ...]
1328-
# [INSTALL]
1329-
# INSTALL_IN_COMPONENT comp
1330-
# source1 [source2 source3 ...])
1331-
#
1332-
# name
1333-
# Name of the library (e.g., swiftParse).
1334-
#
1335-
# SHARED
1336-
# Build a shared library.
1337-
#
1338-
# STATIC
1339-
# Build a static library.
1340-
#
1341-
# DEPENDS
1342-
# Targets that this library depends on.
1343-
#
1344-
# LINK_LIBS
1345-
# Libraries this library depends on.
1346-
#
1347-
# LINK_COMPONENTS
1348-
# LLVM components this library depends on.
1349-
#
1350-
# INSTALL_IN_COMPONENT comp
1351-
# The Swift installation component that this library belongs to.
1352-
#
1353-
# source1 ...
1354-
# Sources to add into this library.
1322+
# [FORCE_BUILD_OPTIMIZED]
1323+
# [...]
13551324
function(add_swift_host_library name)
1356-
set(options
1357-
FORCE_BUILD_OPTIMIZED
1358-
SHARED
1359-
STATIC)
1325+
set(options FORCE_BUILD_OPTIMIZED)
13601326
set(single_parameter_options)
1361-
set(multiple_parameter_options
1362-
DEPENDS
1363-
LINK_LIBS
1364-
LINK_COMPONENTS)
1327+
set(multiple_parameter_options)
13651328

13661329
cmake_parse_arguments(ASHL
13671330
"${options}"
@@ -1370,26 +1333,11 @@ function(add_swift_host_library name)
13701333
${ARGN})
13711334
set(ASHL_SOURCES ${ASHL_UNPARSED_ARGUMENTS})
13721335

1373-
translate_flags(ASHL "${options}")
1374-
1375-
if(NOT ASHL_SHARED AND NOT ASHL_STATIC)
1376-
message(FATAL_ERROR "Either SHARED or STATIC must be specified")
1336+
llvm_add_library(${name} ${ASHL_UNPARSED_ARGUMENTS})
1337+
if(ASHL_FORCE_BUILD_OPTIMIZED)
1338+
target_compile_options(${name} PRIVATE "-O2")
13771339
endif()
13781340

1379-
_add_swift_library_single(
1380-
${name}
1381-
${name}
1382-
${ASHL_SHARED_keyword}
1383-
${ASHL_STATIC_keyword}
1384-
${ASHL_SOURCES}
1385-
SDK ${SWIFT_HOST_VARIANT_SDK}
1386-
ARCHITECTURE ${SWIFT_HOST_VARIANT_ARCH}
1387-
DEPENDS ${ASHL_DEPENDS}
1388-
LINK_LIBRARIES ${ASHL_LINK_LIBS}
1389-
LLVM_COMPONENT_DEPENDS ${ASHL_LINK_COMPONENTS}
1390-
INSTALL_IN_COMPONENT "dev"
1391-
)
1392-
13931341
swift_install_in_component(dev
13941342
TARGETS ${name}
13951343
ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}

0 commit comments

Comments
 (0)