juce_add_plugin(Pump
    VERSION                     1.0.1
    PRODUCT_NAME                "Pump"
    COMPANY_NAME                "e-thomsen"
    BUNDLE_ID                   "dk.e-thomsen.pump"
    PLUGIN_MANUFACTURER_CODE    Etho
    PLUGIN_CODE                 Pump
    FORMATS                     ${ET_FORMATS}
    AU_MAIN_TYPE                kAudioUnitType_Effect
    IS_SYNTH FALSE NEEDS_MIDI_INPUT FALSE NEEDS_MIDI_OUTPUT FALSE IS_MIDI_EFFECT FALSE
    EDITOR_WANTS_KEYBOARD_FOCUS FALSE
    COPY_PLUGIN_AFTER_BUILD     TRUE)
target_sources(Pump PRIVATE Source/PluginProcessor.cpp Source/PluginEditor.cpp)
et_configure_plugin(Pump)

if(ET_BUILD_TESTS)
    add_executable(test_pump tests/test_pump.cpp)
    target_include_directories(test_pump PRIVATE Source/DSP ${CMAKE_SOURCE_DIR}/Common/DSP)
    find_package(Threads REQUIRED)
    target_link_libraries(test_pump PRIVATE Threads::Threads)
    if(NOT APPLE AND CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
        # the snapshot handoff test under ThreadSanitizer: ./test_pump_tsan --handoff
        add_executable(test_pump_tsan tests/test_pump.cpp)
        target_include_directories(test_pump_tsan PRIVATE Source/DSP ${CMAKE_SOURCE_DIR}/Common/DSP)
        target_compile_options(test_pump_tsan PRIVATE -fsanitize=thread -O1 -g)
        target_link_options(test_pump_tsan PRIVATE -fsanitize=thread)
        target_link_libraries(test_pump_tsan PRIVATE Threads::Threads)
    endif()
endif()

# the real processor and editor fed synthetic signals with the transport playing; renders the window for screenshot.png
et_add_view_harness(Pump test_pump_view tests/render_view.cpp)
