Commit Graph

122 Commits

Author SHA1 Message Date
Chris Bieneman
9c35042ae6 Merge remote-tracking branch 'origin/master' into master-next 2017-07-28 09:51:36 -07:00
Chris Bieneman
93717c663c Rename SWIFT_TABLEGEN to LLVM_TABLEGEN
Swift doesn't produce its own tablegen and by faking out the LLVM CMake infrastructure into thinking it does all of LLVM's build cross compilation support breaks.
2017-07-25 14:14:56 -07:00
Bob Wilson
52d14e3f0d Set SWIFT_TABLEGEN_TARGET as required by LLVM r305142.
With the change in LLVM r305142, CMake will fail if SWIFT_TABLEGEN_TARGET
is not set. When cross-compiling, it could be set differently than
SWIFT_TABLEGEN_EXE but it does not look like Swift supports that yet. For
now, just set it to the same value as SWIFT_TABLEGEN_EXE.
2017-06-12 10:53:06 -07:00
Hugh Bellamy
9907502ede Add /permissive- flags with VS2017 2017-03-16 22:02:01 +07:00
Greg Parker
25653ac891 [build] Disallow calls to objc_msgSend() with no function pointer cast. 2017-03-14 13:35:39 -07:00
Hugh Bellamy
38d9cb5d33 [CMake] remove dead version specific checks 2017-02-17 14:35:56 +07:00
Hugh Bellamy
2b1c5efe4b [CMake] remove redundant USES_TERMINAL checks
The minimum version of CMake is 3.4.3
2017-02-17 14:33:42 +07:00
Hugh Bellamy
901b73e89c Merge pull request #7450 from hughbe/cleanup-compiler-flags
Fix potentially appending "/wd4068" on mac builds
2017-02-17 00:20:35 +07:00
Hugh Bellamy
46ccacd7fa Fix potentially appending "/wd4068" on mac builds 2017-02-14 09:20:50 +07:00
Hugh Bellamy
15a0a2c337 Fix Windows linker errors trying to statically link to cmark 2017-02-13 18:05:47 +07:00
Chris Bieneman
04c06945ec Fix the Xcode build broken in PR7344
In Xcode builds the library dir variable contains the build configuration in the path, but the exports file doesn't. If we construct the export file path from the build directory instead of the library directory it should all work.
2017-02-09 16:47:47 -08:00
Chris Bieneman
44b6f32f0e Clean up handling of CMark library dependency.
This change depends on:

https://github.com/apple/swift-cmark/pull/4
2017-02-08 14:32:50 -08:00
Hugh Bellamy
f446dd0297 Ignore unknown pragma warnings with MSVC 2017-01-18 10:33:28 +00:00
Chris Bieneman
f89461bf22 [CMake] NFC. Updates based on post-merge feedback
* Ensure LLVM_CMAKE_DIR is always set so it can be used
* Use LLVM_CMAKE_DIR instead of searching the module paths
* Label parameters of cmake_parse_arguments in comments
2016-09-28 22:21:03 -07:00
practicalswift
7e89679404 [gardening] Fix recently introduced typos. 2016-07-24 22:32:40 +02:00
Saleem Abdulrasool
5e170ebcb5 build: support cross-compiling to windows 2016-07-13 21:37:04 -07:00
Michael Gottesman
b42b7f43d8 [cmake] Combine apply_xcode_substitutions and escape_llvm_path_for_xcode into a better escape_path_for_xcode that can be reused across cmake. 2016-07-08 09:51:18 -07:00
Michael Gottesman
455d3a1960 [cmake] Move the cmake xcode configuration code from SwiftSharedCMakeConfig.cmake => SwiftXcodeSupport.cmake. 2016-07-08 09:51:18 -07:00
Michael Gottesman
d004abc088 [cmake] Instead of figuring out the exact location of all of the various libraries when translating Xcode targets, just use the path already provided in LLVMConfig.cmake for the configuration that we compiled LLVM specifically for.
If we compile LLVM for <CONFIG> in build-script with Xcode as our generator,
LLVMExports.cmake will have specific IMPORTED_*_<CONFIG> variables set for all
of our targets. These variables are what we really want to splat across all
Swift Xcode build configurations.

This patch rips out the old code that determined the actual location and instead
just grabs the IMPORTED_*_<CONFIG> variables and splats it accordingly.
2016-07-08 09:06:06 -07:00
Michael Gottesman
95b659583e [cmake] Also provide absolute paths for shared libraries/executables in addition to static libraries.
Eliminates a warning when building lldb.

It looks like lldb is still able to find the right library. But doing it this
way is guaranteed to be correct (eliminating future bugs is good).
2016-07-06 17:28:38 -07:00
Michael Gottesman
be09b2f873 [cmake] Remove direct computation of dependencies on LLVM libraries and exact paths to those libraries.
Now that we have the full dependency information from LLVM/Clang, this is no
longer necessary. We will just do the *right* thing.

Additionally, since we were passing these libraries as absolute paths, cmake was
always passing through all of the given libraries even if CMake had already
added them to the link line in its non-absolute form. It is not clear to me how
if all linkers would be smart about this.

Regardless, now we just translate components to libraries and continue on our
merry way. In the future, we can even remove the llvm-build code period by just
specifying LLVM dependencies directly via LINK_LIBRARIES instead of having to do
anything with COMPONENT_DEPENDS.

But that is for a future commit.
2016-07-01 17:35:41 -07:00
Michael Gottesman
c2645d07c6 [cmake] Expand $(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) from all LLVM/Clang imported target locations.
Normally when building in Xcode, Xcode will assume that LLVM/Clang use the same
configuration as Swift and will try to pull in the sources from that
configuration's build directory.

This is incorrect when we are compiling a Release LLVM with a Debug Swift. This
commit uses our escaping functionality from 0a48857 and the new imported targets
to fix this issue.

rdar://27062396
2016-07-01 14:02:01 -07:00
Michael Gottesman
0a4885732e [cmake] Expand $(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) in LLVM CMake paths.
In order to support swapping build types without reconfiguring, Swift's CMake
generated Xcode project has one directory for each cmake build type. This
behavior is implemented by placing in variables for Xcode to expand at build
time. This causes issues with our build, namely that our cmake scripts like to
"poke" around the LLVM build directory at configure time. Since the xcode
variables from the commit title are not expanded, failures occur since the
unexpanded paths do not exist.

This patch fixes this problem by expanding out those variables at configure time
from specific LLVM paths. This is essentially tieing LLVM to the specific
build-script build mode used. This is reasonable since we do not support
building in Xcode for configurations that were not selected at build-script
time.

rdar://27062396
2016-07-01 13:47:38 -07:00
Michael Gottesman
523312ed63 Use find_package instead of include.
rdar://27062396
2016-07-01 13:40:21 -07:00
John McCall
bd3bc93787 Fix unified builds. 2016-06-28 10:04:54 -07:00
Michael Gottesman
1abe85ab41 [cmake] Turns out ClangTargets.cmake can also be in $CLANG_BUILD/lib/cmake/clang.
LLVM's cmake path has this extra path (for LLVM) as well. I should have followed
its example. = /.

rdar://26154980
2016-06-25 01:28:52 -07:00
Michael Gottesman
6c261ce993 [cmake] Include ClangTargets.cmake so that any clang libraries we include get the correct LLVM/Clang dependency ordering.
This means that one can just use LINK_LIBRARIES to get the correct dependency
information without needing to know anything further.

rdar://26154980
2016-06-24 23:00:54 -07:00
Michael Gottesman
f6c2532552 [cmake] Remove standalone clang config code for building clang separate from llvm/swift.
We do not support this now. When we do, code can be added back.

rdar://26154980
2016-06-24 19:14:35 -07:00
Michael Gottesman
7f5116336a [cmake] Remove manual setting of include_directories for LLVM include dirs.
LLVM already provides these directories via the LLVMConfig.cmake variable
LLVM_INCLUDE_DIRS, which we are already using to import those directories.

Thus this work is and even worse gives the illusion that we are not delegating
the computation of LLVM's include paths to LLVM (which is really what we are
doing and should be doing).

rdar://26154980
2016-06-24 19:14:35 -07:00
Michael Gottesman
3168df8c11 [cmake] Do not set CMAKE_INCLUDE_CURRENT_DIR.
Setting this value is equivalent to setting:

include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})

in all subdirectories. Since these are all macros, this means that we are adding to the configuration
path the root swift directory. There is no reason to do this and will result in
confusion/bugs in the future.

rdar://26154980
2016-06-24 19:14:34 -07:00
Michael Gottesman
242fa0cd50 [cmake] Refactor out llvm related config from swift_common_standalone_build_config to swift_common_standalone_build_config_llvm.
*NOTE* The diff looks bigger than it actually is. This is just a pure
refactoring.

rdar://26154980
2016-06-24 18:32:34 -07:00
Michael Gottesman
5236f2d384 [cmake] Refactor out clang related config from swift_common_standalone_build_config to swift_common_standalone_build_config_clang.
rdar://26154980
2016-06-24 18:25:20 -07:00
Michael Gottesman
db964d35fc [cmake] Refactor out cmark related config from swift_common_standalone_build_config to swift_common_standalone_build_config_cmark.
This is apart of a series of patches that separates configuration of
llvm/clang/cmark in swift_common_standalone_build_config. Right now each project
has configuration occurring in a mixed up way. By refactoring it becomes much
easier to read the code.

rdar://26154980
2016-06-24 18:14:34 -07:00
Michael Gottesman
bd43806047 Merge pull request #3200 from gottesmm/use_swift_tablegen_instead_of_llvm_tablegen
Use swift tablegen instead of llvm tablegen
2016-06-24 18:09:46 -07:00
Michael Gottesman
25ac3a2df5 [cmake] Remove duplicate unncessary work.
Even before my changes, we had been setting this value twice. = /.

rdar://26154980
2016-06-24 17:51:24 -07:00
Michael Gottesman
5d984de9ec [cmake] Instead of setting LLVM_TABLEGEN_EXE, use our own SWIFT_TABLEGEN_EXE variable.
This eliminates us setting an LLVM_ prefixed variable in a situation where there is
a viable alternative.

We want to eliminate as many of these as possible since they can cause conflicts
with variables set in LLVMConfig.cmake.

I also added some convenience tablegen functions in AddSwiftTableGen.cmake and
changed all tblgen users to use that instead.

rdar://26154980
2016-06-24 17:18:45 -07:00
Michael Gottesman
41e375a8d2 [cmake] Instead of trying to find an absolute path to LLVMConfig.cmake, just add all of the LLVM cmake paths to the CMAKE_MODULE_PATH and just use include(LLVMConfig).
rdar://26154980
2016-06-24 15:22:10 -07:00
Michael Gottesman
d8be0e027b [cmake] When not cross compiling, instead of searching for llvm-tblgen, just use the real native cmake target.
This fixes part of the Xcode build by allowing us to avoid having to use cmake
variables with an unexpanded CMAKE_CFG_INTDIR.

Since those variables are not expanded, they point to a non-existant path like:

.../$(CONFIGURATION)$(...)/lib

So finding tablegen fails. In the cross compile case, we still try to find the
native tablegen.

rdar://26154980
2016-06-24 15:15:43 -07:00
Michael Gottesman
266ead97b9 [cmake] Remove support for invoking llvm-config.
I already removed the one invocation of llvm-config. This code is just dead.

rdar://26154980
2016-06-23 22:19:59 -07:00
Michael Gottesman
be112f18d1 [cmake] Use LLVM_TOOLS_BINARY_DIR from LLVMConfig.cmake and remove any invocation of llvm-config.
There are a couple of things going on in this patch. Lets consider first the
crosscompiling case.

In the cross compiling case, we were already setting LLVM_TOOLS_BINARY_DIR to
the binary dir of the just compiled LLVM (not the native LLVM/clang). This is
exactly what using LLVMConfig.cmake from that just compiled LLVM will set
LLVM_TOOLS_BINARY_DIR.

In the non-cross compiling case, we originally grabbed LLVM_TOOLS_BINARY_DIR
from llvm-config and then used that value to set the NATIVE llvm/clang paths.

rdar://26154980
2016-06-23 18:51:09 -07:00
Michael Gottesman
87fc9ca420 [cmake] Get the default value for LLVM_ENABLE_ASSERTIONS from LLVMConfig.cmake.
rdar://26154980
2016-06-23 18:47:33 -07:00
Michael Gottesman
ea3914d75e [cmake] Remove dead link directory.
This was added some time ago in case we want to build clang separate from llvm
just like we do swift. We do not actually support that though.

Currently, this just results in the main llvm binary directory being added for a
second time to the link path (i.e. this work iw asted). Thus just remove the
line but leave in a *NOTE* to deliver the message that this is where the clang
link path in such a case would need to go.
2016-06-23 17:47:48 -07:00
swift-ci
b2240d0ef0 Merge pull request #3158 from gottesmm/cmake_fix_bug_and_remove_dead_store 2016-06-23 00:33:10 -07:00
Michael Gottesman
8c3bc0a211 [cmake] Remove dead variable.
This variable was added in 2015 to set a value that was needed given upstream
changes. In Feb 2016, we started importing LLVMConfig.cmake. LLVMConfig.cmake
provides this value for us. Thus we can remove the dead variable.

rdar://26154980
2016-06-22 23:36:31 -07:00
Michael Gottesman
ef87fe7ba3 [cmake] Remove dead set (i.e. LLVM_MAIN_INCLUDE_DIR already equals LLVM_MAIN_SRC_DIR/include).
rdar://26154980
2016-06-22 23:16:33 -07:00
Michael Gottesman
8389dae8fb [cmake] Remove line of code that is setting LLVM_BINARY_DIR to CMAKE_BINARY_DIR (i.e., SWIFT_BINARY_DIR).
This bug was in tree before I began to make my changes. I uncovered the bug when
I was thinking about whether or not this line of code was dead and thus looked
at how it was used.

rdar://26154980
2016-06-22 23:16:33 -07:00
Michael Gottesman
e24e1f7dee [cmake] Use LLVMConfig.cmake instead of llvm-config to set some variables.
Previously in order to support cross-compiling, we were setting these variables
in build-script. Now that we are using LLVMConfig.cmake, passing in these values
are no longer necessary. As an added benefit, Swift when not cross compiling,
does not need to set these variables anyways.

rdar://26154980
2016-06-22 19:58:20 -07:00
Michael Gottesman
c87aabb79b [cmake] Use already defined ${product}_PATH_TO_LLVM_{SOURCE,BUILD} values instead of re-setting it later ot the same value.
Before this patch, we would always set ${product}_PATH_TO_LLVM_{SOURCE,BUILD} to
a value taken from llvm-config. But, turns out we had generated llvm-config
using these values. Thus llvm-config is just giving us back values we already
have.

This commit changes these variables to be precondition variables and doesn't
cause them to be reset.

rdar://26154980
2016-06-22 19:58:19 -07:00
Saleem Abdulrasool
b604369fb2 build: include more directories
llvm/Support/Compiler.h recently grew a dependency on llvm-config.h.  This
pointed out that we were not including the path to the generated header
directory in the build output.  Ensure that we have the corresponding -I.
2016-06-18 17:41:45 -07:00
practicalswift
befbebcd30 [gardening] "OSX" → "OS X" 2016-04-11 23:12:40 +02:00