CMakeLists.txt 1021 B

12345678910111213141516171819202122232425262728
  1. set(TARGET cpp-httplib)
  2. find_package(Threads REQUIRED)
  3. add_library(${TARGET} STATIC httplib.cpp httplib.h)
  4. if (NOT MSVC)
  5. # disable warnings in 3rd party code
  6. target_compile_options(${TARGET} PRIVATE -w)
  7. endif()
  8. target_link_libraries (${TARGET} PRIVATE Threads::Threads)
  9. target_compile_features(${TARGET} PRIVATE cxx_std_17)
  10. target_compile_definitions(${TARGET} PRIVATE
  11. # increase max payload length to allow use of larger context size
  12. CPPHTTPLIB_FORM_URL_ENCODED_PAYLOAD_MAX_LENGTH=1048576
  13. # increase backlog size to avoid connection resets for >> 1 slots
  14. CPPHTTPLIB_LISTEN_BACKLOG=512
  15. # increase max URI length to handle longer prompts in query string
  16. CPPHTTPLIB_REQUEST_URI_MAX_LENGTH=32768
  17. # disable Nagle's algorithm
  18. CPPHTTPLIB_TCP_NODELAY=1
  19. )
  20. if (${CMAKE_SYSTEM_NAME} MATCHES "visionOS")
  21. # quick fix for https://github.com/ggml-org/llama.cpp/actions/runs/19247291428/job/55024294176?pr=17150
  22. target_compile_definitions(${TARGET} PRIVATE NI_MAXHOST=1025)
  23. endif()