McMartin / FRUT

Building JUCE projects using CMake made easy
https://frut.readthedocs.io
GNU General Public License v3.0
421 stars 40 forks source link

Best practice for a modularized large scale project #465

Open chikashimiyama opened 5 years ago

chikashimiyama commented 5 years ago

I really like modularizing my projects, for example, If I build a VST plugin, I would structurize the entire project as follows. A - dspCore (static library requires juce) B - dspCoreTestHost (UnitTest project for testing A. requires googletest) C - guiCore (static library requires juce) D - guiCoreTestHost (A standalone project for testing C.) E - PlugIn (uses A, C, and juce)

In which I would build A, C and E using reprojucer.

Modern Cmake is really good at interpreting dependencies between modules. Once I write target_link_libraries I don't have to deal with low-level things such as linker flags and include path, and I would love to keep my project this way.

Now my question is what I should do when I would like to express dependencies in CMake Lists.txt for my project. What I can think of is to write a findModule for A so that B can find A without any concrete paths but it's obviously awkward.

Are there any better way to do that?

thanks.

McMartin commented 5 years ago

@chikashimiyama sorry for taking so long to reply, but I didn't want to get back to you without a concrete answer.

I pushed a branch called example-for-issue-465, where I added an extremely simplified example of a project containing the 5 targets you described, using Reprojucer: https://github.com/McMartin/FRUT/tree/example-for-issue-465/examples/issue-465.

This should give you a rough idea of how such a project can be structured. However, as I said in https://github.com/McMartin/FRUT/issues/6#issuecomment-466110507, Reprojucer is not the right tool to handle such projects, and you might want to wait for me to be done with FindJUCE.cmake.

chikashimiyama commented 5 years ago

Cool. Thank you very much! I will take a look at it!