Commit Graph

43 Commits

Author SHA1 Message Date
Hamish Knight
d260bd8ddb [build-script] Remove Xcode generation support
This was quite brittle and has now been superseded
by swift-xcodegen. Remove the CMake/build-script
logic for it, leaving the option behind to inform
users to switch to using xcodegen instead.
2025-02-12 12:19:21 +00:00
Eric Miotto
efdd4954d3 build-script: add flag to pass arguments to dsymutil
This is currently needed to disable DWARF verification in
some Apple internal configurations.

Addresses rdar://125092216
2024-03-22 08:04:31 -07:00
Daniel Duan
3dfc40898c [NFC] Remove Python 2 imports from __future__ (#42086)
The `__future__` we relied on is now,  where the 3 specific things are
all included [since Python 3.0](https://docs.python.org/3/library/__future__.html):

* absolute_import
* print_function
* unicode_literals
* division

These import statements are no-ops and are no longer necessary.
2022-04-13 14:01:30 -07:00
Michael Gottesman
db01f33d88 [build-script] Specify CMAKE_RANLIB when building a CMakeProduct.
When I perform the stage2 build, the first C-libdispatch seems to require this.
2021-08-12 11:45:17 -07:00
Michael Gottesman
c7001f91d8 [build-script] Provide infrastructure for CMakeProduct subclasses to opt into using the just built swift toolchain. 2021-08-04 13:30:40 -07:00
Michael Gottesman
6f4ef7cee2 [build-script] Begin tracking ar in build-script toolchains and start passing -DCMAKE_AR to cmake.
I am currently working on being able to build cmake build-script projects as
always being cross compiled by using toolchain files (1). CMake expects in means
that I need to be able to specify CMAKE_AR in said toolchain.

(1) We still build for the host machine (of course), but instead of building it
normally with cmake, we build it as if we are cross compiling meaning we are
cross compiling for the host on the host. This makes it so that the host build
is no longer different from cross compilation builds making Swift's cross
compilation build more robust since it will be tested and less mysterious.
2021-05-21 16:09:19 -07:00
Cassie Jones
b5247d2c8f Fix formatting issue 2020-10-02 12:43:42 -04:00
Cassie Jones
7ef9b3287a [build-script] Fix CMake sccache test 2020-10-01 14:17:53 -04:00
Ross Bayer
67d6b10dd0 [Build System: build-script] Add a new versions module to build_swift which provides the Version class.
Version acts very similarly to distutils.version.LooseVersion, but with some more flexibility around character group boundries.
2020-01-18 12:04:53 -08:00
Ross Bayer
0fdef59633 [Build System: build-script] Adopt the six compatibility library in the build_swift module. 2020-01-17 15:43:54 -08:00
Ross Bayer
31f063b8b8 [Build System: build-script] Remove the old arguments module hiding in swift_build_support in favor of the more featureful one living in build_swift. 2020-01-17 00:30:17 -08:00
Daniel Rodríguez Troitiño
5a2fd7441b Merge pull request #23303 from drodriguez/cmake-options-improvements
[build-script] Improvements to CMakeOptions.
2019-06-12 10:01:36 -07:00
Daniel Rodríguez Troitiño
3fb9a2a7a4 [windows] Fix Python tests in Windows.
- Forward several environment variables to the test environment because
Windows uses them to inform the processes about things like the number
of processors and the architecture.
- Normalize some literal Unix paths to be the same as the results in
Windows, that will have forward slashes and the drive letter.
- Skip some test that use build-script-impl and tests that check for
files being executable (everything is executable in Windows).
- Don't use the owner and group arguments for tar on Windows.
- Hide the stderr output of which. In Windows it prints the full PATH in
case of failures, which is disrupting.
- Quote many paths in Windows in the output of build-script results.
- Provide a version of mock-distcc that can be executed in Windows. The
raw Python script cannot.
- Change the expected results for clang/clang++ to the right values in
Windows (clang-cl in both cases).
2019-06-06 11:30:22 -07:00
Daniel Rodríguez Troitiño
6bf0826524 [build-script] Improvements to CMakeOptions.
CMakeOptions was briefly used in the cmake module, but mostly unused in
the rest of the modules, however, several products were dealing with
what eventually will end as CMake options, but not using the already
existing code, and duplicating it.

The changes tries to unify all usage around CMakeOptions which avoids
code duplication. Additionally, it provides some more API surface in
CMakeOptions to make it more useful.

- The initializer can be passed a list of tuples or another CMakeOptions
  to copy into the newly created options.
- Boolean Python values are treated automatically as boolean CMake
  options and transformed into `TRUE` and `FALSE` automatically.
- Provides `extend`, which will add all the tuples from a list or all
  the options from another `CMakeOptions` into the receiving
  `CMakeOptions`.
- Provides `__contains__`, which makes checking for existing options a
  little easier (however, being `CMakeOptions` basically a list, the
  checking has to include also the value, which is not that helpful).
- Modify LLVM and Swift products to use `CMakeOptions`. It makes the
  boolean values clearer and avoid a lot of repetitive string
  formatting.
- Modify the tests to make them pass and provide new test for newly
  introduced features.
2019-05-14 13:25:58 -07:00
Mishal Shah
e296b6bd5c Add cmake-c-launcher and cmake-cxx-launcher flag to build-script 2019-02-26 17:10:54 -08:00
Michael Gottesman
f13b8eb10b [cmake] Rather than using CMAKE_{C,CXX}_COMPILER and CMAKE_{C,CXX}_COMPILER_ARG1 for distcc, use CMAKE_{C,CXX}_COMPILER_LAUNCHER.
This is a cleaner, more principled way of adding "compiler launcher" support and
ensures that cmake understands that distcc is not the "actual" compiler.

This ensures that when we compile SwiftRemoteMirrors for the host, we do not try
to compile using distcc without needing to reset CMAKE_{C,CXX}_COMPILER_ARG1
(which is unset when compiling things in the stdlib).
2019-02-05 13:22:53 -08:00
Michael Gottesman
ad3e05d82e [build-script] Add support for building the compiler with sanitizer coverage so we can make libFuzzer based fuzzers for swift compiler tools. 2018-05-02 17:39:18 -07:00
Jacob Mizraji
68f9659775 Start passing libtool to CMake
This will align the libtool passed to CMake with the clang and clang++
2018-02-05 11:23:37 -08:00
Michael Gottesman
aa4e2dac2c [build-script] Add support for compiling swift with leaks sanitizer.
This only enables the swift compiler (not its output) to be used with leaks
sanitizer on linux.

Some important notes: On Linux, right now we are not completely leak clean. I
was only able to get a -Onone build of the stdlib without triggering lsan (I was
unable to run the optimizer and the tests successfully). Additionally even at
-Onone, I had to suppress some leaks in the driver. The point of this though is
to prevent any further -Onone leaks from being committed to the tree since
-Onone leaks that are not bounded (unlike the driver bugs) could cause SourceKit
to leak memory. Since SourceKit is a long running process... such a type of leak
would be bad.

rdar://32876901
2017-06-22 12:52:12 -07:00
Mishal Shah
f1c3629246 Revert "python: Fix nosetests tests." 2017-04-06 18:51:50 -07:00
Doug Coleman
c0b7918099 python: Fix nosetests tests.
Why are the python reasons for having our code nested in a directory
called ``swift_build_support.swift_build_support/`` instead of simply
``swift_build_support/``? Is that what we really want here?
2017-04-06 17:47:09 -07:00
Jacob Mizraji
2647ca2f84 Pass CLANG_VERSION_* cmake flags to the LLVM build.
In a normal swiftless clang build, if it doesnt know CLANG_VERSION_*,
clang's cmake falls back on LLVM_VERSION_*. We pass a CLANG_COMPILER_VERSION
to swift, but it is not necessarily what clang wants to know.

The intention of this CLANG_VERSION_* flag in Clang is to know
what Swift calls clang_user_visible_version. This is the non-specific
version of Clang. For example, clang-900 - this is 9.0.0, while Swift
would like clang_compiler_version to be the specific version that the
driver will print out.

Flag naming!

Fix tests
2017-03-29 15:57:06 -07:00
Doug Coleman
e7390d1770 Revert "utils: Add swiftenvs, which allow the overriding of compiler tools."
This reverts commit 2b923f3846.
2017-03-22 20:09:34 -07:00
Doug Coleman
e480227d82 Revert "swiftenv-script: Fix some issues with swiftenvs." 2017-03-22 17:00:21 -07:00
Doug Coleman
351a515f6c swiftenv-script: Bug fixes for swiftenv.
Fix the mocked output files of swiftc. Change the lookup of
clang from build-script to build-script-impl like all the other
commands. Pass more args to LLVM. Fix swiftenv creation. Fix unit tests.

The reason this patch works is that build-script-impl gets
all the arguments that are not handled by build-script.
2017-03-22 12:47:33 -07:00
Doug Coleman
2b923f3846 utils: Add swiftenvs, which allow the overriding of compiler tools. 2017-03-21 14:59:12 -07:00
Hugh Bellamy
fa3543d3c5 Fix some pylint errors for double whitespace after class/function 2017-02-17 15:37:19 +07:00
practicalswift
6d1ae2a39c [gardening] 2016 → 2017 2017-01-06 16:41:22 +01:00
Doug Coleman
51543db9e1 swift_build_support: If we are using the Ninja generator and we have found a toolchain.ninja, use that ninja.
If ninja is installed, treat it as a path to ninja anyway.
2016-12-14 11:44:01 -08:00
practicalswift
797b80765f [gardening] Use the correct base URL (https://swift.org) in references to the Swift website
Remove all references to the old non-TLS enabled base URL (http://swift.org)
2016-11-20 17:36:03 +01:00
Michael Gottesman
7611e12bf5 [build-script] Add support for compiling swift with tsan enabled. 2016-08-01 15:11:09 -07:00
Dmitri Gribenko
6eb40a084b build-script: support 4 version components in Clang versions 2016-07-13 22:08:24 -07:00
Rintaro Ishizaki
36898fc933 [build-script][SR-237] Migrate Ninja build to Python
Migrated impl args:
--build-ninja
--darwin-deployment-version-{osx,ios,tvos,watchos}

Removed impl args:
--build-ninja

Added impl args:
--ninja-bin
2016-05-26 10:29:53 +09:00
practicalswift
ac15a59d7d Fix various PEP-8 violations. 2016-05-21 10:43:36 +02:00
Rintaro Ishizaki
b3dc7b74e2 [build-script] Refactor toolchain
`host_toolchain()` initializes Toolchain object corresponding to the platform.

Renamed functions:

* toolchain.host_clang -> toolchain.cc, toolchain.cxx
* cmake.host_cmake -> toolchain.cmake
* ninja.is_ninja_installed -> toolchain.ninja (is not None)
2016-05-03 01:47:12 +09:00
practicalswift
4613b1712b Merge pull request #2359 from practicalswift/typo-fixes-20160501
[gardening] Fix recently introduced typos: "adavances" → "advances", etc. (10 typos)
2016-05-01 20:11:45 +02:00
practicalswift
540cb751ac [gardening] Fix recently introduced typo: "adavances" → "advances"
[gardening] Fix recently introduced typo: "compie" → "compile"

[gardening] Fix recently introduced typo: "consise" → "concise"

[gardening] Fix recently introduced typo: "dengerate" → "degenerate"

[gardening] Fix recently introduced typo: "encodeded" → "encoded"

[gardening] Fix recently introduced typo: "equvalent" → "equivalent"

[gardening] Fix recently introduced typo: "guaranted" → "guaranteed"

[gardening] Fix recently introduced typo: "overridde" → "override"

[gardening] Fix recently introduced typo: "subsquence" → "subsequence"

[gardening] Fix recently introduced typo: "substraction" → "subtraction"

[gardening] Fix recently introduced typo: "whiltespace" → "whitespace"
2016-05-01 20:07:18 +02:00
practicalswift
6cf5f9d255 [gardening] PEP-8 fixes. 2016-05-01 13:18:30 +02:00
Rintaro Ishizaki
d0cbe06b71 [build-script] Validate and parse '--clang-compiler-version' in argparse 2016-04-29 14:54:13 +09:00
Rintaro Ishizaki
4926ed55f1 [build-script][SR-237] Migrated calculation of BUILD_ARGS to Python.
Calculate `BUILD_ARGS` in `build-script`, then pass them to
`build-script-impl` using existing `--build-args` argument.
2016-04-25 16:20:40 +09:00
Rintaro Ishizaki
c025590c88 [build-script][SR-237] Migrated calculation of COMMON_CMAKE_OPTIONS to Python.
Calculate `COMMON_CMAKE_OPTIONS` in `build-script`, then pass them to
`build-script-impl` using newly introduced `--common-cmake-option` argument.
2016-04-25 14:27:29 +09:00
Zach Panzarino
e3a4147ac9 Update copyright date 2015-12-31 23:28:40 +00:00
Brian Gesiak
c65c91d61f [SR-237][build-script] Determine CMake in Python
SR-237 calls for `build-script` and `build-script-impl` to be merged. This
commit takes another step towards that goal by moving the logic that finds
the path to the CMake executable up into `build-script`.

Users of `build-script` were previously able to specify which CMake
they wished to use via `build-script-impl` args, like so:

```
$ utils/build-script -- --cmake=/foo/bar/cmake
```

This commit preserves that behavior, while also allowing users to
specify that path via `build-script` args:

```
$ utils/build-script --cmake=/baz/cmake -- --other --flags
```
2015-12-28 12:37:26 -05:00