cmakelists for Visual Studio Code

Hello!

As I’ve decided to skip QT and instead use VSC for making (and updating) nodes, I’ve struck a bit of a barrier when setting up the cmakelists.txt. In QT this is pretty straightforward, as it masks a lot of the stuff that’s going on and you just list the sources in the .pro file for instance like this:

NODE_SOURCES += \
        source/MM.Points.2dGrid.c \
        source/MM.Points.3dGrid.c \
        source/MM.Points.Arc.c\
        # source/MM.Points.BinetPoints.c \
        source/MM.Points.Cube.c \
        source/MM.Points.GetAngleFromVectors.c \
        source/MM.Points.RectangularCuboid.c \
        source/MM.Points.Phyllotaxis.c \
        source/MM.Points.Spherograph.c \
        source/MM.Points.Spirograph.c

Is it possible to get a similar cmakelists.txt template as for the previous .pro template for compiling a project folder consisting of several nodes?

I was able to get vsc to compile a node from the sdk examples. I installed the cmake extension in vsc along with a c runner that lets me compile and run c programs to the terminal. I wasn’t able to get cmake to run from the debug menu but it works for me when running make from the terminal inside vsc. I’m probably missing some configuration I need to do with the cmake extension. it would be nice to just hit run from the menu and have it do all that cmake wrangling from me.

I don’t entirely understand cmake that well. I usually use the cmake gui to generate Xcode files for me. that doesn’t work with Vuo nodes, so I too am using vsc. i still got to figure out how to set vsc up to use the frameworks as it doesn’t know where node.h is when editing a node from the examples. I don’t know about a cmake template example for compiling multiple nodes as set. I read in the documentation this was possible and they list off naming conventions.

here is a project from Steve that is a little bit old but has his cmake for compiling multiple nodes that might help ? you might be able to modify it to work with your nodes. looks like you set the node sources like this.

set(nodes
	MM.Points.2dGrid.c 
        MM.Points.3dGrid.c 
        MM.Points.Arc.c
)

then the cmake file loops through and compiles the nodes adding whatever dependencies are needed. the file is pretty specific to Steves nodes but you might be able to make some use of it. I honestly don’t know if that would work or not, like I said I don’t entirely understand cmake and these nodes are old and I haven’t compiled them from source. so I don’t know if they still work or not. well I know the binary releases don’t work anymore as they are too old and the readme says to update them from source. so it might still be valid code ?

for me the new sdk broke everything I was working on. I’m not sure why but the old sdk doesn’t work anymore now that installed the new one. the new one won’t compile my generator app and the documentation has been updated to xcode 13 which I am not using. so I might have to upgrade my operating system to be current to use the new sdk ? I wish I could be of more help.

2 Likes

Here’s an example cobbled together from the node/stateless and node/customType examples in the Vuo SDK:
multipleNodeClasses.zip (3.49 KB)

The only part you’d need to change is the list of node class source files for your project:

set(sources
    example.multiple.first.c
    example.multiple.second.c
)

Qt Creator now supports CMake, with qmake and .pro files being deprecated. CMake takes some getting used to, but on the plus side it’s easier to find documentation and answers since it’s a more widely used system.

Thanks a bunch for this @Jstrecker! It is now really easy to get going with coding nodes without much overhead and fuzz! The auto-consolidation of the nodeset is also really neat. One thing I wonder though, is can this also package the examples/descriptions in one fellow sweep?

hey @MartinusMagneson, I started on learing C the hard way. I’m not a big fan of the author’s pedagogy but it’s led me to lots of YouTube equivalents for each chapter. If VSC is easier than QT for VUO node production then I’d like to learn how. I haven’t attempted a Vuo node yet, still learning my ABCs of pointers and structs, but soon.  

Check out this: https://community.vuo.org/t/-/7051

There aren’t any examples in it yet, but it should get you going with the barebones needed to drop in an example file from the node examples by team Vuo, and add it to the CMakelists file for compilation.

I would actually rather recommend “The nature of code” by Daniel Schiffman found here: https://natureofcode.com/. This explains more the realm of graphics programming and concepts for creative coding. It is made for Processing, but as the Vuo API deals with most of the heavy C stuff for simpler nodes, it isn’t too far off for making nodes if you can manage to translate for instance a vec3() to a VuoPoint3d().

1 Like

can this also package the examples/descriptions in one fellow sweep?

Sure. Here’s an updated version. In CMakeLists.txt, the only thing I changed was the add_custom_command at the end.

multipleNodeClasses.zip (7.63 KB)

1 Like