diff --git a/CMakeLists.txt b/CMakeLists.txt index d89f657..1e09be0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,6 +14,14 @@ option(COUNTLY_USE_SQLITE "Use SQLite" OFF) option(COUNTLY_BUILD_TESTS "Build test programs" OFF) option(COUNTLY_BUILD_SAMPLE "Build Sample programs" OFF) +message("Build shared libraries:" ${BUILD_SHARED_LIBS}) +message("Create a module definition (.def) on Windows.:" ${CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS}) +message("Use a custom HTTP library:" ${COUNTLY_USE_CUSTOM_HTTP}) +message("Use a custom SHA 256 library:" ${COUNTLY_USE_CUSTOM_SHA256}) +message("Use SQLite:" ${COUNTLY_USE_SQLITE}) +message("Build test programs:" ${COUNTLY_BUILD_TESTS}) +message("Build Sample programs:" ${COUNTLY_BUILD_SAMPLE}) + if (NOT WIN32 AND NOT BUILD_SHARED_LIBS AND NOT COUNTLY_USE_CUSTOM_HTTP) message(FATAL_ERROR "You must provide a custom HTTP function when compiling statically.") endif() @@ -53,13 +61,16 @@ target_link_libraries(countly Threads::Threads) target_include_directories(countly PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/vendor/json/include) if (COUNTLY_BUILD_TESTS) + message("Compiling definitions for tests") target_compile_definitions(countly PRIVATE COUNTLY_BUILD_TESTS) endif() if (COUNTLY_USE_CUSTOM_SHA256) + message("Compiling definitions for custom sha256") target_compile_definitions(countly PRIVATE COUNTLY_USE_CUSTOM_SHA256) else() if (APPLE) + message("Setting openssl root for Mac") set(OPENSSL_ROOT_DIR "/usr/local/opt/openssl") endif() find_package(OpenSSL REQUIRED) @@ -68,14 +79,17 @@ target_link_libraries(countly ${OPENSSL_LIBRARIES}) endif() if(COUNTLY_USE_CUSTOM_HTTP) + message("Will compile definitions for custom http") target_compile_definitions(countly PRIVATE COUNTLY_USE_CUSTOM_HTTP) elseif(NOT WIN32) + message("Checking url as device is not windows") find_package(CURL REQUIRED) target_include_directories(countly PRIVATE ${CURL_INCLUDE_DIRS}) target_link_libraries(countly ${CURL_LIBRARIES}) endif() if(COUNTLY_USE_SQLITE) + message("Building sqlite directories") target_compile_definitions(countly PRIVATE COUNTLY_USE_SQLITE) set(Sqlite3_DIR ${CMAKE_CURRENT_SOURCE_DIR}/vendor/sqlite/build) find_package(Sqlite3) @@ -84,6 +98,7 @@ if(COUNTLY_USE_SQLITE) endif() if(COUNTLY_BUILD_TESTS) + message("Building test directories") add_executable(countly-tests ${CMAKE_CURRENT_SOURCE_DIR}/tests/main.cpp ${CMAKE_CURRENT_SOURCE_DIR}/tests/views.cpp @@ -94,10 +109,12 @@ if(COUNTLY_BUILD_TESTS) target_compile_definitions(countly-tests PRIVATE COUNTLY_BUILD_TESTS) if(COUNTLY_USE_SQLITE) + message("Compiling definitions for sqlite") target_compile_definitions(countly-tests PRIVATE COUNTLY_USE_SQLITE) target_include_directories(countly-tests PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/vendor/sqlite) endif() if(COUNTLY_USE_CUSTOM_SHA256) + message("Compiling definitions for custom sha256") target_compile_definitions(countly-tests PRIVATE COUNTLY_USE_CUSTOM_SHA256) endif() target_include_directories(countly-tests PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/vendor/doctest/doctest) @@ -110,6 +127,7 @@ if(COUNTLY_BUILD_TESTS) endif() if(COUNTLY_BUILD_SAMPLE) + message("Building sample directories") add_executable(countly-sample ${CMAKE_CURRENT_SOURCE_DIR}/examples/example_integration.cpp) diff --git a/include/countly/constants.hpp b/include/countly/constants.hpp index edb5c92..6e24c78 100644 --- a/include/countly/constants.hpp +++ b/include/countly/constants.hpp @@ -9,6 +9,7 @@ #include #include #include +#include #include "nlohmann/json.hpp" #define COUNTLY_SDK_NAME "cpp-native-unknown" diff --git a/src/countly.cpp b/src/countly.cpp index f8581b5..57896fb 100644 --- a/src/countly.cpp +++ b/src/countly.cpp @@ -290,6 +290,25 @@ void Countly::_changeDeviceIdWithoutMerge(const std::string &value) { void Countly::start(const std::string &app_key, const std::string &host, int port, bool start_thread) { mutex->lock(); log(LogLevel::INFO, "[Countly][start]"); + +#ifdef COUNTLY_USE_SQLITE + log(LogLevel::INFO, "[Countly][start] 'COUNTLY_USE_SQLITE' is defined"); +#else + log(LogLevel::INFO, "[Countly][start] 'COUNTLY_USE_SQLITE' is not defined"); +#endif + +#ifdef COUNTLY_USE_CUSTOM_HTTP + log(LogLevel::INFO, "[Countly][start] 'COUNTLY_USE_CUSTOM_HTTP' is defined"); +#else + log(LogLevel::INFO, "[Countly][start] 'COUNTLY_USE_CUSTOM_HTTP' is not defined"); +#endif + +#ifdef COUNTLY_USE_CUSTOM_SHA256 + log(LogLevel::INFO, "[Countly][start] 'COUNTLY_USE_CUSTOM_SHA256' is defined"); +#else + log(LogLevel::INFO, "[Countly][start] 'COUNTLY_USE_CUSTOM_SHA256' is not defined"); +#endif + enable_automatic_session = start_thread; start_thread = true;