McMartin/FRUT

How to add a Command Line Project to a Plugin Project?

Opened this issue · 6 comments

Hi there!
Thanks again for this great project, i am really looking forward to trying this out!

A little background to the question: I am working on a cross-platform OSX/Windows plugin. I'd like to begin to unit-test it, therefore I'd like to use Catch2. At the moment there is already a Jenkins pipeline running.

I created some basic tests, but with Projucer there is no possiblility to add a command-line sub-project to a Plugin-Project. Therefore I created another completely new JUCE command line project that statically links to the shared code of my plugin.
Of course this is not a good setup, since these two projects basically do not know each other, there is no possiblility to easily run the unit tests when developing the project within Visual Studio. The best would probably be to have another sub-project along with the sub-projects for each plugin type.

If i understand this project correctly, i am allowed to do anything i'd like to do in the CMakeLists.txt. But how would you set up this testing project? Do you have any advice on that?

Thanks a lot!
Stephan

Maybe i should open another issue for this, but I have one additional goal by using CMake with JUCE:
I'd love to compile my project with clang under windows and osx! This way i would not have problems with different warnings, compiler features ect..

Do you see any hope for this dream? :)

But how would you set up this testing project? Do you have any advice on that?

I guess the easiest way to explain is to show you. I pushed a branch called example-for-issue-490, which contains 7 commits (so you can have a look at the progression) that result in a super-project (called issue-490) that combines an Audio Plug-In project (named Plugin490) and a Console Application project (named TestingExe), which uses Catch2.

Let me know if something is not clear or if you have more questions based on my example.

I'd love to compile my project with clang under windows and osx!

It might be quite hard to get it working with the current state of FRUT, which only provides Reprojucer.cmake (you might get something working by using the Code::Block (Windows) exporter, but it doesn't support "Use IPP Library"...).

Do you see any hope for this dream? :)

However there is hope, since I'm also working on FindJUCE.cmake, a "pure CMake" way of building JUCE projects (as I already mentioned when replying to other people in #458 (comment) and #463 (comment)).

Thank you a lot for your reply! This is awesome, i love how supportive you are 👍

Regarding the FindJUCE.cmake, is there anything I could help you with? I am a CMake beginner, but I'm keen on learning more about it for quite a time now! I have access to a Windows, Unix and Linux machine, so maybe i could at least help you test things?

Hi, I'm just starting out with Frut and unit testing. I'm trying to use your example-for-issue-490 branch for helping me getting started, as I want to unit test a Juce plugin. I'm almost there I think, I was able to compile everything and run the TestingExe target. Now I'd like to actually add a basic test to TestingExe/Source/Main.cpp. For instance, I could start out by checking the name of the plugin, a kind of HelloWorld unit test as done in this ADC talk .

I guess I need to start by including the PluginProcessor in the test.

I tried several variations along the lines of

#define CATCH_CONFIG_MAIN
#include <catch2/catch.hpp>
#include <PluginProcessor.h>

but the build fails...

Any hint, or even better a simple test example instanciating the plugin?

[EDIT] Using Xcode

For those interested, I solved my issue with the folllowing steps:

In Plugin490/CMakeLists.txt, I added

    "${CMAKE_CURRENT_LIST_DIR}/../Plugin490/Source"

to the HEADER_SEARCH_PATHS field of the jucer_project_settings section.

Then I wrote a basic test with the following in TestingExe/Source/Main.cpp :

#define CATCH_CONFIG_MAIN
#include <catch2/catch.hpp>
#include <PluginProcessor.h>

Plugin490AudioProcessor myPlugin;
TEST_CASE( "Plugin instance name", "[name]" ) {
    CHECK_THAT( myPlugin.getName().toStdString(), Catch::Equals( "Plugin490" ) );
}