112 Commits

Author SHA1 Message Date
Brad King
996e1885c4 server: deprecate in favor of the file-api
Document the server mode as deprecated.  Add a deprecation message
to the configure step output when invoked through server mode.

Closes: #19101
2019-04-22 09:38:44 -04:00
Gregor Jasny
1c6c2bae28 cmake-server: Normalize build and source directories
Fixes: #18862
2019-01-31 12:49:56 -05:00
Regina Pfeifer
5a0784ddea clang-tidy: Pass by value 2019-01-22 13:03:04 -05:00
Kyle Edwards
4568d046c4 Properties: Add CMAKE_ROLE global property
This property allows scripts to determine whether they're in project
mode, script mode, find-package mode, CTest, or CPack.
2019-01-17 09:44:29 -05:00
Regina Pfeifer
3e60580784 clang-tidy: Fix readability-static-accessed-through-instance
Enable the check in .clang-tidy and fix all warnings.
2018-11-22 00:11:37 +01:00
Brad King
284a38e42f cmake-server: Revert "Support codemodel filegroups for INTERFACE_SOURCES"
Revert commit v3.13.0-rc1~144^2 (cmake-server: Support codemodel
filegroups for INTERFACE_SOURCES, 2018-08-10).  The changes activate
code paths not meant to be used with interface libraries.  Another
approach will be needed to expose this information later.

This revert has to be done by hand because the code in question has been
changed somewhat since the changes were made, and was also factored out
to another source file.

Fixes: #18463
2018-10-17 14:02:39 -04:00
Brad King
72b4c2c48a server: Compile json object generation source separately
Declare entry points in a dedicated header and compile the source
separately instead of including it in the server implementation.
2018-09-21 11:39:59 -04:00
Brad King
b48165346f server: Split json dictionary into separate header
Move dictionary entries used by the json object generation code into a
separate header.  These are distinct from the server-only entries used
in the protocol implementation.
2018-09-21 11:39:21 -04:00
Brad King
85be67217b server: Split json object generation into separate source
For now just move the content and `#include` it back in to the original
translation unit.  That way `git blame` can cleanly track the original
lines.
2018-09-21 11:39:21 -04:00
Brad King
aabce52851 server: factor out json object generation entry points
Make entry points for these that do not reference the server code.  For
now we leave the "cache" object generation alone because its
implementation interleaves error handling and the format may not
suitable outside a server response.
2018-09-21 11:36:55 -04:00
Brad King
708b3fecfe Merge topic 'gicv-stdstring'
13d10ee616 cmState::GetInitializedCacheValue: Return as const std::string*

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2365
2018-09-12 09:38:37 -04:00
Vitaly Stakhovsky
13d10ee616 cmState::GetInitializedCacheValue: Return as const std::string* 2018-09-10 09:31:48 -04:00
Brad King
1b57f49586 genex: Simplify cmGeneratorExpressionInterpreter
All callers were constructing with a non-empty target name using the
target whose pointer was passed anyway.  Drop this argument.  Simplify
logic accordingly.  Re-order constructor arguments to match the
cmCompiledGeneratorExpression::Evaluate arguments.

Also remove unnecessary getters.
2018-09-07 09:23:43 -04:00
Brad King
69ce062969 Merge topic 'cmakeServerSourcesForInterfaceLibraries'
d74c2282ea cmake-server: Support codemodel filegroups for INTERFACE_SOURCES

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Tobias Hunger <tobias.hunger@gmail.com>
Acked-by: Markus Enzenberger <markus.enzenberger@gmail.com>
Merge-request: !2282
2018-09-04 09:57:58 -04:00
Justin Goshi
d74c2282ea cmake-server: Support codemodel filegroups for INTERFACE_SOURCES
This change returns information for INTERFACE_SOURCES. We add
a flag to the filegroup to indicate if the target represents
interface sources.

Protocol version is updated to 1.3 since this is a change to what was
released in cmake version 3.12.
2018-08-30 16:09:22 -07:00
Brad King
d879999534 Merge topic 'genex-evaluate-stdstring'
65ab9ce938 Genex: Return Evaluate results as const std::string&

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2314
2018-08-30 09:18:58 -04:00
Vitaly Stakhovsky
65ab9ce938 Genex: Return Evaluate results as const std::string&
Also remove unused overloads.
2018-08-28 13:56:29 -04:00
Vitaly Stakhovsky
c8fd23ec6f cmMakefile: return directories as const std::string& 2018-08-27 14:07:43 -04:00
Vitaly Stakhovsky
c530e2f74f cmCompiledGeneratorExpression::Evaluate(): return const std::string& 2018-08-09 14:50:17 -04:00
Brad King
aefb8559dc IWYU: Fix workaround mapping for std::hash
It is provided by `functional`, not `utility`.  Fix the mapping added by
commit 276d3c7afe (IWYU: Add workaround mapping for std::hash,
2018-07-31).  Also generalize the workaround from commit v3.12.0-rc1~39^2~1
(IWYU: Define a macro to tell code it is preprocessing for iwyu,
2018-05-25) to allow local builds to configure specific flags.  This
is needed because iwyu behaves differently in different environments.
2018-08-07 12:04:58 -04:00
Brad King
276d3c7afe IWYU: Add workaround mapping for std::hash
When using GCC 8's standard library IWYU thinks that `<system_error>`
must be included to get `std::hash`.  Add a mapping for `<utility>`.
2018-07-31 09:34:55 -04:00
Kitware Robot
d7204e649e Revise C++ coding style using clang-format-6.0
Run the `clang-format.bash` script to update all our C and C++ code to a
new style defined by `.clang-format`.  Use `clang-format` version 6.0.

* 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.
2018-06-01 09:53:42 -04:00
Brad King
2deb9b7f34 Genex: Fix COMPILE_LANGUAGE in SYSTEM include directories
When evaluating `INTERFACE_SYSTEM_INCLUDE_DIRECTORIES`, or evaluating
`INTERFACE_INCLUDE_DIRECTORIES` on an imported target, thread the
compile language through to the generator expression evaluator so
that it can support `$<COMPILE_LANGUAGE:...>`.

Fixes: #17811
2018-03-12 11:45:01 -04:00
Pavel Solodovnikov
653b894683 Reduce raw string pointers usage.
* Change some functions to take `std::string` instead of
  `const char*` in the following classes: `cmMakeFile`, `cmake`,
  `cmCoreTryCompile`, `cmSystemTools`,  `cmState`, `cmLocalGenerator`
  and a few others.
* Greatly reduce using of `const char*` overloads for
  `cmSystemTools::MakeDirectory` and `cmSystemTools::RelativePath`.
* Remove many redundant `c_str()` conversions throughout the code.
2018-01-31 18:23:03 +03:00
Pavel Solodovnikov
c85bb007df Reduce allocation of temporary values on heap.
- Use `std::move` while inserting temporary results into vectors.
- Change `push_back` to `emplace_back` where appropriate.
2018-01-26 13:24:45 +03:00
Brad King
5c724c4ca8 Merge topic 'server-polish-opt-handshake'
239a3ef8 Server-mode: Document protocol version for optional handshake arguments
9b1a3d24 Server-mode: Rename functions to reflect what they do

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1693
2018-01-25 08:35:28 -05:00
Tobias Hunger
9b1a3d244b Server-mode: Rename functions to reflect what they do
Rename the test* static functions to getOrTest* to better reflect
what they do now.
2018-01-24 17:01:40 +01:00
Marc Chevrier
0448311179 sourceFile properties: add property INCLUDE_DIRECTORIES 2018-01-24 15:10:10 +01:00
Marc Chevrier
78b1c2e09e sourceFile properties: add property COMPILE_OPTIONS
Add the support of per-source property COMPILE_OPTIONS,
including generator expressions support.

Related: #17507
2018-01-23 10:24:56 +01:00
Justin Goshi
33802b3168 server: fix crash if no min version specified
If a CMakeLists.txt file doesn't contain cmake_minimum_required then the
server was crashing. The root cause was the json object model does not
support null and was crashing. Add the null check and use an empty
string in this case.
2018-01-18 20:54:02 -08:00
Justin Goshi
2c1ecab64d server: Expand generator expressions for test info 2018-01-03 16:49:00 -08:00
Marc Chevrier
10f58b27ac Genex: Per-source $<COMPILE_LANGUAGE:...> support
Fixes: #17542
2017-12-13 16:35:22 +01:00
Brad King
b7100756d7 Merge branch 'backport-revert-server-target-backtraces' into revert-server-target-backtraces 2017-12-06 11:49:52 -05:00
Brad King
976370d134 server: drop "ctestInfo" backtrace information
Backtrace information was included by commit 35a52bd1b4 (server: add
"ctestInfo" request to get test info, 2017-10-25) to match that already
provided for targets.  However, the backtrace representation uses too
much memory and needs to be dropped.  Remove it from test information.

Issue: #17502
2017-12-06 11:45:51 -05:00
Brad King
8b2736c71c server: Revert "Report backtraces in codemodel response"
The backtrace information is very repetitive and hugely increases the
size of the codemodel object.  We need to remove it until an alternative
representation can be developed.  Revert commit v3.10.0-rc1~393^2
(server: Report backtraces in codemodel response, 2017-06-20), except
for the protocol version number (because it indicates other new things).

Unfortunately this is incompatible with clients that expect the
"crossReferences" field in targets.  However, the regression in memory
usage is quite serious, especially on large projects, and therefore
breaks even older clients that do not use backtraces.  Since the
"crossReferences" field was only provided by one release (3.10.0), it is
simplest to revert it outright for 3.10.1.

Fixes: #17502
2017-12-06 11:39:03 -05:00
Marc Chevrier
9432f686e6 Add generator expression support to per-source COMPILE_DEFINITIONS
This allows users to specify different genex-based compile definitions for each file in a target.

Fixes: #17508
2017-12-05 14:47:39 +01:00
Marc Chevrier
6bffc13ef1 Refactor per-source generator expression evaluation
Prepare to add generator expression support to more source properties.
Factor out some duplicated code into a helper to avoid further
duplication.
2017-12-04 09:10:09 -05:00
Brad King
08f66764b3 Merge topic 'server-target-isGeneratorProvided'
afd9a339 server: return whether or not a target is generator provided

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1475
2017-11-27 08:52:06 -05:00
Brad King
0c1912e3e5 Merge topic 'serverFixTestDiscovery'
fe2c2b0f server: ctestInfo fix to return all tests

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1479
2017-11-27 08:51:35 -05:00
Justin Goshi
afd9a339a1 server: return whether or not a target is generator provided
Some generators auto-generate targets. For example VS generators create
the ALL_BUILD target. Add the ability to mark targets as generator
provided and return that info through cmake-server codemodel.
2017-11-20 14:29:50 -05:00
Justin Goshi
fe2c2b0ffb server: ctestInfo fix to return all tests
Prior to this change we were looking at targets. But tests are
associated with directories. This change fixes how we gather all tests.
2017-11-17 09:19:26 -08:00
Justin Goshi
cb7d0a80fa server: project has install rule bug fix
Need to check all generators associated with the project because any of
them may have an install rule.
2017-11-16 09:03:08 -08:00
Justin Goshi
cdf5f34b0c server: return minimum cmake required version for each project 2017-11-07 12:15:57 -08:00
Justin Goshi
35a52bd1b4 server: add "ctestInfo" request to get test info 2017-11-03 09:39:01 -07:00
Justin Goshi
296eb9ad4c cmake-server: Add target install destinations to codemodel
Protocol version is updated to 1.2 since this is a change
to what was released in cmake version 3.10.
2017-10-24 14:58:07 -04:00
Matthias Maennich
79b8c3802a Improve several occurrences of vector::push_back in loops
Fix issues diagnosed by clang-tidy by pre-allocating the vector capacity
before the loop [performance-inefficient-vector-operation].

Signed-off-by: Matthias Maennich <matthias@maennich.net>
2017-09-28 07:23:41 -04:00
Pavel Solodovnikov
7d5095796a Meta: modernize old-fashioned loops to range-based for.
Changes done via `clang-tidy` with some manual fine-tuning
for the variable naming and `auto` type deduction
where appropriate.
2017-09-12 16:22:47 +03:00
Daniel Pfeifer
2b4c32c95f clang-format: format all code as Cpp11 2017-08-30 11:07:05 -04:00
Daniel Pfeifer
7ddd43183d Merge topic 'cstyle-casts'
190e3825 Replace C-style casts

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1176
2017-08-30 06:38:00 -04:00
Daniel Pfeifer
190e3825d4 Replace C-style casts 2017-08-27 09:58:46 +02:00