C++ Weekly – Ep 191 – Cevelop IDE With CMake Based Projects

C++ Weekly – Ep 191 – Cevelop IDE With CMake Based Projects

Hello and welcome to C++ Weekly
I’m your host, Jason Turner. I’m available for code
reviews, contracting, and on-site training. On this episode, I wanted to
mention the Cevelop C++ IDE. It is a free and open source
IDE that has lots of features for refactoring and
cleaning up your C++ code. It’s something that I’ve
wanted to try for a while. And just so you know,
it is Eclipsed based. I know some of us have personal
opinions about Eclipse. Maybe we haven’t had great
luck with it in the past. And I’ve had a hard time
getting Cevelop working for me in the past because it’s
been actually a while that I’ve wanted to try it out
and make an episode about it. But I went ahead and sat down
and figured out how to use it with the projects that I
have and the way that I work, at least a bit. Enough to get started. And I thought that I would cover
it in an episode of C++ Weekly. So this is Cevelop. This is the website. It is Cevelop.com. And it’s got this handy way of
looking at issues in your code and doing automatic corrections. I’m not going to spend
a ton of time on that. What we’re going to focus on
is getting started and set up. Now first of all, one of the
main things I don’t like about Eclipse and C++ Eclipse based
IDEs is they seem to want to force this kind of
workspace structure on me that doesn’t work at all
with how I work. I use CMake. So a large part of this video is
going to be using Cevelop with a CMake based project. Now, on the Cevelop FAQ, which
does seem like a logical place for me to have looked, there
is instructions on how can I import my existing CMake
based project to Cevelop. Now, first of all,
this first instruction, which seems easier, says
using CMake inside the source directory. Don’t do that. Don’t ever do that. You should never run CMake
inside your source directory. You should never do in
project source builds. That is– well, I’ll
say quite strongly– a terrible idea because
you end up making all kinds of assumptions about the
visibility of pads during compilation. And then, doing a clean build
becomes virtually impossible, at this point. You have to do something like
use get if you’re even using source control to help
you figure out what files don’t belong in the project that
need to be deleted and where artifacts from running CMake. So never, ever do that. So we’re going to be down here,
and we’re going to be using CMake outside of the
source directory, which seems slightly
more complicated, but it gives us a little
bit of clues here. So let’s go ahead
and make a check out, and I’m going to do a
check out of ChaiScript. All right. Clean check out at ChaiScript. Not a very big repository. Now, I’m going to
make my build folder. And now I need to run CMake. Now, let’s look at
CMake real quick here. It lists for us this following
generators that are available on this platform. And somehow– I don’t know if
it was a mental block or what– but when I’ve looked at this
in the past before looking at the documentation
on Cevelop’s website, I just never saw this Eclipse
CDT 4 Unix make files generator down here. I just never saw it. So that’s the one
that we need to use. Now, the next thing that it says
we need to do is be explicit about our SDD equals CXX flags
to the command line so that the [INAUDIBLE] knows the
correct C++ standard version of your project. Now, I’m not going to
do that for the moment. But be aware, if
you have problems, you might have to specify this. But I’m trying to make sure
that my CMake project tells the compiler what
standard flags I need. So I’m going to do that. I’m not going to do it, that is. All right. CMake. No big deal. It ran. I have a make file here. Now, to be perfectly honest,
I have absolutely no idea what makes this make file special. Nope. No idea what makes it a special
make file why it can be picked up by CDT. But let’s go ahead
and go for it. Now, I am on Manjaro
Linux, as you can see here. Manjaro Linux. And so I’m using Tri-Sen,
which is the installer for AUR for the user archive
of ARC Linux packages. And I’ve used that to
install Cevelop for me. So it’s already installed here. And then, that was actually a
really easy way to get this set up. That’s another reason why
I’ve avoided Eclipse IDEs. I’m not a very big fan of the
JVM because I know there’s been so many security issues with
it on Windows, particularly, and keeping it up to
date is relatively hard. But if I can do that
in my package manager, that saves me some steps. All right. So I’m going to launch Cevelop. And now it’s asking me what
workspace I want to use. And I’m going to go ahead and
let it create this workspace folder for me. And I currently have
no projects in here. And I don’t know if there is
any way to zoom this interface. Well, if there is,
I’m not seeing it. So I’m going to have to
zoom it in post-processing. So I’m going to import a project
and a general existing project. And the root directory is going
to be this C++ weekly folder that I just created
here, this build folder, and I’m going to open this. And now it’s already knows
that the name of the project is ChaiScript. That’s good. And I’m going to hit finish. Now, what I should have is a
project folder here that has all of the different
things in my projects. I’ve got build targets, and I
don’t have any binaries in here yet. So with one of
these build targets, I should be able to click on
this and hit Build Target. And then, we can see here
that I’m getting the output, and at the same time, I believe
Cevelop is analyzing my project for me automatically. And it’s going to be generating
a list of warnings and such that are coming back
from the console. Now, some of the things that I
haven’t figured out yet is did I just make a debug
build or release build? I’m not sure at the moment,
to be perfectly honest. We’re doing an experiment here. And then, you can start to see
where it’s showing us targets that have been
built, libparser.a. That was just completed. That’s one of the libraries
that’s built and linked with ChaiScript And there’s the
ChaiScript standard library that’s just been
completed building. And now it is actually building
the ChaiScript interpreter. And there I have the
ChaiScript interpreter. So I can, right down
here, run or debug it. So if I say I want to run
this, there’s a local thing. Now, it found some errors,
and it says build failed. I’m not entirely sure where
those are coming from, but I do know that Chai.exe or
the Chai executable that is was properly linked here, so
I’m just going to go ahead and proceed. And I can see that I do have
inside my little console window here a working ChaiScript
interpreter, so that’s cool. Now, let’s just go ahead
and click through some of the includes and some of the
header files and source files in here. So if I go into some of the
basic ChaiScript defines here. I found this pretty interesting,
and I’m going to try again. There we go. I can zoom this text. OK. This kind of thing,
it has a star here. I’m like, well what
does this star mean? It says this macro definition
can be replaced with a constant expression. You know what? That sounds like a good idea. Let’s just go ahead and replace
it with a const expression. I’m always board with that. And there we go. I double click on it, and it
replaced this with a constant expression. You know, honestly, I had
never really considered using a constant expression here. And an alternative would
actually be that I could make it a string view as of C++ 17. So that would be the next
level change to make there. So it has these recommendations
throughout your code. And it’s probably going to
tell me refactor C string and the standard string. Now, I don’t agree with
that one right there. That should be a string view. Not a standard string. Particularly, since I was
already using a constexpr context. I see there’s exclamation
points here on source files. They might be too small to
show up in the video well, but let’s see. The spell checker built in. That’s not very helpful to me. It’s telling me something about
this function declaration found pointer parameter. That’s true. I am using a pointer
parameter here. So it has an interesting
number of things here. Oh, task. Automatically pulling
in to do items. Oh, yeah, we don’t want to
bring too much of that up. And then, here is some of these
things that I was clicking through manually. So it found 13 items. Macro definitions, type depths,
that kind of things that could be, maybe, using
declarations or whatever. So yeah, there you go. That’s just a super high
level intro to Cevelop because, honestly, I
don’t know a lot about it. But if you’ve been like me
and you’ve been interested in giving it a try but you
couldn’t figure out how to get started with your CMake
base project, hopefully, this gets you going with that. So thanks for watching
this episode of C++ weekly.

11 thoughts on “C++ Weekly – Ep 191 – Cevelop IDE With CMake Based Projects”

  1. I'm using Eclipse for C++ on Ubuntu. It was a pain to setup and link stuff like OpenGL, but now it's fine. But I don't really want to setup a second project in there. Way too much work

  2. Currently I find that the VSCode + official C++ and CMake extensions are quite enough for CMake-based projects. It is all open-source and multiplatform as well. There is also plenty of other useful extensions for Git.

  3. Never had problems with Eclipse but their Codan-Indexer is just unusable beyond c++14. Thats the biggest downside for me – buggy highlighting and autocompletion. But there is no alternative for ARM development except some visual studio stuff. correct me if i am wrong.. PLEASE

  4. It's eclipse based get away daemon i have a C++ Spec.
    Also isn't cmake also pretty horrible i get my holy code snippets to protect me from that stuff.

  5. I use CLion it's great for Linux and on windows I use Visual studio. But these days I use VSCode with ccls which is faster and better than Microsoft C++ Linter

  6. What kind of refactoring does it offer? Because for the moment it is just repeating clang-tidy warnings I already know, and failing to accept std::optional.

  7. Is there a way to report closed captioning issues? It looks like it was written by a human, but one with no experience with the subject matter so made some basic mistakes from not knowing jargon.

Leave a Reply

Your email address will not be published. Required fields are marked *