Does anybody know how to get CLion to work with openFrameworks on macOS?

Hi folks,

Does anybody use openFrameworks with CLion on macOS?

I have tried getting ofxCMake to work, but it doesn’t seem to be maintained anymore. There haven’t been any commits to the GitHub repo since 2017, and the latest version doesn’t seem to harmonise with openFrameworks 0.11.0.
Anyways, I’ve configured everything like indicated on the GitHub page, but CLion spits out a whole lot of errors! It looks for instance for a ofMesh.cpp file, which doesn’t exist anymore.

Are there any alternatives?

I hope to get CLion running, since its performance is a whole lot better than XCode (and I don’t want to switch to Visual Studio Code).

Thanks.

I used AppCode and runs faster than XCode. Tried CLion too without success.

Thanks for the reply, but I don’t want to invest into another software license. :frowning:

Has really nobody this up and running, and is willing to share some knowledge?

There is an old thread here about Cmake. CMake works! Simple usability - CLion support. I do not know the actual status of that repository. I would stick with the supported IDEs, setting up unsupported IDE is usually complicated.

Thanks, but I mentioned above that this method doesn’t seem to work anymore.
CLion is simply a better IDE than Xcode! What can I tell you.

I’ve got it working with a set of kinda-hacky-sortof-working CMake scripts. The latest versions also have Makefile support. I’ve done some limited testing, and for simple cases this works. Haven’t tried with more complicated projects.

1 Like

Oh, I’m using linux, so ‘my’ CMake scripts might need some tweaking.

1 Like

It’s seemed to me like Apple pretty much required Xcode (and a recent version running on a recent Mac) if you want to distribute to their App(le) Stores (which they make so complex that it’s barely possible even using Xcode).

What kind of performance increase would CLion offer?

  • it’s overall quicker and snappier, especially for code completion, text editing, and processing “library” files (which in Xcode is pretty horrible)
  • it offers cross-platform support (i.e. Windows, macOS, Linux)
  • it has a smart editor, which by the way is mostly amazing (vs. inferior Inellisense)
  • generally considered one of the best C/C++ IDEs
  • it’s a 250-ish MB installation (just saying, not that you wouldn’t need Xcode either way)

I just wish it would get cross-platform support in openFrameworks. I get that it isn’t free though!
I don’t hate Xcode. but it’s just so cluttered and slow… Visual Studio is better, but I’d argue that CLion is far superior!

1 Like

Oh, interesting. Thanks for the run-down!

Hmm, that does seem worthwhile to try to get working.

Just yesterday I was searching the web for “visual studio find all references takes forever”. :wink:

I’ve been using gcc and er, gedit ( :slight_smile: ), when on Linux. And it has been interesting going between VS, Xcode, gcc and Android Studio, and seeing what they each have to say about my code. It would be nice to have another IDE, and one that works with OF on all three computer OS’s, and especially one that isn’t designed nor developed by Apple, Google nor Microsoft.

1 Like

250 MB? Nice. Especially if it’s not like Visual Studio, which in my case is taking up about 4-5 GB per modest OF project for whatever metadata it thinks is helpful… and it still often takes way too long to seach for things in the project.

1 Like

CLion now supports makefile projects as announced here
I am using CLion 2020.2.1 pro (paid version) on ubuntu 18.04 and I’m able to use it with of_v0.11.0_linux64gcc6_release.
I’m not sure if it works with other versions/platforms like macOS, but the announcement makes no mention of platforms, so probably?
It has some quirks.
Getting the run/build configuration set up is odd - I had to supply bogus executable target (just an empty bash script will do) in order to do the first build. Or I guess you could build from cmd line once.
And when clion closes/reopens it loses track of all the oF source. It still builds, but all the IDE niceties go away. You can delete the CLion .idea files and open the makefile anew… Or just never close CLion… which is what I do.

2 Likes

Hi @Ciel,

Yes, I’ve seen the newly added makefile support feature on their site. I’m using 2020.2.3.

CLion should be cross-platform.

Where do you even begin to set this up? I mean do you just copy an existing project?
I know too little about the openFrameworks project structure to get his going.
Can you give me some pointers please?

OK.

Haha, that’s seems unfortunate. :slight_smile:

@diff-arch If it’s going to work at all it should be pretty simple.
tldr:
CLion | File | Open -> select Makefile | Open as Project. Then create a Makefile App run/build config.

In more detail…
First make sure your compiler is going to work with some oF example, choose a simple one like
of_v0.11_osx_release/examples/3d/3DPrimitivesExample/
(* read edit below)
and build from command line

cd of_v0.11_osx_release/examples/3d/3DPrimitivesExample/  
make Debug

If this fails you have more basic problems than CLion to fix, and in osX I can’t help you further.
If it works there should be an executable such as
of_v0.11_osx_release/examples/3d/3DPrimitivesExample/bin/3DPrimitivesExample_debug
which you’ll need for step 5 below

In CLion

  1. Do file | open (not “import project” or “new project”)
  2. Select the oF example Makefile
    of_v0.11_osx_release/examples/3d/3DPrimitivesExample/Makefile
  3. Accept CLion request “Open as Project” and to make clean.
    It takes a few minutes for CLion to chew through all the oF src.
  4. Click Run|Edit Configurations|’+’|Makefile Application
  5. Select Target=Debug and Executable= browse to the bin/3DPrimitivesExample_debug built above.
  6. Select Run | Run and choose the run config from step 5

That should build and attempt to run.

And FYI, the oF installation I’m using is an “installed” version from
https://openframeworks.cc/download/
as opposed to “from source” using the oF github repo. I am guessing that would be more fuss to get going.

Good luck.

EDIT: I just noticed that my “simple” 3DPrimitivesExample example may be a bad choice: It seems inexplicably and unnecessarily to be accessing ofGstVideoGrabber camera HW. That’s the kind of HW dependency hiccup I was hoping to avoid for a “hello world” test.
Any simple example should be okay for the flow above.

1 Like

Hey @Ciel,

make debug didn’t work, but simply make did the trick!

Works great! It seems to create a new executable, instead of overwriting the existing one, but that’s fine.

Hm, for me it works with the official version from the website.

How do you start new projects? Do you always begin with one of the example files?
I guess it should be fine to use the project generator to create a new project, since it also generates the make file?

Also, for building “golden” versions, not debug, do you simply create a new configuration in CLion as RunRelease?

Thanks for the walk-through! Super appreciated!!
And you were right about the 3DPrimitivesExample. :wink:

Good.

Either way. Just make sure the Makefile OF_ROOT=../some/path Will resolve properly to the oF dir. The error messages otherwise aren’t very helpful.

Yah, like that. But ensure the config’s selected executable matches what’s generated - or it could get really confusing.

You’re welcome.

1 Like

@Ciel, one thing I’ve noticed is that when I create new .cpp/.h files and try to #include ofMain.h, CLion somehow can’t find it, although it is correctly included and found in main.cpp.

@diff-arch, yah, more quirks of new CLion makefile support?
I assume all those src files are in the same dir.
Here are some things that have helped me with various proj/ide issues.

  1. Mark project src dirs as such:
    CLion | Project window | RightClick your src dir | Mark directory as | Project Sources and headers
  2. After adding new src files to src dir “Load makefile changes”:
    CLion | Tools | Makefile | Reload Makefile project
    I’ve noticed if I touch the Makefile or add a new src file (sometimes) that a “Load Makefile Changes” widget appears on the src windows:

clion_update_makefile

and that simultaneously lots of ide symbol resolution gets weird. That’s your cue to reload the makefile. And magically the dude abides!