This is an automated email from the ASF dual-hosted git repository. isapego pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/ignite.git
The following commit(s) were added to refs/heads/master by this push: new f37ec9e IGNITE-13174 C++: Add CMake support for Windows f37ec9e is described below commit f37ec9eece4db627f2d5190e589f0522e445a251 Author: Igor Sapego <isap...@apache.org> AuthorDate: Fri Sep 25 02:20:10 2020 +0300 IGNITE-13174 C++: Add CMake support for Windows --- modules/platforms/cpp/CMakeLists.txt | 4 ++ modules/platforms/cpp/binary/CMakeLists.txt | 2 + .../include/ignite/impl/binary/binary_field_meta.h | 4 +- .../ignite/impl/binary/binary_object_impl.h | 2 +- .../include/ignite/impl/binary/binary_type_impl.h | 2 +- .../ignite/impl/binary/binary_type_snapshot.h | 4 +- .../binary/src/impl/binary/binary_field_meta.cpp | 4 +- .../binary/src/impl/binary/binary_object_impl.cpp | 2 +- .../src/impl/binary/binary_type_snapshot.cpp | 4 +- modules/platforms/cpp/cmake/FindIgnite.cmake | 27 ++++++++---- modules/platforms/cpp/cmake/FindODBC.cmake | 9 +++- modules/platforms/cpp/common/CMakeLists.txt | 2 + .../cpp/common/include/ignite/common/big_integer.h | 14 +++---- .../cpp/common/include/ignite/common/decimal.h | 14 +++---- .../common/include/ignite/common/platform_utils.h | 2 +- .../cpp/common/include/ignite/common/utils.h | 12 +++--- .../common/os/linux/src/common/platform_utils.cpp | 2 +- .../os/win/include/ignite/common/concurrent_os.h | 2 +- .../common/os/win/src/common/platform_utils.cpp | 2 +- modules/platforms/cpp/common/src/common/utils.cpp | 14 +++---- modules/platforms/cpp/core-test/CMakeLists.txt | 4 +- modules/platforms/cpp/core/CMakeLists.txt | 4 ++ modules/platforms/cpp/examples/CMakeLists.txt | 2 + .../cpp/examples/compute-example/CMakeLists.txt | 3 +- .../continuous-query-example/CMakeLists.txt | 3 +- .../cpp/examples/odbc-example/CMakeLists.txt | 8 +++- .../cpp/examples/put-get-example/CMakeLists.txt | 3 +- .../cpp/examples/query-example/CMakeLists.txt | 3 +- .../examples/query-example/src/query_example.cpp | 48 ++++++++++++++-------- .../thin-client-put-get-example/CMakeLists.txt | 3 +- modules/platforms/cpp/jni/CMakeLists.txt | 10 ++++- modules/platforms/cpp/network/CMakeLists.txt | 5 ++- .../cpp/network/include/ignite/network/network.h | 7 ++-- .../cpp/network/include/ignite/network/utils.h | 4 +- .../cpp/network/os/win/src/network/utils.cpp | 2 +- .../platforms/cpp/network/src/network/network.cpp | 6 +-- modules/platforms/cpp/odbc-test/CMakeLists.txt | 4 +- modules/platforms/cpp/odbc/CMakeLists.txt | 12 +++--- modules/platforms/cpp/thin-client/CMakeLists.txt | 4 ++ 39 files changed, 168 insertions(+), 95 deletions(-) diff --git a/modules/platforms/cpp/CMakeLists.txt b/modules/platforms/cpp/CMakeLists.txt index 4492f04..cfebc78 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 e1f5fad..c69d6e3 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 $<TARGET_OBJECTS:${TARGET}-objlib>) 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 73864eb..70982f0 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 976ba29..21eb2d2 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 c93ba20..8ed43c0 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<IgniteError> + struct IGNITE_IMPORT_EXPORT BinaryType<IgniteError> { 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 186bb84..406b27a 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 3d0b065..02dcbee 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 b48e790..d322da3 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 05962b1..d6d42c0 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 ffdb9e3..a5705e0 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 33817c8..4886cc0 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 7ea0638..9d40af9 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 $<TARGET_OBJECTS:${TARGET}-objlib>) + + 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 ceddd8f..0899bf1 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 cd3bbde..ac1238b 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 d9d5ec4..1adaf33 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 f4b5147..196c8df 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 4417db0..a03b999 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 75fc7dd..a4f6f58 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 b3f403d..9e2f68c 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<unsigned>(GetTickCount() ^ GetCurrentProcessId()); } diff --git a/modules/platforms/cpp/common/src/common/utils.cpp b/modules/platforms/cpp/common/src/common/utils.cpp index 54a7d03..c1e0809 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 ba24021..416e95e 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 e84a8bb..8b1c513 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 380eb8a..8c635f5 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 315477b..6fc1cf7 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 e67ec89..31cb10f 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 6fd6138..386558e 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 0f3e8b2..fefb760 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 c2df0e3..4f543bc 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 44fbe6c..bab74c4 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<std::string>() << " " << row.GetNext<std::string>() << std::endl; + std::string firstName = row.GetNext<std::string>(); + std::string lastName = row.GetNext<std::string>(); + + std::cout << firstName << " " << lastName << std::endl; } std::cout << std::endl; @@ -92,7 +95,10 @@ void DoSqlQueryWithDistributedJoin() { QueryFieldsRow row = cursor.GetNext(); - std::cout << row.GetNext<std::string>() << " " << row.GetNext<std::string>() << std::endl; + std::string firstName = row.GetNext<std::string>(); + std::string lastName = row.GetNext<std::string>(); + + std::cout << firstName << " " << lastName << std::endl; } std::cout << std::endl; @@ -125,8 +131,10 @@ void DoSqlQueryWithJoin() { QueryFieldsRow row = cursor.GetNext(); - std::cout << row.GetNext<std::string>() << " is working in "; - std::cout << row.GetNext<std::string>() << std::endl; + std::string person = row.GetNext<std::string>(); + std::string organization = row.GetNext<std::string>(); + + 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::string>() << std::endl; + { + std::string person = cursor.GetNext().GetNext<std::string>(); + + 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<double>() << std::endl; + { + double salary = cursor.GetNext().GetNext<double>(); + + std::cout << salary << std::endl; + } std::cout << std::endl; } @@ -215,11 +231,11 @@ void DoSqlQuery() { QueryFieldsRow row = cursor.GetNext(); - std::cout - << row.GetNext<std::string>() << " " - << row.GetNext<std::string>() << " : " - << row.GetNext<double>() - << std::endl; + std::string firstName = row.GetNext<std::string>(); + std::string lastName = row.GetNext<std::string>(); + double salary = row.GetNext<double>(); + + 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<std::string>() << " " - << row.GetNext<std::string>() << " : " - << row.GetNext<double>() - << std::endl; + std::string firstName = row.GetNext<std::string>(); + std::string lastName = row.GetNext<std::string>(); + double salary = row.GetNext<double>(); + + 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 7a00a34..fab5a1f 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 75f83f6..0783c45 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 d450f7d..6665ab7 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 $<TARGET_OBJECTS:${TARGET}-objlib>) + + add_library(${TARGET} SHARED $<TARGET_OBJECTS:${TARGET}-objlib>) 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 6bb07b3..5e83cc1 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 <string> +#include <ignite/common/common.h> #include <ignite/network/socket_client.h> 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 f195784..e8f0851 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 <set> #include <string> +#include <ignite/common/common.h> + namespace ignite { namespace network @@ -32,7 +34,7 @@ namespace ignite * * @param addrs Addresses set. */ - void GetLocalAddresses(std::set<std::string>& addrs); + void IGNITE_IMPORT_EXPORT GetLocalAddresses(std::set<std::string>& 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 1ff1aca..5fde3bf 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<std::string>& addrs) + IGNITE_IMPORT_EXPORT void GetLocalAddresses(std::set<std::string>& 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 b2ef23c..ab1b295 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 72e27e2..9b87a60 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 5cbd99c..524d9bc 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 988e13f..feb896a 100644 --- a/modules/platforms/cpp/thin-client/CMakeLists.txt +++ b/modules/platforms/cpp/thin-client/CMakeLists.txt @@ -42,6 +42,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)