Discussion:
CMake project for Fossil development using IDE [branch: cmake-ide]
(too old to reply)
Artur Shepilko
2018-08-02 10:59:20 UTC
Permalink
For anyone interested in using IDE for developing or exploring the
Fossil code -- I just pushed a CMake project that handles the Fossil
build [http://fossil-scm.org/index.html/timeline?r=cmake-ide].

In case you wonder, the build is done via CMake
`ExternalProject_Add()`. So, basically, it kind of wraps the current
autosetup-based Fossil build without duplicating the dependencies. It
was also possible to unify the current Linux and Windows (MSVC)
scripts.

The rationale is to leverage the usual IDE conveninces such as code
browsing, auto-complete, visual debugger etc. Also, having a Fossil
source control plugin helps navigating the changes.

CMake project can be generated into Makefiles or native projects for
some IDEs. Most major C/C++ IDEs handle CMake one way or another. So
far I tested building CMake Fossil with QtCreator, Code::Blocks,
Eclipse CDT, and VSCode -- basically free and open source IDEs. Also I
know that CLion has a good CMake support, and recently VisualStudio
promoted better CMake integration, though I didn't test their native
support.

I used Makefiles generators with the IDEs that I tested, both on Linux
and Windows. The Fossil MSVC build now can be also done out-of-source.

IDE::
QtCreator => opens CMakeLists.txt directly
Code::Blocks => cmake .. -G"CodeBlocks - Unix Makefiles"
VSCode => opens CMakeLists.txt (needs CMakeTools extension)
Eclipse CDT => cmake .. -G"Eclipse CDT4 - Unix Makefiles"

BTW, It appears that Eclipse CDT can already import a __configured__
autosetup-based Fossil project AS IS (import Exisitng C/C++ Makefiles
Project) ! With a couple of additional settings for includes and
sources, all of the IDE features are usable. Nice to know.

I mostly use this CMake project from QtCreator, I'm also using a
Fossil version control plugin. Of course, cmake build can also be done
from the command-line as usual:
-----------------
cd fossil
mkdir build
cd build

Linux::
cmake .. -G"Unix Makefiles" -DCMAKE_BUILD_TYPE=Release (OR Debug)
make

MSVC::
cmake .. -G"NMake Makefiles" -DCMAKE_BUILD_TYPE=Release (OR Debug)
nmake

cd bin
fossil
-----------------
Additional parameters may be passed on cmake call via vars:
-DFOSSIL_CONFIGURE="", -DFOSSIL_BUILD="", -DFOSSIL_TEST=""

Hope this would be useful to fellow Fossil developers. Please let me
know of your experinces and ideas. If this makes sense, I may try to
write up some Fossil wiki page with detailed instructions on how to
set up the Fossil project development in IDE.


Artur Shepilko
Stephan Beal
2018-08-02 11:39:48 UTC
Permalink
Post by Artur Shepilko
The rationale is to leverage the usual IDE conveninces such as code
browsing, auto-complete, visual debugger etc. Also, having a Fossil
source control plugin helps navigating the changes.
One forewarning about code browsing: the build process filters the files
under src/, copying them to bld/, which means that if you accidentally
browse (via "symbol-following" features) into bld/*.c and start editing,
any changes will be lost the next time you build. Been there, done that.

Also, many C files under src/ use custom markup (lines starting with @)
which will confuse most C editors (any which do syntax highlighting).
That's only "cosmetic confusion", though - it doesn't break anything.
--
----- stephan beal
http://wanderinghorse.net/home/stephan/
"Freedom is sloppy. But since tyranny's the only guaranteed byproduct of
those who insist on a perfect world, freedom will have to do." -- Bigby Wolf
Loading...