summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalNinjaGenerator.cxx
Commit message (Collapse)AuthorAgeFilesLines
* Simplify boolean expressionsDaniel Pfeifer2016-06-021-3/+3
| | | | | | Use clang-tidy's readability-simplify-boolean-expr checker. After applying the fix-its, revise all changes *very* carefully. Be aware of false positives and invalid changes.
* Remove unnecessary local copies.Daniel Pfeifer2016-05-261-4/+3
| | | | | | | Use clang-tidy's performance-unnecessary-copy-initialization checker. After applying the fix-its (which turns the copies into const&), revise the changes and see whether the copies can be removed entirely by using the original instead.
* Merge topic 'improve-character-find-and-replace'Brad King2016-05-251-4/+4
|\ | | | | | | | | | | | | | | 5784747d Improve string find: prefer character overloads. 5cec953e Use std::replace for replacing chars in strings. 2a1a2033 cmExtraEclipseCDT4Generator: use std::replace. 34bc6e1f cmCTestScriptHandler: don't call find repeatedly.
| * Use std::replace for replacing chars in strings.Daniel Pfeifer2016-05-241-4/+4
| | | | | | | | | | | | | | | | | | | | | | Find uses of `cmSystemTools::ReplaceString` where both `replace` and `with` are string literals with a size of one. Automate with: git grep -l ReplaceString | xargs sed -i "s|cmSystemTools::ReplaceString(\([^,]*\), \"\(.\)\", \"\(.\)\");|std::replace(\1.begin(), \1.end(), '\2', '\3');|g" git grep -l ReplaceString | xargs sed -i "s|cmSystemTools::ReplaceString(\([^,]*\), \"\(.\)\", \"\\\\\\\\\");|std::replace(\1.begin(), \1.end(), '\2', '\\\\\\\\');|g" git grep -l ReplaceString | xargs sed -i "s|cmSystemTools::ReplaceString(\([^,]*\), \"\\\\\\\\\", \"\(.\)\");|std::replace(\1.begin(), \1.end(), '\\\\\\\\', '\2');|g"
* | Use enums defined in cmOutputConverter using their fully qualified name.Daniel Pfeifer2016-05-251-5/+5
|/ | | | | | | | | 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
* Ninja: Support embedding of CMake as subninja projectNicolas Despres2016-05-171-3/+44
| | | | | | Add a `CMAKE_NINJA_OUTPUT_PATH_PREFIX` variable. When it is set, CMake generates a `build.ninja` file suitable for embedding into another ninja project potentially generated by an alien generator.
* Ninja: Pass all build paths through a central methodNicolas Despres2016-05-171-7/+16
| | | | This gives us a central location to revise paths.
* Ninja: Pre-compute "CMakeCache.txt" build target nameNicolas Despres2016-05-171-2/+3
|
* Ninja: Pre-compute "all" build target nameNicolas Despres2016-05-171-2/+4
|
* Ninja: Simplify generation of custom target logical pathBrad King2016-05-171-9/+4
| | | | | | In `AppendTargetOutputs` we generate a logical build target name for each UTILITY command. Simplify the logic to avoid testing the result of `ConvertToNinjaPath`.
* Revise C++ coding style using clang-formatKitware Robot2016-05-161-565/+383
| | | | | | | | | | | | | 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.
* Remove `//------...` horizontal separator commentsBrad King2016-05-091-5/+0
| | | | | | | | | | | | | | | | | | | | | | | | Modern editors provide plenty of ways to visually separate functions. Drop the explicit comments that previously served this purpose. Use the following command to automate the change: $ git ls-files -z -- \ "*.c" "*.cc" "*.cpp" "*.cxx" "*.h" "*.hh" "*.hpp" "*.hxx" | egrep -z -v "^Source/cmCommandArgumentLexer\." | egrep -z -v "^Source/cmCommandArgumentParser(\.y|\.cxx|Tokens\.h)" | egrep -z -v "^Source/cmDependsJavaLexer\." | egrep -z -v "^Source/cmDependsJavaParser(\.y|\.cxx|Tokens\.h)" | egrep -z -v "^Source/cmExprLexer\." | egrep -z -v "^Source/cmExprParser(\.y|\.cxx|Tokens\.h)" | egrep -z -v "^Source/cmFortranLexer\." | egrep -z -v "^Source/cmFortranParser(\.y|\.cxx|Tokens\.h)" | egrep -z -v "^Source/cmListFileLexer\." | egrep -z -v "^Source/cm_sha2" | egrep -z -v "^Source/(kwsys|CursesDialog/form)/" | egrep -z -v "^Utilities/(KW|cm).*/" | xargs -0 sed -i '/^\(\/\/---*\|\/\*---*\*\/\)$/ {d;}' This avoids modifying third-party sources and generated sources.
* Isolate formatted streaming blocks with clang-format off/onBrad King2016-05-061-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The clang-format tool can do a good job formatting most code, but well-organized streaming blocks are best left manually formatted. Find blocks of the form os << "...\n" "...\n" ; using the command $ git ls-files -z -- Source | egrep -v -z '^Source/kwsys/' | xargs -0 pcregrep -M --color=always -B 1 -A 1 -n \ '<<[^\n]*\n(^ *("[^\n]*("|<<|;)$|;)\n){2,}' Find blocks of the form os << "...\n" << "...\n" << "...\n"; using the command $ git ls-files -z -- Source | egrep -v -z '^Source/kwsys/' | xargs -0 pcregrep -M --color=always -B 1 -A 1 -n \ '<<[^\n]*\n(^ *<<[^\n]*(\\n"|<<|;)$\n){2,}' Surround such blocks with the pair /* clang-format off */ ... /* clang-format on */ in order to protect them from update by clang-format. Use the C-style `/*...*/` comments instead of C++-style `//...` comments in order to prevent them from ever being swallowed by re-formatting of surrounding comments.
* Format include directive blocks and ordering with clang-formatBrad King2016-04-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Sort include directives within each block (separated by a blank line) in lexicographic order (except to prioritize `sys/types.h` first). First run `clang-format` with the config file: --- SortIncludes: false ... Commit the result temporarily. Then run `clang-format` again with: --- SortIncludes: true IncludeCategories: - Regex: 'sys/types.h' Priority: -1 ... Commit the result temporarily. Start a new branch and cherry-pick the second commit. Manually resolve conflicts to preserve indentation of re-ordered includes. This cleans up the include ordering without changing any other style. Use the following command to run `clang-format`: $ git ls-files -z -- \ '*.c' '*.cc' '*.cpp' '*.cxx' '*.h' '*.hh' '*.hpp' '*.hxx' | egrep -z -v '(Lexer|Parser|ParserHelper)\.' | egrep -z -v '^Source/cm_sha2' | egrep -z -v '^Source/(kwsys|CursesDialog/form)/' | egrep -z -v '^Utilities/(KW|cm).*/' | egrep -z -v '^Tests/Module/GenerateExportHeader' | egrep -z -v '^Tests/RunCMake/CommandLine/cmake_depends/test_UTF-16LE.h' | xargs -0 clang-format -i This selects source files that do not come from a third-party. Inspired-by: Daniel Pfeifer <daniel@pfeifer-mail.de>
* Source: Stabilize include orderBrad King2016-04-291-1/+2
| | | | | 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.
* cmGlobalNinjaGenerator: Clarify logic for forcing use of response filesDmitry Ivanov2016-04-071-3/+4
| | | | | Update the WriteBuild method to use a negative command line length limit to specify that we should force use of response files.
* Ninja: Add `$subdir/all` targetsCharles Huet2016-03-181-0/+82
| | | | | | | | | | | | | With the Makefile generator one can use `cd $subdir; make all` to build all targets associated with a given subdirectory. This is not possible to do with the Ninja generator since there is only one `build.ninja` file at the top of the build tree. However, we can approximate it by allowing one to run `ninja $subdir/all` at the top of the tree to build the targets in the corresponding subdirectory. Port logic from cmGlobalUnixMakefileGenerator3::WriteDirectoryRule2 to cmGlobalNinjaGenerator in order to produce equivalent directory-level targets.
* Drop Visual Studio 6 generatorBrad King2016-03-091-1/+0
| | | | | | This generator has been deprecated since CMake 3.3. Remove it. Update documentation, modules, and tests to drop content specific to this generator.
* Ninja: Fix non-determinism in generated target dependency order (#15968)Brad King2016-02-121-1/+4
| | | | | | | We represent target dependency sets as `set<cmTargetDepend>` which orders by a `cmGeneratorTarget const*` pointer value. Therefore the order of dependencies encountered in AppendTargetDepends is not predictable. Sort them by content to make the result deterministic.
* Ninja: Add 'restat' parameter to custom command generation methodBrad King2015-11-191-1/+6
| | | | Pass 'true' from all call sites to preserve existing behavior.
* Ninja: Refactor generation of 'restat' on custom commandsBrad King2015-11-191-1/+2
| | | | | | 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.
* cmGlobalNinjaGenerator: Save 'ninja' version very earlyBrad King2015-11-021-14/+11
| | | | | Keep it in a member variable for convenient reference. Store the value as soon as it is known.
* cmGlobalNinjaGenerator: Save path to 'ninja' tool very earlyBrad King2015-11-021-3/+11
| | | | | Keep it in a member variable for convenient reference. Set the value as soon as it is known.
* cmGeneratorTarget: Add GetUtilities APIStephen Kelly2015-10-271-1/+1
|
* Ninja: Port to cmGeneratorTarget.Stephen Kelly2015-10-241-13/+10
|
* Use cmLocalGenerator at generate-time.Stephen Kelly2015-10-241-2/+2
|
* cmGeneratorTarget: Copy IsFrameworkOnApple from cmTarget.Stephen Kelly2015-10-191-2/+3
| | | | Leave the cmTarget method behind for now to implement cmInstallCommand.
* Merge topic 'clean-up-cmTarget'Brad King2015-10-161-9/+9
|\ | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * cmState: Move TargetType enum from cmTarget.Stephen Kelly2015-10-141-9/+9
| | | | | | | | | | | | | | 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
* | cmLocalGenerator: Port GetTargetDirectory to cmGeneratorTarget.Stephen Kelly2015-10-141-3/+1
|/
* cmLocalGenerator: Add Home directory accessors.Stephen Kelly2015-10-081-3/+2
| | | | Reduce reasons for cmLocalGenerator to have a cmMakefile.
* Ninja: Centralize path conversion in global generator (#15757)Brad King2015-09-251-14/+19
| | | | | | | | | | | | | | | | | 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.
* cmLocalGenerator: Create from already-constructed cmMakefile.Stephen Kelly2015-08-281-2/+2
| | | | Don't manage the lifetime of the cmMakefile with cmLocalGenerator.
* cmLocalGenerator: Remove Parent pointer.Stephen Kelly2015-08-281-3/+2
|
* Ninja: Prevent generating if installed Ninja version is too old.James Johnston2015-08-091-0/+12
|
* Ninja: Centralized required Ninja version numbers and comparisons.James Johnston2015-08-091-3/+4
|
* Merge topic 'use-generator-target'Brad King2015-08-061-3/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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. ...
| * cmGlobalNinjaGenerator: Simplify usage of API.Stephen Kelly2015-08-041-3/+1
| |
* | cmMakefile: Store EvaluationFiles.Stephen Kelly2015-08-011-14/+12
|/ | | | | Relieve the cmGlobalGenerator of this responsibility. Evaluate the generator expressions in the context of the cmLocalGenerator.
* Move GetFullPath to cmGeneratorTargetStephen Kelly2015-07-271-2/+6
|
* Add common base classes to Makefile and Ninja generatorsBrad King2015-07-091-1/+1
| | | | Provide a place to move functionality common to both.
* cmComputeTargetDepends: Change API to use cmGeneratorTarget.Stephen Kelly2015-07-011-3/+3
|
* Merge topic 'inject-state-snapshot'Brad King2015-05-271-5/+6
|\ | | | | | | | | | | | | | | 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.
| * cmLocalGenerator: Require a valid cmState::Snapshot in the ctor.Stephen Kelly2015-05-271-2/+3
| | | | | | | | | | | | | | | | | | | | | | 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.
| * cmState: Host some state from the cmGlobalGenerator.Stephen Kelly2015-05-271-1/+1
| |
| * cmGlobalGenerator: Require a cmake instance in ctor.Stephen Kelly2015-05-271-2/+2
| | | | | | | | It is required anyway, so this makes it explicit.
* | Merge topic 'ninja-per-target-rules'Brad King2015-05-271-1/+0
|\ \ | |/ |/| | | | | 9da84ab6 Ninja: Fix regression in .rsp file support
| * Ninja: Fix regression in .rsp file supportBrad King2015-05-261-1/+0
| | | | | | | | | | | | | | | | | | | | 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>
* | Use cmSystemTools::GetCMakeCommand() to get path to cmake internallyBrad King2015-05-201-7/+4
|/ | | | | This is much simpler than finding a way to lookup "CMAKE_COMMAND" everywhere.
* Ninja: Generate separate compile and link rules for each targetBrad King2015-05-181-1/+31
| | | | | | | | 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.