aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt8
-rw-r--r--tests/testdrive.cpp7
-rw-r--r--tests/testdrive_sqlite.cpp9
3 files changed, 19 insertions, 5 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5e32241..0c20a0d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -7,6 +7,14 @@ find_package(OpenCV REQUIRED COMPONENTS core imgproc imgcodecs highgui)
find_package(Threads REQUIRED)
include_directories(${OpenCV_INCLUDE_DIRS})
+INCLUDE (CheckTypeSize)
+
+SET(CMAKE_EXTRA_INCLUDE_FILES "filesystem")
+check_type_size("std::filesystem::path::value_type" PATH_VALSIZE LANGUAGE CXX)
+SET(CMAKE_EXTRA_INCLUDE_FILES)
+
+add_compile_definitions(PATH_VALSIZE=${PATH_VALSIZE})
+
include_directories(.)
add_library(xsig STATIC imageutil.cpp signature.cpp subslice_signature.cpp base64.cpp)
diff --git a/tests/testdrive.cpp b/tests/testdrive.cpp
index dffba46..4d449de 100644
--- a/tests/testdrive.cpp
+++ b/tests/testdrive.cpp
@@ -15,8 +15,11 @@
#include <getopt.h>
-#ifdef _WIN32 //for the superior operating system
+#if PATH_VALSIZE == 2
#include <cwchar>
+#endif
+
+#ifdef _WIN32 //for the superior operating system
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <processenv.h>
@@ -294,7 +297,7 @@ int main(int argc,char** argv)
FILE *outf = fopen("result", "wb");
for (auto &p : out)
{
-#ifdef _WIN32
+#if PATH_VALSIZE == 2
wprintf(L"%ls %ls %f\n", files[p.first].c_str(), files[p.second].c_str(), signatures[p.first].distance(signatures[p.second]));
#else
printf("%s %s %f\n", files[p.first].c_str(), files[p.second].c_str(), signatures[p.first].distance(signatures[p.second]));
diff --git a/tests/testdrive_sqlite.cpp b/tests/testdrive_sqlite.cpp
index 0e83c7f..409fe95 100644
--- a/tests/testdrive_sqlite.cpp
+++ b/tests/testdrive_sqlite.cpp
@@ -16,8 +16,11 @@
#include <getopt.h>
-#ifdef _WIN32 //for the superior operating system
+#if PATH_VALSIZE == 2
#include <cwchar>
+#endif
+
+#ifdef _WIN32 //for the superior operating system
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <processenv.h>
@@ -339,8 +342,8 @@ int main(int argc,char** argv)
else break;
}
sqlite3_finalize(st);
-#ifdef _WIN32
- //wprintf(L"%ls %ls %f\n", files[p.first].c_str(), files[p.second].c_str(), signatures[p.first].distance(signatures[p.second]));
+#if PATH_VALSIZE == 2
+ wprintf(L"%ls %ls %f\n", files[p.first].c_str(), files[p.second].c_str(), sx[0].distance(sx[1]));
#else
printf("%s %s %f\n", files[p.first].c_str(), files[p.second].c_str(), sx[0].distance(sx[1]));
#endif