Skip to content

Add an implementation of Differentiation without tgmath #34116

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions stdlib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ option(SWIFT_ENABLE_MODULE_INTERFACES
"Generate .swiftinterface files alongside .swiftmodule files"
"${SWIFT_STDLIB_STABLE_ABI}")

option(SWIFT_COMPILE_DIFFERENTIATION_WITHOUT_TGMATH
"Build Differentation without tgmath (and dependency on platform runtime libraries)"
FALSE)

#
# End of user-configurable options.
#
Expand Down
10 changes: 9 additions & 1 deletion stdlib/public/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,15 @@ if(SWIFT_BUILD_STDLIB)
add_subdirectory(SwiftOnoneSupport)

if(SWIFT_ENABLE_EXPERIMENTAL_DIFFERENTIABLE_PROGRAMMING)
add_subdirectory(Differentiation)
if(SWIFT_COMPILE_DIFFERENTIATION_WITHOUT_TGMATH)
# Use a different CMakeLists.txt for this configuration
# while sharing the bulk of the code
# This way we will reduce any side effect on the main configuration
# and increase the readability of the CMake code
add_subdirectory(Differentiation_NoTgMath)
else()
add_subdirectory(Differentiation)
endif()
endif()

if(SWIFT_ENABLE_EXPERIMENTAL_CONCURRENCY)
Expand Down
20 changes: 20 additions & 0 deletions stdlib/public/Differentiation_NoTgMath/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
set(SOURCES_FOLDER ../Differentiation)

add_swift_target_library(swift_Differentiation ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} IS_STDLIB
${SOURCES_FOLDER}/Differentiable.swift
${SOURCES_FOLDER}/DifferentialOperators.swift
${SOURCES_FOLDER}/DifferentiationUtilities.swift
${SOURCES_FOLDER}/AnyDifferentiable.swift
${SOURCES_FOLDER}/ArrayDifferentiation.swift
${SOURCES_FOLDER}/OptionalDifferentiation.swift

GYB_SOURCES
${SOURCES_FOLDER}/FloatingPointDifferentiation.swift.gyb
${SOURCES_FOLDER}/SIMDDifferentiation.swift.gyb

SWIFT_COMPILE_FLAGS
${SWIFT_STANDARD_LIBRARY_SWIFT_FLAGS}
-parse-stdlib
LINK_FLAGS "${SWIFT_RUNTIME_SWIFT_LINK_FLAGS}"
DARWIN_INSTALL_NAME_DIR "@rpath"
INSTALL_IN_COMPONENT stdlib)