From b17c7f70a19db3806ff770b9caebed9a0d83b344 Mon Sep 17 00:00:00 2001 From: simon987 Date: Mon, 13 Apr 2020 08:51:12 -0400 Subject: [PATCH] Add debug lib --- .gitignore | 5 ++++- CMakeLists.txt | 38 +++++++++++++++++++++++++++++++++++--- 2 files changed, 39 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 9f59a01..2366bc7 100644 --- a/.gitignore +++ b/.gitignore @@ -16,4 +16,7 @@ cmake_install.cmake Makefile # wavelib stuff -Bin/ \ No newline at end of file +Bin/ + +imhash +install_manifest.txt \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 460785b..d9e6570 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,6 +25,12 @@ add_library( fastimagehash.cpp fastimagehash.h ) +add_library( + fastimagehash_debug + SHARED + fastimagehash.cpp fastimagehash.h +) + target_include_directories( fastimagehash PUBLIC @@ -33,6 +39,14 @@ target_include_directories( ${FFTW_INCLUDE_DIRS} ) +target_include_directories( + fastimagehash_debug + PUBLIC + ${CMAKE_SOURCE_DIR}/thirdparty/wavelib/header/ + ${OpenCV_INCLUDE_DIRS} + ${FFTW_INCLUDE_DIRS} +) + target_link_libraries( fastimagehash ${OpenCV_LIBS} @@ -41,6 +55,15 @@ target_link_libraries( pthread ) +target_link_libraries( + fastimagehash_debug + asan + ${OpenCV_LIBS} + ${FFTW_LIBRARIES} + wavelib + pthread +) + target_compile_options( fastimagehash PRIVATE @@ -52,6 +75,14 @@ target_compile_options( -freciprocal-math ) +target_compile_options( + fastimagehash_debug + PRIVATE + -fPIC + -g + -fsanitize=address +) + add_executable(bm benchmark.cpp) target_link_libraries( @@ -68,7 +99,7 @@ set_target_properties( add_executable(imhash imhash.c) target_link_libraries( imhash - ${CMAKE_SOURCE_DIR}/libfastimagehash.so + ${CMAKE_SOURCE_DIR}/libfastimagehash_debug.so ) target_compile_options( imhash @@ -78,12 +109,13 @@ target_compile_options( set_target_properties(fastimagehash PROPERTIES PUBLIC_HEADER "fastimagehash.h") INSTALL( - TARGETS fastimagehash + TARGETS fastimagehash fastimagehash_debug LIBRARY DESTINATION /usr/lib/ PUBLIC_HEADER DESTINATION /usr/include/ ) add_dependencies(fastimagehash wavelib) +add_dependencies(fastimagehash_debug wavelib) add_dependencies(bm fastimagehash) add_dependencies(bm benchmark) -add_dependencies(imhash fastimagehash) +add_dependencies(imhash fastimagehash_debug)