rurban / smhasher

Hash function quality and speed tests
https://rurban.github.io/smhasher/
Other
1.84k stars 177 forks source link

used PROPERTIES COMPILE_DEFINITIONS and added it in a function #248

Closed tansy closed 1 year ago

tansy commented 1 year ago

Every next change of properties replaces old one. What you want is appending new changes. To do it It is necessary to read, spend and then replace. It's done in a function, do it is easily understood, clear and in one line.

tansy commented 1 year ago

All that was intended to compile smhasher on non-sse-4.2 machine with controllling of compilation process only. The obstacles encountered were t1ha and blake3. With t1ha I tried this:

--- CMakeLists.txt-PRIx64-2 2022-11-11 00:10:10.000000000 +0100
+++ CMakeLists.txt-PRIx64-3 2022-11-11 00:29:42.000000000 +0100
@@ -502,6 +502,12 @@ if(AES_FOUND AND (PROCESSOR_FAMILY STREQ
   endif()
 else()
   set(T1HA_SRC t1ha/t1ha0.c t1ha/t1ha1.c t1ha/t1ha2.c)
+    # AES-NI not available
+    add_source_file_definitions("DifferentialTest.cpp" "T1HA0_AESNI_AVAILABLE=0")
+    add_source_file_definitions("Hashes.cpp" "T1HA0_AESNI_AVAILABLE=0")
+    add_source_file_definitions("KeysetTest.cpp" "T1HA0_AESNI_AVAILABLE=0")
+    add_source_file_definitions("SpeedTest.cpp" "T1HA0_AESNI_AVAILABLE=0")
+    add_source_file_definitions("main.cpp" "T1HA0_AESNI_AVAILABLE=0")
 endif(AES_FOUND AND (PROCESSOR_FAMILY STREQUAL "Intel"))

 if(SHA_FOUND)

but still got undefined references.

libSMHasherSupport.a(t1ha0.c.o): In function `t1ha0':
smhasher-cmake/t1ha/t1ha0.c:(.text+0x4e3): undefined reference to `t1ha0_ia32aes_avx2'
(...)
/usr/bin/ld: SMHasher: hidden symbol `t1ha0_ia32aes_avx2' isn't defined

So there is something missing.

And with blake3 it's even worse. Here I won't even pretend to be able to do that as it has constructions like this:

#if defined(IS_X86)
 void blake3_compress_in_place_sse41(uint32_t cv[8],

So I edited it but I that's not the way to do it here, obviously.

rurban commented 1 year ago

I see. LGTM

rurban commented 1 year ago

Branch tansy-PRIx64-2

tansy commented 1 year ago

The PR is improvement to #246 as described here.