Commit Graph

34 Commits

Author SHA1 Message Date
Kitware Robot d9fd2f5402 Revise C++ coding style using clang-format
Run the `Utilities/Scripts/clang-format.bash` script to update
all our C++ code to a new style defined by `.clang-format`.
Use `clang-format` version 3.8.

* If you reached this commit for a line in `git blame`, re-run the blame
  operation starting at the parent of this commit to see older history
  for the content.

* See the parent commit for instructions to rebase a change across this
  style transition commit.
2016-05-16 16:05:19 -04:00
Brad King 180538c706 Source: Stabilize include order
Each source file has a logical first include file.  Include it in an
isolated block so that tools that sort includes do not move them.
2016-04-29 13:58:31 -04:00
Brad King 59ade844ef Ninja: Fix non-determinism in generated build statement order (#15968)
Generate custom command build statements in the order we encounter
source files specifying them.  Do not depend on pointer values of
internally allocated structures for ordering.
2016-02-11 08:53:37 -05:00
Stephen Kelly 80de856bb5 Ninja: Port to cmGeneratorTarget. 2015-10-24 09:19:53 +02:00
Stephen Kelly 7f5ec9f109 cmLocalGenerator: Port GetTargetDirectory to cmGeneratorTarget. 2015-10-15 00:33:12 +02:00
Brad King 6e2a4087f2 Ninja: Centralize path conversion in global generator (#15757)
In the Ninja generator we run all build rules from the top of the build
tree rather than changing into each subdirectory.  Therefore we convert
all paths relative to the HOME_OUTPUT directory.  However, the Convert
method on cmLocalGenerator restricts relative path conversions to avoid
leaving the build tree with a "../" sequence.  Therefore conversions
performed for "subdirectories" that are outside the top of the build
tree always use full paths while conversions performed for
subdirectories that are inside the top of the build tree may use
relative paths to refer to the same files.

Since Ninja always runs rules from the top of the build tree we should
convert them using only the top-level cmLocalGenerator in order to
remain consistent.  Also extend the test suite with a case that fails
without this fix.
2015-09-25 14:36:30 -04:00
Stephen Kelly ff8ac8ee6a cmLocalGenerator: Create from already-constructed cmMakefile.
Don't manage the lifetime of the cmMakefile with cmLocalGenerator.
2015-08-28 18:44:39 +02:00
Stephen Kelly 9b6a743b80 cmLocalGenerator: Remove Parent pointer. 2015-08-28 18:44:38 +02:00
Brad King 9d41f6d87b cmLocalCommonGenerator: Adopt ConfigName member
De-duplicate the member from the local Makefile and Ninja generators.
2015-07-09 09:50:06 -04:00
Brad King 001f9b3617 Add common base classes to Makefile and Ninja generators
Provide a place to move functionality common to both.
2015-07-09 09:50:05 -04:00
Stephen Kelly 363caa2fa5 cmLocalGenerator: De-virtualize Configure().
The generators that override it do so in order to populate
data members which can instead be populated in Generate().
2015-06-04 09:06:40 -04:00
Stephen Kelly 3b880a0741 cmLocalGenerator: Require a valid cmState::Snapshot in the ctor.
Refactor the local generator creation API to accept a
cmState::Snapshot.  Adjust MakeLocalGenerator to use the 'current'
snapshot in cases where there is no parent.  Create the snapshot
for subdirectories in cmMakefile::AddSubdirectory.

This means that snapshots are now created at the point of extending the tree,
as appropriate, and independently of the cmLocalGenerator and cmMakefile they
represent the state for.
2015-05-27 09:18:32 -04:00
Stephen Kelly 444bc34978 Ninja: Remove some bogus comments.
The virtual methods are overrides not overloads, the constructor
is no longer a default variant, the destructor and GetCMakeInstance
comments add no value, only a typo.
2015-05-23 14:56:33 +02:00
Stephen Kelly c5059c9000 cmLocalGenerator: Add abstraction to check if top-level.
Move from the cmLocalNinjaGenerator.  Fix the case of the name.
2015-05-14 20:44:55 +02:00
Stephen Kelly 34c9ee2ed7 cmLocalGenerator: Require a global generator in the constructor.
Port generator factory methods to pass it.
2015-05-14 20:36:27 +02:00
Stephen Kelly a48aebcb67 cmLocalGenerator: Require a parent in the constructor.
Pass the parent though cmGlobalGenerator::CreateLocalGenerator.

This will make it easy to initialize state scopes independent of
cmMakefile.
2015-04-28 07:50:52 +02:00
Nils Gladitz cc1139cc30 strings: Remove redundant calls to std::string::c_str()
Replacements were detected and performed by the clang tool
remove-cstr-calls on a linux build.
2014-10-15 14:54:05 +02:00
Brad King f4c5eade78 Ninja: Fix RC include directories regression
Changes in commit b9aa5041 (cmLocalGenerator: Simplify GetIncludeFlags
output formatting, 2014-03-04) caused Windows Resource Compiler include
directories to be computed as relative paths in the Ninja generator.
This breaks the cmcldeps handling of include paths.  The reason for the
regression is that several cmLocalGenerator::GetIncludeFlags callers
treated the fourth "bool forResponseFile" argument as if it controlled
whether include directories were a full path.  It actually did control
that by accident until the above commit.

Add an explicit "bool forceFullPaths" argument to GetIncludeFlags
and thread the value through ConvertToIncludeReference as needed.
Update GetIncludeFlags call sites that really wanted to control the
forResponseFile setting to be aware of the new argument.  Extend the
VSResource test to cover this case.
2014-10-13 08:20:05 -04:00
Sylvain Joubert 9f32a2411b Ninja: Use 'console' pool for CMake re-run if possible (#14915)
The pre-defined 'console' pool is a non-buffered pool that runs with a
depth of 1.  CMake re-run cannot be run concurrently and it will
eventually output something.  A non-buffered pool allows to get it as
soon as possible

Also, generate the minimal required version of Ninja in the build file.
2014-10-03 08:48:47 -04:00
Ben Boeckel 3c64089117 ninja: Use string parameters 2014-05-02 13:05:44 -04:00
Stephen Kelly f6da044080 cmLocalGenerator: Add ComputeObjectFilenames interface.
Implement it in the local generators and use it in the global
generators.
2014-03-13 15:28:02 +01:00
Brad King bc993f277e Generalize cmCustomCommandGenerator to more fields
Until now the cmCustomCommandGenerator was used only to compute the
command lines of a custom command.  Generalize it to get the comment,
working directory, dependencies, and outputs of custom commands.  Update
use in all generators to support this.
2014-03-12 10:44:01 -04:00
Ben Boeckel acb116e3b5 stringapi: Return a string reference for the configuration 2014-03-08 13:05:36 -05:00
Brad King 971653b767 cmLocalGenerator: Add format option to ConvertToLinkReference
Replace the hard-coded SHELL output format with an optional argument.
2014-03-04 13:12:47 -05:00
Brad King 0c0ef9e7b7 cmLocalGenerator: Add format option to ConvertToIncludeReference
Replace the hard-coded SHELL output format with an optional argument.
2014-03-04 13:04:02 -05:00
Peter Kümmel 7605e37aab Ninja: job pool support for compiling and linking
Could be tested by setting the environment
variable NINJA_STATUS=[%r]
2013-11-25 22:23:24 +01:00
Nils Gladitz 05c70424f6 Ninja: run custom commands through launcher if available 2013-10-31 09:28:55 -04:00
Peter Kümmel d569f3ef15 Ninja: void function can't return a value 2012-07-19 07:32:03 +02:00
Peter Kümmel 7751966297 Ninja: remove 'friend' in ninja code 2012-07-18 11:27:49 +02:00
Brad King f5b06cda0f Pre-compute object file names before Ninja generation
Implement cmGlobalGenerator::ComputeTargetObjects in the Ninja generator
to pre-compute all the object file names.  Use the results during
generation instead of re-computing it later.
2012-03-16 10:18:35 -04:00
Brad King ac800f49d0 Ninja: Constify use of cmCustomCommand
The generator never needs to modify custom command instances.
2012-03-13 11:23:14 -04:00
David Cole 8c634330db Ninja: Add friend struct so it can access the private ConvertToNinjaPath.
The HP aCC compiler is apparently more strict than all our other
dashboard compilers with respect to complaining about this.
2012-03-07 16:24:34 -05:00
Peter Collingbourne 5d19e8aa6a Ninja: Appease various compilers 2012-02-05 01:48:08 +00:00
Peter Collingbourne 6dd410c2b9 Ninja: Add the Ninja generator 2012-02-02 23:40:21 +00:00