From d44da6bf34b7fe046dbc779342346fb531ab9fd9 Mon Sep 17 00:00:00 2001 From: simon987 Date: Thu, 26 Dec 2019 22:20:05 -0500 Subject: [PATCH] CMake install --- CMakeLists.txt | 18 ++++++++++++------ README.md | 5 ++++- fastimagehash.cpp | 2 -- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 469690c..ed89427 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -44,16 +44,15 @@ target_link_libraries( target_compile_options( fastimagehash PRIVATE -# -Ofast -# -march=native -# -fno-stack-protector -# -fomit-frame-pointer -# -freciprocal-math + # -Ofast + # -march=native + # -fno-stack-protector + # -fomit-frame-pointer + # -freciprocal-math -g ) - add_executable(bm benchmark.cpp) target_link_libraries( bm @@ -77,6 +76,13 @@ target_compile_options( -g ) +set_target_properties(fastimagehash PROPERTIES PUBLIC_HEADER "fastimagehash.h") +INSTALL( + TARGETS fastimagehash + LIBRARY DESTINATION /usr/lib/ + PUBLIC_HEADER DESTINATION /usr/include/ +) + add_dependencies(fastimagehash wavelib) add_dependencies(bm fastimagehash) add_dependencies(bm benchmark) diff --git a/README.md b/README.md index 67ddb39..4422771 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ replacement for C/C++. ### Example usage ```C -#include "fastimagehash.h" +#include int main() { unsigned char result[HASH_SIZE]; @@ -47,6 +47,9 @@ git clone --recursive https://github.com/simon987/fastimagehash # Build cmake . make + +# Install as a system library +sudo make install ``` diff --git a/fastimagehash.cpp b/fastimagehash.cpp index 848eebf..479fce3 100644 --- a/fastimagehash.cpp +++ b/fastimagehash.cpp @@ -40,7 +40,6 @@ void hash_to_hex_string_reversed(const uchar *h, char *out, int hash_size) { int hash_len = hash_size * hash_size / 4; for (unsigned int i = 0; i < hash_len; i += 2) { - uchar c = (h[i / 2] & 0x80) >> 7 | (h[i / 2] & 0x40) >> 5 | (h[i / 2] & 0x20) >> 3 | @@ -370,7 +369,6 @@ int multi_hash_mem(void *buf, multi_hash_t *out, size_t buf_len, resize(im, dhash_im, Size(hash_size + 1, hash_size), 0, 0, INTER_AREA); resize(im, whash_im, Size(wh_img_scale, wh_img_scale), 0, 0, INTER_AREA); resize(im, phash_im, Size(ph_img_scale, ph_img_scale), 0, 0, INTER_AREA); - } catch (Exception &e) { return FASTIMAGEHASH_ERR; }