[PATCH] D113218: [llvm] [Debuginfo] Add cpp-httplib optional dependency.

Noah Shutty via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 23 15:56:15 PST 2021


noajshu updated this revision to Diff 389345.
noajshu added a comment.

Change `LLVM_ENABLE_CPP_HTTPLIB` -> `LLVM_ENABLE_HTTPLIB` and remove redundant use of `check_cxx_symbol_exists`.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D113218/new/

https://reviews.llvm.org/D113218

Files:
  llvm/CMakeLists.txt
  llvm/cmake/config-ix.cmake
  llvm/include/llvm/Config/llvm-config.h.cmake


Index: llvm/include/llvm/Config/llvm-config.h.cmake
===================================================================
--- llvm/include/llvm/Config/llvm-config.h.cmake
+++ llvm/include/llvm/Config/llvm-config.h.cmake
@@ -85,6 +85,9 @@
 /* Define if we have z3 and want to build it */
 #cmakedefine LLVM_WITH_Z3 ${LLVM_WITH_Z3}
 
+/* Define if we have cpp-httplib and want to use it */
+#cmakedefine LLVM_ENABLE_HTTPLIB ${LLVM_ENABLE_HTTPLIB}
+
 /* Define if we have curl and want to use it */
 #cmakedefine LLVM_ENABLE_CURL ${LLVM_ENABLE_CURL}
 
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,26 @@
   set(LLVM_ENABLE_CURL "${HAVE_CURL}")
 endif()
 
+if(LLVM_ENABLE_HTTPLIB)
+  if(LLVM_ENABLE_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_LIBRARIES ${HTTPLIB_LIBRARY})
+    check_cxx_symbol_exists(CPPHTTPLIB_HTTPLIB_H ${HTTPLIB_HEADER_PATH} HAVE_HTTPLIB)
+    cmake_pop_check_state()
+    if(LLVM_ENABLE_HTTPLIB STREQUAL FORCE_ON AND NOT HAVE_HTTPLIB)
+      message(FATAL_ERROR "Failed to configure cpp-httplib")
+    endif()
+  endif()
+  set(LLVM_ENABLE_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
@@ -393,6 +393,8 @@
 
 set(LLVM_ENABLE_CURL "ON" CACHE STRING "Use libcurl for the HTTP client if available. Can be ON, OFF, or FORCE_ON")
 
+set(LLVM_ENABLE_HTTPLIB "ON" 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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D113218.389345.patch
Type: text/x-patch
Size: 2449 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211123/07297193/attachment.bin>


More information about the llvm-commits mailing list