charlesangus / DeepC

Suite of Deep compositing tools for Foundry's Nuke.
GNU General Public License v3.0
103 stars 13 forks source link

Create python DeepC Menu via CMake and remove redundancy of the makefile #70

Closed jonassorgenfrei closed 2 years ago

jonassorgenfrei commented 2 years ago

I would suggest to create the python/menu.py via the CMakeFile and to remove the makefile to avoid the need of appending all the source nodes/files at different places.

If you want i can implement the CMake generator for the menu.py file.

charlesangus commented 2 years ago

Removing the old makefile is fine, it's deprecated.

Not quite sure I follow "make the menu.py via the CMakeFile". Like, copy it into the install dir? Is that not happening now?

Or do you mean like procedurally write the menu.py based on the plugins in cmake, which strikes me as abusing cmake a little just to remove one touchpoint required to make a new plugin.

jonassorgenfrei commented 2 years ago

Yeah the copying process is already included in your setup. The idea would be to use: The configure_file function in cmake is helping with this: https://cmake.org/cmake/help/latest/command/configure_file.html This is normaly used to create headers with version information but can be used for other things too.

` So it would really need to abuse cmake with some ther scripts. We just need to loop over all plugins and create a python list of these names. So the menu.py file would be --> menu.py.in.

...
menus = {
            "Draw": {"icon":"ToolbarDraw.png",
                    "nodes": [@DEEPC_DRAW_NODES@]},
...

And using the configuration function this can be replaced by the cmake build.

The cool thing would be for example if we add at some point Nodes using for example cuda libs (or other 3rd party libs) we can use this to have dynamically build the menu when some nodes should not be build e.g. cmake -DNO_CUDA_BUILD ...

charlesangus commented 2 years ago

Cool, yeah, sounds interesting, let's give it a shot.

jonassorgenfrei commented 2 years ago

So here we go added it to the PR. https://github.com/charlesangus/DeepC/pull/69/commits/12c51e1b9182d7c8878d938624aa9e799bf0cec1

Works nicely. Create the menu on the run with the CMake file.

I restructured the src/CMakeLists.txt file to define 3 lists of dependencies.

And added the definition for the Python Menu just below it :)

Please let me know if it's cool like it :)

Additionally i removed the Make file.

charlesangus commented 2 years ago

Haven't tried it but read the diff and looks cool, thanks!