[PATCH] D113218: [llvm] [Debuginfo] Add cpp-httplib optional dependency.
Noah Shutty via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 4 15:13:44 PDT 2021
noajshu created this revision.
Herald added a subscriber: mgorny.
noajshu requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Adds optional dependency on cpp-httplib, a lightweight header-only HTTP server.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D113218
Files:
llvm/CMakeLists.txt
llvm/cmake/config-ix.cmake
Index: llvm/cmake/config-ix.cmake
===================================================================
--- llvm/cmake/config-ix.cmake
+++ llvm/cmake/config-ix.cmake
@@ -6,6 +6,7 @@
include(CheckIncludeFile)
include(CheckLibraryExists)
include(CheckSymbolExists)
+include(CheckCXXSymbolExists)
include(CheckFunctionExists)
include(CheckStructHasMember)
include(CheckCCompilerFlag)
@@ -180,6 +181,39 @@
set(LLVM_ENABLE_CURL "${HAVE_CURL}")
endif()
+if(LLVM_ENABLE_CPP_HTTPLIB)
+ if(LLVM_ENABLE_CPP_HTTPLIB STREQUAL FORCE_ON)
+ find_package(httplib REQUIRED)
+ else()
+ find_package(httplib)
+ endif()
+ if(HTTPLIB_FOUND)
+ # Check if the "httplib" we found is usable; for example there may be another
+ # library with the same name.
+ cmake_push_check_state()
+ # list(APPEND CMAKE_REQUIRED_INCLUDES ${HTTPLIB_INCLUDE_DIRS})
+ # list(APPEND CMAKE_REQUIRED_LIBRARIES ${HTTPLIB_LIBRARY})
+ list(APPEND CMAKE_REQUIRED_LIBRARIES ${HTTPLIB_LIBRARY})
+ message(${LLVM_PTHREAD_LIB})
+ if(NOT EXISTS ${HTTPLIB_HEADER_PATH})
+ message(FATAL_ERROR "HTTPLIB Header not found")
+ endif()
+ check_cxx_symbol_exists(CPPHTTPLIB_HTTPLIB_H ${HTTPLIB_HEADER_PATH} HAVE_HTTPLIB_HEADER)
+ check_cxx_symbol_exists(httplib::default_socket_options ${HTTPLIB_HEADER_PATH} HAVE_HTTPLIB_DEFAULT_SOCKET_OPTIONS)
+ check_cxx_symbol_exists(httplib::detail::find_content_type ${HTTPLIB_HEADER_PATH} HAVE_HTTPLIB_FIND_CONTENT_TYPE)
+ if(HAVE_HTTPLIB_HEADER AND HAVE_HTTPLIB_DEFAULT_SOCKET_OPTIONS AND HAVE_HTTPLIB_FIND_CONTENT_TYPE)
+ set(HAVE_HTTPLIB YES)
+ else()
+ set(HAVE_HTTPLIB NO)
+ endif()
+ cmake_pop_check_state()
+ if(LLVM_ENABLE_CPP_HTTPLIB STREQUAL FORCE_ON AND NOT HAVE_HTTPLIB)
+ message(FATAL_ERROR "Failed to configure cpp-httplib")
+ endif()
+ endif()
+ set(LLVM_ENABLE_CPP_HTTPLIB "${HAVE_HTTPLIB}")
+endif()
+
# Don't look for these libraries if we're using MSan, since uninstrumented third
# party code may call MSan interceptors like strlen, leading to false positives.
if(NOT LLVM_USE_SANITIZER MATCHES "Memory.*")
Index: llvm/CMakeLists.txt
===================================================================
--- llvm/CMakeLists.txt
+++ llvm/CMakeLists.txt
@@ -383,6 +383,8 @@
set(LLVM_ENABLE_ZLIB "ON" CACHE STRING "Use zlib for compression/decompression if available. Can be ON, OFF, or FORCE_ON")
+set(LLVM_ENABLE_CPP_HTTPLIB "OFF" CACHE STRING "Use cpp-httplib HTTP server library if available. Can be ON, OFF, or FORCE_ON")
+
set(LLVM_Z3_INSTALL_DIR "" CACHE STRING "Install directory of the Z3 solver.")
option(LLVM_ENABLE_Z3_SOLVER
@@ -979,7 +981,7 @@
include(AddLLVM)
# make this boolean usable in lit config
-llvm_canonicalize_cmake_booleans(LLVM_ENABLE_CURL)
+llvm_canonicalize_cmake_booleans(LLVM_ENABLE_CURL LLVM_ENABLE_CPP_HTTPLIB)
include(TableGen)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D113218.384880.patch
Type: text/x-patch
Size: 2873 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211104/db3d25bd/attachment.bin>
More information about the llvm-commits
mailing list