Index: llvm/CMakeLists.txt =================================================================== --- llvm/CMakeLists.txt +++ llvm/CMakeLists.txt @@ -414,6 +414,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_CURL "OFF" CACHE STRING "Use libcurl for the HTTP client if available. Can be ON, OFF, or FORCE_ON") + +set(LLVM_ENABLE_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.") @@ -1249,11 +1251,11 @@ set(BENCHMARK_ENABLE_INSTALL OFF CACHE BOOL "Don't install benchmark" FORCE) set(BENCHMARK_DOWNLOAD_DEPENDENCIES OFF CACHE BOOL "Don't download dependencies" FORCE) set(BENCHMARK_ENABLE_GTEST_TESTS OFF CACHE BOOL "Disable Google Test in benchmark" FORCE) - set(BENCHMARK_ENABLE_WERROR ${LLVM_ENABLE_WERROR} CACHE BOOL + set(BENCHMARK_ENABLE_WERROR ${LLVM_ENABLE_WERROR} CACHE BOOL "Handle -Werror for Google Benchmark based on LLVM_ENABLE_WERROR" FORCE) # Since LLVM requires C++11 it is safe to assume that std::regex is available. set(HAVE_STD_REGEX ON CACHE BOOL "OK" FORCE) - add_subdirectory(${LLVM_THIRD_PARTY_DIR}/benchmark + add_subdirectory(${LLVM_THIRD_PARTY_DIR}/benchmark ${CMAKE_CURRENT_BINARY_DIR}/third-party/benchmark) add_subdirectory(benchmarks) endif() 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/include/llvm/Config/llvm-config.h.cmake =================================================================== --- llvm/include/llvm/Config/llvm-config.h.cmake +++ llvm/include/llvm/Config/llvm-config.h.cmake @@ -88,6 +88,9 @@ /* Define if we have curl and want to use it */ #cmakedefine LLVM_ENABLE_CURL ${LLVM_ENABLE_CURL} +/* Define if we have cpp-httplib and want to use it */ +#cmakedefine LLVM_ENABLE_HTTPLIB ${LLVM_ENABLE_HTTPLIB} + /* Define if zlib compression is available */ #cmakedefine01 LLVM_ENABLE_ZLIB