Skip to content

Open Source alternative to Algolia + Pinecone and an Easier-to-Use alternative to ElasticSearch ⚡ 🔍 ✨ Fast, typo tolerant, in-memory fuzzy Search Engine for building delightful search experiences

Ensure that the OSX build links dependencies statically.

Kishore Nallanecbe8d3b27f4
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a140a6bc..fde641f0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -14,7 +14,7 @@ if (APPLE)
add_definitions(-DGTEST_USE_OWN_TR1_TUPLE)
add_definitions(-D__GLIBCXX__)
- # For Brew
+ # Prefer brew installated libraries
set(ENV{OPENSSL_ROOT_DIR} /usr/local/opt/openssl)
set(SNAPPY_ROOT_DIR /usr/local/opt/snappy)
set(ZLIB_ROOT /usr/local/opt/zlib)
@@ -69,9 +69,10 @@ target_compile_definitions(benchmark PRIVATE ROOT_DIR="${CMAKE_SOURCE_DIR}/")
target_compile_definitions(typesense_test PRIVATE ROOT_DIR="${CMAKE_SOURCE_DIR}/")
if (APPLE)
- # https://stackoverflow.com/a/26543140/131050 (can't statically link libgcc on Mac)
- set(STD_LIB -static-libstdc++)
- set(CURL_LIBRARIES curl)
+ set(STD_LIB -static-libstdc++) # https://stackoverflow.com/a/26543140/131050 (can't statically link libgcc on Mac)
+
+ FIND_PACKAGE(ngHTTP2 REQUIRED)
+ set(CURL_LIBRARIES ldap ${NGHTTP2_LIBRARIES} ${CURL_LIBRARIES}) # ldap and nghttp2 were not being statically built
else()
set(STD_LIB -static-libgcc -static-libstdc++)
endif()
diff --git a/cmake/Modules/FindNGHTTP2.cmake b/cmake/Modules/FindNGHTTP2.cmake
new file mode 100644
index 00000000..47f37ad4
--- /dev/null
+++ b/cmake/Modules/FindNGHTTP2.cmake
@@ -0,0 +1,18 @@
+include(FindPackageHandleStandardArgs)
+
+find_path(NGHTTP2_INCLUDE_DIR "nghttp2/nghttp2.h")
+
+find_library(NGHTTP2_LIBRARY NAMES nghttp2)
+
+find_package_handle_standard_args(NGHTTP2
+ FOUND_VAR
+ NGHTTP2_FOUND
+ REQUIRED_VARS
+ NGHTTP2_LIBRARY
+ NGHTTP2_INCLUDE_DIR
+ FAIL_MESSAGE
+ "Could NOT find NGHTTP2"
+ )
+
+set(NGHTTP2_INCLUDE_DIRS ${NGHTTP2_INCLUDE_DIR} )
+set(NGHTTP2_LIBRARIES ${NGHTTP2_LIBRARY})