forked from swiftlang/swift
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
66 lines (62 loc) · 2.16 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
set(swiftDriver_sources
Action.cpp
Compilation.cpp
DarwinToolChains.cpp
DependencyGraph.cpp
Driver.cpp
ExperimentalDependencyDriverGraph.cpp
FrontendUtil.cpp
Job.cpp
ParseableOutput.cpp
PrettyStackTrace.cpp
ToolChain.cpp
ToolChains.cpp
UnixToolChains.cpp
WindowsToolChains.cpp
)
set(swiftDriver_targetDefines)
add_swift_host_library(swiftDriver STATIC
${swiftDriver_sources})
add_dependencies(swiftDriver
SwiftOptions)
target_link_libraries(swiftDriver PRIVATE
swiftAST
swiftBasic
swiftOption)
# Generate the static-stdlib-args.lnk file used by -static-stdlib option
# for 'GenericUnix' (eg linux)
if(SWIFT_BUILD_STATIC_STDLIB)
set(static_stdlib_lnk_file_list)
foreach(sdk ${SWIFT_CONFIGURED_SDKS})
if("${SWIFT_SDK_${sdk}_OBJECT_FORMAT}" STREQUAL "ELF")
string(TOLOWER "${sdk}" lowercase_sdk)
if(SWIFT_${SWIFT_HOST_VARIANT_SDK}_${SWIFT_HOST_VARIANT_ARCH}_ICU_STATICLIB)
set(ICU_STATICLIB "TRUE")
else()
set(ICU_STATICLIB "FALSE")
find_package(ICU REQUIRED COMPONENTS uc i18n)
get_filename_component(ICU_UC_LIBDIR "${ICU_UC_LIBRARIES}" DIRECTORY)
get_filename_component(ICU_I18N_LIBDIR "${ICU_I18N_LIBRARIES}" DIRECTORY)
endif()
set(linkfile "${lowercase_sdk}/static-stdlib-args.lnk")
add_custom_command_target(swift_static_stdlib_${sdk}_args
COMMAND
"${SWIFT_SOURCE_DIR}/utils/gen-static-stdlib-link-args"
"${sdk}"
"${SWIFTSTATICLIB_DIR}/${linkfile}"
"${ICU_STATICLIB}"
"${ICU_UC_LIBDIR}"
"${ICU_I18N_LIBDIR}"
OUTPUT
"${SWIFTSTATICLIB_DIR}/${linkfile}"
DEPENDS
"${SWIFT_SOURCE_DIR}/utils/gen-static-stdlib-link-args")
list(APPEND static_stdlib_lnk_file_list ${swift_static_stdlib_${sdk}_args})
swift_install_in_component(FILES "${SWIFTSTATICLIB_DIR}/${linkfile}"
DESTINATION "lib/swift_static/${lowercase_sdk}"
COMPONENT stdlib)
endif()
endforeach()
add_custom_target(swift_static_lnk_args ALL DEPENDS ${static_stdlib_lnk_file_list})
add_dependencies(stdlib swift_static_lnk_args)
endif()