# Guard keeps the repository configuring if this folder is ever emptied.
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/Source/PluginProcessor.cpp)
juce_add_plugin(Harmony
    VERSION                     1.0.1
    PRODUCT_NAME                "Harmony"
    COMPANY_NAME                "e-thomsen"
    BUNDLE_ID                   "dk.e-thomsen.harmony"
    PLUGIN_MANUFACTURER_CODE    Etho
    PLUGIN_CODE                 Hrmy
    FORMATS                     ${ET_FORMATS}
    AU_MAIN_TYPE                kAudioUnitType_MusicEffect
    IS_SYNTH FALSE NEEDS_MIDI_INPUT TRUE NEEDS_MIDI_OUTPUT FALSE IS_MIDI_EFFECT FALSE
    EDITOR_WANTS_KEYBOARD_FOCUS FALSE
    COPY_PLUGIN_AFTER_BUILD     TRUE)
target_sources(Harmony PRIVATE Source/PluginProcessor.cpp Source/PluginEditor.cpp)
et_configure_plugin(Harmony)
endif()

if(ET_BUILD_TESTS AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/tests/test_harmony.cpp)
    add_executable(test_harmony tests/test_harmony.cpp)
    target_include_directories(test_harmony PRIVATE Source/DSP ${CMAKE_SOURCE_DIR}/Common/DSP)
endif()

if(ET_BUILD_TESTS AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/tests/render_view.cpp)
    # the real processor and editor fed the synthetic singer; renders the window for screenshot.png
    juce_add_console_app(test_harmony_view PRODUCT_NAME "test_harmony_view")
    target_sources(test_harmony_view PRIVATE tests/render_view.cpp Source/PluginProcessor.cpp Source/PluginEditor.cpp)
    target_include_directories(test_harmony_view PRIVATE Source tests ${CMAKE_SOURCE_DIR}/Common ${CMAKE_SOURCE_DIR}/Common/DSP)
    target_compile_definitions(test_harmony_view PRIVATE JUCE_WEB_BROWSER=0 JUCE_USE_CURL=0 JUCE_MODAL_LOOPS_PERMITTED=1
                               "JucePlugin_Name=\"Harmony\"")
    target_link_libraries(test_harmony_view PRIVATE juce::juce_audio_utils et_common_assets juce::juce_dsp juce::juce_recommended_config_flags)
endif()
