Changeset: d2013f1f665a for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/d2013f1f665a
Modified Files:
cmake/monetdb-findpackages.cmake
gdk/CMakeLists.txt
gdk/gdk_hash.h
monetdb5/mal/CMakeLists.txt
monetdb5/tools/CMakeLists.txt
sql/backends/monet5/CMakeLists.txt
tools/monetdbe/CMakeLists.txt
Branch: default
Log Message:
Updates to xxhash config.
We changed the way in which cmake defines the relevant variables, and we
worked around problems with older versions (0.7.0) of xxhash (our power8
which runs an ancient Fedora) that can't use inline functions (it tries
to include the missing file xxhash.c) and then subsequent problems on
the Mac which can't include xxhash.h two times.
diffs (126 lines):
diff --git a/cmake/monetdb-findpackages.cmake b/cmake/monetdb-findpackages.cmake
--- a/cmake/monetdb-findpackages.cmake
+++ b/cmake/monetdb-findpackages.cmake
@@ -13,17 +13,12 @@ find_package(BISON 3.0 REQUIRED)
find_package(Iconv)
find_package(Threads)
find_package(PkgConfig REQUIRED)
-pkg_check_modules(PC_XXHASH REQUIRED libxxhash)
-find_library(XXHASH_LIBRARIES NAMES xxhash
- HINTS
- ${PC_XXHASH_LIBDIR}
- ${PC_XXHASH_LIBRARY_DIRS}
-)
-find_path(XXHASH_INCLUDE_DIR NAMES xxhash.h
- HINTS
- ${PC_XXHASH_INCLUDEDIR}
- ${PC_XXHASH_INCLUDE_DIRS}
-)
+pkg_check_modules(XXHASH REQUIRED libxxhash)
+if(${XXHASH_VERSION} VERSION_GREATER_EQUAL "0.8.0")
+ # with version at least 0.8.0 we inline all xxhash functions so we
+ # don't need the library
+ set(XXHASH_LDFLAGS "")
+endif()
find_package(Python3 COMPONENTS Interpreter Development)
diff --git a/gdk/CMakeLists.txt b/gdk/CMakeLists.txt
--- a/gdk/CMakeLists.txt
+++ b/gdk/CMakeLists.txt
@@ -103,7 +103,7 @@ target_include_directories(bat
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/monetdb>
$<$<BOOL:${OPENSSL_FOUND}>:${OPENSSL_INCLUDE_DIR}>
- ${XXHASH_INCLUDE_DIR})
+ ${XXHASH_INCLUDE_DIRS})
target_link_libraries(bat
PRIVATE
@@ -113,7 +113,7 @@ target_link_libraries(bat
monetdb_config_header
moptions
mutils
- ${XXHASH_LIBRARIES}
+ ${XXHASH_LDFLAGS}
$<$<BOOL:${OPENSSL_FOUND}>:OpenSSL::SSL>
$<$<BOOL:${RTREE_FOUND}>:rtree::rtree>
$<$<NOT:$<PLATFORM_ID:Windows>>:m>
diff --git a/gdk/gdk_hash.h b/gdk/gdk_hash.h
--- a/gdk/gdk_hash.h
+++ b/gdk/gdk_hash.h
@@ -11,8 +11,26 @@
#ifndef _GDK_SEARCH_H_
#define _GDK_SEARCH_H_
+#ifdef __APPLE__
+/* the compiler on the Mac can't deal with including xxhash.h twice
+ * because of identical redefinitions of types and we happen to know
+ * that the xxhash version is high enough, so just define the magic
+ * inline token and include the file only once */
+#define XXH_INLINE_ALL
+#endif
+
+#include <xxhash.h>
+
+#ifndef __APPLE__
+#if XXH_VERSION_NUMBER >= 0*100*100 + 8*100 + 0 /* at least 0.8.0 */
+/* in newer versions, we can define XXH_INLINE_ALL to inline all hash
+ * functions before including xxhash.h again (we didn't need the first
+ * include, except we need the version number to make the
+ * distinction) */
#define XXH_INLINE_ALL
#include <xxhash.h>
+#endif
+#endif
struct Hash {
int type; /* type of index entity */
diff --git a/monetdb5/mal/CMakeLists.txt b/monetdb5/mal/CMakeLists.txt
--- a/monetdb5/mal/CMakeLists.txt
+++ b/monetdb5/mal/CMakeLists.txt
@@ -82,7 +82,7 @@ target_link_libraries(mal
stream
mapi
bat
- ${XXHASH_LIBRARIES}
+ ${XXHASH_LDFLAGS}
$<$<BOOL:${MALLOC_FOUND}>:Malloc::Malloc>)
set_target_properties(mal
diff --git a/monetdb5/tools/CMakeLists.txt b/monetdb5/tools/CMakeLists.txt
--- a/monetdb5/tools/CMakeLists.txt
+++ b/monetdb5/tools/CMakeLists.txt
@@ -26,7 +26,7 @@ target_link_libraries(monetdb5
stream
mapi
mutils
- ${XXHASH_LIBRARIES}
+ ${XXHASH_LDFLAGS}
${SOCKET_LIBRARIES}
$<$<BOOL:${LibXml2_FOUND}>:LibXml2::LibXml2>
$<$<BOOL:${PCRE_FOUND}>:PCRE::PCRE>
diff --git a/sql/backends/monet5/CMakeLists.txt
b/sql/backends/monet5/CMakeLists.txt
--- a/sql/backends/monet5/CMakeLists.txt
+++ b/sql/backends/monet5/CMakeLists.txt
@@ -192,7 +192,7 @@ target_link_libraries(sql
mapi
bat
mutils
- ${XXHASH_LIBRARIES})
+ ${XXHASH_LDFLAGS})
set_target_properties(sql
PROPERTIES
diff --git a/tools/monetdbe/CMakeLists.txt b/tools/monetdbe/CMakeLists.txt
--- a/tools/monetdbe/CMakeLists.txt
+++ b/tools/monetdbe/CMakeLists.txt
@@ -75,7 +75,7 @@ set(MONETDBE_LINK_LIBS
monetdb5
sql
mutils
- ${XXHASH_LIBRARIES}
+ ${XXHASH_LDFLAGS}
$<$<NOT:$<PLATFORM_ID:Windows>>:m>
$<$<PLATFORM_ID:Windows>:${GETOPT_LIB}>
Threads::Threads)
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]