summaryrefslogtreecommitdiffstats
path: root/Source/cmNinjaNormalTargetGenerator.cxx
Commit message (Collapse)AuthorAgeFilesLines
* Include cmAlgorithms where it is used.Stephen Kelly2015-03-101-0/+1
|
* Merge topic 'ninja-rsp_file-calculation'Brad King2015-01-261-7/+22
|\ | | | | | | | | 097e26f4 ninja: use the minimum of all command line length limits (#14892)
| * ninja: use the minimum of all command line length limits (#14892)Ben Boeckel2015-01-231-7/+22
| | | | | | | | | | | | When choosing whether to use a response file, consider several possible command line length limits for the current operating system, and choose the smallest.
* | Port all cmOStringStream to std::ostringstream.Stephen Kelly2015-01-111-5/+5
| | | | | | | | All compilers hosting CMake support the std class.
* | Merge topic 'ninja-fix-subdir-objlib-languages'Brad King2014-12-241-2/+15
|\ \ | |/ | | | | | | | | 07fc7b75 Tests: Test using objects from a language enabled in a subdirectory (#15325) fdbfcfdf Ninja: Generate rules only for languages compiled in a target (#15325)
| * Ninja: Generate rules only for languages compiled in a target (#15325)Brad King2014-12-231-2/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Refactoring in commit v3.1.0-rc1~688^2~2 (cmTarget: Compute languages from object libraries on demand, 2014-03-18) taught cmTarget::GetLanguages to (correctly) include the languages of object library sources. Previously this was done only in cmTarget::ComputeLinkImplementationLanguages to choose the linker language. The Ninja generator writes out generic build rules for each language compiled within a target using the rule variables defined in the directory of the target. This only needs to be done for languages actually compiled within the current target. Switch from using the cmTarget::GetLanguages method to get the list of languages over to using cmTarget::GetSourceFiles directly so we do not get the languages in object libraries. Strictly speaking this should make no difference because it is not safe to use objects from a language not enabled in the directory containing a target or else the link information for the language may not be considered. However, in cases when no link information happens to be needed for a language it was possible in CMake 3.0 and below to enable a language only in a subdirectory providing an object library, and then use the objects from a containing directory. The above change teaches the Ninja generator to continue working in this case.
* | Add an option for explicit BYPRODUCTS of custom commands (#14963)Brad King2014-11-141-1/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-3/+3
| | | | | | | | | | This will allow values other than "" and "1" to be generated in the rules.ninja file.
* | Ninja: Use a TARGET_FILE variable to hold the link output fileBrad King2014-11-141-18/+11
| | | | | | | | | | | | Use an explicit "$TARGET_FILE" variable instead of "$out" so that we can have multiple output files while still only referencing the main one in command lines.
* | strings: Remove redundant calls to std::string::c_str()Nils Gladitz2014-10-151-6/+6
|/ | | | | Replacements were detected and performed by the clang tool remove-cstr-calls on a linux build.
* Ninja: Remove _COMPILER_LINKER_OPTION_FLAG_ remnantsNils Gladitz2014-07-291-6/+1
|
* Ninja: Add order-only dependencies to link commands (#14728)Ben Boeckel2014-07-011-1/+6
| | | | | | | | | | | | | A library or executable target that consists only of a reference to an object library may have no sources to compile or custom commands to run. The command in the target is the link (or archive) command. Add missing order-only dependencies to link commands so that target ordering dependencies are satisfied for it without depending on an intermediate compilation rule. Extend the ObjectLibrary test to cover this case. Co-Author: Brad King <brad.king@kitware.com>
* cmGeneratorTarget: Improve GetCreateRuleVariable APIBrad King2014-05-211-5/+5
| | | | | Pass the language and configuration to the method so it can return the complete rule variable name.
* Merge topic 'ninja-link-with-compile-flags'Brad King2014-04-151-149/+163
|\ | | | | | | | | | | | | 97f2b7f5 Ninja: set correct LANGUAGE_COMPILE_FLAGS when linking 49fcffc6 Ninja: cmake formatting, make code more readable b735c8cb MinGW: link like on Unix and use compile flags when linking
| * Ninja: set correct LANGUAGE_COMPILE_FLAGS when linkingPeter Kümmel2014-04-151-15/+14
| |
| * Ninja: cmake formatting, make code more readablePeter Kümmel2014-04-151-138/+153
| |
* | Ninja: replace \ in LINK_PATH for MinGWPeter Kümmel2014-04-151-0/+2
|/
* Watcom: Use single quote for all file/path items in wlink commandJiri Malak2014-04-081-1/+7
| | | | | | Watcom Linker use single quote if necessary for quoting target name, libraries names and libraries search path. Object names were already fixed.
* Merge topic 'target-transitive-sources'Brad King2014-04-031-1/+2
|\ | | | | | | | | | | | | | | | | | | | | 9407174b target_sources: New command to add sources to target. 81ad69e0 Make the SOURCES target property writable. 6e636f2e cmTarget: Make the SOURCES origin tracable. 3676fb49 cmTarget: Allow transitive evaluation of SOURCES property. e6971df6 cmTarget: Make the source files depend on the config. df753df9 cmGeneratorTarget: Don't add computed sources to the target. 869328aa cmComputeTargetDepends: Use valid config to compute target depends.
| * cmTarget: Make the source files depend on the config.Stephen Kelly2014-04-021-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | Ninja: Simplify code for linker commandsJiri Malak2014-04-011-51/+29
|/ | | | | Use GetCreateRuleVariable function instead of redundant code for Rule variable name. Use temporary variables to improve code.
* Generalize cmCustomCommandGenerator to more fieldsBrad King2014-03-121-1/+4
| | | | | | | 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.
* Merge topic 'remove-c_str-calls'Brad King2014-03-121-8/+8
|\ | | | | | | | | | | | | 3be265b3 Workaround Sun C++ 5.9 compiler crash af8a1643 Remove c_str calls when using stream APIs. 21c573f6 Remove some c_str() calls.
| * Remove some c_str() calls.Stephen Kelly2014-03-111-8/+8
| | | | | | | | | | | | Use the clang RemoveCStrCalls tool to automatically migrate the code. This was only run on linux, so does not have any positive or negative effect on other platforms.
* | Ninja: Detect command-line length limit on HaikuAdrien Destugues2014-03-101-1/+1
|/
* strings: Remove cmStdString referencesBen Boeckel2014-03-081-2/+2
| | | | | | | | | | | 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.
* stringapi: Use strings in target nameBen Boeckel2014-03-081-1/+1
|
* stringapi: Use strings for the languagesBen Boeckel2014-03-081-4/+4
|
* Ninja: job pool support for compiling and linkingPeter Kümmel2013-11-251-0/+2
| | | | | Could be tested by setting the environment variable NINJA_STATUS=[%r]
* Port some of the generator API to cmGeneratorTarget.Stephen Kelly2013-11-221-6/+8
| | | | | | | Just enough to reach the BuildMacContentDirectory method and the NeedRelinkBeforeInstall methods. In the future, those methods can be moved to cmGeneratorTarget.
* cmTarget: Make custom command accessors API const.Stephen Kelly2013-11-191-1/+1
| | | | Add specific mutators instead of providing non-const refs.
* Ninja: use deps = gcc/msvc featurePeter Kümmel2013-10-241-3/+20
| | | | cmcldeps is now only used for .rc file processing
* OS X: Fix regression handling frameworks for NinjaClinton Stimpson2013-07-221-2/+4
| | | | | | | | | | Fix a regression created by commit 373faae5 (Refactor how bundles and frameworks are supported, 2013-05-05). Since the ninja file isn't aware of how framework symlinks work, we suppress symlink creation and let cmOSXBundleGenerator handle it. Also, use the real name of framework library in build rules as was done before, instead of the symlink.
* Revert "Use --sysroot when cross compiling."Stephen Kelly2013-07-121-21/+1
| | | | | | | This reverts commit de4da665d3205afa239749c41513a315c3831f51. This feature is not yet ready for release. It needs to be merged with the CMAKE_OSX_SYSROOT feature.
* Ninja: GlobalNinjaGenerator WriteBuild and WritePhonyBuild non staticRobert Maynard2013-07-011-36/+41
| | | | | | To properly track the usage of dependencies that are generated at compile time as the side effect of other build steps we need to make the WriteBuild and WritePhonyBuild commands non static
* Merge topic 'set-sysroot'Brad King2013-06-241-1/+21
|\ | | | | | | | | de4da66 Use --sysroot when cross compiling.
| * Use --sysroot when cross compiling.Stephen Kelly2013-06-071-1/+21
| | | | | | | | | | | | | | | | | | | | As CMAKE_ROOT_FIND_PATH can be a list, a new CMAKE_SYSROOT is introduced, which is never a list. The contents of this variable is passed to supporting compilers as --sysroot. It is also accounted for when processing implicit link directories reported by the compiler, and when generating RPATH information.
* | Add whitespace after colons in error messages.Stephen Kelly2013-06-211-1/+2
|/
* Merge topic 'cfbundle-location'Brad King2013-06-041-2/+0
|\ | | | | | | | | 483e208 OS X: Fix getting of CFBundle LOCATION property.
| * OS X: Fix getting of CFBundle LOCATION property.Clinton Stimpson2013-06-031-2/+0
| | | | | | | | | | | | | | This fixes bug #13797. The kinds of changes applied in 373faae5 for frameworks are now applied to CFBundle. The prefix and suffix for CFBundles are now handled in cmTarget::GetFullNameInternal.
* | Merge topic 'framework-refactor'Brad King2013-06-031-6/+13
|\ \ | |/ | | | | | | 373faae Refactor how bundles and frameworks are supported.
| * Refactor how bundles and frameworks are supported.Clinton Stimpson2013-05-231-6/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make handling of directory separators consistent between non-bundle and bundle code. Remove xcode specific flag from cmTarget when getting install_name. Add (more) consistent convenience functions in cmTarget to get directories inside of bundles and frameworks to add files to. This refactor also fixes bug #12263 where frameworks had the wrong install name when SKIP_BUILD_RPATH. Also make install_name for frameworks consistent between Makefile and Xcode generator.
* | Fix spelling and typos (non-binary)Andreas Mohr2013-05-071-1/+1
|/
* Ninja: Avoid LNK1170 linker errorPatrick Gansterer2013-02-041-1/+1
| | | | | | | link.exe has problems with very very long lines in rsp files too. Use $in_newline instead of $in variable for rspcontent which separates the arguments with a newline instead of a simple space and was specially made for this purpose.
* Ninja: encode LINK_FLAGS to handle bash variablesPeter Kümmel2012-11-201-0/+3
| | | | Bug 13560
* Resolve warnings about unused variables.Stephen Kelly2012-11-071-0/+1
|
* Ninja: add option to enforce usage of response filesPeter Kümmel2012-10-011-4/+4
| | | | | If the cmake or environment variable CMAKE_NINJA_FORCE_RESPONSE_FILE is set then a response file is used regardless the command line length.
* Ninja: move <OBJECTS> in front of the first linker optionPeter Kümmel2012-10-011-11/+25
| | | | | | In the response file also linker options could be passed, and because <OBJECTS> is replaced by a response file, it is necessary that no compiler option follows <OBJECTS>.
* Ninja: move -LIBPATH behind -link optionPeter Kümmel2012-10-011-0/+5
| | | | Don' pass linker option to the compile
* Ninja: don't confuse ninja's rsp files with nmake'sPeter Kümmel2012-09-281-2/+7
| | | | Move response files into CMakeFiles/ which makes them different to nmake's.