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 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120
|
set(ASTGen_Swift_dependencies)
# If requested, build the regular expression parser into the compiler itself.
if(SWIFT_BUILD_REGEX_PARSER_IN_COMPILER)
file(GLOB_RECURSE _COMPILER_REGEX_PARSER_SOURCES
"${SWIFT_PATH_TO_STRING_PROCESSING_SOURCE}/Sources/_RegexParser/*.swift")
set(COMPILER_REGEX_PARSER_SOURCES)
foreach(source ${_COMPILER_REGEX_PARSER_SOURCES})
file(TO_CMAKE_PATH "${source}" source)
list(APPEND COMPILER_REGEX_PARSER_SOURCES ${source})
endforeach()
message(STATUS "Using Experimental String Processing library for _CompilerRegexParser (${SWIFT_PATH_TO_STRING_PROCESSING_SOURCE}).")
add_pure_swift_host_library(_CompilerRegexParser STATIC EMIT_MODULE
"${COMPILER_REGEX_PARSER_SOURCES}"
)
list(APPEND ASTGen_Swift_dependencies _CompilerRegexParser)
endif()
add_pure_swift_host_library(swiftASTGen STATIC
Sources/ASTGen/ASTGen.swift
Sources/ASTGen/Bridge.swift
Sources/ASTGen/DeclAttrs.swift
Sources/ASTGen/Decls.swift
Sources/ASTGen/Diagnostics.swift
Sources/ASTGen/DiagnosticsBridge.swift
Sources/ASTGen/Exprs.swift
Sources/ASTGen/Generics.swift
Sources/ASTGen/LegacyParse.swift
Sources/ASTGen/Literals.swift
Sources/ASTGen/Macros.swift
Sources/ASTGen/ParameterClause.swift
Sources/ASTGen/Patterns.swift
Sources/ASTGen/PluginHost.swift
Sources/ASTGen/Regex.swift
Sources/ASTGen/SourceFile.swift
Sources/ASTGen/SourceManager.swift
Sources/ASTGen/SourceManager+MacroExpansionContext.swift
Sources/ASTGen/Stmts.swift
Sources/ASTGen/TypeAttrs.swift
Sources/ASTGen/Types.swift
DEPENDENCIES
swiftAST
SWIFT_DEPENDENCIES
SwiftBasicFormat
SwiftCompilerPluginMessageHandling
SwiftDiagnostics
SwiftOperators
SwiftParser
SwiftParserDiagnostics
SwiftSyntax
SwiftSyntaxBuilder
SwiftSyntaxMacros
SwiftSyntaxMacroExpansion
${ASTGen_Swift_dependencies}
)
add_pure_swift_host_library(swiftIDEUtilsBridging
Sources/SwiftIDEUtilsBridging/NameMatcherBridging.swift
DEPENDENCIES
swiftAST
swiftASTGen
SWIFT_DEPENDENCIES
SwiftIDEUtils
SwiftSyntax
)
set(c_include_paths
# LLVM modules and headers.
"${LLVM_MAIN_INCLUDE_DIR}"
# Generated LLVM headers.
"${LLVM_INCLUDE_DIR}"
# Clang modules and headers.
${CLANG_INCLUDE_DIRS}
# Bridging modules and headers.
"${SWIFT_MAIN_INCLUDE_DIR}"
# Generated C headers.
"${CMAKE_CURRENT_BINARY_DIR}/../../include")
set(c_include_paths_args)
foreach(c_include_path ${c_include_paths})
list(APPEND c_include_paths_args "SHELL: -Xcc -I -Xcc ${c_include_path}")
endforeach()
set(compile_options
${c_include_paths_args}
"SHELL: -DRESILIENT_SWIFT_SYNTAX"
"SHELL: -Xcc -std=c++17 -Xcc -DCOMPILED_WITH_SWIFT"
# FIXME: Needed to work around an availability issue with CxxStdlib
"SHELL: -Xfrontend -disable-target-os-checking"
# Necessary to avoid treating IBOutlet and IBAction as keywords
"SHELL:-Xcc -UIBOutlet -Xcc -UIBAction -Xcc -UIBInspectable"
"SHELL:-Xcc -D_CRT_USE_BUILTIN_OFFSETOF"
)
# Prior to 5.9, we have to use the experimental flag for C++ interop.
if (CMAKE_Swift_COMPILER_VERSION VERSION_LESS 5.9)
list(APPEND compile_options "-Xfrontend" "-enable-experimental-cxx-interop")
else()
list(APPEND compile_options "-cxx-interoperability-mode=default")
endif()
# FXIME: Importing package-cmo enabled '.swiftmodule' causes compiler crash :(
if(Swift_COMPILER_PACKAGE_CMO_SUPPORT)
list(APPEND compile_options
"SHELL:-Xfrontend -module-load-mode -Xfrontend prefer-interface")
endif()
if(SWIFT_BUILD_SWIFT_SYNTAX)
foreach(target swiftASTGen swiftIDEUtilsBridging)
target_compile_options(${target} PRIVATE ${compile_options})
endforeach()
endif()
|