summaryrefslogtreecommitdiffstats
path: root/Source/cmNinjaTargetGenerator.cxx
Commit message (Collapse)AuthorAgeFilesLines
* Merge topic 'use-generator-target'Brad King2015-07-281-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 57f03e59 Port some of the cmExportFileGenerator API to cmGeneratorTarget. 57ab0f70 Port cmExportBuildFileGenerator to cmGeneratorTarget. 570938cb cmExportTryCompileFileGenerator: Create cmGeneratorTargets. ec38e4c8 Move GetFullPath to cmGeneratorTarget dfb025bf Move GetLocationForBuild to cmGeneratorTarget. 9f2dca80 Move GetLocation to cmGeneratorTarget. c7a8e74b Always access target location from a cmGeneratorTarget instance. 5b60eaf6 cmTarget: Restore the ImportedGetLocation method. 50b17a61 cmIncludeCommand: Populate the cmGeneratorTargets in deprecated path. ba266858 cmTarget: Create cmGeneratorTargets before reading deprecated LOCATION. 5ab3a946 cmTarget: Inline GetLocation into deprecated callers. 496f4cd0 cmGlobalGenerator: Create cmGeneratorTargets before QtAutomoc. de80993a cmGlobalGenerator: Create cmGeneratorTargets earlier. 611220f7 cmTarget: Use reliable test for CMP0024 and CMP0026 OLD. bbad6ba5 cmLocalGenerator: Remove unused AddCustomCommandToCreateObject method. e4dc83ad cmLocalGenerator: Remove unused AddBuildTargetRule method. ...
| * cmCustomCommandGenerator: Require cmLocalGenerator in API.Stephen Kelly2015-07-271-1/+1
| |
* | cmNinjaTargetGenerator: Factor out compile command exporterBrad King2015-07-271-65/+87
|/
* Merge topic 'refactor-rule-var-includes'Brad King2015-07-141-0/+3
|\ | | | | | | | | | | c736de7b Factor an <INCLUDES> placeholder out of <FLAGS> in rule variables 6f94b03c Place <DEFINES> before <FLAGS> consistently across compilers
| * Factor an <INCLUDES> placeholder out of <FLAGS> in rule variablesBrad King2015-07-131-0/+3
| | | | | | | | | | | | | | | | | | | | | | Teach the Makefile and Ninja generators to substitute for an <INCLUDES> placeholder instead of putting -I in <FLAGS>. Update our values for CMAKE_<LANG>_COMPILE_OBJECT, CMAKE_<LANG>_CREATE_ASSEMBLY_SOURCE, and CMAKE_<LANG>_CREATE_PREPROCESSED_SOURCE to place <INCLUDES> just before <FLAGS>.
* | cmNinjaTargetGenerator: Restore addition of Fortran format flagsBrad King2015-07-131-0/+6
|/ | | | | | | Restore call to AppendFortranFormatFlags accidentally dropped by commit 0837538e (cmCommonTargetGenerator: Adopt GetFlags method, 2015-07-09). It was added originally by commit 6a56740e (cmNinjaTargetGenerator: Add Fortran flag generation, 2015-07-09).
* cmNinjaTargetGenerator: Use GetDefines methodBrad King2015-07-091-11/+1
| | | | | | | | | Simplify the per-source ComputeDefines implementation by getting target-wide defines from GetDefines. Technically this changes behavior by no-longer de-duplicating/sorting defines from both the target and the source, but this makes it consistent with the Makefile generator. It may also later help move target-wide defines into per-target compilation rules.
* cmCommonTargetGenerator: Adopt GetFlags methodBrad King2015-07-091-49/+1
| | | | | De-duplicate per-target flag computation in Makefile and Ninja target generators.
* cmNinjaTargetGenerator: Add OX X framework flagsBrad King2015-07-091-2/+4
| | | | | Teach ComputeFlagsForObject to add -F flags just like the Makefile generator does.
* cmNinjaTargetGenerator: Factor out AddIncludeFlags helperBrad King2015-07-091-16/+23
| | | | | Factor an AddIncludeFlags method out of ComputeFlagsForObject just like cmMakefileTargetGenerator has already.
* cmNinjaTargetGenerator: Add Fortran flag generationBrad King2015-07-091-7/+12
| | | | | Make ComputeFlagsForObject consistent with the Makefile generator in regard to Fortran flags.
* cmCommonTargetGenerator: Adopt ModuleDefinitionFile memberBrad King2015-07-091-32/+1
| | | | | De-duplicate the ModuleDefinitionFile and AddModuleDefinitionFlag members from the Makefile and Ninja target generators.
* cmCommonTargetGenerator: Adopt GetFeature and friendsBrad King2015-07-091-26/+0
| | | | | De-duplicate the GetFeature, GetFeatureAsBool, and AddFeatureFlags members from the Makefile and Ninja target generators.
* cmCommonTargetGenerator: Adopt ConfigName memberBrad King2015-07-091-5/+0
| | | | De-duplicate the member from the Makefile and Ninja target generators.
* cmCommonTargetGenerator: Adopt basic target generator membersBrad King2015-07-091-4/+1
| | | | | De-duplicate the GeneratorTarget, Target, and Makefile members from the local Makefile and Ninja generators.
* Add common base classes to Makefile and Ninja generatorsBrad King2015-07-091-1/+1
| | | | Provide a place to move functionality common to both.
* cmNinjaGenerator: Require cmGeneratorTarget.Stephen Kelly2015-06-221-6/+5
|
* Merge topic 'compiler-launcher'Brad King2015-06-151-0/+20
|\ | | | | | | | | 698f7597 Add options to launch the compiler through tools like ccache or distcc
| * Add options to launch the compiler through tools like ccache or distccBill Hoffman2015-06-151-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | Create a <LANG>_COMPILER_LAUNCHER target property (initialized by a CMAKE_<LANG>_COMPILER_LAUNCHER variable) to specify a compiler launcher tool. This will supersede the CMAKE_<LANG>_COMPILER_ARG1 approach to using such tools. The old approach set CMAKE_<LANG>_COMPILER to the launcher tool while the new approach leaves this variable set to the actual compiler. Implement this property for Makefile and Ninja generators. It cannot be implemented for VS or Xcode generators as the IDE build tools offer no such hooks.
* | cmGeneratorTarget: Move Feature API from cmTarget.Stephen Kelly2015-06-061-2/+3
|/
* Add options to run include-what-you-use with the compilerBrad King2015-05-191-0/+17
| | | | | | Create a <LANG>_INCLUDE_WHAT_YOU_USE target property (initialized by a CMAKE_<LANG>_INCLUDE_WHAT_YOU_USE variable) to specify an IWYU command line to be run along with the compiler.
* Ninja: Generate separate compile and link rules for each targetBrad King2015-05-181-0/+7
| | | | | | | | 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.
* Ninja: Use forward slashes for any GCC on Windows (#15439)Thomas Herz2015-05-071-1/+1
| | | | | Any GCC compiler on a Windows host needs forward slashes, not just those built for MinGW.
* Ninja: Refactor detection of MinGW tools on WindowsBrad King2015-05-071-1/+1
| | | | | | | | | | | 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.
* cmMakefile: Port users of GetStart* methods to new names.Stephen Kelly2015-04-201-1/+2
|
* Genex: Allow COMPILE_LANGUAGE when processing compile definitions.Stephen Kelly2015-03-091-1/+1
| | | | Issue an error if this is encountered by an IDE generator.
* Ninja: Use "deps = msvc" only for C and CXX (#15253)Brad King2015-01-291-29/+23
| | | | | | | | The "/showIncludes" flag is only available with MS C and C++ compilers, and on compilers that "simulate" them (like Intel for Windows). Fix our logic to choose this type only for MS tools with these languages. All other cases need to use "deps = gcc" and define DEP_FILE in the build rule.
* Merge topic 'fix-OBJECT_DEPENDS-after-path-normalization'Brad King2015-01-291-0/+8
|\ | | | | | | | | 9259d778 Normalize OBJECT_DEPENDS paths to match custom commands (#15366)
| * Normalize OBJECT_DEPENDS paths to match custom commands (#15366)Brad King2015-01-281-0/+8
| | | | | | | | | | | | | | | | | | | | Custom command path normalization added in commit v3.1.0-rc1~471^2 (add_custom_command: Normalize OUTPUT and DEPENDS paths, 2014-05-28) broke use of OBJECT_DEPENDS to bring in custom commands because the latter paths were not normalized too. Normalize them and add a test case. Reported-by: Daniel v. Gerpen
* | IncludeDirectories: Respect SYSTEM flag when using CONFIG genex.Stephen Kelly2015-01-221-1/+3
| | | | | | | | | | Update the Makefile and Ninja generators to use the config when requesting the include flags.
* | Port all cmOStringStream to std::ostringstream.Stephen Kelly2015-01-111-2/+2
| | | | | | | | All compilers hosting CMake support the std class.
* | Merge topic 'ninja-fix-crash-on-error'Brad King2014-12-231-1/+4
|\ \ | |/ | | | | | | 9a13fcbf Ninja: Do not crash when CMAKE_<LANG>_COMPILE_OBJECT is empty (#15325)
| * Ninja: Do not crash when CMAKE_<LANG>_COMPILE_OBJECT is empty (#15325)Brad King2014-12-221-1/+4
| |
* | Add an option for explicit BYPRODUCTS of custom commands (#14963)Brad King2014-11-141-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A common idiom in CMake-based build systems is to have custom commands that generate files not listed explicitly as outputs so that these files do not have to be newer than the inputs. The file modification times of such "byproducts" are updated only when their content changes. Then other build rules can depend on the byproducts explicitly so that their dependents rebuild when the content of the original byproducts really does change. This "undeclared byproduct" approach is necessary for Makefile, VS, and Xcode build tools because if a byproduct were listed as an output of a rule then the rule would always rerun when the input is newer than the byproduct but the byproduct may never be updated. Ninja solves this problem by offering a 'restat' feature to check whether an output was really modified after running a rule and tracking the fact that it is up to date separately from its timestamp. However, Ninja also stats all dependencies up front and will only restat files that are listed as outputs of rules with the 'restat' option enabled. Therefore an undeclared byproduct that does not exist at the start of the build will be considered missing and the build will fail even if other dependencies would cause the byproduct to be available before its dependents build. CMake works around this limitation by adding 'phony' build rules for custom command dependencies in the build tree that do not have any explicit specification of what produces them. This is not optimal because it prevents Ninja from reporting an error when an input to a rule really is missing. A better approach is to allow projects to explicitly specify the byproducts of their custom commands so that no phony rules are needed for them. In order to work with the non-Ninja generators, the byproducts must be known separately from the outputs. Add a new "BYPRODUCTS" option to the add_custom_command and add_custom_target commands to specify byproducts explicitly. Teach the Ninja generator to specify byproducts as outputs of the custom commands. In the case of POST_BUILD, PRE_LINK, and PRE_BUILD events on targets that link, the byproducts must be specified as outputs of the link rule that runs the commands. Activate 'restat' for such rules so that Ninja knows it needs to check the byproducts, but not for link rules that have no byproducts.
* | Ninja: Refactor restat to be a string internallyBrad King2014-11-141-1/+1
| | | | | | | | | | This will allow values other than "" and "1" to be generated in the rules.ninja file.
* | strings: Remove redundant calls to std::string::c_str()Nils Gladitz2014-10-151-11/+11
|/ | | | | Replacements were detected and performed by the clang tool remove-cstr-calls on a linux build.
* Ninja: Skip generating empty phony rulesAdam Strzelecki2014-06-301-13/+19
| | | | | | | | | Ninja generator ensures that all custom commands being target dependencies are run before other source compilations. However in case there are no such dependencies it currently generates empty phony rules which clutter the build graph. Teach the Ninja generator to produce such rules only when necessary.
* Add OBJECT_FILE_DIR rule placeholder for compilation linesBrad King2014-06-051-0/+6
| | | | | | | | | Some compilers do not offer an option to specify the path to the object file, but rather only to the directory in which to place the object file. See issue 14876 for some examples. Add a new OBJECT_FILE_DIR placeholder to specify the directory containing the object file for the current compilation. This may differ from the main target OBJECT_DIR when the object corresponds to a source in a subdirectory.
* cmTarget: Add GetFeatureAsBool methodBrad King2014-05-211-1/+1
| | | | Return the GetFeature method result converted to a boolean value.
* Merge topic 'ninja-intel-linux'Brad King2014-05-121-2/+4
|\ | | | | | | | | 54535f47 Ninja: Fix deptype for Intel compiler on Linux
| * Ninja: Fix deptype for Intel compiler on LinuxBrad King2014-05-091-2/+4
| | | | | | | | | | | | | | | | | | | | | | Since commit v3.0.0-rc1~305^2 (Ninja: deptype msvc for Intel's compiler on Windows, 2013-11-25) we used "deps = msvc" for the Intel compiler. This is correct only on Windows. On Linux we still want "deps = gcc". Fix the logic to use "deps = msvc" when the compiler id or the "simulate id" is "MSVC". This will preserve the behavior on Intel for Windows and fix the behavior on Intel for Linux. In the future this should be converted to a platform information module variable.
* | ninja: Factor out custom command order-only dependsBen Boeckel2014-05-071-14/+15
| | | | | | | | | | This makes WebKitGTK's CMake build.ninja file go from 165M to 11M and configure/generate in 5 seconds.
* | ninja: Factor out target-level order-only dependenciesBen Boeckel2014-05-071-5/+22
| | | | | | | | | | | | This reduces ninja file output even more for projects with lots of libraries with entangled transitive dependencies. ParaView goes from the previous 58M to about 45M.
* | LocalGenerator: Add a string overload for AppendFlagsBen Boeckel2014-05-071-2/+2
| |
* | ninja: Use string parametersBen Boeckel2014-05-021-3/+4
| |
* | Ninja: Query custom commands once per target, not once per file.Stephen Kelly2014-04-051-7/+7
| | | | | | | | | | Computing the source files is now more expensive, so the Ninja generator became very slow with a large number of files.
* | cmTarget: Make the source files depend on the config.Stephen Kelly2014-04-021-7/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Disallow the use of config-specific source files with the Visual Studio and Xcode generators. They don't have any way to represent the condition currently. Use the same common-config API in cmQtAutoGenerators. While it accepts config-specific files, it doesn't have to support multiple configurations yet. Loop over the configs in cmTargetTraceDependencies and cmGlobalGenerator::WriteSummary and consume all source files. Loop over the configs in cmComputeTargetDepends and compute the object library dependencies for each config.
* | cmTarget: Allow any generator expression in SOURCES property.Stephen Kelly2014-04-021-11/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove use of UseObjectLibraries from Makefile and Ninja generators. It is not needed now because those generators use GetExternalObjects which already contains the objects from object libraries. The VS10 generator calls both the UseObjectLibraries and the GetExternalObjects methods. Ensure that duplicates are not created by skipping objects from object libraries in handling of GetExternalObjects. Similarly, fix VS6, VS7 and Xcode object handling by skipping external objects from OBJECT_LIBRARY usage as appropriate. The error message in the BadSourceExpression1 test is now reported by the generator expression evaluator, so it has different text.
* | ninja: Add support for custom depfile formatsBen Boeckel2014-03-241-0/+5
| | | | | | | | | | | | | | | | Not everything that isn't MSVC is GCC. I have support for LDC's depfile format on its way upstream[1], but its future is uncertain. CMake should at least support this for future depfile formats. [1]https://github.com/martine/ninja/pull/721
* | cmGeneratorTarget: Constify cmSourceFile* in containers.Stephen Kelly2014-03-131-10/+10
| | | | | | | | | | Some of them will be used with other APIs which require value_type to be cmSourceFile const*.