FRUT icon indicating copy to clipboard operation
FRUT copied to clipboard

Concerning the need for Projucer...

Open McMartin opened this issue 5 years ago • 3 comments

Originally posted by @paulfd in https://github.com/McMartin/FRUT/issues/458#issuecomment-475869212:

I'm sorry for hijacking this... Concerning the need for Projucer, does this mean that once I turned the jucer file into a CMakeList I can somehow treat it as a standard CMakeList and manually add e.g. new source files or targets?

McMartin avatar Mar 25 '19 09:03 McMartin

@paulfd

Thanks for your interest in FRUT!

Once you have converted a .jucer file into a CMakeLists.txt file, you can indeed treat the generated CMakeLists.txt file as the "single source of truth". You can stop using the .jucer file and Projucer. You can even delete the .jucer file (but only after you're 100% sure that FRUT does things the way you want). You can manually add new source files easily. You can also add new targets, though I would recommend adding them in one or several other CMakeLists.txt files to keep things clean and tidy.

I hope this helps!

McMartin avatar Mar 25 '19 10:03 McMartin

Ho ok there are github "question" labels, didn't know ; I'm a bit of a newbie :) Thanks for the reply

I ended up going fully manual, if only to understand CMake a bit better. In the end if you have simple projects it's not too hard. If anyone is interested it kinda boils down to this:

# Add a list of juce modules you need
set(JUCE_MODULES
    juce_audio_basics
    juce_audio_devices
    juce_audio_formats
    juce_audio_processors
    juce_audio_utils
    juce_core
    juce_data_structures
    juce_events
    juce_graphics
    juce_gui_basics
    juce_gui_extra
)

# Directories and Juce source files
set(JUCE_ROOT_DIR "c:/JUCE")
set(JUCE_MODULES_DIR "${JUCE_ROOT_DIR}/modules")

# Create the static Juce library
add_library(JUCE)

# Add sources
foreach(module ${JUCE_MODULES})
    target_sources(JUCE PRIVATE ${JUCE_MODULES_DIR}/${module}/${module}.cpp)
endforeach()

# Public includes that will be propagated to targets
target_include_directories(JUCE PUBLIC SYSTEM ${JUCE_MODULES_DIR})
target_include_directories(JUCE PUBLIC JuceLibraryCode)
target_include_directories(JUCE PUBLIC ${JUCE_MODULES_DIR}/juce_audio_processors/format_types/VST3_SDK)
# Force include the AppConfig
target_compile_options(JUCE PUBLIC /FI AppConfig.h)

You can then use target_link_libraries(${PROJECT_NAME}_Standalone JUCE) to target the JUCE library, with the proper includes apparently. The main bad trick here is force including the AppConfig.h and the JuceLibraryCode directory rather than having access to the options directly from the cmake file. Note that on Linux you also need to target some libraries.

I mainly needed this to have a test target so for now it works, but I'll revisit FRUT for the next time I have to setup something since I do prefer working with cmake overall... If I manage to add a target I'll post an howto here :)

paulfd avatar Apr 04 '19 10:04 paulfd

@paulfd

Thanks for your interest in FRUT!

Once you have converted a .jucer file into a CMakeLists.txt file, you can indeed treat the generated CMakeLists.txt file as the "single source of truth". You can stop using the .jucer file and Projucer. You can even delete the .jucer file (but only after you're 100% sure that FRUT does things the way you want). You can manually add new source files easily. You can also add new targets, though I would recommend adding them in one or several other CMakeLists.txt files to keep things clean and tidy.

I hope this helps!

Hi. I tried deleting the .jucer file in my project after migrating to FRUT but get the following error:

CMake Error at /Users/andrewrynhard/Workspace/Studio/Library/FRUT/prefix/FRUT/cmake/Reprojucer.cmake:87 (message):
  No such JUCE project file:
  "REDACTED/Plugin.jucer"
  ("REDACTED/Plugin.jucer")
Call Stack (most recent call first):
  CMakeLists.txt:19 (jucer_project_begin)

Is it still true I can get rid of the .jucer file or am I missing something? Thanks!

andrewrynhard avatar Jan 18 '24 20:01 andrewrynhard