if (NOT libai)
    message(
      ${HIGHLIGHTED_STATUS}
      "Skipping contrib/defiance: ns3-ai not found"
    )
    return()
endif()

# check ns3-ai dependencies
find_package(Boost CONFIG COMPONENTS program_options)
if(NOT Boost_FOUND)
    message(
      ${HIGHLIGHTED_STATUS}
      "Skipping contrib/defiance: boost not found"
    )
    return()
endif()
find_package(Python COMPONENTS Interpreter Development)
if(NOT Python_FOUND)
    message(
      ${HIGHLIGHTED_STATUS}
      "Skipping contrib/defiance: Python not found"
    )
    return()
endif()
find_package(pybind11 CONFIG)
if(NOT pybind11_FOUND)
    message(
      ${HIGHLIGHTED_STATUS}
      "Skipping contrib/defiance: pybind11 not found"
    )
    return()
endif()
find_package(Protobuf CONFIG)
if(NOT Protobuf_FOUND)
    find_package(Protobuf)
    if(NOT Protobuf_FOUND)
        message(
          ${HIGHLIGHTED_STATUS}
          "Skipping contrib/defiance: Protobuf not found"
        )
    return()
    endif()
endif()

check_include_file_cxx(stdint.h HAVE_STDINT_H)
if(HAVE_STDINT_H)
    add_definitions(-DHAVE_STDINT_H)
endif()

build_lib(
    LIBNAME defiance
    SOURCE_FILES
            model/action-application.cc
            model/agent-application.cc
            model/aggregated-info.cc
            model/base-test.cc
            model/channel-interface.cc
            model/data-collector-application.cc
            model/history-container.cc
            model/observation-application.cc
            model/reward-application.cc
            model/rl-application-container.cc
            model/rl-application.cc
            model/simple-channel-interface.cc
            model/socket-channel-interface.cc
            helper/communication-helper.cc
            helper/rl-application-helper.cc
    HEADER_FILES
            model/action-application.h
            model/agent-application.h
            model/aggregated-info.h
            model/base-test.h
            model/channel-interface.h
            model/data-collector-application.h
            model/history-container.h
            model/observation-application.h
            model/reward-application.h
            model/rl-application-container.h
            model/rl-application.h
            model/simple-channel-interface.h
            model/socket-channel-interface.h
            helper/communication-helper.h
            helper/rl-application-helper.h
    LIBRARIES_TO_LINK
            ${libai}
            ${libcore}
            ${libinternet}
    TEST_SOURCES
            test/action-application-test.cc
            test/agent-application-test.cc
            test/communication-test.cc
            test/data-collector-application-test.cc
            test/history-container-test.cc
            test/marl-interface-test.cc
            test/rl-application-test.cc
            test/simple-channel-interface-test.cc
            test/socket-channel-interface-test.cc
)
