Commit Graph

157 Commits

Author SHA1 Message Date
Brad King 7d64a0598d Ninja: Add 'restat' parameter to custom command generation method
Pass 'true' from all call sites to preserve existing behavior.
2015-11-19 15:11:00 -05:00
Brad King 866c75dedd Ninja: Refactor generation of 'restat' on custom commands
Move generation of 'restat = 1' from the CUSTOM_COMMAND rule to every
build statement using it.  This will allow future selection of this
option on a per-custom-command basis.
2015-11-19 14:51:24 -05:00
Brad King a3c5ca960b cmGlobalNinjaGenerator: Save 'ninja' version very early
Keep it in a member variable for convenient reference.  Store the
value as soon as it is known.
2015-11-02 16:37:59 -05:00
Brad King ed67f40522 cmGlobalNinjaGenerator: Save path to 'ninja' tool very early
Keep it in a member variable for convenient reference.  Set the
value as soon as it is known.
2015-11-02 16:27:31 -05:00
Stephen Kelly 736c2042c6 cmGeneratorTarget: Add GetUtilities API 2015-10-27 07:44:20 +01:00
Stephen Kelly 80de856bb5 Ninja: Port to cmGeneratorTarget. 2015-10-24 09:19:53 +02:00
Stephen Kelly 4c41e74da5 Use cmLocalGenerator at generate-time. 2015-10-24 09:19:53 +02:00
Stephen Kelly b5f5de70c0 cmGeneratorTarget: Copy IsFrameworkOnApple from cmTarget.
Leave the cmTarget method behind for now to implement cmInstallCommand.
2015-10-19 20:27:41 +02:00
Brad King f13521317a Merge topic 'clean-up-cmTarget'
55474e61 cmState: Move GetTargetTypeName from cmTarget.
38df5c36 Remove now-obsolete casts.
4ee2b267 cmGeneratorTarget: Use enum for GetType.
eac15298 cmState: Move TargetType enum from cmTarget.
482b3811 cmTarget: Move link type enum out.
2ee1cb85 cmTarget: Move ImportInfoMap out of internal class.
a48bcabd cmTarget: Move backtrace member out of internal class.
6694d993 cmTarget: Remove unneeded constructors.
983c00f8 Generators: Use GetType from the cmGeneratorTarget.
2015-10-16 09:35:34 -04:00
Stephen Kelly eac15298a8 cmState: Move TargetType enum from cmTarget.
Mostly automated:

 values=( "EXECUTABLE" "STATIC_LIBRARY" "SHARED_LIBRARY" "MODULE_LIBRARY" "OBJECT_LIBRARY" "UTILITY" "GLOBAL_TARGET" "INTERFACE_LIBRARY" "UNKNOWN_LIBRARY" "TargetType")
 for i in "${values[@]}"; do     git grep -l cmTarget::$i | xargs sed -i "s|cmTarget::$i|cmState::$i|g"; done
2015-10-15 00:41:39 +02:00
Stephen Kelly 7f5ec9f109 cmLocalGenerator: Port GetTargetDirectory to cmGeneratorTarget. 2015-10-15 00:33:12 +02:00
Stephen Kelly 12cb3bdce4 cmLocalGenerator: Add Home directory accessors.
Reduce reasons for cmLocalGenerator to have a cmMakefile.
2015-10-09 00:00:19 +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
James Johnston 874e70bc57 Ninja: Prevent generating if installed Ninja version is too old. 2015-08-09 13:51:35 -04:00
James Johnston c5ac2b9df3 Ninja: Centralized required Ninja version numbers and comparisons. 2015-08-09 13:31:24 -04:00
Brad King 55706506c7 Merge topic 'use-generator-target'
a309409e cmOrderDirectories: Port to cmGeneratorTarget.
f83e8402 cmGeneratorTarget: Move CompileInfoMap from cmTarget.
b3f0e353 cmGeneratorTarget: Move GetCompilePDBDirectory from cmTarget.
34c43741 cmGeneratorTarget: Move GetOutputName from cmTarget.
4329a71c cmComputeLinkDepends: Port to cmGeneratorTarget.
c93230ac cmComputeLinkInformation: Port to cmGeneratorTarget.
ee26add4 cmGeneratorTarget: Move IsBundleOnApple from cmTarget.
c8a5f5ae cmMakefileTargetGenerator: Add accessor for GeneratorTarget.
f8076644 cmGeneratorTarget: Move GetLinkClosure from cmTarget.
7c809fa2 cmGeneratorTarget: Move GetLinkerLanguage from cmTarget.
6da99de3 cmGeneratorTarget: Move GetFrameworkDirectory from cmTarget.
d6bb319b cmGeneratorTarget: Move GetFullName from cmTarget.
7a460852 cmGeneratorTarget: Move GetAppBundleDirectory from cmTarget.
d560bfd2 cmGeneratorTarget: Move GetInstallNameDir* from cmTarget.
89e2a080 cmGeneratorTarget: Move GetMacContentDirectory from cmTarget.
62720e44 cmGeneratorTarget: Move GetFullNameComponents from cmTarget.
...
2015-08-06 09:38:27 -04:00
Stephen Kelly 1ab59f688f cmGlobalNinjaGenerator: Simplify usage of API. 2015-08-04 19:19:40 +02:00
Stephen Kelly 6c0e9ee276 cmMakefile: Store EvaluationFiles.
Relieve the cmGlobalGenerator of this responsibility.  Evaluate
the generator expressions in the context of the cmLocalGenerator.
2015-08-01 13:07:11 +02:00
Stephen Kelly ec38e4c84f Move GetFullPath to cmGeneratorTarget 2015-07-27 21:59:02 +02: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 faec4e611d cmComputeTargetDepends: Change API to use cmGeneratorTarget. 2015-07-01 19:46:19 +02:00
Brad King c12fc3573b Merge topic 'inject-state-snapshot'
3b880a07 cmLocalGenerator: Require a valid cmState::Snapshot in the ctor.
e12afe76 cmState: Host some state from the cmGlobalGenerator.
c7b79aa1 cmGlobalGenerator: Require a cmake instance in ctor.
01e1cd5c cmState: Move snapshot creation to the cmake instance.
2015-05-27 09:23:01 -04:00
Brad King af570e13fd Merge topic 'ninja-per-target-rules'
9da84ab6 Ninja: Fix regression in .rsp file support
2015-05-27 09:22:55 -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 e12afe766e cmState: Host some state from the cmGlobalGenerator. 2015-05-27 09:18:31 -04:00
Stephen Kelly c7b79aa16a cmGlobalGenerator: Require a cmake instance in ctor.
It is required anyway, so this makes it explicit.
2015-05-27 09:18:31 -04:00
Brad King 9da84ab64a Ninja: Fix regression in .rsp file support
In commit a390de65 (Ninja: Generate separate compile and link rules for
each target, 2015-05-18) we removed the _RSP_FILE suffix from rule names
meant for targets that need to build with a .rsp file because we now use
per-target rules anyway.  Remove this suffix from references to the rule
too.

Reported-by: Herz Thomas <Thomas.Herz@kuka.com>
2015-05-26 09:15:10 -04:00
Brad King 6fbd4cae0d Use cmSystemTools::GetCMakeCommand() to get path to cmake internally
This is much simpler than finding a way to lookup "CMAKE_COMMAND"
everywhere.
2015-05-20 11:20:42 -04:00
Brad King a390de65e0 Ninja: Generate separate compile and link rules for each target
Our <LANG>_COMPILER and <LANG>_<TARGET_TYPE>_LINKER rule generation has
access to a specific cmTarget so the results may depend on it.  Instead
generate separate rules for each target using an encoded target name.
In particular, this makes CTEST_USE_LAUNCHERS report proper target
information.
2015-05-18 15:01:06 -04: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
Thomas Herz b3de0dfe93 Ninja: Use forward slashes for any GCC on Windows (#15439)
Any GCC compiler on a Windows host needs forward slashes, not just
those built for MinGW.
2015-05-07 14:07:20 -04:00
Brad King 378c2a0e86 Ninja: Refactor detection of MinGW tools on Windows
Check for CMAKE_COMPILER_IS_MINGW only after enabling a language when it
might actually be set.  Previously this worked by accident because the
check for working compiler or a second language enabled would cause the
code path to be taken.

Store UsingMinGW as an instance member of cmGlobalNinjaGenerator so that
it is reset on each reconfigure.  Otherwise cmake-gui cannot switch
between build trees for MinGW or non-MinGW tools.
2015-05-07 14:02:44 -04:00
Brad King 957c2aac7f RC: Simplify selection of resource compiler based on C/C++ toolchain
Revert the refactoring by commit v2.8.11~105^2~1 (Ninja: use MinGW
generator code in EnableLanguage, 2013-03-09) and move the MinGW-
specific logic back to the "MinGW Makefiles" generator.  Instead teach
the platform information modules for GNU and MSVC on Windows to set the
preferred RC compiler just before enabling the RC language.  This way
we choose the RC compiler based on the C/C++ toolchain that is actually
enabled.
2015-05-07 11:43:02 -04:00
Stephen Kelly de21168612 Port to static cmPolicies API. 2015-05-04 22:32:20 +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
Brad King 5a5ef00106 Merge topic 'clean-up-cmMakefile'
8dc3a67c cmMakefile: Out-of-line the directory methods.
0f3c8cfa cmMakefile: Use method abstraction to access directories.
b288a997 cmMakefile: Rename SetStart* directory API to SetCurrent*.
932d53bc cmMakefile: Remove redundant method duplication.
32b8f03a cmMakefile: Port users of GetStart* methods to new names.
54d6a918 cmMakefile: Rename GetCurrent{Output,Binary}Directory.
55d80d0a cmMakefile: Rename GetCurrent{,Source}Directory.
b23cf06f cmake: Remove redundant start directories.
fcf246ac cmMakefile: Populate Home directories on initialize.
8878bea7 cmake: Initialize Home directories on cmake for find-package mode.
044dc815 Use the Home directories from the cmake class where intended.
d67e8f24 cmake: Fix directory used to find the cache
1ea085d1 cmMakefile: Initialize dir definitions early.
f034bb2f Remove redundant calls to MakeStartDirectoriesCurrent.
3a68c323 cmMakefile: Fix wrong parameter names.
2015-04-21 09:42:07 -04:00
Stephen Kelly 32b8f03acc cmMakefile: Port users of GetStart* methods to new names. 2015-04-21 00:15:20 +02:00
Stephen Kelly 54d6a9187f cmMakefile: Rename GetCurrent{Output,Binary}Directory.
Match names used in CMake code.
2015-04-21 00:12:52 +02:00
Brad King 356c26ebdf cmSystemTools: Teach RunSingleCommand to separate stdout and stderr
Extend the RunSingleCommand signature to capture stdout and stderr
separately.  Allow both to be captured to the same std::string
to preserve existing behavior.  Update all call sites to do this
so that this refactoring does not introduce functional changes.
2015-04-20 15:47:50 -04:00
Brad King 5e0e65c189 Merge topic 'add-GreenHills-MULTI-generator'
66b641f4 Help: Add notes for topic 'add-GreenHills-MULTI-generator'
48004d9d Add a 'Green Hills MULTI' generator on Windows
051d8be1 cmLocalGenerator: Constify some cmTarget and cmGeneratorTarget arguments
2015-04-20 14:02:52 -04:00
Geoff Viola 48004d9dbe Add a 'Green Hills MULTI' generator on Windows
Green Hills MULTI is an IDE for embedded real-time systems.  The IDE's
product page can be found here:

 http://www.ghs.com/products/MULTI_IDE.html

It supports cross compiling on ARM, Intel x86, and other architectures
with various operating systems.  The IDE exists on Linux and Windows
host systems, but CMake will currently only generate the project files
on Windows host systems.
2015-04-20 13:55:40 -04:00
Brad King 9ac0568390 Ninja: Drop 'experimental' label in documentation
This generator is no longer experimental and has been fairly
mature for several releases already.
2015-04-14 13:14:50 -04:00
Brad King bd9c7f9b2c Ninja: Add policy to require explicit custom command byproducts
Add policy CMP0058 to avoid generating 'phony' ninja rules for unknown
custom command dependencies.  This requires projects to specify their
custom command byproducts explicitly.  With this requirement we no
longer have to assume that unknown custom command dependencies are
generated and can instead simply assume they are source files expected
to exist when the build starts.  This is particularly important in
in-source builds.  It is also helpful for out-of-source builds to allow
Ninja to diagnose missing files before running custom command rules that
depend on them.
2015-03-20 17:40:12 -04:00
Brad King ed8e30b00d cmGlobalNinjaGenerator: Optimize handling of known build outputs
Teach WriteUnknownExplicitDependencies to take ownership of the set of
WriteBuild outputs immediately since no other methods need the data.
This avoids re-inserting the whole set into another already populated
set.
2015-03-20 13:33:13 -04:00
Brad King ad094f435e cmGlobalNinjaGenerator: Fix spelling of "unknown" 2015-03-20 13:32:55 -04:00
Brad King 80afe28a10 Ninja: Do not generate circular phony rules (#15454)
The phony rules added by commit v2.8.12~248^2 (Ninja: Custom Command
file depends don't need to exist before building, 2013-06-07) are
circular, e.g.

  build side-effect: phony side-effect

This is not diagnosed by Ninja as of version 1.5, but the dependency
does not make sense.  Simply drop it and use phony rules of the form

  build side-effect: phony

instead.

Reported-by: Daniel Dunbar
2015-03-18 12:55:27 -04:00
Gregor Jasny ce935ebe50 cmake: Teach --build to honor CMAKE_VERBOSE_MAKEFILE for Ninja
The Ninja build system does not support a in-file verbositiy switch.
Instead teach 'cmake --build' to extract the CMAKE_VERBOSE_MAKEFILE
setting and pass it as an optional '-v' argument to Ninja.  This can
serve as a reasonable fallback.

Signed-off-by: Gregor Jasny <gjasny@googlemail.com>
2015-02-26 09:51:11 -05:00