Skip to content

Commit

Permalink
add shim for playing with google's cityhash64
Browse files Browse the repository at this point in the history
  • Loading branch information
totaam committed Jul 27, 2024
1 parent 35dc36d commit 85c7a36
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ tests/unittests/test-file*
/xpra/buffers/new_buffers.c
/xpra/buffers/membuf.c
/xpra/buffers/xxh.c
/xpra/buffers/cityhash.c
/xpra/buffers/cyxor.c
/xpra/client/*/*.c
/xpra/client/*.c
Expand Down
12 changes: 8 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ def has_header_file(name, isdir=False) -> bool:
lz4_ENABLED = DEFAULT
rencodeplus_ENABLED = DEFAULT
brotli_ENABLED = DEFAULT and has_header_file("/brotli/decode.h") and has_header_file("/brotli/encode.h")
cityhash_ENABLED = DEFAULT and has_header_file("/city.h")
qrencode_ENABLED = DEFAULT and has_header_file("/qrencode.h")
clipboard_ENABLED = DEFAULT
Xdummy_ENABLED = None if POSIX else False # None means auto-detect
Expand Down Expand Up @@ -394,7 +395,7 @@ def has_header_file(name, isdir=False) -> bool:
"cython": (
"cython", "codecs",
"server", "client", "shadow",
"rencodeplus", "brotli", "qrencode", "websockets", "netdev", "vsock",
"rencodeplus", "brotli", "cityhash", "qrencode", "websockets", "netdev", "vsock",
"lz4",
"x11", "gtk_x11",
"pam", "sd_listen", "proc",
Expand All @@ -412,7 +413,7 @@ def has_header_file(name, isdir=False) -> bool:
SWITCHES += [
"cython_tracing", "cythonize_more",
"modules", "data",
"brotli", "qrencode",
"brotli", "cityhash", "qrencode",
"vsock", "netdev", "proc", "mdns", "lz4",
"clipboard",
"scripts",
Expand Down Expand Up @@ -2432,14 +2433,17 @@ def noop(*_args, **_kwargs): # pylint: disable=function-redefined
#*******************************************************************************
if cython_ENABLED:
add_packages("xpra.buffers")
buffers_pkgconfig = pkgconfig(optimize=3)
import platform
# this may well be suboptimal:
extra_compile_args = "-mfpmath=387" if platform.machine() == "i386" else None
extra_compile_args = "-mfpmath=387" if platform.machine() == "i386" else {}
tace(cython_ENABLED, "xpra.buffers.membuf,xpra/buffers/memalign.c", optimize=3,
extra_compile_args=extra_compile_args)
tace(cython_ENABLED, "xpra.buffers.xxh", "libxxhash", optimize=3,
extra_compile_args=extra_compile_args)
if cityhash_ENABLED:
ace("xpra.buffers.cityhash", optimize=3,
language="c++",
extra_link_args="-lcityhash")

toggle_packages(dbus_ENABLED, "xpra.dbus")
toggle_packages(server_ENABLED or proxy_ENABLED, "xpra.server", "xpra.server.auth")
Expand Down

0 comments on commit 85c7a36

Please sign in to comment.