remymuller / juce-cmake

CMake find module for the JUCE library
MIT License
30 stars 7 forks source link

Cannot build for audio plugin - defines not propagated #18

Closed lkotsonis closed 4 years ago

lkotsonis commented 4 years ago

I've been trying to use the juce_add_audio_plugin function to build my plugin but it seems that defines such as JucePlugin_Build_* and JucePlugin_IsSynth, JucePlugin_Name etc are not properly written into AppConfig.h (or even if this is not the case, I keep getting the compilation errors due to not defined values).

Here's an example of the error I get:

In file included from ../third_party/JUCE/modules/juce_audio_plugin_client/RTAS/juce_RTAS_MacUtilities.mm:28:
../third_party/JUCE/modules/juce_audio_plugin_client/RTAS/../utility/juce_CheckSettingMacros.h:35:3: error: "You need to enable at least one plugin format!"
 #error "You need to enable at least one plugin format!"
  ^
../third_party/JUCE/modules/juce_audio_plugin_client/RTAS/../utility/juce_CheckSettingMacros.h:44:3: error: "You need to define the JucePlugin_IsSynth value!"
 #error "You need to define the JucePlugin_IsSynth value!"
  ^
../third_party/JUCE/modules/juce_audio_plugin_client/RTAS/../utility/juce_CheckSettingMacros.h:48:3: error: "You need to define the JucePlugin_ManufacturerCode value!"
 #error "You need to define the JucePlugin_ManufacturerCode value!"
  ^
../third_party/JUCE/modules/juce_audio_plugin_client/RTAS/../utility/juce_CheckSettingMacros.h:52:3: error: "You need to define the JucePlugin_PluginCode value!"
 #error "You need to define the JucePlugin_PluginCode value!"
  ^
../third_party/JUCE/modules/juce_audio_plugin_client/RTAS/../utility/juce_CheckSettingMacros.h:56:3: error: "You need to define the JucePlugin_ProducesMidiOutput value!"
 #error "You need to define the JucePlugin_ProducesMidiOutput value!"
  ^
../third_party/JUCE/modules/juce_audio_plugin_client/RTAS/../utility/juce_CheckSettingMacros.h:60:3: error: "You need to define the JucePlugin_WantsMidiInput value!"
 #error "You need to define the JucePlugin_WantsMidiInput value!"
  ^
../third_party/JUCE/modules/juce_audio_plugin_client/RTAS/../utility/juce_CheckSettingMacros.h:68:3: error: "You need to define the JucePlugin_EditorRequiresKeyboardFocus value!"
 #error "You need to define the JucePlugin_EditorRequiresKeyboardFocus value!"

and this is my cmake configuration:

//...
find_package(
  JUCE REQUIRED
  COMPONENTS juce_audio_basics
             juce_audio_devices
             juce_audio_formats
             juce_audio_plugin_client
             juce_audio_processors
             juce_audio_utils
             juce_core
             juce_data_structures
             juce_events
             juce_graphics
             juce_gui_basics
             juce_gui_extra)

set(SOURCES
    Source/Main.cpp
    // ... )

set(common_definitions JUCE_QUICKTIME=0 JUCE_PLUGIN_HOST_AAX=0
                       JUCE_PLUGINHOST_AU=1 JUCE_PLUGINHOST_RTAS=0 JUCE_PLUGINHOST_VST=0)

juce_add_audio_plugin(
  PRODUCT_NAME ${PROJECT_NAME}
  VERSION      1.0.0
  PLUGIN_NAME  "PluginName"
  PLUGIN_DES   "PluginName"
  PLUGIN_MANUFACTURER  "Company"
  PLUGIN_MANUFACTURER_EMAIL  "mail@mail.com"
  PLUGIN_MANUFACTURER_CODE  CMPN
  PLUGIN_CODE  plgn
  PLUGIN_IS_SYNTH  1
  PLUGIN_IS_MIDI_EFFECT  0
  PLUGIN_WANTS_MIDI_IN  1
  PLUGIN_PRODUCES_MIDI_OUT  0
  PLUGIN_EDITOR_REQUIRES_KEYS  0
  ENABLE_IAA  1
  PLUGIN_AU_EXPORT_PREFIX  CompanyPluginHostAU
  PLUGIN_AU_VIEW_CLASS  CompanyPluginHostAU_V1
  COMPANY_NAME  "Company"
  COMPANY_WEBSITE  www.company.com
  AAX_IDENTIFIER  com.company.PluginName
  AAX_CATEGORY  AAX_ePlugInCategory_Dynamics
  VST3_CATEGORY  "Fx"
  BUNDLE_IDENTIFIER  com.company.PluginName
  FORMATS  AU
  DEFINITIONS  ${common_definitions}
  SOURCES  ${SOURCES}
  LIBRARIES  ${JUCE_LIBRARIES})

add_executable(${PROJECT_NAME} ${SOURCES})
target_link_libraries(${PROJECT_NAME} ${JUCE_LIBRARIES})

I would appreciate any hints or help! Thanks!

lkotsonis commented 4 years ago

Nevermind, I realised the issue. juce_add_audio_plugin should not be combined with a target.