From 08b975293c356f7a39ca28aa5bc243fe3281d361 Mon Sep 17 00:00:00 2001 From: Aaron Seigo Date: Sun, 14 Dec 2014 13:09:14 +0100 Subject: compile ixes, make akonadi2common an actual shared lib --- CMakeLists.txt | 2 +- common/CMakeLists.txt | 4 ++-- common/commands.h | 5 +++-- common/console.h | 4 +++- common/storage.h | 3 ++- common/storage_unqlite.cpp | 4 +++- common/unqlite/unqlite.h | 2 +- tests/storagebenchmark.cpp | 11 +++-------- 8 files changed, 18 insertions(+), 17 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3f86163..0373671 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,7 +36,7 @@ endfunction(generate_flatbuffers) set(CMAKE_AUTOMOC ON) add_definitions("-Wall -std=c++0x") -include_directories(${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${FLATBUFFERS_INCLUDE_DIR}) +include_directories(${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}/common ${FLATBUFFERS_INCLUDE_DIR}) configure_file(hawd.conf hawd.conf) diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index dc9a670..c0cc7d9 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -16,8 +16,8 @@ set(command_SRCS storage_common.cpp ${storage_SRCS}) -message("We have: ${storage_SRCS}") -add_library(${PROJECT_NAME} ${command_SRCS}) +add_library(${PROJECT_NAME} SHARED ${command_SRCS}) +generate_export_header(${PROJECT_NAME} BASE_NAME Akonadi2Common EXPORT_FILE_NAME akonadi2common_export.h) SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES LINKER_LANGUAGE CXX) qt5_use_modules(${PROJECT_NAME} Widgets) target_link_libraries(${PROJECT_NAME} ${storage_LIBS}) diff --git a/common/commands.h b/common/commands.h index 534308d..5f2b006 100644 --- a/common/commands.h +++ b/common/commands.h @@ -1,5 +1,6 @@ #pragma once +#include #include class QIODevice; @@ -14,6 +15,6 @@ enum CommandIds { CustomCommand = 0xffff }; -void write(QIODevice *device, int commandId, flatbuffers::FlatBufferBuilder &fbb); +void AKONADI2COMMON_EXPORT write(QIODevice *device, int commandId, flatbuffers::FlatBufferBuilder &fbb); -} \ No newline at end of file +} diff --git a/common/console.h b/common/console.h index d36ce05..0df5c38 100644 --- a/common/console.h +++ b/common/console.h @@ -1,11 +1,13 @@ #pragma once +#include + #include #include class QTextBrowser; -class Console : public QWidget +class AKONADI2COMMON_EXPORT Console : public QWidget { Q_OBJECT public: diff --git a/common/storage.h b/common/storage.h index 3f14e83..2fac068 100644 --- a/common/storage.h +++ b/common/storage.h @@ -1,10 +1,11 @@ #pragma once +#include #include #include #include -class Storage { +class AKONADI2COMMON_EXPORT Storage { public: enum AccessMode { ReadOnly, ReadWrite }; diff --git a/common/storage_unqlite.cpp b/common/storage_unqlite.cpp index f94643f..2bdfc2c 100644 --- a/common/storage_unqlite.cpp +++ b/common/storage_unqlite.cpp @@ -9,7 +9,9 @@ #include #include -#include "unqlite/unqlite.h" +extern "C" { + #include "unqlite/unqlite.h" +} static const char *s_unqliteDir = "/unqlite/"; diff --git a/common/unqlite/unqlite.h b/common/unqlite/unqlite.h index 2a2b1ad..bf7ee50 100644 --- a/common/unqlite/unqlite.h +++ b/common/unqlite/unqlite.h @@ -946,4 +946,4 @@ UNQLITE_APIEXPORT const char * unqlite_lib_signature(void); UNQLITE_APIEXPORT const char * unqlite_lib_ident(void); UNQLITE_APIEXPORT const char * unqlite_lib_copyright(void); -#endif /* _UNQLITE_H_ */ \ No newline at end of file +#endif /* _UNQLITE_H_ */ diff --git a/tests/storagebenchmark.cpp b/tests/storagebenchmark.cpp index 130753f..33898d3 100644 --- a/tests/storagebenchmark.cpp +++ b/tests/storagebenchmark.cpp @@ -93,16 +93,11 @@ private Q_SLOTS: time.start(); { - auto event = createEvent(); + auto event = std::string(500, '1');//createEvent(); + + if (store) store->startTransaction(); for (int i = 0; i < count; i++) { if (store) { - if (i % 10000 == 0) { - if (i > 0) { - store->commitTransaction(); - } - store->startTransaction(); - } - store->write(keyPrefix + std::to_string(i), event); } else { myfile << event; -- cgit v1.2.3