Skip to content

Commit 24cfa38

Browse files
committed
Add RegexBuilder module.
The [regex builder DSL](https://forums.swift.org/t/pitch-regex-builder-dsl/56007) proposal adds regex builder to a new module named `RegexBuilder`. Friend PR: swiftlang/swift-experimental-string-processing#227
1 parent 7390f7d commit 24cfa38

File tree

2 files changed

+49
-0
lines changed

2 files changed

+49
-0
lines changed

stdlib/public/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ if(SWIFT_BUILD_STDLIB)
125125
if(SWIFT_ENABLE_EXPERIMENTAL_STRING_PROCESSING)
126126
add_subdirectory(MatchingEngine)
127127
add_subdirectory(StringProcessing)
128+
add_subdirectory(RegexBuilder)
128129
endif()
129130
endif()
130131

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#===--- CMakeLists.txt - String processing support library -----------------===#
2+
#
3+
# This source file is part of the Swift.org open source project
4+
#
5+
# Copyright (c) 2021 Apple Inc. and the Swift project authors
6+
# Licensed under Apache License v2.0 with Runtime Library Exception
7+
#
8+
# See https://swift.org/LICENSE.txt for license information
9+
# See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
10+
#
11+
#===------------------------------------------------------------------------===#
12+
13+
set(swift_regex_builder_link_libraries
14+
swiftCore
15+
swift_MatchingEngine
16+
swift_StringProcessing)
17+
18+
file(GLOB_RECURSE _REGEX_BUILDER_SOURCES
19+
"${EXPERIMENTAL_STRING_PROCESSING_SOURCE_DIR}/Sources/RegexBuilder/*.swift")
20+
set(REGEX_BUILDER_SOURCES)
21+
foreach(source ${_REGEX_BUILDER_SOURCES})
22+
file(TO_CMAKE_PATH "${source}" source)
23+
list(APPEND REGEX_BUILDER_SOURCES ${source})
24+
endforeach()
25+
message(STATUS "Using Experimental String Processing library for RegexBuilder (${EXPERIMENTAL_STRING_PROCESSING_SOURCE_DIR}).")
26+
27+
add_swift_target_library(swiftRegexBuilder ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} IS_STDLIB
28+
"${REGEX_BUILDER_SOURCES}"
29+
30+
SWIFT_MODULE_DEPENDS_LINUX Glibc
31+
SWIFT_MODULE_DEPENDS_FREEBSD Glibc
32+
SWIFT_MODULE_DEPENDS_OPENBSD Glibc
33+
SWIFT_MODULE_DEPENDS_CYGWIN Glibc
34+
SWIFT_MODULE_DEPENDS_HAIKU Glibc
35+
SWIFT_MODULE_DEPENDS_WINDOWS CRT
36+
37+
LINK_LIBRARIES ${swift_regex_builder_link_libraries}
38+
39+
C_COMPILE_FLAGS
40+
-DswiftRegexBuilder_EXPORTS
41+
SWIFT_COMPILE_FLAGS
42+
${SWIFT_STANDARD_LIBRARY_SWIFT_FLAGS}
43+
-Xfrontend -enable-experimental-pairwise-build-block
44+
LINK_FLAGS "${SWIFT_RUNTIME_SWIFT_LINK_FLAGS}"
45+
46+
SWIFT_MODULE_DEPENDS _StringProcessing
47+
INSTALL_IN_COMPONENT stdlib
48+
)

0 commit comments

Comments
 (0)