Discussion:
[Rock-dev] [rock] #384: Adding CMAKE_EXPORT_COMPILE_COMMANDS to rock_standard_layout()
rock
2013-11-29 16:37:59 UTC
Permalink
#384: Adding CMAKE_EXPORT_COMPILE_COMMANDS to rock_standard_layout()
-----------------------------+-----------------------------------
Reporter: martin.zenzes@? | Owner: rock-dev-mailing-list
Type: enhancement | Status: new
Priority: minor | Milestone:
Component: base | Keywords: cmake,clang_complete
-----------------------------+-----------------------------------
Hi,

would be nice to have this cmake option set by default for all rock-cmake-
projects. The option would create a file
`${CMAKE_BINARY_DIR}/compile_commands.json`, containing the exact compile-
calls for all translation units of a project. Benefits:

- easier debugging of build process. Not always necessary to search
manually in the output of `make -B VERBOSE=1|less`
- allows using this file for code-completion tools like
[https://github.com/Rip-Rip/clang_complete clang_complete] or
[https://github.com/Valloric/YouCompleteMe YouCompleteMe]

Adding this line in the beginning of the macro-definition of
"rock_standard_library()" in Rock.cmake will do the trick for ordinary
rock-libraries:
{{{
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
}}}

I didn't find an appropriate place for orogen-projects. There, all cmake-
files are generated once? Adding the option manually in the beginning of
the top-level `CMakeLists.txt` seems to work, for example.

Adding it globally would help jumping to different sub-projects and using
code-completion without introducing private local changes.
--
Ticket URL: <http://rock.opendfki.de/ticket/384>
rock <http://rock.opendfki.de>
rock: the robot construction kit
rock
2013-11-29 16:41:43 UTC
Permalink
#384: Adding CMAKE_EXPORT_COMPILE_COMMANDS to rock_standard_layout()
----------------------------------+------------------------------------
Reporter: martin.zenzes@? | Owner: rock-dev-mailing-list
Type: enhancement | Status: new
Priority: minor | Milestone:
Component: base | Resolution:
Keywords: cmake,clang_complete |
----------------------------------+------------------------------------

Comment (by sylvain.joyeux):

Before doing these kind of things, I always ask myself:

Why don't the CMake people turn that ON by default ? What are the
drawback(s) ?

Do you have the answer to that ?
--
Ticket URL: <https://rock.opendfki.de/ticket/384#comment:1>
rock <https://rock.opendfki.de>
rock: the robot construction kit
Martin Zenzes
2013-11-29 18:23:19 UTC
Permalink
Post by rock
#384: Adding CMAKE_EXPORT_COMPILE_COMMANDS to rock_standard_layout()
----------------------------------+------------------------------------
Type: enhancement | Status: new
Keywords: cmake,clang_complete |
----------------------------------+------------------------------------
Why don't the CMake people turn that ON by default ? What are the
drawback(s) ?
Do you have the answer to that ?
No, not really. Was added in 2011 [1] by an llvm/clang developer, and
seems to be mostly used by llvm/clangs tooling Infrastructure... I can't
find posts asking to make it default... The file is only created for
Unix Makefiles (and the "Ninja" buildsystem)...

Right, it would be nicer to just use cmake's default...

[1]
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5674844de4b74d0b66cfc6b8237e631702c43637;hp=fe07b0557b0b6cc47c29547d9c1d30a2b440fcd8it
--
M.Sc. Martin Zenzes
Space Robotics

Hauptgesch?ftsstelle Standort Bremen:
DFKI GmbH
Robotics Innovation Center
Robert-Hooke-Stra?e 5
28359 Bremen, Germany

Phone: +49 (0) 421 178 45 - 6658
Fax: +49 (0) 421 178 45 - 4150
E-Mail: martin.zenzes at dfki.de

Weitere Informationen: http://www.dfki.de/robotik
-----------------------------------------------------------------------
Deutsches Forschungszentrum fuer Kuenstliche Intelligenz GmbH
Firmensitz: Trippstadter Stra?e 122, D-67663 Kaiserslautern
Geschaeftsfuehrung: Prof. Dr. Dr. h.c. mult. Wolfgang Wahlster
(Vorsitzender) Dr. Walter Olthoff
Vorsitzender des Aufsichtsrats: Prof. Dr. h.c. Hans A. Aukes
Amtsgericht Kaiserslautern, HRB 2313
Sitz der Gesellschaft: Kaiserslautern (HRB 2313)
USt-Id.Nr.: DE 148646973
Steuernummer: 19/673/0060/3
-----------------------------------------------------------------------
rock
2013-12-02 14:39:09 UTC
Permalink
#384: Adding CMAKE_EXPORT_COMPILE_COMMANDS to rock_standard_layout()
----------------------------------+------------------------------------
Reporter: martin.zenzes@? | Owner: rock-dev-mailing-list
Type: enhancement | Status: new
Priority: minor | Milestone:
Component: base | Resolution:
Keywords: cmake,clang_complete |
----------------------------------+------------------------------------

Comment (by mzenzes):

No, not really. Was
[http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5674844de4b74d0b66cfc6b8237e631702c43637;hp=fe07b0557b0b6cc47c29547d9c1d30a2b440fcd8it
added] in 2011 by an llvm/clang developer, and seems to be mostly used by
llvm/clangs tooling Infrastructure... I can't find posts asking to make
it default... The file is only created for Unix Makefiles (and the "Ninja"
buildsystem)...

Right, it would be nicer to just use cmake's default...
--
Ticket URL: <https://rock.opendfki.de/ticket/384#comment:2>
rock <https://rock.opendfki.de>
rock: the robot construction kit
rock
2013-12-11 13:26:14 UTC
Permalink
#384: Adding CMAKE_EXPORT_COMPILE_COMMANDS to rock_standard_layout()
----------------------------------+------------------------------------
Reporter: martin.zenzes@? | Owner: rock-dev-mailing-list
Type: enhancement | Status: new
Priority: minor | Milestone:
Component: base | Resolution:
Keywords: cmake,clang_complete |
----------------------------------+------------------------------------

Comment (by sylvain.joyeux):

What I'd like to suggest is:
- some of us enable it by default on their install (see below for that)
- we add our experience with it to this ticket in let's say three month
time
- if everything's fine, we turn it on for everyone

One way to enable it for every cmake package is to do it in autoproj. Edit
autoproj/overrides.rb and add

{{{
Autoproj.post_import do |pkg|
if pkg.kind_of?(Autobuild::CMake)
pkg.define "CMAKE_EXPORT_COMPILE_COMMANDS", "ON"
end
end
}}}
--
Ticket URL: <https://rock.opendfki.de/ticket/384#comment:3>
rock <https://rock.opendfki.de>
rock: the robot construction kit
rock
2014-01-03 14:57:51 UTC
Permalink
#384: Adding CMAKE_EXPORT_COMPILE_COMMANDS to rock_standard_layout()
----------------------------------+------------------------------------
Reporter: martin.zenzes@? | Owner: rock-dev-mailing-list
Type: enhancement | Status: new
Priority: minor | Milestone:
Component: base | Resolution:
Keywords: cmake,clang_complete |
----------------------------------+------------------------------------

Comment (by mzenzes):

Hi,

just as an update: I have the option currently activated, as an autoproj-
override like suggested.

After the huge recompile, nothing seems to break immediately.
--
Ticket URL: <http://rock.opendfki.de/ticket/384#comment:4>
rock <http://rock.opendfki.de>
rock: the robot construction kit
rock
2014-05-26 07:29:38 UTC
Permalink
#384: Adding CMAKE_EXPORT_COMPILE_COMMANDS to rock_standard_layout()
----------------------------------+------------------------------------
Reporter: martin.zenzes@? | Owner: rock-dev-mailing-list
Type: enhancement | Status: new
Priority: minor | Milestone:
Component: base | Resolution:
Keywords: cmake,clang_complete |
----------------------------------+------------------------------------

Comment (by mago02):

I turned it on also and it make no problems at all.

So i vote for activating this on master now as default.
--
Ticket URL: <https://rock.opendfki.de/ticket/384#comment:5>
rock <https://rock.opendfki.de>
rock: the robot construction kit
rock
2014-06-02 09:18:18 UTC
Permalink
#384: Adding CMAKE_EXPORT_COMPILE_COMMANDS to rock_standard_layout()
----------------------------------+------------------------------------
Reporter: martin.zenzes@? | Owner: rock-dev-mailing-list
Type: enhancement | Status: new
Priority: minor | Milestone:
Component: base | Resolution:
Keywords: cmake,clang_complete |
----------------------------------+------------------------------------

Comment (by mzenzes):

Jupp, using it ever since and am still quite happy... just works (tm)
--
Ticket URL: <https://rock.opendfki.de/ticket/384#comment:6>
rock <https://rock.opendfki.de>
rock: the robot construction kit
rock
2014-06-03 09:02:57 UTC
Permalink
#384: Adding CMAKE_EXPORT_COMPILE_COMMANDS to rock_standard_layout()
----------------------------------+------------------------------------
Reporter: martin.zenzes@? | Owner: rock-dev-mailing-list
Type: enhancement | Status: new
Priority: minor | Milestone:
Component: base | Resolution:
Keywords: cmake,clang_complete |
----------------------------------+------------------------------------

Comment (by sylvain.joyeux):

+1 here.
--
Ticket URL: <https://rock.opendfki.de/ticket/384#comment:7>
rock <https://rock.opendfki.de>
rock: the robot construction kit
rock
2014-08-19 09:19:01 UTC
Permalink
#384: Adding CMAKE_EXPORT_COMPILE_COMMANDS to rock_standard_layout()
----------------------------------+------------------------------------
Reporter: martin.zenzes@? | Owner: rock-dev-mailing-list
Type: enhancement | Status: new
Priority: minor | Milestone:
Component: base | Resolution:
Keywords: cmake,clang_complete |
----------------------------------+------------------------------------

Comment (by mzenzes):

Just got asked on how to generate the compile_commands for Rock-projects.
So people use it, and people want it.

Where would be a good place to actually add it permanently? Just add the
snippet to overrides?
--
Ticket URL: <https://rock.opendfki.de/ticket/384#comment:8>
rock <https://rock.opendfki.de>
rock: the robot construction kit
rock
2014-08-19 18:39:37 UTC
Permalink
#384: Adding CMAKE_EXPORT_COMPILE_COMMANDS to rock_standard_layout()
----------------------------------+------------------------------------
Reporter: martin.zenzes@? | Owner: rock-dev-mailing-list
Type: enhancement | Status: new
Priority: minor | Milestone:
Component: base | Resolution:
Keywords: cmake,clang_complete |
----------------------------------+------------------------------------

Comment (by sylvain.joyeux):

Yes, adding it to the overrides.rb in rock.core would do the trick.
--
Ticket URL: <http://rock.opendfki.de/ticket/384#comment:9>
rock <http://rock.opendfki.de>
rock: the robot construction kit
Loading...