Commit Graph

78 Commits

Author SHA1 Message Date
Daniel Mensinger a98db022aa cmake: Detect custom command targets in compiler args
This is required to make `-include /path/to/custom/target.hpp`
work. This setup is used by wxWidgets and this PR is
required to use wxWidgets as a CMake subproject.
2020-08-09 19:36:38 +03:00
Daniel Mensinger 1c1ec9ff11
cmake: resolve IMPORTED executables in custom commands (fixes #7509) 2020-08-03 17:48:12 +02:00
Daniel Mensinger 05ddd6543d
mdata: remove setuptools and use mesondata instead 2020-07-16 21:03:23 +02:00
Jussi Pakkanen 64f36613ef
Merge pull request #7231 from mensinda/cmOverride
cmake: Add more advanced subproject configuration options
2020-07-01 00:04:08 +03:00
georgev93 5acd8acd51 Move mesonbuild/cmake/data/run_ctgt.py to mesonbuild/scripts/cmake_run_ctgt.py, as well as enclose everything in a run() function so it can be called by `meson --internal cmake_run_ctgt ...`. Also, include mesonbuild/cmake/data/ in the msi package. 2020-06-30 23:50:10 +03:00
Daniel Mensinger 6c56478ee1 cmake: fix definitions with interface libraries (fixes #7299) 2020-06-13 18:50:00 +00:00
Daniel Mensinger a2f94ca18b
cmake: Add more advanced subproject configuration options
This is done with the new cmake subprojects options object
that is similar to the already exisiting configuration data
object. It is consumed by the new `options` kwarg of the
cmake.subproject function.
2020-06-05 11:45:05 +02:00
Daniel Mensinger a252a17e6e cmake: always split property lists (fixes #7228) 2020-06-02 20:47:22 +03:00
Alexander Neumann ec7ee8fd9e fix cmake target configuration selection. 2020-05-24 12:59:53 +02:00
Nirbheek Chauhan f2d0551941 cmake: Print supported stds when warning
This was helpful while debugging CI failure on the 0.54 branch due to
a difference in the structure of self.env.coredata.compiler_options:

https://github.com/mesonbuild/meson/runs/674391139
https://travis-ci.org/github/mesonbuild/meson/jobs/686982807
2020-05-15 02:09:33 +00:00
Nirbheek Chauhan 76c636daac cmake: Fix string substitution index error
```
  File "mesonbuild/cmake/interpreter.py", line 293, in postprocess
    'Unknown {}_std "{}" -> Ingoring. Try setting the project'
IndexError: Replacement index 2 out of range for positional args tuple
```
2020-05-14 15:37:38 +00:00
Daniel Mensinger 956cba0222 cmake: Ignore unknown c(pp)? stds (fixes #7104) 2020-05-12 20:45:06 +03:00
Dylan Baker 57b468c75a Use pkg_resource to find resources files (data)
Doing this by hand is fraught with corner cases, and we're running into
some of those problems already. setuptools pkg_resource is a well tested
solution for not running into corner cases, and we already rely on
setuptools to make our entry point scripts work, so we might as well
make us of the other things it can solve for us.

Fixes #6801
2020-04-21 00:40:19 +03:00
Daniel Mensinger cf4b9e6502 cmake: Do not compile explicit header files 2020-04-17 18:28:40 +03:00
Daniel Mensinger fa1bb2a676 cmake: Preserve include directory order (fixes #6959) 2020-04-12 19:39:01 +03:00
Daniel Mensinger 95e7477d12 cmake: Only expand executable targets in COMMAND (fixes #6857) 2020-03-29 19:35:37 +03:00
Daniel Mensinger 91976a3489 cmake: Fix build_by_default: false, install: true (fixes #6737) 2020-03-08 14:10:22 +02:00
Daniel Mensinger ab988198c7
review: Initial fixup 2020-03-02 10:47:20 +01:00
Daniel Mensinger c14aea2812
types: Annotate mparser.py
This also fixes that the keys in ArgumentNode.kwargs are
all of the type BaseNode now. Before this commit, it was
possible that both strings and Nodes where used as keys.
2020-03-02 10:34:55 +01:00
Jussi Pakkanen bacf063aae
Merge pull request #6635 from mensinda/cmOTMFix
cmake: Fix dependency loops in custom targets (fixes #6632)
2020-02-23 12:49:50 +02:00
Daniel Mensinger 113ec96626
cmake: Fix relative paths for add_custom_{command,target}
Do this by tracking CMAKE_CURRENT_{SOURCE,BINARY}_DIR variables.
This is achieved by injecting CMake code with CMAKE_PROJECT_INCLUDE
and overriding some builtin functions with a wrapper that adds
additional trace information.
2020-02-20 11:16:37 +01:00
Daniel Mensinger 55d3fe4f4a cmake: Ignore files that violate subproject isolation (fixes #6640) 2020-02-19 23:07:41 +02:00
Daniel Mensinger 4ec6918cd5
cmake: Fix dependency loops in custom targets (fixes #6632) 2020-02-19 11:52:22 +01:00
Daniel Mensinger 1f7e73fd5c cmake: Sanitize CMake names (fixes #6554) 2020-02-04 00:39:04 +02:00
Daniel Mensinger acc6dbfab7
cmake: Add support for --trace-redirect 2020-01-26 18:23:41 +01:00
Daniel Mensinger 3607f50d7f
cmake: Refactor CMakeExecutor and CMakeTraceParser
This moves most of the execution code from the CMakeInterpreter
into CMakeExecutor. Also, CMakeTraceParser is now responsible
for determining the trace cmd arguments.
2020-01-26 18:23:34 +01:00
Daniel Mensinger bc27ebacc9 cmake: Always Add C, CXX if no language is specified (fixes #6441) 2020-01-23 20:57:17 +01:00
Daniel Mensinger 09b53c534f types: import typing as T (fixes #6333) 2020-01-08 15:28:17 +01:00
Daniel Mensinger 4f6453bc32 cmake: Use trace for missing link flags (fixes #6386)
This is neccessary for static libraries, since the
CMake file API does not add link flags here.
2019-12-29 19:02:24 +02:00
Daniel Mensinger 77e0008a1f cmake: Fix obeject libraries
This fixes an issue with generated sources and object libraries, as
well as an issue on windows with the `link` linker and the vs backend.
The last issue is resolved by building the source files multiple times
to avoid extracting object files in meson.
2019-12-22 22:38:20 +02:00
Daniel Mensinger 0c875e16c4 lgtm: fix Non-iterable used in for loop
Not sure why LGTM is complaining about this, but moving this
from a static to a local context should fix this.
2019-12-05 00:22:10 +02:00
Daniel Mensinger 36749a1625 cmake: Make output_target_map more robust (fixes #6208)
This PR refactors the old output_target_map, which was a
raw dict, into it's own class. This makes the access to
the map more uniform and robust (at the cost of more lines
of code).

Additionally relative paths to the build directory are
now also tracked for outputs. This is neccessary to
corretcly distingluish files with the same name, that are
in different directories.
2019-11-30 22:00:18 +02:00
Daniel Mensinger 82df046bc1
cmake: Reassign dependencies from header-only targets 2019-11-28 11:11:15 +01:00
Daniel Mensinger 3cdc386cde
cmake: Detect dependenciy cycles and avoid infinite recursion 2019-11-28 11:10:27 +01:00
Daniel Mensinger b2b9c102b5
cmake: Some minor fixup 2019-11-28 11:07:20 +01:00
Xavier Claessens daeee32d9b
cmake: Add support for add_custom_target() with a command
The command could have no output, in which case we create a dummy one.
2019-11-27 21:12:55 +01:00
Xavier Claessens 6844ad374e
cmake: Add support for add_dependencies()
Closes: #5983
2019-11-27 21:12:50 +01:00
Daniel Mensinger f2114fa167
cmake: add_custom_command fix empty and quoted parameters 2019-11-20 20:58:38 +01:00
Daniel Mensinger 7e839fc4a9
cmake: Fix confilcting custom targets 2019-11-20 19:44:47 +01:00
Daniel Mensinger 560c4f7f96
cmake: Uniform target name handling 2019-11-20 17:44:48 +01:00
Daniel Mensinger 3e1435a968
cmake: Handle CMake system include dirs (closes #6079) 2019-11-19 13:08:17 +01:00
Daniel Mensinger e1fd830070 cmake: Log warnings in CMakeLists.txt
Previously, warnings genereated in CMake were not logged because
CMake sends them to stderr alongside the trace information. With
this PR, only real trace lines are send to the trace parser and
all other lines in stderr are logged as warnings.
2019-11-12 20:40:51 +02:00
Wolfgang Stöggl f037e7ef45 Fix typos found by codespell
- Typos were found by codespell v1.16.0
2019-11-06 09:55:30 -05:00
Jussi Pakkanen aece7ecded
Merge pull request #6074 from mensinda/cmFileAPI
cmake: Add CMake file API support
2019-10-20 17:45:02 +03:00
Daniel Mensinger 30a668d0bb cmake: Blacklist more compiler warning flags 2019-10-20 14:12:52 +03:00
Daniel Mensinger 66e1e1747e
cmake: Do not add imported targets 2019-10-20 12:04:15 +02:00
Daniel Mensinger 902ed589a5
cmake: Add CMake file API support
The file API will automatically be used when CMake >= 3.14
is detected. This new API is meant as a replacement for the
now deprecated CMake server API.

The new API (mostly) provides the same information in a
different format. Thus only a slight bit of refactoring was
necessary to implement this new backend
2019-10-20 12:04:15 +02:00
Daniel Mensinger b2c89e6f87
cmake: Move CMake API classes to common 2019-10-20 12:04:15 +02:00
Daniel Mensinger 27c01dff01 cmake: Blacklist MS debug flags (fixes #6021) 2019-10-10 16:25:35 -07:00
Daniel Mensinger 4185a00057
Revert "cmake: postprocess libraries names with so version"
This reverts commit 73f0061498.
2019-10-03 18:17:09 +02:00