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

if(ET_BUILD_TESTS AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/tests/test_kicksynth.cpp)
    # DSP (JUCE-free): the 0.1 checks on engine 1, the 0.2 checks, compatibility against the frozen 0.1.3 DSP, the preset table
    add_executable(test_kicksynth tests/test_kicksynth.cpp)
    target_include_directories(test_kicksynth PRIVATE Source/DSP tests ${CMAKE_SOURCE_DIR}/Common/DSP)

    # the real processor and editor: programs, 0.1.3 states, program changes mid-hit, .aupreset files, screenshot.png
    juce_add_console_app(test_kicksynth_view PRODUCT_NAME "test_kicksynth_view")
    target_sources(test_kicksynth_view PRIVATE tests/render_view.cpp Source/PluginProcessor.cpp Source/PluginEditor.cpp)
    target_include_directories(test_kicksynth_view PRIVATE Source Source/DSP tests ${CMAKE_SOURCE_DIR}/Common ${CMAKE_SOURCE_DIR}/Common/DSP)
    target_compile_definitions(test_kicksynth_view PRIVATE JUCE_WEB_BROWSER=0 JUCE_USE_CURL=0 JUCE_MODAL_LOOPS_PERMITTED=1
                               "JucePlugin_Name=\"Kick Synth\"" "KS_TESTS_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}/tests\"")
    target_link_libraries(test_kicksynth_view PRIVATE juce::juce_audio_utils et_common_assets juce::juce_dsp juce::juce_recommended_config_flags juce::juce_recommended_warning_flags)
endif()
