# Web server - smartbotic-server binary

# Create library for webserver components
add_library(smartbotic_webserver STATIC
    src/config.cpp
    src/http_server.cpp
)

target_include_directories(smartbotic_webserver
    PUBLIC
        $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
        $<INSTALL_INTERFACE:include>
)

target_compile_options(smartbotic_webserver PRIVATE ${SMARTBOTIC_CXX_WARNINGS})

target_link_libraries(smartbotic_webserver
    PUBLIC
        smartbotic::common
        spdlog::spdlog
        nlohmann_json::nlohmann_json
        yaml-cpp::yaml-cpp
        Boost::beast
        Boost::asio
)

add_library(smartbotic::webserver ALIAS smartbotic_webserver)

# Create the executable
add_executable(smartbotic-server
    src/main.cpp
)

target_include_directories(smartbotic-server
    PRIVATE
        ${CMAKE_CURRENT_SOURCE_DIR}/include
)

target_compile_options(smartbotic-server PRIVATE ${SMARTBOTIC_CXX_WARNINGS})

target_link_libraries(smartbotic-server
    PRIVATE
        smartbotic::webserver
        smartbotic::common
        smartbotic::proto
        spdlog::spdlog
        nlohmann_json::nlohmann_json
        sodium
)
