set(TARGET diffusion-cli)

add_executable(${TARGET}
    common/audio_decode.cpp
    common/common.cpp
    common/log.cpp
    common/media_io.cpp
    common/mesh_io.cpp
    common/mp3_encoder.cpp
    common/mp4_writer.cpp
    common/h264_encoder_impl.c
    image_metadata.cpp
    main.cpp
    tts_server.cpp
    tts_server.h
)
set_target_properties(${TARGET} PROPERTIES OUTPUT_NAME diffusion)
if(APPLE)
    sd_set_macos_rpaths(${TARGET})
endif()
target_include_directories(${TARGET} PRIVATE
    "${CMAKE_CURRENT_SOURCE_DIR}"
    "${CMAKE_CURRENT_SOURCE_DIR}/../src"
)
install(TARGETS ${TARGET} RUNTIME)
# --serve (tts_server.cpp) speaks HTTP through the engine's cpp-httplib,
# included as <cpp-httplib/httplib.h> from the engine's thirdparty/
target_include_directories(${TARGET} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../../thirdparty")
target_link_libraries(${TARGET} PRIVATE diffusion cpp-httplib ${CMAKE_THREAD_LIBS_INIT})
target_compile_features(${TARGET} PUBLIC c_std_11 cxx_std_17)
