diff --git a/modules/platforms/cpp/CMakeLists.txt b/modules/platforms/cpp/CMakeLists.txt index 48a04960d5e2b..dd5099a5767e6 100644 --- a/modules/platforms/cpp/CMakeLists.txt +++ b/modules/platforms/cpp/CMakeLists.txt @@ -42,6 +42,10 @@ if (WIN32) add_definitions(-DUNICODE=1) add_compile_options(/source-charset:utf-8) + + set (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) + + set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) endif() option (WITH_ODBC OFF) diff --git a/modules/platforms/cpp/binary/CMakeLists.txt b/modules/platforms/cpp/binary/CMakeLists.txt index e1f5fad8a8e64..c69d6e3ef7ec3 100644 --- a/modules/platforms/cpp/binary/CMakeLists.txt +++ b/modules/platforms/cpp/binary/CMakeLists.txt @@ -50,6 +50,8 @@ if (WIN32) add_library(${TARGET} SHARED $) list(APPEND _target_libs ${TARGET}-objlib) + + set_target_properties(${TARGET} PROPERTIES OUTPUT_NAME "ignite.binary") else() add_library(${TARGET} SHARED ${SOURCES}) endif() diff --git a/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_field_meta.h b/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_field_meta.h index 73864eb4ddc6d..70982f099bd6d 100644 --- a/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_field_meta.h +++ b/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_field_meta.h @@ -87,14 +87,14 @@ namespace ignite * * @param writer Writer. */ - void Write(ignite::binary::BinaryRawWriter& writer) const; + IGNITE_IMPORT_EXPORT void Write(ignite::binary::BinaryRawWriter& writer) const; /** * Read from data stream. * * @param reader reader. */ - void Read(ignite::binary::BinaryRawReader& reader); + IGNITE_IMPORT_EXPORT void Read(ignite::binary::BinaryRawReader& reader); private: /** Type ID. */ diff --git a/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_object_impl.h b/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_object_impl.h index 976ba2944923b..21eb2d2fcc57a 100644 --- a/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_object_impl.h +++ b/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_object_impl.h @@ -243,7 +243,7 @@ namespace ignite /* Specialization */ template<> - BinaryObjectImpl BinaryObjectImpl::GetField(const char* name) const; + IGNITE_IMPORT_EXPORT BinaryObjectImpl BinaryObjectImpl::GetField(const char* name) const; } } } diff --git a/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_type_impl.h b/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_type_impl.h index c93ba20370a16..8ed43c0a94dc2 100644 --- a/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_type_impl.h +++ b/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_type_impl.h @@ -34,7 +34,7 @@ namespace ignite struct BinaryType; template<> - struct BinaryType + struct IGNITE_IMPORT_EXPORT BinaryType { static int32_t GetTypeId(); diff --git a/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_type_snapshot.h b/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_type_snapshot.h index 186bb848345da..406b27a201668 100644 --- a/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_type_snapshot.h +++ b/modules/platforms/cpp/binary/include/ignite/impl/binary/binary_type_snapshot.h @@ -48,7 +48,7 @@ namespace ignite * @param typeName Type name. * @param typeId Type ID. */ - BinaryTypeSnapshot(std::string typeName, int32_t typeId); + IGNITE_IMPORT_EXPORT BinaryTypeSnapshot(std::string typeName, int32_t typeId); /** * Copy constructor. @@ -115,7 +115,7 @@ namespace ignite * @param fieldName Field name. * @param fieldTypeId Field type ID. */ - void AddField(int32_t fieldId, const std::string& fieldName, int32_t fieldTypeId); + IGNITE_IMPORT_EXPORT void AddField(int32_t fieldId, const std::string& fieldName, int32_t fieldTypeId); /** * Copy fields from another snapshot. diff --git a/modules/platforms/cpp/binary/src/impl/binary/binary_field_meta.cpp b/modules/platforms/cpp/binary/src/impl/binary/binary_field_meta.cpp index 3d0b06555e882..02dcbee31c271 100644 --- a/modules/platforms/cpp/binary/src/impl/binary/binary_field_meta.cpp +++ b/modules/platforms/cpp/binary/src/impl/binary/binary_field_meta.cpp @@ -26,13 +26,13 @@ namespace ignite { namespace binary { - void BinaryFieldMeta::Write(ignite::binary::BinaryRawWriter& writer) const + IGNITE_IMPORT_EXPORT void BinaryFieldMeta::Write(ignite::binary::BinaryRawWriter& writer) const { writer.WriteInt32(typeId); writer.WriteInt32(fieldId); } - void BinaryFieldMeta::Read(ignite::binary::BinaryRawReader& reader) + IGNITE_IMPORT_EXPORT void BinaryFieldMeta::Read(ignite::binary::BinaryRawReader& reader) { typeId = reader.ReadInt32(); fieldId = reader.ReadInt32(); diff --git a/modules/platforms/cpp/binary/src/impl/binary/binary_object_impl.cpp b/modules/platforms/cpp/binary/src/impl/binary/binary_object_impl.cpp index b48e790e0a9cd..d322da3e81fb2 100644 --- a/modules/platforms/cpp/binary/src/impl/binary/binary_object_impl.cpp +++ b/modules/platforms/cpp/binary/src/impl/binary/binary_object_impl.cpp @@ -91,7 +91,7 @@ namespace ignite } template<> - BinaryObjectImpl BinaryObjectImpl::GetField(const char* name) const + IGNITE_IMPORT_EXPORT BinaryObjectImpl BinaryObjectImpl::GetField(const char* name) const { CheckIdResolver(); diff --git a/modules/platforms/cpp/binary/src/impl/binary/binary_type_snapshot.cpp b/modules/platforms/cpp/binary/src/impl/binary/binary_type_snapshot.cpp index 05962b199a915..d6d42c0439726 100644 --- a/modules/platforms/cpp/binary/src/impl/binary/binary_type_snapshot.cpp +++ b/modules/platforms/cpp/binary/src/impl/binary/binary_type_snapshot.cpp @@ -23,7 +23,7 @@ namespace ignite { namespace binary { - BinaryTypeSnapshot::BinaryTypeSnapshot(std::string typeName, int32_t typeId) : + IGNITE_IMPORT_EXPORT BinaryTypeSnapshot::BinaryTypeSnapshot(std::string typeName, int32_t typeId) : typeName(typeName), typeId(typeId), fieldIds(), @@ -41,7 +41,7 @@ namespace ignite // No-op. } - void BinaryTypeSnapshot::AddField(int32_t fieldId, const std::string& fieldName, int32_t fieldTypeId) + IGNITE_IMPORT_EXPORT void BinaryTypeSnapshot::AddField(int32_t fieldId, const std::string& fieldName, int32_t fieldTypeId) { fieldIds.insert(fieldId); fields[fieldName] = BinaryFieldMeta(fieldTypeId, fieldId); diff --git a/modules/platforms/cpp/cmake/FindIgnite.cmake b/modules/platforms/cpp/cmake/FindIgnite.cmake index ffdb9e3a8c9dc..a5705e00c5903 100644 --- a/modules/platforms/cpp/cmake/FindIgnite.cmake +++ b/modules/platforms/cpp/cmake/FindIgnite.cmake @@ -19,26 +19,37 @@ find_path(IGNITE_INCLUDE_DIR ignite/ignite.h HINTS ${IGNITE_CPP_DIR}/include PATH_SUFFIXES ignite) -find_library(IGNITE_LIB ignite HINTS ${IGNITE_CPP_DIR}/lib) +if (WIN32) + find_library(IGNITE_LIB ignite.core HINTS ${IGNITE_CPP_DIR}/lib) -find_library(IGNITE_COMMON_LIB ignite-common HINTS ${IGNITE_CPP_DIR}/lib) + find_library(IGNITE_COMMON_LIB ignite.common HINTS ${IGNITE_CPP_DIR}/lib) -find_library(IGNITE_NETWORK_LIB ignite-network HINTS ${IGNITE_CPP_DIR}/lib) + find_library(IGNITE_NETWORK_LIB ignite.network HINTS ${IGNITE_CPP_DIR}/lib) -find_library(IGNITE_JNI_LIB ignite-jni HINTS ${IGNITE_CPP_DIR}/lib) + find_library(IGNITE_JNI_LIB ignite.jni HINTS ${IGNITE_CPP_DIR}/lib) -find_library(IGNITE_THIN_CLIENT_LIB ignite-thin-client HINTS ${IGNITE_CPP_DIR}/lib) + find_library(IGNITE_THIN_CLIENT_LIB ignite.thin-client HINTS ${IGNITE_CPP_DIR}/lib) -find_library(IGNITE_ODBC_LIB ignite-odbc HINTS ${IGNITE_CPP_DIR}/lib) + find_library(IGNITE_BINARY_LIB ignite.binary HINTS ${IGNITE_CPP_DIR}/lib) +else() + find_library(IGNITE_LIB ignite HINTS ${IGNITE_CPP_DIR}/lib) -find_library(IGNITE_BINARY_LIB ignite-binary HINTS ${IGNITE_CPP_DIR}/lib) + find_library(IGNITE_COMMON_LIB ignite-common HINTS ${IGNITE_CPP_DIR}/lib) + + find_library(IGNITE_NETWORK_LIB ignite-network HINTS ${IGNITE_CPP_DIR}/lib) + + find_library(IGNITE_JNI_LIB ignite-jni HINTS ${IGNITE_CPP_DIR}/lib) + + find_library(IGNITE_THIN_CLIENT_LIB ignite-thin-client HINTS ${IGNITE_CPP_DIR}/lib) + + find_library(IGNITE_BINARY_LIB ignite-binary HINTS ${IGNITE_CPP_DIR}/lib) +endif() include(FindPackageHandleStandardArgs) find_package_handle_standard_args(Ignite DEFAULT_MSG IGNITE_LIB IGNITE_THIN_CLIENT_LIB - IGNITE_ODBC_LIB IGNITE_BINARY_LIB IGNITE_NETWORK_LIB IGNITE_COMMON_LIB diff --git a/modules/platforms/cpp/cmake/FindODBC.cmake b/modules/platforms/cpp/cmake/FindODBC.cmake index 33817c8868fe4..4886cc0dc67d0 100644 --- a/modules/platforms/cpp/cmake/FindODBC.cmake +++ b/modules/platforms/cpp/cmake/FindODBC.cmake @@ -9,7 +9,14 @@ set(_odbc_required_libs_names) ### Try Windows Kits ########################################################## if(WIN32) - set(_odbc_lib_names odbc32;) + # List names of ODBC libraries on Windows + if(NOT MINGW) + set(ODBC_LIBRARY odbc32.lib) + else() + set(ODBC_LIBRARY libodbc32.a) + endif() + + set(_odbc_lib_names odbc32;) # List additional libraries required to use ODBC library if(MSVC OR CMAKE_CXX_COMPILER_ID MATCHES "Intel") diff --git a/modules/platforms/cpp/common/CMakeLists.txt b/modules/platforms/cpp/common/CMakeLists.txt index 7ea06389880c9..9d40af9547a53 100644 --- a/modules/platforms/cpp/common/CMakeLists.txt +++ b/modules/platforms/cpp/common/CMakeLists.txt @@ -54,6 +54,8 @@ if (WIN32) add_library(${TARGET}-objlib OBJECT ${SOURCES}) add_library(${TARGET} SHARED $) + + set_target_properties(${TARGET} PROPERTIES OUTPUT_NAME "ignite.common") list(APPEND _target_libs ${TARGET}-objlib) else() diff --git a/modules/platforms/cpp/common/include/ignite/common/big_integer.h b/modules/platforms/cpp/common/include/ignite/common/big_integer.h index ceddd8f9c0ca9..0899bf123bba5 100644 --- a/modules/platforms/cpp/common/include/ignite/common/big_integer.h +++ b/modules/platforms/cpp/common/include/ignite/common/big_integer.h @@ -32,7 +32,7 @@ namespace ignite /** * Big integer number implementation. */ - class BigInteger + class IGNITE_IMPORT_EXPORT BigInteger { friend class Decimal; public: @@ -471,7 +471,7 @@ namespace ignite * @param val2 Second value. * @return True if equal. */ - bool IGNITE_IMPORT_EXPORT operator==(const BigInteger& val1, const BigInteger& val2); + IGNITE_IMPORT_EXPORT bool operator==(const BigInteger& val1, const BigInteger& val2); /** * Comparison operator. @@ -480,7 +480,7 @@ namespace ignite * @param val2 Second value. * @return True if not equal. */ - bool IGNITE_IMPORT_EXPORT operator!=(const BigInteger& val1, const BigInteger& val2); + IGNITE_IMPORT_EXPORT bool operator!=(const BigInteger& val1, const BigInteger& val2); /** * Comparison operator. @@ -489,7 +489,7 @@ namespace ignite * @param val2 Second value. * @return True if less. */ - bool IGNITE_IMPORT_EXPORT operator<(const BigInteger& val1, const BigInteger& val2); + IGNITE_IMPORT_EXPORT bool operator<(const BigInteger& val1, const BigInteger& val2); /** * Comparison operator. @@ -498,7 +498,7 @@ namespace ignite * @param val2 Second value. * @return True if less or equal. */ - bool IGNITE_IMPORT_EXPORT operator<=(const BigInteger& val1, const BigInteger& val2); + IGNITE_IMPORT_EXPORT bool operator<=(const BigInteger& val1, const BigInteger& val2); /** * Comparison operator. @@ -507,7 +507,7 @@ namespace ignite * @param val2 Second value. * @return True if gretter. */ - bool IGNITE_IMPORT_EXPORT operator>(const BigInteger& val1, const BigInteger& val2); + IGNITE_IMPORT_EXPORT bool operator>(const BigInteger& val1, const BigInteger& val2); /** * Comparison operator. @@ -516,7 +516,7 @@ namespace ignite * @param val2 Second value. * @return True if gretter or equal. */ - bool IGNITE_IMPORT_EXPORT operator>=(const BigInteger& val1, const BigInteger& val2); + IGNITE_IMPORT_EXPORT bool operator>=(const BigInteger& val1, const BigInteger& val2); } } diff --git a/modules/platforms/cpp/common/include/ignite/common/decimal.h b/modules/platforms/cpp/common/include/ignite/common/decimal.h index cd3bbde681d0b..ac1238bff215f 100644 --- a/modules/platforms/cpp/common/include/ignite/common/decimal.h +++ b/modules/platforms/cpp/common/include/ignite/common/decimal.h @@ -33,7 +33,7 @@ namespace ignite /** * Big decimal number implementation. */ - class Decimal + class IGNITE_IMPORT_EXPORT Decimal { public: /** @@ -475,7 +475,7 @@ namespace ignite * @param val2 Second value. * @return True if equal. */ - bool IGNITE_IMPORT_EXPORT operator==(const Decimal& val1, const Decimal& val2); + IGNITE_IMPORT_EXPORT bool operator==(const Decimal& val1, const Decimal& val2); /** * Comparison operator. @@ -484,7 +484,7 @@ namespace ignite * @param val2 Second value. * @return True if not equal. */ - bool IGNITE_IMPORT_EXPORT operator!=(const Decimal& val1, const Decimal& val2); + IGNITE_IMPORT_EXPORT bool operator!=(const Decimal& val1, const Decimal& val2); /** * Comparison operator. @@ -493,7 +493,7 @@ namespace ignite * @param val2 Second value. * @return True if less. */ - bool IGNITE_IMPORT_EXPORT operator<(const Decimal& val1, const Decimal& val2); + IGNITE_IMPORT_EXPORT bool operator<(const Decimal& val1, const Decimal& val2); /** * Comparison operator. @@ -502,7 +502,7 @@ namespace ignite * @param val2 Second value. * @return True if less or equal. */ - bool IGNITE_IMPORT_EXPORT operator<=(const Decimal& val1, const Decimal& val2); + IGNITE_IMPORT_EXPORT bool operator<=(const Decimal& val1, const Decimal& val2); /** * Comparison operator. @@ -511,7 +511,7 @@ namespace ignite * @param val2 Second value. * @return True if gretter. */ - bool IGNITE_IMPORT_EXPORT operator>(const Decimal& val1, const Decimal& val2); + IGNITE_IMPORT_EXPORT bool operator>(const Decimal& val1, const Decimal& val2); /** * Comparison operator. @@ -520,7 +520,7 @@ namespace ignite * @param val2 Second value. * @return True if gretter or equal. */ - bool IGNITE_IMPORT_EXPORT operator>=(const Decimal& val1, const Decimal& val2); + IGNITE_IMPORT_EXPORT bool operator>=(const Decimal& val1, const Decimal& val2); } } diff --git a/modules/platforms/cpp/common/include/ignite/common/platform_utils.h b/modules/platforms/cpp/common/include/ignite/common/platform_utils.h index d9d5ec44a5345..1adaf339c2659 100644 --- a/modules/platforms/cpp/common/include/ignite/common/platform_utils.h +++ b/modules/platforms/cpp/common/include/ignite/common/platform_utils.h @@ -116,7 +116,7 @@ namespace ignite * * @return Random seed. */ - unsigned GetRandSeed(); + IGNITE_IMPORT_EXPORT unsigned GetRandSeed(); } } diff --git a/modules/platforms/cpp/common/include/ignite/common/utils.h b/modules/platforms/cpp/common/include/ignite/common/utils.h index f4b514762ed67..196c8df9b6d1c 100644 --- a/modules/platforms/cpp/common/include/ignite/common/utils.h +++ b/modules/platforms/cpp/common/include/ignite/common/utils.h @@ -391,7 +391,7 @@ namespace ignite * @param sec Sec. * @return Date. */ - Date MakeDateGmt(int year = 1900, int month = 1, + IGNITE_FRIEND_EXPORT Date MakeDateGmt(int year = 1900, int month = 1, int day = 1, int hour = 0, int min = 0, int sec = 0); /** @@ -407,7 +407,7 @@ namespace ignite * @param sec Sec. * @return Date. */ - Date MakeDateLocal(int year = 1900, int month = 1, + IGNITE_FRIEND_EXPORT Date MakeDateLocal(int year = 1900, int month = 1, int day = 1, int hour = 0, int min = 0, int sec = 0); /** @@ -420,7 +420,7 @@ namespace ignite * @param sec Second. * @return Time. */ - Time MakeTimeGmt(int hour = 0, int min = 0, int sec = 0); + IGNITE_FRIEND_EXPORT Time MakeTimeGmt(int hour = 0, int min = 0, int sec = 0); /** * Make Time in human understandable way. @@ -432,7 +432,7 @@ namespace ignite * @param sec Second. * @return Time. */ - Time MakeTimeLocal(int hour = 0, int min = 0, int sec = 0); + IGNITE_FRIEND_EXPORT Time MakeTimeLocal(int hour = 0, int min = 0, int sec = 0); /** * Make Timestamp in human understandable way. @@ -448,7 +448,7 @@ namespace ignite * @param ns Nanosecond. * @return Timestamp. */ - Timestamp MakeTimestampGmt(int year = 1900, int month = 1, + IGNITE_FRIEND_EXPORT Timestamp MakeTimestampGmt(int year = 1900, int month = 1, int day = 1, int hour = 0, int min = 0, int sec = 0, long ns = 0); /** @@ -465,7 +465,7 @@ namespace ignite * @param ns Nanosecond. * @return Timestamp. */ - Timestamp MakeTimestampLocal(int year = 1900, int month = 1, + IGNITE_FRIEND_EXPORT Timestamp MakeTimestampLocal(int year = 1900, int month = 1, int day = 1, int hour = 0, int min = 0, int sec = 0, long ns = 0); /** diff --git a/modules/platforms/cpp/common/os/linux/src/common/platform_utils.cpp b/modules/platforms/cpp/common/os/linux/src/common/platform_utils.cpp index 4417db0c01990..a03b99952ffd0 100644 --- a/modules/platforms/cpp/common/os/linux/src/common/platform_utils.cpp +++ b/modules/platforms/cpp/common/os/linux/src/common/platform_utils.cpp @@ -124,7 +124,7 @@ namespace ignite return ostr; } - unsigned GetRandSeed() + IGNITE_IMPORT_EXPORT unsigned GetRandSeed() { timespec ts; diff --git a/modules/platforms/cpp/common/os/win/include/ignite/common/concurrent_os.h b/modules/platforms/cpp/common/os/win/include/ignite/common/concurrent_os.h index 75fc7dd307111..a4f6f58329104 100644 --- a/modules/platforms/cpp/common/os/win/include/ignite/common/concurrent_os.h +++ b/modules/platforms/cpp/common/os/win/include/ignite/common/concurrent_os.h @@ -152,7 +152,7 @@ namespace ignite /** * Primitives for atomic access. */ - class Atomics + class IGNITE_IMPORT_EXPORT Atomics { public: /** diff --git a/modules/platforms/cpp/common/os/win/src/common/platform_utils.cpp b/modules/platforms/cpp/common/os/win/src/common/platform_utils.cpp index b3f403d1da44d..9e2f68c49c09d 100644 --- a/modules/platforms/cpp/common/os/win/src/common/platform_utils.cpp +++ b/modules/platforms/cpp/common/os/win/src/common/platform_utils.cpp @@ -130,7 +130,7 @@ namespace ignite return ostr; } - unsigned GetRandSeed() + IGNITE_IMPORT_EXPORT unsigned GetRandSeed() { return static_cast(GetTickCount() ^ GetCurrentProcessId()); } diff --git a/modules/platforms/cpp/common/src/common/utils.cpp b/modules/platforms/cpp/common/src/common/utils.cpp index 54a7d03153170..c1e080984fbf7 100644 --- a/modules/platforms/cpp/common/src/common/utils.cpp +++ b/modules/platforms/cpp/common/src/common/utils.cpp @@ -87,7 +87,7 @@ namespace ignite return value; } - Date MakeDateGmt(int year, int month, int day, int hour, + IGNITE_FRIEND_EXPORT Date MakeDateGmt(int year, int month, int day, int hour, int min, int sec) { tm date = { 0 }; @@ -102,7 +102,7 @@ namespace ignite return CTmToDate(date); } - Date MakeDateLocal(int year, int month, int day, int hour, + IGNITE_FRIEND_EXPORT Date MakeDateLocal(int year, int month, int day, int hour, int min, int sec) { tm date = { 0 }; @@ -119,7 +119,7 @@ namespace ignite return CTimeToDate(localTime); } - Time MakeTimeGmt(int hour, int min, int sec) + IGNITE_FRIEND_EXPORT Time MakeTimeGmt(int hour, int min, int sec) { tm date = { 0 }; @@ -133,7 +133,7 @@ namespace ignite return CTmToTime(date); } - Time MakeTimeLocal(int hour, int min, int sec) + IGNITE_FRIEND_EXPORT Time MakeTimeLocal(int hour, int min, int sec) { tm date = { 0 }; @@ -149,7 +149,7 @@ namespace ignite return CTimeToTime(localTime); } - Timestamp MakeTimestampGmt(int year, int month, int day, + IGNITE_FRIEND_EXPORT Timestamp MakeTimestampGmt(int year, int month, int day, int hour, int min, int sec, long ns) { tm date = { 0 }; @@ -164,7 +164,7 @@ namespace ignite return CTmToTimestamp(date, ns); } - Timestamp MakeTimestampLocal(int year, int month, int day, + IGNITE_FRIEND_EXPORT Timestamp MakeTimestampLocal(int year, int month, int day, int hour, int min, int sec, long ns) { tm date = { 0 }; @@ -181,7 +181,7 @@ namespace ignite return CTimeToTimestamp(localTime, ns); } - std::string GetDynamicLibraryName(const char* name) + IGNITE_IMPORT_EXPORT std::string GetDynamicLibraryName(const char* name) { std::stringstream libNameBuffer; diff --git a/modules/platforms/cpp/core-test/CMakeLists.txt b/modules/platforms/cpp/core-test/CMakeLists.txt index ba24021532622..416e95ec35cff 100644 --- a/modules/platforms/cpp/core-test/CMakeLists.txt +++ b/modules/platforms/cpp/core-test/CMakeLists.txt @@ -19,12 +19,12 @@ project(ignite-tests) set(TARGET ${PROJECT_NAME}) -find_package(Boost 1.53 REQUIRED COMPONENTS unit_test_framework chrono thread system) - if (WIN32) set(Boost_USE_STATIC_LIBS ON) endif() +find_package(Boost 1.53 REQUIRED COMPONENTS unit_test_framework chrono thread system) + include_directories(include ${Boost_INCLUDE_DIRS} ${JNI_INCLUDE_DIRS}) set(SOURCES src/reference_test.cpp diff --git a/modules/platforms/cpp/core/CMakeLists.txt b/modules/platforms/cpp/core/CMakeLists.txt index e84a8bb43eb65..8b1c513fea29c 100644 --- a/modules/platforms/cpp/core/CMakeLists.txt +++ b/modules/platforms/cpp/core/CMakeLists.txt @@ -46,6 +46,10 @@ add_library(${TARGET} SHARED ${SOURCES}) set_target_properties(${TARGET} PROPERTIES VERSION ${CMAKE_PROJECT_VERSION}) +if (WIN32) + set_target_properties(${TARGET} PROPERTIES OUTPUT_NAME "ignite.core") +endif() + target_link_libraries(${TARGET} ignite-binary ignite-jni) target_include_directories(${TARGET} INTERFACE include) diff --git a/modules/platforms/cpp/examples/CMakeLists.txt b/modules/platforms/cpp/examples/CMakeLists.txt index 380eb8a0eb811..8c635f5a5257f 100644 --- a/modules/platforms/cpp/examples/CMakeLists.txt +++ b/modules/platforms/cpp/examples/CMakeLists.txt @@ -26,6 +26,8 @@ if (WIN32) add_definitions(-DUNICODE=1) add_compile_options(/source-charset:utf-8) + + set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) endif() add_subdirectory(compute-example) diff --git a/modules/platforms/cpp/examples/compute-example/CMakeLists.txt b/modules/platforms/cpp/examples/compute-example/CMakeLists.txt index 315477b988b34..6fc1cf79c0947 100644 --- a/modules/platforms/cpp/examples/compute-example/CMakeLists.txt +++ b/modules/platforms/cpp/examples/compute-example/CMakeLists.txt @@ -28,4 +28,5 @@ include_directories(../include ${IGNITE_INCLUDE_DIR} ${JNI_INCLUDE_DIRS}) add_executable(${TARGET} src/compute_example.cpp) -target_link_libraries(${TARGET} ${IGNITE_LIB} ${IGNITE_BINARY_LIB} ${IGNITE_COMMON_LIB} ${CMAKE_THREAD_LIBS_INIT}) +target_link_libraries(${TARGET} ${IGNITE_LIB} ${IGNITE_JNI_LIB} ${IGNITE_BINARY_LIB} ${IGNITE_COMMON_LIB} + ${CMAKE_THREAD_LIBS_INIT}) diff --git a/modules/platforms/cpp/examples/continuous-query-example/CMakeLists.txt b/modules/platforms/cpp/examples/continuous-query-example/CMakeLists.txt index e67ec895662ed..31cb10f91dd57 100644 --- a/modules/platforms/cpp/examples/continuous-query-example/CMakeLists.txt +++ b/modules/platforms/cpp/examples/continuous-query-example/CMakeLists.txt @@ -28,4 +28,5 @@ include_directories(../include ${IGNITE_INCLUDE_DIR} ${JNI_INCLUDE_DIRS}) add_executable(${TARGET} src/continuous_query_example.cpp) -target_link_libraries(${TARGET} ${IGNITE_LIB} ${IGNITE_BINARY_LIB} ${IGNITE_COMMON_LIB} ${CMAKE_THREAD_LIBS_INIT}) +target_link_libraries(${TARGET} ${IGNITE_LIB} ${IGNITE_JNI_LIB} ${IGNITE_BINARY_LIB} ${IGNITE_COMMON_LIB} + ${CMAKE_THREAD_LIBS_INIT}) diff --git a/modules/platforms/cpp/examples/odbc-example/CMakeLists.txt b/modules/platforms/cpp/examples/odbc-example/CMakeLists.txt index 6fd613886d0c9..386558e9bfd93 100644 --- a/modules/platforms/cpp/examples/odbc-example/CMakeLists.txt +++ b/modules/platforms/cpp/examples/odbc-example/CMakeLists.txt @@ -29,5 +29,9 @@ include_directories(../include ${IGNITE_INCLUDE_DIR} ${JNI_INCLUDE_DIRS}) add_executable(${TARGET} src/odbc_example.cpp) -target_link_libraries(${TARGET} ${IGNITE_LIB} ${IGNITE_BINARY_LIB} ${IGNITE_COMMON_LIB} ${ODBC_LIBRARY} - ${CMAKE_THREAD_LIBS_INIT}) +if (WIN32) + remove_definitions(-DUNICODE=1) +endif() + +target_link_libraries(${TARGET} ${IGNITE_LIB} ${IGNITE_JNI_LIB} ${IGNITE_BINARY_LIB} ${IGNITE_COMMON_LIB} + ${ODBC_LIBRARY} ${CMAKE_THREAD_LIBS_INIT}) diff --git a/modules/platforms/cpp/examples/put-get-example/CMakeLists.txt b/modules/platforms/cpp/examples/put-get-example/CMakeLists.txt index 0f3e8b20a2ba5..fefb760cd4b9f 100644 --- a/modules/platforms/cpp/examples/put-get-example/CMakeLists.txt +++ b/modules/platforms/cpp/examples/put-get-example/CMakeLists.txt @@ -28,4 +28,5 @@ include_directories(../include ${IGNITE_INCLUDE_DIR} ${JNI_INCLUDE_DIRS}) add_executable(${TARGET} src/put_get_example.cpp) -target_link_libraries(${TARGET} ${IGNITE_LIB} ${IGNITE_BINARY_LIB} ${IGNITE_COMMON_LIB} ${CMAKE_THREAD_LIBS_INIT}) +target_link_libraries(${TARGET} ${IGNITE_LIB} ${IGNITE_JNI_LIB} ${IGNITE_BINARY_LIB} ${IGNITE_COMMON_LIB} + ${CMAKE_THREAD_LIBS_INIT}) diff --git a/modules/platforms/cpp/examples/query-example/CMakeLists.txt b/modules/platforms/cpp/examples/query-example/CMakeLists.txt index c2df0e349a714..4f543bc0e8fc3 100644 --- a/modules/platforms/cpp/examples/query-example/CMakeLists.txt +++ b/modules/platforms/cpp/examples/query-example/CMakeLists.txt @@ -28,4 +28,5 @@ include_directories(../include ${IGNITE_INCLUDE_DIR} ${JNI_INCLUDE_DIRS}) add_executable(${TARGET} src/query_example.cpp) -target_link_libraries(${TARGET} ${IGNITE_LIB} ${IGNITE_BINARY_LIB} ${IGNITE_COMMON_LIB} ${CMAKE_THREAD_LIBS_INIT}) +target_link_libraries(${TARGET} ${IGNITE_LIB} ${IGNITE_JNI_LIB} ${IGNITE_BINARY_LIB} ${IGNITE_COMMON_LIB} + ${CMAKE_THREAD_LIBS_INIT}) diff --git a/modules/platforms/cpp/examples/query-example/src/query_example.cpp b/modules/platforms/cpp/examples/query-example/src/query_example.cpp index 44fbe6c12ca00..bab74c484ec80 100644 --- a/modules/platforms/cpp/examples/query-example/src/query_example.cpp +++ b/modules/platforms/cpp/examples/query-example/src/query_example.cpp @@ -74,7 +74,10 @@ void DoSqlQueryWithDistributedJoin() { QueryFieldsRow row = cursor.GetNext(); - std::cout << row.GetNext() << " " << row.GetNext() << std::endl; + std::string firstName = row.GetNext(); + std::string lastName = row.GetNext(); + + std::cout << firstName << " " << lastName << std::endl; } std::cout << std::endl; @@ -92,7 +95,10 @@ void DoSqlQueryWithDistributedJoin() { QueryFieldsRow row = cursor.GetNext(); - std::cout << row.GetNext() << " " << row.GetNext() << std::endl; + std::string firstName = row.GetNext(); + std::string lastName = row.GetNext(); + + std::cout << firstName << " " << lastName << std::endl; } std::cout << std::endl; @@ -125,8 +131,10 @@ void DoSqlQueryWithJoin() { QueryFieldsRow row = cursor.GetNext(); - std::cout << row.GetNext() << " is working in "; - std::cout << row.GetNext() << std::endl; + std::string person = row.GetNext(); + std::string organization = row.GetNext(); + + std::cout << person << " is working in " << organization << std::endl; } std::cout << std::endl; @@ -151,7 +159,11 @@ void DoSqlQueryWithFunction() // In this particular case each row will have one element with full name of an employees. while (cursor.HasNext()) - std::cout << cursor.GetNext().GetNext() << std::endl; + { + std::string person = cursor.GetNext().GetNext(); + + std::cout << person << std::endl; + } std::cout << std::endl; } @@ -182,7 +194,11 @@ void DoSqlQueryWithAggregation() std::cout << "Average salary for 'ApacheIgnite' employees: " << std::endl; while (cursor.HasNext()) - std::cout << cursor.GetNext().GetNext() << std::endl; + { + double salary = cursor.GetNext().GetNext(); + + std::cout << salary << std::endl; + } std::cout << std::endl; } @@ -215,11 +231,11 @@ void DoSqlQuery() { QueryFieldsRow row = cursor.GetNext(); - std::cout - << row.GetNext() << " " - << row.GetNext() << " : " - << row.GetNext() - << std::endl; + std::string firstName = row.GetNext(); + std::string lastName = row.GetNext(); + double salary = row.GetNext(); + + std::cout << firstName << " " << lastName << " : " << salary << std::endl; } std::cout << std::endl; @@ -238,11 +254,11 @@ void DoSqlQuery() { QueryFieldsRow row = cursor.GetNext(); - std::cout - << row.GetNext() << " " - << row.GetNext() << " : " - << row.GetNext() - << std::endl; + std::string firstName = row.GetNext(); + std::string lastName = row.GetNext(); + double salary = row.GetNext(); + + std::cout << firstName << " " << lastName << " : " << salary << std::endl; } std::cout << std::endl; diff --git a/modules/platforms/cpp/examples/thin-client-put-get-example/CMakeLists.txt b/modules/platforms/cpp/examples/thin-client-put-get-example/CMakeLists.txt index 7a00a349ee92c..fab5a1fb6a592 100644 --- a/modules/platforms/cpp/examples/thin-client-put-get-example/CMakeLists.txt +++ b/modules/platforms/cpp/examples/thin-client-put-get-example/CMakeLists.txt @@ -20,9 +20,10 @@ project(thin-client-put-get-example) set(TARGET ignite-${PROJECT_NAME}) find_package(Ignite) +find_package(Threads) include_directories(../include ${IGNITE_INCLUDE_DIR}) add_executable(${TARGET} src/thin_client_put_get_example.cpp) -target_link_libraries(${TARGET} ${IGNITE_THIN_CLIENT_LIB} ${IGNITE_BINARY_LIB} ${IGNITE_COMMON_LIB}) +target_link_libraries(${TARGET} ${IGNITE_THIN_CLIENT_LIB} ${IGNITE_BINARY_LIB} ${IGNITE_COMMON_LIB} ${CMAKE_THREAD_LIBS_INIT}) diff --git a/modules/platforms/cpp/jni/CMakeLists.txt b/modules/platforms/cpp/jni/CMakeLists.txt index 75f83f69af249..0783c45de5807 100644 --- a/modules/platforms/cpp/jni/CMakeLists.txt +++ b/modules/platforms/cpp/jni/CMakeLists.txt @@ -29,7 +29,7 @@ if (WIN32) list(APPEND SOURCES os/win/src/utils.cpp) else() list(APPEND SOURCES os/linux/src/utils.cpp) -endif () +endif() add_library(${TARGET} SHARED ${SOURCES}) @@ -37,6 +37,14 @@ set_target_properties(${TARGET} PROPERTIES VERSION ${CMAKE_PROJECT_VERSION}) target_link_libraries(${TARGET} ignite-common ${JVM_LIBRARY}) +if (WIN32) + target_link_libraries(${TARGET} delayimp) + + set_target_properties(${TARGET} PROPERTIES LINK_FLAGS "/DELAYLOAD:jvm.dll") + + set_target_properties(${TARGET} PROPERTIES OUTPUT_NAME "ignite.jni") +endif() + target_include_directories(${TARGET} INTERFACE include) install(TARGETS ${TARGET} LIBRARY DESTINATION lib) diff --git a/modules/platforms/cpp/network/CMakeLists.txt b/modules/platforms/cpp/network/CMakeLists.txt index d450f7dc3c9a3..6665ab7789beb 100644 --- a/modules/platforms/cpp/network/CMakeLists.txt +++ b/modules/platforms/cpp/network/CMakeLists.txt @@ -44,9 +44,12 @@ endif() list(APPEND _target_libs ${TARGET}) if (WIN32) add_library(${TARGET}-objlib OBJECT ${SOURCES}) - add_library(${TARGET} SHARED $) + + add_library(${TARGET} SHARED $) list(APPEND _target_libs ${TARGET}-objlib) + + set_target_properties(${TARGET} PROPERTIES OUTPUT_NAME "ignite.network") else() add_library(${TARGET} SHARED ${SOURCES}) endif() diff --git a/modules/platforms/cpp/network/include/ignite/network/network.h b/modules/platforms/cpp/network/include/ignite/network/network.h index 6bb07b3d1b520..5e83cc1b84742 100644 --- a/modules/platforms/cpp/network/include/ignite/network/network.h +++ b/modules/platforms/cpp/network/include/ignite/network/network.h @@ -20,6 +20,7 @@ #include +#include #include namespace ignite @@ -36,12 +37,12 @@ namespace ignite * * @throw IgniteError if it is not possible to load SSL library. */ - void EnsureSslLoaded(); + IGNITE_IMPORT_EXPORT void EnsureSslLoaded(); /** * Make basic TCP socket. */ - SocketClient* MakeTcpSocketClient(); + IGNITE_IMPORT_EXPORT SocketClient* MakeTcpSocketClient(); /** * Make secure socket for SSL/TLS connection. @@ -52,7 +53,7 @@ namespace ignite * * @throw IgniteError if it is not possible to load SSL library. */ - SocketClient* MakeSecureSocketClient(const std::string& certPath, + IGNITE_IMPORT_EXPORT SocketClient* MakeSecureSocketClient(const std::string& certPath, const std::string& keyPath, const std::string& caPath); } } diff --git a/modules/platforms/cpp/network/include/ignite/network/utils.h b/modules/platforms/cpp/network/include/ignite/network/utils.h index f19578481bea3..e8f0851b6f8ea 100644 --- a/modules/platforms/cpp/network/include/ignite/network/utils.h +++ b/modules/platforms/cpp/network/include/ignite/network/utils.h @@ -21,6 +21,8 @@ #include #include +#include + namespace ignite { namespace network @@ -32,7 +34,7 @@ namespace ignite * * @param addrs Addresses set. */ - void GetLocalAddresses(std::set& addrs); + void IGNITE_IMPORT_EXPORT GetLocalAddresses(std::set& addrs); } } } diff --git a/modules/platforms/cpp/network/os/win/src/network/utils.cpp b/modules/platforms/cpp/network/os/win/src/network/utils.cpp index 1ff1acac5d37f..5fde3bffece94 100644 --- a/modules/platforms/cpp/network/os/win/src/network/utils.cpp +++ b/modules/platforms/cpp/network/os/win/src/network/utils.cpp @@ -37,7 +37,7 @@ namespace ignite { namespace utils { - void GetLocalAddresses(std::set& addrs) + IGNITE_IMPORT_EXPORT void GetLocalAddresses(std::set& addrs) { IP_ADAPTER_ADDRESSES outAddrs[64]; diff --git a/modules/platforms/cpp/network/src/network/network.cpp b/modules/platforms/cpp/network/src/network/network.cpp index b2ef23ccc40b1..ab1b295d0c7b4 100644 --- a/modules/platforms/cpp/network/src/network/network.cpp +++ b/modules/platforms/cpp/network/src/network/network.cpp @@ -29,17 +29,17 @@ namespace ignite { namespace ssl { - void EnsureSslLoaded() + IGNITE_IMPORT_EXPORT void EnsureSslLoaded() { SslGateway::GetInstance().LoadAll(); } - SocketClient* MakeTcpSocketClient() + IGNITE_IMPORT_EXPORT SocketClient* MakeTcpSocketClient() { return new TcpSocketClient; } - SocketClient* MakeSecureSocketClient(const std::string& certPath, + IGNITE_IMPORT_EXPORT SocketClient* MakeSecureSocketClient(const std::string& certPath, const std::string& keyPath, const std::string& caPath) { EnsureSslLoaded(); diff --git a/modules/platforms/cpp/odbc-test/CMakeLists.txt b/modules/platforms/cpp/odbc-test/CMakeLists.txt index 72e27e26cac8b..9b87a60f23c73 100644 --- a/modules/platforms/cpp/odbc-test/CMakeLists.txt +++ b/modules/platforms/cpp/odbc-test/CMakeLists.txt @@ -19,12 +19,12 @@ project(ignite-odbc-tests) set(TARGET ${PROJECT_NAME}) -find_package(Boost 1.53 REQUIRED COMPONENTS unit_test_framework chrono thread system regex) - if (WIN32) set(Boost_USE_STATIC_LIBS ON) endif() +find_package(Boost 1.53 REQUIRED COMPONENTS unit_test_framework chrono thread system regex) + find_package(ODBC REQUIRED) include_directories(include ../odbc/include ../network/include ${ODBC_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${JNI_INCLUDE_DIRS}) diff --git a/modules/platforms/cpp/odbc/CMakeLists.txt b/modules/platforms/cpp/odbc/CMakeLists.txt index 5cbd99c2d913d..524d9bc2b8188 100644 --- a/modules/platforms/cpp/odbc/CMakeLists.txt +++ b/modules/platforms/cpp/odbc/CMakeLists.txt @@ -75,7 +75,8 @@ if (WIN32) list(APPEND SOURCES os/win/src/system_dsn.cpp os/win/src/system/ui/custom_window.cpp os/win/src/system/ui/dsn_configuration_window.cpp - os/win/src/system/ui/window.cpp) + os/win/src/system/ui/window.cpp + project/vs/module.def) endif () add_library(${TARGET} SHARED ${SOURCES}) @@ -85,7 +86,7 @@ set_target_properties(${TARGET} PROPERTIES VERSION ${CMAKE_PROJECT_VERSION}) target_link_libraries(${TARGET} ${ODBC_LIBRARIES}) if (WIN32) - target_link_libraries(${TARGET} ignite-common-objlib ignite-binary-objlib ignite-network-objlib shlwapi) + target_link_libraries(${TARGET} ignite-common-objlib ignite-binary-objlib ignite-network-objlib odbccp32 shlwapi) remove_definitions(-DUNICODE=1) @@ -94,6 +95,8 @@ if (WIN32) if (MSVC_VERSION GREATER_EQUAL 1900) target_link_libraries(${TARGET} legacy_stdio_definitions) endif() + + set_target_properties(${TARGET} PROPERTIES OUTPUT_NAME "ignite.odbc") else() target_link_libraries(${TARGET} ignite-common ignite-binary ignite-network) endif() @@ -101,8 +104,3 @@ endif() target_include_directories(${TARGET} INTERFACE include) install(TARGETS ${TARGET} LIBRARY DESTINATION lib) -install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_PREFIX}/include FILES_MATCHING PATTERN "*.h*") - -if (WIN32) - install(DIRECTORY os/win/include/ DESTINATION ${CMAKE_INSTALL_PREFIX}/include FILES_MATCHING PATTERN "*.h*") -endif() diff --git a/modules/platforms/cpp/thin-client/CMakeLists.txt b/modules/platforms/cpp/thin-client/CMakeLists.txt index 5cd121f36072a..e451cc714dff3 100644 --- a/modules/platforms/cpp/thin-client/CMakeLists.txt +++ b/modules/platforms/cpp/thin-client/CMakeLists.txt @@ -40,6 +40,10 @@ add_library(${TARGET} SHARED ${SOURCES}) set_target_properties(${TARGET} PROPERTIES VERSION ${CMAKE_PROJECT_VERSION}) +if (WIN32) + set_target_properties(${TARGET} PROPERTIES OUTPUT_NAME "ignite.thin-client") +endif() + target_link_libraries(${TARGET} ignite-binary ignite-network) target_include_directories(${TARGET} INTERFACE include)