Skip to content

Commit 715ba63

Browse files
committed
Merge branch 'master' into synthesize-equatable-hashable
2 parents a30c218 + bcb9571 commit 715ba63

File tree

1,126 files changed

+28622
-15107
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,126 files changed

+28622
-15107
lines changed

CMakeLists.txt

Lines changed: 77 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,11 @@ else()
6666
endif()
6767

6868
option(SWIFT_BUILD_PERF_TESTSUITE
69-
"Create targets for swift performance benchmarks."
69+
"Create in-tree targets for building swift performance benchmarks."
70+
FALSE)
71+
72+
option(SWIFT_BUILD_EXTERNAL_PERF_TESTSUITE
73+
"Create out-of-tree targets for building swift performance benchmarks."
7074
FALSE)
7175

7276
option(SWIFT_INCLUDE_TESTS "Create targets for building/running tests." TRUE)
@@ -81,6 +85,13 @@ option(SWIFT_INCLUDE_DOCS
8185
# TODO: Please categorize these!
8286
#
8387

88+
if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
89+
set(CMAKE_BUILD_TYPE "Debug" CACHE STRING
90+
"Build type for Swift [Debug, RelWithDebInfo, Release, MinSizeRel]"
91+
FORCE)
92+
message(STATUS "No build type was specified, will default to ${CMAKE_BUILD_TYPE}")
93+
endif()
94+
8495
set(SWIFT_STDLIB_BUILD_TYPE "${CMAKE_BUILD_TYPE}" CACHE STRING
8596
"Build type for the Swift standard library and SDK overlays [Debug, RelWithDebInfo, Release, MinSizeRel]")
8697
set_property(CACHE SWIFT_STDLIB_BUILD_TYPE PROPERTY
@@ -170,10 +181,10 @@ set(SWIFT_ANDROID_DEPLOY_DEVICE_PATH "" CACHE STRING
170181
"Path on an Android device where build products will be pushed. These are used when running the test suite against the device")
171182

172183
#
173-
# User-configurable ICU specific options for Android, FreeBSD, Linux.
184+
# User-configurable ICU specific options for Android, FreeBSD, Linux and Haiku.
174185
#
175186

176-
foreach(sdk ANDROID;FREEBSD;LINUX;WINDOWS)
187+
foreach(sdk ANDROID;FREEBSD;LINUX;WINDOWS;HAIKU)
177188
set(SWIFT_${sdk}_ICU_UC "" CACHE STRING
178189
"Path to a directory containing the icuuc library for ${sdk}")
179190
set(SWIFT_${sdk}_ICU_UC_INCLUDE "" CACHE STRING
@@ -536,6 +547,8 @@ else()
536547
set(SWIFT_HOST_VARIANT_SDK_default "CYGWIN")
537548
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")
538549
set(SWIFT_HOST_VARIANT_SDK_default "WINDOWS")
550+
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Haiku")
551+
set(SWIFT_HOST_VARIANT_SDK_default "HAIKU")
539552
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
540553
set(SWIFT_HOST_VARIANT_SDK_default "OSX")
541554
else()
@@ -677,6 +690,16 @@ elseif("${SWIFT_HOST_VARIANT_SDK}" STREQUAL "WINDOWS")
677690
set(SWIFT_PRIMARY_VARIANT_SDK_default "${SWIFT_HOST_VARIANT_SDK}")
678691
set(SWIFT_PRIMARY_VARIANT_ARCH_default "${SWIFT_HOST_VARIANT_ARCH}")
679692

693+
elseif("${SWIFT_HOST_VARIANT_SDK}" STREQUAL "HAIKU")
694+
695+
set(CMAKE_EXECUTABLE_FORMAT "ELF")
696+
set(SWIFT_HOST_VARIANT "haiku" CACHE STRING
697+
"Deployment OS for Swift host tools (the compiler) [haiku].")
698+
699+
configure_sdk_unix(HAIKU "Haiku" "haiku" "haiku" "x86_64" "x86_64-unknown-haiku" "/")
700+
set(SWIFT_PRIMARY_VARIANT_SDK_default "${SWIFT_HOST_VARIANT_SDK}")
701+
set(SWIFT_PRIMARY_VARIANT_ARCH_default "x86_64")
702+
680703
elseif("${SWIFT_HOST_VARIANT_SDK}" MATCHES "(OSX|IOS*|TVOS*|WATCHOS*)")
681704

682705
set(SWIFT_HOST_VARIANT "macosx" CACHE STRING
@@ -805,14 +828,23 @@ message(STATUS " Assertions: ${LLVM_ENABLE_ASSERTIONS}")
805828
message(STATUS " LTO: ${SWIFT_TOOLS_ENABLE_LTO}")
806829
message(STATUS "")
807830

808-
message(STATUS "Building Swift standard library and SDK overlays for SDKs: ${SWIFT_SDKS}")
809-
message(STATUS " Build type: ${SWIFT_STDLIB_BUILD_TYPE}")
810-
message(STATUS " Assertions: ${SWIFT_STDLIB_ASSERTIONS}")
811-
message(STATUS "")
831+
if (SWIFT_BULID_STDLIB OR SWIFT_BUILD_SDK_OVERLAY)
812832

813-
message(STATUS "Building Swift runtime with:")
814-
message(STATUS " Leak Detection Checker Entrypoints: ${SWIFT_RUNTIME_ENABLE_LEAK_CHECKER}")
815-
message(STATUS "")
833+
message(STATUS "Building Swift standard library and overlays for SDKs: ${SWIFT_SDKS}")
834+
message(STATUS " Build type: ${SWIFT_STDLIB_BUILD_TYPE}")
835+
message(STATUS " Assertions: ${SWIFT_STDLIB_ASSERTIONS}")
836+
message(STATUS "")
837+
838+
message(STATUS "Building Swift runtime with:")
839+
message(STATUS " Leak Detection Checker Entrypoints: ${SWIFT_RUNTIME_ENABLE_LEAK_CHECKER}")
840+
message(STATUS "")
841+
842+
else()
843+
844+
message(STATUS "Not building Swift standard library, SDK overlays, and runtime")
845+
message(STATUS "")
846+
847+
endif()
816848

817849
#
818850
# Find required dependencies.
@@ -857,22 +889,54 @@ if(NOT DEFINED SWIFT_API_NOTES_INPUTS)
857889
endif()
858890

859891
# Add all of the subdirectories, where we actually do work.
892+
893+
###############
894+
# PLEASE READ #
895+
###############
896+
#
897+
# We have to include stdlib/ before tools/.
898+
# Do not move add_subdirectory(stdlib) after add_subdirectory(tools)!
899+
#
900+
# We must include stdlib/ before tools/ because stdlib/CMakeLists.txt
901+
# declares the swift-stdlib-* set of targets. These targets will then
902+
# implicitly depend on any targets declared with IS_STDLIB or
903+
# TARGET_LIBRARY.
904+
#
905+
# One such library that declares IS_STDLIB is SwiftSyntax, living in
906+
# tools/SwiftSyntax. If we include stdlib/ after tools/,
907+
# the swift-stdlib-* set of targets will not have been generated yet,
908+
# causing the implicit dependency for SwiftSyntax to silently not be
909+
# created. This then will cause SwiftSyntax to fail to build.
910+
#
911+
# https://bugs.swift.org/browse/SR-5975
912+
add_subdirectory(stdlib)
913+
860914
if(SWIFT_INCLUDE_TOOLS)
861915
add_subdirectory(include)
862916
add_subdirectory(lib)
917+
918+
# Always include this after including stdlib/!
919+
# Refer to the large comment above the add_subdirectory(stdlib) call.
920+
# https://bugs.swift.org/browse/SR-5975
863921
add_subdirectory(tools)
864922
endif()
865923

866924
add_subdirectory(utils)
867-
add_subdirectory(stdlib)
868925

869926
if(SWIFT_BUILD_DYNAMIC_STDLIB AND SWIFT_INCLUDE_TESTS)
870927
add_subdirectory(tools/swift-reflection-test)
871928
endif()
872929

873-
if(SWIFT_BUILD_PERF_TESTSUITE AND "${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
874-
add_subdirectory(benchmark)
930+
if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
931+
if(SWIFT_BUILD_PERF_TESTSUITE)
932+
add_subdirectory(benchmark)
933+
endif()
934+
if(SWIFT_BUILD_EXTERNAL_PERF_TESTSUITE)
935+
include(SwiftExternalBenchmarkBuild)
936+
add_external_benchmark_suite()
937+
endif()
875938
endif()
939+
876940
if(SWIFT_INCLUDE_TESTS)
877941
add_subdirectory(test)
878942
add_subdirectory(unittests)

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ which can be installed via a package manager:
7070

7171
sudo port install cmake ninja
7272

73-
Instructions for installing CMake and Ninja directly can be found [below](#build-dependencies)
73+
Instructions for installing CMake and Ninja directly can be found [below](#build-dependencies).
7474

7575
#### Linux
7676

@@ -81,7 +81,7 @@ For Ubuntu, you'll need the following development dependencies:
8181
**Note:** LLDB currently requires at least `swig-1.3.40` but will successfully build
8282
with version 2 shipped with Ubuntu.
8383

84-
Build instructions for Ubuntu 14.04 LTS can be found [here](docs/Ubuntu14.md)
84+
Build instructions for Ubuntu 14.04 LTS can be found [here](docs/Ubuntu14.md).
8585

8686
### Getting Sources for Swift and Related Projects
8787

@@ -181,12 +181,12 @@ To open the Swift project in Xcode, open `${SWIFT_BUILD_DIR}/Swift.xcodeproj`.
181181
It will auto-create a *lot* of schemes for all of the available targets. A
182182
common debug flow would involve:
183183

184-
- Select the 'swift' scheme
185-
- Pull up the scheme editor (⌘⇧<)
186-
- Select the 'Arguments' tab and click the '+'
187-
- Add the command line options
188-
- Close the scheme editor
189-
- Build and run
184+
- Select the 'swift' scheme.
185+
- Pull up the scheme editor (⌘⇧<).
186+
- Select the 'Arguments' tab and click the '+'.
187+
- Add the command line options.
188+
- Close the scheme editor.
189+
- Build and run.
190190

191191
Another option is to change the scheme to "Wait for executable to be launched",
192192
then run the build product in Terminal.

benchmark/CMakeLists.txt

Lines changed: 31 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,19 @@ cmake_minimum_required(VERSION 2.8.12)
1111
list(APPEND CMAKE_MODULE_PATH
1212
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")
1313

14+
# Load utility modules.
15+
include(SwiftBenchmarkUtils)
16+
17+
set(SWIFT_BENCHMARK_BUILT_STANDALONE FALSE)
18+
if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
19+
set(SWIFT_BENCHMARK_BUILT_STANDALONE TRUE)
20+
endif()
21+
22+
if(SWIFT_BENCHMARK_SUBCMAKE_BUILD)
23+
precondition(SWIFT_BENCHMARK_BUILD_STANDALONE
24+
MESSAGE "If we are a subcmake build, we must be built standalone")
25+
endif()
26+
1427
include(AddSwiftBenchmarkSuite)
1528

1629
set(SWIFT_BENCH_MODULES
@@ -25,6 +38,7 @@ set(SWIFT_BENCH_MODULES
2538
single-source/ArrayOfGenericRef
2639
single-source/ArrayOfPOD
2740
single-source/ArrayOfRef
41+
single-source/ArraySetElement
2842
single-source/ArraySubscript
2943
single-source/BitCount
3044
single-source/ByteSwap
@@ -89,6 +103,7 @@ set(SWIFT_BENCH_MODULES
89103
single-source/RC4
90104
single-source/RGBHistogram
91105
single-source/RangeAssignment
106+
single-source/RangeIteration
92107
single-source/RecursiveOwnedParameter
93108
single-source/ReduceInto
94109
single-source/ReversedCollections
@@ -119,13 +134,15 @@ set(SWIFT_BENCH_MODULES
119134
single-source/XorLoop
120135
)
121136

122-
set(SWIFT_MULTISOURCE_BENCHES
137+
set(SWIFT_MULTISOURCE_SWIFT3_BENCHES
138+
multi-source/PrimsSplit
123139
)
124140

141+
set(PrimsSplit_sources
142+
multi-source/PrimsSplit/Prims.swift
143+
multi-source/PrimsSplit/main.swift)
125144

126-
set(BENCH_DRIVER_LIBRARY_MODULES
127-
utils/DriverUtils
128-
utils/TestsUtils
145+
set(SWIFT_MULTISOURCE_SWIFT4_BENCHES
129146
)
130147

131148
set(BENCH_DRIVER_LIBRARY_FLAGS)
@@ -134,6 +151,11 @@ if (SWIFT_RUNTIME_ENABLE_LEAK_CHECKER)
134151
endif()
135152

136153
set(BENCH_LIBRARY_MODULES
154+
utils/TestsUtils
155+
)
156+
157+
set(BENCH_DRIVER_LIBRARY_MODULES
158+
utils/DriverUtils
137159
)
138160

139161
add_definitions(-DSWIFT_EXEC -DSWIFT_LIBRARY_PATH -DONLY_PLATFORMS
@@ -177,7 +199,7 @@ Available configurations: <Optlevel>_SINGLEFILE, <Optlevel>_MULTITHREADED")
177199
# Syntax for an optset: <optimization-level>_<configuration>
178200
# where "_<configuration>" is optional.
179201
if(NOT SWIFT_OPTIMIZATION_LEVELS)
180-
set(SWIFT_OPTIMIZATION_LEVELS "Onone" "O" "Ounchecked"
202+
set(SWIFT_OPTIMIZATION_LEVELS "Onone" "O" "Osize"
181203
${SWIFT_EXTRA_BENCH_CONFIGS})
182204
endif()
183205

@@ -225,6 +247,7 @@ endforeach()
225247

226248
message("--")
227249
message("-- Swift Benchmark Suite:")
250+
message("-- SWIFT_BENCHMARK_BUILT_STANDALONE = ${SWIFT_BENCHMARK_BUILT_STANDALONE}")
228251
message("-- SWIFT_EXEC = ${SWIFT_EXEC}")
229252
message("-- SWIFT_LIBRARY_PATH = ${SWIFT_LIBRARY_PATH}")
230253
message("-- CLANG_EXEC = ${CLANG_EXEC}")
@@ -239,16 +262,12 @@ endforeach()
239262

240263
set(executable_targets)
241264

242-
if(SWIFT_SDKS)
243-
set(IS_SWIFT_BUILD true)
244-
endif()
245-
246265
set(srcdir "${CMAKE_CURRENT_SOURCE_DIR}")
247266

248-
if(IS_SWIFT_BUILD)
249-
get_filename_component(swift-bin-dir "${SWIFT_EXEC}" DIRECTORY)
250-
else()
267+
if(SWIFT_BENCHMARK_BUILT_STANDALONE)
251268
set(swift-bin-dir "${CMAKE_BINARY_DIR}/bin")
269+
else()
270+
get_filename_component(swift-bin-dir "${SWIFT_EXEC}" DIRECTORY)
252271
endif()
253272

254273
set(benchmark-bin-dir "${CMAKE_CURRENT_BINARY_DIR}/bin")

0 commit comments

Comments
 (0)