Skip to content
Closed
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
1 change: 1 addition & 0 deletions cmake/modules/AddSwift.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -848,6 +848,7 @@ function(_add_swift_library_single target name)
handle_gyb_sources(
gyb_dependency_targets
SWIFTLIB_SINGLE_SOURCES
"${SWIFTLIB_SINGLE_SDK}"
"${SWIFTLIB_SINGLE_ARCHITECTURE}")

if (SWIFT_RUNTIME_ENABLE_DTRACE)
Expand Down
24 changes: 16 additions & 8 deletions cmake/modules/SwiftHandleGybSources.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,25 @@ include(SwiftSetIfArchBitness)
# targets that invoke gyb. Every target that depends on the generated
# sources should depend on ${dependency_out_var_name} targets.
#
# sdk
# The platform ("IOS", "LINUX", "ANDROID") the files will be compiled for.
# If this is false, the files are platform-independent and will be emitted
# into ${CMAKE_CURRENT_BINARY_DIR}/${arch} instead of a platform-specific
# destination; this is useful for generated include files.
#
# arch
# The architecture that the files will be compiled for. If this is
# false, the files are architecture-independent and will be emitted
# into ${CMAKE_CURRENT_BINARY_DIR} instead of an architecture-specific
# into ${CMAKE_CURRENT_BINARY_DIR}/${sdk} instead of an architecture-specific
# destination; this is useful for generated include files.
function(handle_gyb_sources dependency_out_var_name sources_var_name arch)
function(handle_gyb_sources dependency_out_var_name sources_var_name sdk arch)
set(extra_gyb_flags "")
if (arch)
set_if_arch_bitness(ptr_size
ARCH "${arch}"
CASE_32_BIT "4"
CASE_64_BIT "8")
set(extra_gyb_flags "-DCMAKE_SIZEOF_VOID_P=${ptr_size}")
set(extra_gyb_flags "-DCMAKE_SIZEOF_VOID_P=${ptr_size}" "-DCMAKE_SDK=${sdk}")
endif()

set(gyb_flags
Expand All @@ -52,10 +58,12 @@ function(handle_gyb_sources dependency_out_var_name sources_var_name arch)
if(src STREQUAL src_sans_gyb)
list(APPEND de_gybbed_sources "${src}")
else()
if (arch)
set(dir "${CMAKE_CURRENT_BINARY_DIR}/${ptr_size}")
else()
set(dir "${CMAKE_CURRENT_BINARY_DIR}")
set(dir "${CMAKE_CURRENT_BINARY_DIR}")
if(sdk)
set(dir "${dir}/${ptr_size}")
endif()
if(arch)
set(dir "${dir}/${ptr_size}")
endif()
set(output_file_name "${dir}/${src_sans_gyb}")
list(APPEND de_gybbed_sources "${output_file_name}")
Expand All @@ -72,7 +80,7 @@ function(handle_gyb_sources dependency_out_var_name sources_var_name arch)
"${CMAKE_COMMAND}" -E remove "${output_file_name}.tmp"
OUTPUT "${output_file_name}"
DEPENDS "${gyb_tool_source}" "${src}" "${gyb_extra_sources}"
COMMENT "Generating ${src_sans_gyb} from ${src} with ptr size = ${ptr_size}"
COMMENT "Generating ${src_sans_gyb} from ${src} with sdk = ${sdk} and ptr size = ${ptr_size}"
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
SOURCES "${src}"
IDEMPOTENT)
Expand Down
1 change: 1 addition & 0 deletions lib/ClangImporter/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ set(generated_include_sources SortedCFDatabase.def.gyb)
handle_gyb_sources(
generated_include_targets
generated_include_sources
""
"")

add_swift_library(swiftClangImporter
Expand Down
7 changes: 6 additions & 1 deletion stdlib/public/core/BuiltinMath.swift.gyb
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,15 @@ def cFuncSuffix(bits):
UnaryIntrinsicFunctions = [
'cos', 'sin',
'exp', 'exp2',
'log', 'log10', 'log2',
'log', 'log10',
'fabs',
'ceil', 'floor', 'nearbyint', 'rint', 'round', 'trunc',
]
# Android doesn't have a native log2 function.
# FIXME: Incorporate an implementation that works with Swift's license,
# or implement one ourselves in 'stdlib/public/stubs'.
if CMAKE_SDK != "ANDROID":
UnaryIntrinsicFunctions += ['log2']

def TypedUnaryIntrinsicFunctions():
for ufunc in UnaryIntrinsicFunctions:
Expand Down
2 changes: 0 additions & 2 deletions stdlib/public/stubs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ add_swift_library(swiftStdlibStubs IS_STDLIB IS_STDLIB_CORE
LibcShims.cpp
Stubs.cpp
UnicodeExtendedGraphemeClusters.cpp.gyb
android_support/Android_log2.cpp
android_support/Android_log2f.cpp
${swift_stubs_objc_sources}
${swift_stubs_unicode_normalization_sources}
C_COMPILE_FLAGS ${SWIFT_CORE_CXX_FLAGS}
Expand Down
5 changes: 0 additions & 5 deletions stdlib/public/stubs/android_support/Android_log2.cpp

This file was deleted.

5 changes: 0 additions & 5 deletions stdlib/public/stubs/android_support/Android_log2f.cpp

This file was deleted.

120 changes: 0 additions & 120 deletions stdlib/public/stubs/android_support/e_log2.c

This file was deleted.

82 changes: 0 additions & 82 deletions stdlib/public/stubs/android_support/e_log2f.c

This file was deleted.

Loading