Skip to content

Commit b972bef

Browse files
authored
Add an implementation of Differentiation without tgmath (#34116)
Addresses rdar://68471851
1 parent 99b16d0 commit b972bef

File tree

3 files changed

+33
-1
lines changed

3 files changed

+33
-1
lines changed

stdlib/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ option(SWIFT_ENABLE_MODULE_INTERFACES
6666
"Generate .swiftinterface files alongside .swiftmodule files"
6767
"${SWIFT_STDLIB_STABLE_ABI}")
6868

69+
option(SWIFT_COMPILE_DIFFERENTIATION_WITHOUT_TGMATH
70+
"Build Differentation without tgmath (and dependency on platform runtime libraries)"
71+
FALSE)
72+
6973
#
7074
# End of user-configurable options.
7175
#

stdlib/public/CMakeLists.txt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,15 @@ if(SWIFT_BUILD_STDLIB)
8787
add_subdirectory(SwiftOnoneSupport)
8888

8989
if(SWIFT_ENABLE_EXPERIMENTAL_DIFFERENTIABLE_PROGRAMMING)
90-
add_subdirectory(Differentiation)
90+
if(SWIFT_COMPILE_DIFFERENTIATION_WITHOUT_TGMATH)
91+
# Use a different CMakeLists.txt for this configuration
92+
# while sharing the bulk of the code
93+
# This way we will reduce any side effect on the main configuration
94+
# and increase the readability of the CMake code
95+
add_subdirectory(Differentiation_NoTgMath)
96+
else()
97+
add_subdirectory(Differentiation)
98+
endif()
9199
endif()
92100

93101
if(SWIFT_ENABLE_EXPERIMENTAL_CONCURRENCY)
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
set(SOURCES_FOLDER ../Differentiation)
2+
3+
add_swift_target_library(swift_Differentiation ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} IS_STDLIB
4+
${SOURCES_FOLDER}/Differentiable.swift
5+
${SOURCES_FOLDER}/DifferentialOperators.swift
6+
${SOURCES_FOLDER}/DifferentiationUtilities.swift
7+
${SOURCES_FOLDER}/AnyDifferentiable.swift
8+
${SOURCES_FOLDER}/ArrayDifferentiation.swift
9+
${SOURCES_FOLDER}/OptionalDifferentiation.swift
10+
11+
GYB_SOURCES
12+
${SOURCES_FOLDER}/FloatingPointDifferentiation.swift.gyb
13+
${SOURCES_FOLDER}/SIMDDifferentiation.swift.gyb
14+
15+
SWIFT_COMPILE_FLAGS
16+
${SWIFT_STANDARD_LIBRARY_SWIFT_FLAGS}
17+
-parse-stdlib
18+
LINK_FLAGS "${SWIFT_RUNTIME_SWIFT_LINK_FLAGS}"
19+
DARWIN_INSTALL_NAME_DIR "@rpath"
20+
INSTALL_IN_COMPONENT stdlib)

0 commit comments

Comments
 (0)