Commit Graph

74 Commits

Author SHA1 Message Date
Tobias Hunger
73e45e30a3 CMake: Clear tasks when forceParse-ing
Server-mode only used to clear the tasks for normal parsing.

Change-Id: Ibbc3ac30f00afaff4874cb0682f5d7e8f1abafcd
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-12-05 09:19:11 +00:00
Tobias Hunger
63c0fbc4e4 CMake: Cache cmake configuration only once
This fixes saves memory and fixes some update issues with the cmake
configuration, where the three layers of caches used to interfere
with each other.

Task-number: QTCREATORBUG-17360
Change-Id: I5564bbe46ca8de6b38dd710100bfc18fad98eac5
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-12-02 12:00:09 +00:00
Tobias Hunger
168c5c67a2 CMake: No need to update the reader when it already is up to date
The reader notifies us about the configuration being changed, so there
is no need to tell it about those changes again.

Change-Id: I458947babf1cd9c50a66ea7863f37d1e43d6c5f2
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-12-02 11:59:44 +00:00
Tobias Hunger
46fb4f430f CMake: Clean cmake cache on compiler changes
According to the cmake developers this needs to be done.

Change-Id: I85670da11be31a71dd22fe2ea8d9102e47cc6535
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-12-02 11:59:33 +00:00
Tobias Hunger
2d8d90bc79 CMake: Cache buildtargets in builddirmanager
No need to have the builddirreaders to so.

Change-Id: Ia7e38f6483b29d6a4f4b65baacc17bf184a3cb34
Task-number: QTCREATORBUG-17359
Reviewed-by: Florian Apolloner <florian@apolloner.eu>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2016-11-30 14:23:36 +00:00
Tobias Hunger
b7f15d8cdf CMake: Do not crash when restarting a filesystem scan
Change-Id: I7a86169f4dd891c91295a7d6daadfd2bac8db751
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-11-14 10:29:59 +00:00
Tobias Hunger
4b4dc9d06c CMake: Project tree for server mode data
Change-Id: Ief884a76c1b4211501dd6515b17b6e88a8e881e5
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-11-14 10:29:53 +00:00
Tobias Hunger
38f30e733f CMake: Always show CMakeLists.txt in project tree
Always show the top level CMakeLists.txt file in the project tree,
even when parsing failed.

Change-Id: I42c844eb54b32fcb51131ad63a8fc372622636fc
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-11-14 10:29:30 +00:00
Tobias Hunger
ae46c06ac6 CMake: Show scanned header files in project tree (TeaLeafReader)
Change-Id: I06ed341a603f4062b41eabc91a90d6d8041aaa4b
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-11-14 09:03:37 +00:00
Tobias Hunger
269e699fd9 CMake: Pass scanned files on to builddirreaders
Change-Id: I226aeafe6800a84fe4bbf8cf6fd21b8237575a88
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-11-14 09:03:28 +00:00
Tobias Hunger
9073a6419a CMake: Clear buildsystem related tasks before starting a new parser run
This prevents stale tasks from piling up in the issues pane.

Change-Id: I90f79e969b8929e5bb43e3964c01fcd10af2ea33
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-11-07 21:16:56 +00:00
Tobias Hunger
c286d16c00 CMake: Scan cmake tree for files
CMake is pretty poor with the data on which files are contained in a project.
Run a filesystem scan of the project directory to find more files.

Change-Id: I9cc3293a9faf9a967efa5f586c144c3e7773588b
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-11-04 13:31:12 +00:00
Tobias Hunger
db6b60874d CMake: Make connections in server-mode setup more robust
Change-Id: I1e66b4decd485edac9e3fb5508d5c0bb10d0554a
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-11-01 15:42:04 +00:00
Tobias Hunger
ea44a2ce4e CMake: Force reparsing of cmake projects
Change-Id: I2f309e38e99a7b5836c623995e71470e7161ee98
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-10-31 13:03:51 +00:00
Tobias Hunger
36cfa32a86 CMake: Use ServerModeReader to retrieve data
Change-Id: I415dbf7ca79c909eea23ef3dc3a1d87438e9f261
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-10-31 13:03:27 +00:00
Tobias Hunger
9a980adf3c CMake: Implement different backends to run cmake
Only the original one is implemented so far, but at least
in theory backends for retrieving data from cmake can now
be switched at runtime.

Change-Id: Id73a81c7d40f078be95defd30a38511dca3a3720
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2016-10-31 10:40:24 +00:00
Alexander Drozdov
72d3f4383e CMake: handle CMake files saving only for active build configuration
...otherwise all previously selected build configurations begins to
process changes in CMakeLists.txt or other cmake-related files after
save it.

Change-Id: I86ff59022c85d88052ff434480e670ebddd90864
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2016-10-19 12:49:05 +00:00
Tobias Hunger
17977b3de7 CMake: Turn CMakeConfigItem into a CMake argument
Add a method to turn a CMakeConfigItem into a string suitable to be passed
to CMake.

Change-Id: Ia7834f1c2fad387dd6e6eaa3863f93385d48ca71
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-10-17 14:41:47 +00:00
Tobias Hunger
93051ad76c CMake: Update button labels on dialog asking to import CMake changes
Change-Id: I5a4b0f192b30b7104ee7da160bcbf269f3f59bb3
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2016-10-17 12:40:03 +00:00
Tobias Hunger
9ff2bd16d3 CMake: Use Utils::FileName where appropriate
Change-Id: I3ab0a68920e27ebcf4e1dd58180a72ded58b892e
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2016-10-17 11:41:51 +00:00
Tobias Hunger
b1433e2a05 CMake: Only pass the path mapper to the cbp-parser
No need to pass in the complete kit. Remove a couple of unnecessary
namespace names.

Change-Id: I2ac895535a80b4a54a423ce62dbdede65b67437b
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-10-17 11:02:26 +00:00
Tobias Hunger
628c4c5213 CMake: Do not continue watching files after a different BC got active
Change-Id: Ib044a168c2f4e8153cd89dac2a98a80cddb14513
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-10-12 09:58:38 +00:00
Alexander Drozdov
76b76f2723 CMakeProjectManager: Support drop down selector for options
CMake provides "hack" for cmake-gui, that allows set options variants
and select then from drop down list. Allows Qt Creator re-use this
solution.

See:
- https://blog.kitware.com/constraining-values-with-comboboxes-in-cmake-cmake-gui/
- http://blog.bethcodes.com/cmake-tips-tricks-drop-down-list

Drop down values can be added to option via:
 SET_PROPERTY(CACHE OptionName PROPERTY STRINGS Option1 Option2 Option3)

This solution should not restrict to provide any other value, it
provides only suggestion for user to select one of prdefined values.

Change-Id: I8fc52155775f1e04979db8206bb42363df9359e8
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2016-10-10 15:07:30 +00:00
Tobias Hunger
9e67dfbe17 CMake: Move more code into BuildDirManager
Continue to concentrate all the code reading random cmake files in
BuildDirManager. Now the task is to clean up the code, make it less
dependent on values it should not depend on (kits, etc.), make it
handle changes better and finally add another implementation that
uses the cmake server mode to extract the data.

Change-Id: I533625e376b969b64287bc205bd2e4be7a605306
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-10-10 14:45:51 +00:00
Tobias Hunger
b17c98ad6f CMake: Trigger cmake run *before* build when files changed
Make sure to run cmake *before* cmake --build when cmake files just
got saved. This helps e.g. when editing CMakeLists.txt files and the
hitting "Built" and "Save all" (or "Always save before build").

Task-number: QTCREATORBUG-16187
Change-Id: I16b1d02eb342a447003380946ce7a9d785476a0e
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2016-10-07 08:47:02 +00:00
Tobias Hunger
9b40c1fc04 CMake: Move code from CMakeProject into BuildDirManager
This is in preparation for having support for cmake's server
mode.

Change-Id: I6cc04fe7c5132c491c3f3c0f46560b8ad88808e8
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-10-06 10:03:16 +00:00
Tobias Hunger
4bce0d7c36 CMake: Use generator arguments, not generator
Generator is only part of the picture now that the extraGenerator
is separate. Use CMakeGeneratorKitInformation::generatorArguments
instead, that is always the complete thing.

Change-Id: Ifb6238397e70b36e2dc1b145d3dfad1afa2caa3f
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-09-30 07:26:15 +00:00
Tobias Hunger
a7cbae1e4d CMake: Make sure top level CMakeLists.txt file is listed exactly once
The toplevel CMakeLists.txt file should always be visible in the project tree,
otherwise there is no way to fix problems that stop creator from reading the
project structure.

Since the cmake configuration may add that file itself, creator needs to
check before adding that file. All other files are taken straight from
cmake, which makes sure they are unique.

See the minimal project attached to QTCREATORBUG-16671 for an example
triggering this issue.

Change-Id: Iff3e307134b023e6955f47657e998a5981b03da0
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2016-08-17 13:08:45 +00:00
Tobias Hunger
703c410085 CMake: Only start parsing when creator gets focus again
Rip out QFileSystemWatcher and use Qt Creators IDocument for file
watching instead. The latter properly delays any action till creator
gets focus again.

Task-number: QTCREATORBUG-16354
Change-Id: Ibb71963416b09712a80ee95347425550453b7fd4
Reviewed-by: Tim Jenssen <tim.jenssen@theqtcompany.com>
2016-06-28 09:10:02 +00:00
Tobias Hunger
d8ed91c44f CMake: Add per-cmake option to not automatically run cmake
Task-number: QTCREATORBUG-15934
Change-Id: I54fdb505a451fb269c3747a370c8dfd7043c6c9d
Reviewed-by: Tim Jenssen <tim.jenssen@theqtcompany.com>
2016-06-28 09:09:10 +00:00
Eike Ziller
4f9016e03f Merge remote-tracking branch 'origin/4.0' into 4.1
Conflicts:
	qtcreator.pri
	qtcreator.qbs
	src/plugins/android/android.qbs
	src/plugins/android/androiddevice.cpp
	src/plugins/autotest/testcodeparser.cpp
	src/plugins/debugger/analyzer/analyzerstartparameters.h
	src/plugins/projectexplorer/devicesupport/desktopdevice.cpp
	src/plugins/projectexplorer/devicesupport/idevice.cpp
	src/plugins/projectexplorer/runconfiguration.h

Change-Id: I2474d06f2309fa71210a8401846bc2ef85bebf1d
2016-06-22 11:09:32 +02:00
David Faure
52ed384549 cmake: resolve symlinks when comparing source directories.
Testcase: trying to use an existing build dir which was
made for /d/foo where /d is a symlink to $HOME/d.

To help understanding the problem, the error message now prints
both source dirs, the one found in the builddir and the one we expected.

Change-Id: I9a24fbd6ef3cf8108c5edba0d2a5b99ecdea0e89
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2016-06-20 07:37:41 +00:00
Orgad Shaneh
868ec2b6d8 CMake: Pass STATIC types on cmake execution
Was submitted by mistake for 4.0 (and reverted). Resubmit for master.

Change-Id: Ie3401d009044a46af7fac314d1f29975543a44b0
(cherry picked from commit 0043c721c2)
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2016-06-03 07:41:50 +00:00
Eike Ziller
73bb92c5a6 Merge remote-tracking branch 'origin/4.0'
Change-Id: I89c52ca2145a43c94d3366367ba72fde605dd577
2016-05-31 12:02:13 +02:00
Tobias Hunger
8405a16179 Revert "CMake: Pass STATIC types on cmake execution"
I have missed that this change was headed for 4.0 instead
of master. It breaks the build there.

This reverts commit 0043c721c2.

Change-Id: Ia359798c2636b2b4699de9cc73484ec12a757601
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2016-05-30 12:06:54 +00:00
Orgad Shaneh
0043c721c2 CMake: Pass STATIC types on cmake execution
Change-Id: Ie3401d009044a46af7fac314d1f29975543a44b0
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2016-05-30 11:34:26 +00:00
Orgad Shaneh
6531ff5672 CMake: Unindent a lambda
Change-Id: I71af11e3fba9a47c24b06bb19617ab212ee5b8a1
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2016-05-30 11:34:07 +00:00
Eike Ziller
0c5bae640b Merge remote-tracking branch 'origin/4.0'
Change-Id: I80bc3371c6d7cf9f2d46cbcf8e79e4761213d8aa
2016-05-27 12:01:36 +02:00
Tobias Hunger
278819f8fd CMake: WS-only fix
Change-Id: If1dcc869560b526d8750195f90b2b94b928eb918
Reviewed-by: Tim Jenssen <tim.jenssen@theqtcompany.com>
2016-05-23 13:19:05 +00:00
Tobias Hunger
d5a1eff8ee CMake: Fix warning about empty filename after persisting cmake config
Change-Id: I2639059055cc42cf6ab9431f4885a01970980fca
Reviewed-by: Tim Jenssen <tim.jenssen@theqtcompany.com>
2016-05-23 13:19:01 +00:00
Tobias Hunger
1f7582e86e CMake: Fix race between persisting cmake configuration and parsing
First make sure the configuration is reset: This makes sure the correct
branch is taken in parse().

Then trigger parsing through the event loop so that its signals will
definitely arrive after persistCMakeState has returned.

Task-number: QTCREATORBUG-16258
Change-Id: I103ca6b6119ec70c99828d883d728a8bb97fd6bf
Reviewed-by: Tim Jenssen <tim.jenssen@theqtcompany.com>
2016-05-23 13:18:54 +00:00
Tobias Hunger
5bc0d12c6d CMake: Check CMakeCache.txt for changes
Check CMakeCache.txt for changes and ask whether to apply these to the
project going forward.

This will only consider settings that were previously changed by Qt Creator
and will not pick up on newly changed settings.

Change-Id: Ia20c67bc2a5e9965243f08003c10ec684875387f
Reviewed-by: Tim Jenssen <tim.jenssen@theqtcompany.com>
2016-05-23 13:18:47 +00:00
Tobias Hunger
8c316aa1c1 CMake: Do not parse that often
Wait longer before triggering a reparse.

Change-Id: I02ed83b0e9a3be7de5f720f9a9595e6a886d1ab0
Reviewed-by: Tim Jenssen <tim.jenssen@theqtcompany.com>
2016-05-23 13:03:32 +00:00
Tobias Hunger
5d69bdfde7 CMake: Cache CMakeCache.txt
Change-Id: Ib3e7a9943d15a2e90afd29642b666892ba7b0613
Reviewed-by: Tim Jenssen <tim.jenssen@theqtcompany.com>
2016-05-23 13:03:20 +00:00
Tobias Hunger
5100454222 CMake: Make it easier to get the expanded value of a CMake configuration
Change-Id: If289c48ef4ec2815e8bd12e08b990d1dc809c524
Reviewed-by: Tim Jenssen <tim.jenssen@theqtcompany.com>
2016-05-20 11:51:23 +00:00
Eike Ziller
6efd8e33e2 Merge remote-tracking branch 'origin/4.0'
Conflicts:
	qtcreator.pri
	qtcreator.qbs

Change-Id: I6217662f0c51d04a83f7a85dc5d7c7f25e78e09a
2016-05-13 16:24:37 +02:00
Tobias Hunger
82b6d728c7 CMake: Fix Clear Cache when builddir is not persistent yet.
Change-Id: I4dc2c5889845b13ebe167b89e78b104f8805a1f6
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2016-05-12 13:10:02 +00:00
Tobias Hunger
ddefe062c7 Fix up QProcess::waitForFinished()
waitForFinish returns false if the process is no longer running at
the time of the call. Handle that throughout the codebase.

Change-Id: Ia7194095454e82efbd4eb88f2d55926bdd09e094
Reviewed-by: hjk <hjk@theqtcompany.com>
2016-05-11 10:04:38 +00:00
Tobias Hunger
7276da8212 CMake: Reuse code to turn CMakeConfigItems into strings
Change-Id: Iecb553ce562e22daa5429cef431fe12994637f9a
Reviewed-by: Vikas Pachdha <vikas.pachdha@theqtcompany.com>
Reviewed-by: Tim Jenssen <tim.jenssen@theqtcompany.com>
2016-04-19 11:05:46 +00:00
Tobias Hunger
b9efc096f6 CMake: Do not purge the configuration to change the EXTRA_GENERATOR
CMake does change the EXTRA_GENERATOR without having to clear the
configuration. So do not do that anymore.

Change-Id: I09a8ee32e3e2577381fbfb86d55caa75c43c5bf2
Reviewed-by: Vikas Pachdha <vikas.pachdha@theqtcompany.com>
Reviewed-by: Tim Jenssen <tim.jenssen@theqtcompany.com>
2016-04-13 11:25:14 +00:00