Commit Graph

149 Commits

Author SHA1 Message Date
Daniel Pfeifer 1d6909a287 use CM_NULLPTR 2016-06-28 09:02:26 -04:00
Daniel Pfeifer a7a9239096 mark functions with CM_OVERRIDE 2016-06-27 23:24:38 +02:00
Daniel Pfeifer 25d1ef6424 Use enums defined in cmOutputConverter using their fully qualified name.
Mostly automated:

values=("RelativeRoot" "NONE" "FULL" "HOME" "START" "HOME_OUTPUT" "START_OUTPUT"
        "OutputFormat" "UNCHANGED" "MAKERULE" "SHELL" "WATCOMQUOTE" "RESPONSE"
        "FortranFormat" "FortranFormatNone" "FortranFormatFixed" "FortranFormatFree")
for i in "${values[@]}"; do git grep -l cmLocalGenerator::$i | xargs sed -i "s|cmLocalGenerator::$i|cmOutputConverter::$i|g"; done
2016-05-25 09:20:09 -04:00
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
Stephen Kelly 4bc65d76f1 Makefiles: Port to cmGeneratorTarget. 2015-10-24 09:19:53 +02:00
Stephen Kelly 3df749af55 Remove vestigial declarations. 2015-10-21 00:19:57 +02:00
Stephen Kelly 3e8ef64273 cmLocalGenerator: Port some API to cmGeneratorTarget. 2015-10-17 17:30:38 +02:00
Stephen Kelly 7f5ec9f109 cmLocalGenerator: Port GetTargetDirectory to cmGeneratorTarget. 2015-10-15 00:33:12 +02:00
Stephen Kelly 06f56d3bf5 cmLocalUnixMakefileGenerator3: Port AppendCleanCommand to cmGeneratorTarget. 2015-10-15 00:23:53 +02:00
Stephen Kelly c8f8f16541 cmLocalUnixMakefileGenerator3: Port another API to cmGeneratorTarget. 2015-10-15 00:20:16 +02:00
Stephen Kelly 9f299a1225 cmLocalUnixMakefileGenerator3: Port API to cmGenertorTarget. 2015-10-15 00:11:21 +02: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 a4a2518dd4 cmLocalUnixMakefileGenerator3: Provide GetConfigName() accessor
Rename internal member from ConfigurationName to ConfigName to
match the ninja generator.
2015-07-09 09:50:05 -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 61c0113c13 cmLocalUnixMakefileGenerator3: Remove unused method. 2015-06-21 21:14:07 +02:00
Stephen Kelly 0efe4944e1 cmGlobalGenerator: Add ComputeHomeRelativeOutputPath method.
Fix generation of tgt/fast build targets.

Commit 363caa2f (cmLocalGenerator: De-virtualize Configure().,
2015-05-30) moved the computation of HomeRelativeOutputPath from
Configure-time to Generate-time, because it is only used at
Generate-time.  However, that commit caused the member for one
local generator to be computed immediately before generating with
that local generator, whereas previously the members of all local
generators were computed before generating any of them.

The HomeRelativeOutputPath is used by the GetRelativeTargetDirectory
method, which is called by the
cmGlobalUnixMakefileGenerator3::WriteConvenienceRules method.  That
method is called by the
cmLocalUnixMakefileGenerator3::WriteLocalMakefile method when generating
for the top-most (ie, the first) local generator.  At that point,
the HomeRelativeOutputPath is not yet computed.

Fix that by computing the member just before generating anything.
This will eventually be done in the cmLocalUnixMakefileGenerator3
constructor instead, but further refactoring is needed to make
that possible.
2015-06-13 08:38:27 +02:00
Stephen Kelly 3e087a408b cmLocalUnixMakefileGenerator: Re-arrange data layout.
Size goes from 536 to 528 bytes.
2015-06-07 09:32:38 +02: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 684e5cefb2 cmGlobalGenerator: Host the MakeSilentFlag. 2015-05-18 20:06:20 +02:00
Stephen Kelly 2047144f49 cmLocalGenerator: Remove unused IgnoreLibPrefix. 2015-05-18 20:06:20 +02:00
Stephen Kelly 333c1fa83b cmGlobalUnixMakefileGenerator3: Host the UnixCD. 2015-05-18 20:06:16 +02:00
Stephen Kelly a97df5e135 cmGlobalUnixMakefileGenerator3: Host the PassMakeflags. 2015-05-18 20:03:49 +02:00
Stephen Kelly cf7f03e522 cmGlobalUnixMakefileGenerator3: Host the DefineWindowsNULL. 2015-05-16 05:20:36 +02:00
Stephen Kelly e9b134b95d cmGlobalUnixMakefileGenerator3: Host the include directive.
There is no sense in copying this to each cmLocalGenerator.
2015-05-16 05:20:12 +02:00
Stephen Kelly 24613d8b45 cmLocalGenerator: Remove unused method. 2015-05-16 05:18:32 +02:00
Stephen Kelly b17686d2bb cmGlobalGenerator: Move some flags from cmLocalGenerator.
These flags are global, and so they belong here instead of being
set on each local generator.
2015-05-14 20:36:28 +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
Brad King 8403c8da2c Merge topic 'mingw32-make-backslash-workaround'
bb6663ca Makefile: Workaround mingw32-make trailing backslash trouble (#15546)
2015-05-04 11:02:18 -04:00
Brad King bb6663ca0a Makefile: Workaround mingw32-make trailing backslash trouble (#15546)
When given the command line

  tool a\ b c

mingw32-make incorrectly passes "a b" and "c" to the tool.  When given
the command line

  tool a\ b "c"

mingw32-make correctly passes "a\", "b", and "c" to the tool.

Since commit v3.1.0-rc1~861^2 (MSVC: Add properties to configure
compiler PDB files, 2014-02-24) we pass the compiler pdb option to
MS-style compiler tools as "/Fd<dir>\" but mingw32-make may consume
the backslash as escaping a following space as described above.
Workaround this problem by changing the backslash to a forward
slash as had been used prior to the above commit.
2015-05-01 08:23:22 -04: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
Brad King 387466dd95 Merge topic 'custom-command-multiple-outputs'
66a9c90c Makefile: Fix multiple custom command outputs regression (#15116)
2015-03-09 09:45:51 -04:00
Brad King 66a9c90c4b Makefile: Fix multiple custom command outputs regression (#15116)
In commit v3.2.0-rc1~272^2~2 (Makefile: Fix rebuild with multiple custom
command outputs, 2014-12-05) we changed the generated makefile pattern
for multiple outputs from

  out1: depends...
          commands...
  out2: out1

to

  out1 out2: depends...
          commands...

This was based on the incorrect assumption that make tools would treat
this as a combined output rule and run the command(s) exactly once for
them.  It turns out that instead this new pattern is equivalent to

  out1: depends...
          commands...
  out2: depends...
          commands...

so the commands may be run more than once.

Some documents suggest using a "dedicated witness" stamp file:

  stamp: depends...
          rm -f stamp
          touch stamp.tmp
          commands...
          mv stamp.tmp stamp
  out1 out2: stamp

However, if the commands fail the error message will refer to the stamp
instead of any of the real outputs, which may be confusing to readers.
Also, this approach seems to have the same behavior of the original
approach that motiviated the above commit: multiple invocations are
needed to bring consumers of the outputs up to date.

Instead we can return to the original approach but add an explicit
touch to each extra output rule:

  out1: depends...
          commands...
  out2: out1
          touch -c out2

This causes make tools to recognize that all outputs have changed and
therefore to execute any commands that consume them.
2015-03-06 19:58:30 -05:00
Brad King 8521fdf56e Makefile: Fix output during parallel builds (#12991)
Replace use of separate "cmake -E cmake_progress_report" and "cmake -E
cmake_echo_color" commands to report the progress and message portions
of build output lines with --progress-* options to the latter to print
everything with a single command.  The line buffering of the stdout FILE
stream should cause the whole line to be printed with one atomic write.
This will avoid inter-mixing of line-wise messages from different
processes during a parallel build.
2015-02-06 08:36:51 -05:00
Brad King 6c67b8168c Makefile: Workaround Borland Make bug with multiple outputs
Given a rule of the form

  out1 out2: dep1
  out1 out2: dep2

Borland Make complains that there are multiple rules for "out1"
even though this works when there is only one output.  Instead
generate

  out1 out2: dep1 dep2

for Borland Make, but only when there are multiple outputs.
2014-12-06 07:36:52 -05:00
Brad King 644b4688d7 Makefile: Fix rebuild with multiple custom command outputs (#15116)
Fix the generated makefiles for custom commands with multiple outputs to
list all the outputs on the left hand side of the build rule.  This is
much simpler and more reliable than the old multiple-output-pair
infrastructure.
2014-12-05 09:55:49 -05:00
Ben Boeckel 6fa6bedf78 LocalGenerator: Add a string overload for AppendFlags 2014-05-07 14:30:31 -04:00
Jiri Malak 423009c17f Makefile: Generate single-quoted object lists for Watcom
Drop the CMAKE_NO_QUOTED_OBJECTS internal variable from the Makefile
generators.  The underlying problem is with the Watcom linker, not with
WMake.  The Watcom linker wants object files to be single-quoted.  Add
<LINK-RULE>_USE_WATCOM_QUOTE platform information variables to tell the
generators to use Watcom-style single quotes for object files on link
lines.

On Windows, Watcom uses the GetCommandLine API to get the original
command-line string and do custom parsing that expects single quotes.
On POSIX systems, Watcom approximates the original command line by
joining all argv[] entries separated by a single space.  Therefore we
need to double-quote the single-quoted arguments so that the shell does
not consume them and they are available for the parser to see.
2014-03-27 13:45:29 -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
Stephen Kelly d5b2e33be2 Makefiles: Compute local object files on demand.
Don't compute them up front.
2014-03-13 15:27:23 +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
Jiri Malak f1b689b64a Makefile: Improve handling of WMake verbose output and errors
* The '-e' option has nothing to do with verbose output.
  It is now properly handled by .ERASE directive in make file

* The '-s' option sets silent output globally, it cannot be switched off.
  It is now handled only by .SILENT directive in make file directive
  is simply controlled by a conditonal block.

Remove SilentNoColon member variable as it is no longer needed.
2014-03-10 11:15:12 -04:00
Ben Boeckel b3bf31a548 stringapi: Miscellaneous char* parameters 2014-03-08 13:05:37 -05:00
Ben Boeckel 270eb96df0 strings: Remove cmStdString references
Casts from std::string -> cmStdString were high on the list of things
taking up time. Avoid such implicit casts across function calls by just
using std::string everywhere.

The comment that the symbol name is too long is no longer relevant since
modern debuggers alias the templates anyways and the size is a
non-issue since the underlying methods are generated since it's
inherited.
2014-03-08 13:05:35 -05:00
Ben Boeckel fabf1fbabb stringapi: Use strings in target name 2014-03-08 13:05:31 -05:00
Ben Boeckel ce5114354c stringapi: Use strings for the languages 2014-03-08 13:05:30 -05:00
Alex Neundorf 05f162ce95 AddCustomCommand: Handle multiple IMPLICIT_DEPENDS files (#10048)
The code handling IMPLICIT_DEPENDS was only able to track a single file,
the latest file replaced earlier files in the list.

The documentation now mentions that the language has to be prefixed to
every file and the test now uses two implicit dependencies, where only
the second is modified to trigger re-running of the custom command.

Alex

Inspired-by: Michael Wild <themiwi@users.sourceforge.net>
2012-11-06 11:54:58 -05:00
Brad King 3baaf6ccec Pre-compute object file names before Makefile generation
Add a virtual cmGlobalGenerator::ComputeTargetObjects method invoked
during cmGeneratorTarget construction.  Implement it in the Makefile
generator to pre-compute all object file names for each target.  Use
the results during generation instead of re-computing it later.
2012-03-09 15:16:02 -05:00