diff --git a/modules/platforms/cpp/CMakeLists.txt b/modules/platforms/cpp/CMakeLists.txt index 90632c1396b..c0c3a674b3a 100644 --- a/modules/platforms/cpp/CMakeLists.txt +++ b/modules/platforms/cpp/CMakeLists.txt @@ -32,6 +32,8 @@ set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) +add_definitions(-DIGNITE_FRIEND) + list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir) if("${isSystemDir}" STREQUAL "-1") diff --git a/modules/platforms/cpp/binary/CMakeLists.txt b/modules/platforms/cpp/binary/CMakeLists.txt index a65733dcbc5..a9f75b80db7 100644 --- a/modules/platforms/cpp/binary/CMakeLists.txt +++ b/modules/platforms/cpp/binary/CMakeLists.txt @@ -42,13 +42,19 @@ set(SOURCES src/binary/binary_containers.cpp src/impl/interop/interop_output_stream.cpp src/impl/interop/interop_input_stream.cpp) -add_library(${TARGET} SHARED ${SOURCES}) +add_library(${TARGET}-objlib OBJECT ${SOURCES}) + +set_property(TARGET ${TARGET}-objlib PROPERTY POSITION_INDEPENDENT_CODE 1) + +add_library(${TARGET} SHARED $) set_target_properties(${TARGET} PROPERTIES VERSION ${CMAKE_PROJECT_VERSION}) +target_link_libraries(${TARGET}-objlib ignite-common) target_link_libraries(${TARGET} ignite-common) target_include_directories(${TARGET} INTERFACE include) +target_include_directories(${TARGET}-objlib INTERFACE include) install(TARGETS ${TARGET} LIBRARY DESTINATION lib) install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_PREFIX}/include FILES_MATCHING PATTERN "*.h*") diff --git a/modules/platforms/cpp/common/CMakeLists.txt b/modules/platforms/cpp/common/CMakeLists.txt index 19a44c308bb..d82eab67d99 100644 --- a/modules/platforms/cpp/common/CMakeLists.txt +++ b/modules/platforms/cpp/common/CMakeLists.txt @@ -48,17 +48,23 @@ endif() include_directories(${OS_INCLUDE}) -add_library(${TARGET} SHARED ${SOURCES}) +add_library(${TARGET}-objlib OBJECT ${SOURCES}) + +set_property(TARGET ${TARGET}-objlib PROPERTY POSITION_INDEPENDENT_CODE 1) + +add_library(${TARGET} SHARED $) if (NOT WIN32) find_package(Threads REQUIRED) target_link_libraries(${TARGET} ${CMAKE_THREAD_LIBS_INIT} ${CMAKE_DL_LIBS}) + target_link_libraries(${TARGET}-objlib ${CMAKE_THREAD_LIBS_INIT} ${CMAKE_DL_LIBS}) endif() set_target_properties(${TARGET} PROPERTIES VERSION ${CMAKE_PROJECT_VERSION}) target_include_directories(${TARGET} INTERFACE include ${OS_INCLUDE}) +target_include_directories(${TARGET}-objlib INTERFACE include ${OS_INCLUDE}) install(TARGETS ${TARGET} LIBRARY DESTINATION lib) install(DIRECTORY include/ ${OS_INCLUDE}/ DESTINATION ${CMAKE_INSTALL_PREFIX}/include FILES_MATCHING PATTERN "*.h*") diff --git a/modules/platforms/cpp/core-test/CMakeLists.txt b/modules/platforms/cpp/core-test/CMakeLists.txt index 7185874a763..83453d8a3c8 100644 --- a/modules/platforms/cpp/core-test/CMakeLists.txt +++ b/modules/platforms/cpp/core-test/CMakeLists.txt @@ -19,6 +19,11 @@ project(ignite-tests) set(TARGET ${PROJECT_NAME}) +if (WIN32) + set(Boost_USE_STATIC_LIBS ON) + set(Boost_USE_MULTITHREADED ON) +endif() + find_package(Boost 1.53 REQUIRED COMPONENTS unit_test_framework chrono thread system) include_directories(include ${Boost_INCLUDE_DIRS} ${JNI_INCLUDE_DIRS}) diff --git a/modules/platforms/cpp/network/CMakeLists.txt b/modules/platforms/cpp/network/CMakeLists.txt index 10749e6a78e..37ce69c4327 100644 --- a/modules/platforms/cpp/network/CMakeLists.txt +++ b/modules/platforms/cpp/network/CMakeLists.txt @@ -41,12 +41,23 @@ else() os/linux/src/network/utils.cpp) endif() -add_library(${TARGET} SHARED ${SOURCES}) +add_library(${TARGET}-objlib OBJECT ${SOURCES}) + +set_property(TARGET ${TARGET}-objlib PROPERTY POSITION_INDEPENDENT_CODE 1) + +add_library(${TARGET} SHARED $) set_target_properties(${TARGET} PROPERTIES VERSION ${CMAKE_PROJECT_VERSION}) +target_link_libraries(${TARGET}-objlib ignite-common) target_link_libraries(${TARGET} ignite-common) +if(WIN32) + target_link_libraries(${TARGET}-objlib wsock32 ws2_32 iphlpapi) + target_link_libraries(${TARGET} wsock32 ws2_32 iphlpapi) +endif() + +target_include_directories(${TARGET}-objlib INTERFACE include) target_include_directories(${TARGET} INTERFACE include) install(TARGETS ${TARGET} LIBRARY DESTINATION lib) diff --git a/modules/platforms/cpp/odbc-test/CMakeLists.txt b/modules/platforms/cpp/odbc-test/CMakeLists.txt index 2b67a1f4658..7a05d33fabb 100644 --- a/modules/platforms/cpp/odbc-test/CMakeLists.txt +++ b/modules/platforms/cpp/odbc-test/CMakeLists.txt @@ -19,7 +19,12 @@ project(ignite-odbc-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) + set(Boost_USE_MULTITHREADED ON) +endif() + +find_package(Boost 1.53 REQUIRED COMPONENTS unit_test_framework chrono thread system regex) find_package(ODBC REQUIRED) @@ -87,6 +92,10 @@ add_executable(${TARGET} ${SOURCES}) target_link_libraries(${TARGET} ${Boost_LIBRARIES} ignite ${ODBC_LIBRARY}) +if (WIN32) + remove_definitions(-DUNICODE=1) +endif() + if (NOT WIN32) add_definitions(-DBOOST_TEST_DYN_LINK) endif() diff --git a/modules/platforms/cpp/odbc/CMakeLists.txt b/modules/platforms/cpp/odbc/CMakeLists.txt index fb0199bdb6d..b243fe3a4c2 100644 --- a/modules/platforms/cpp/odbc/CMakeLists.txt +++ b/modules/platforms/cpp/odbc/CMakeLists.txt @@ -85,7 +85,18 @@ add_library(${TARGET} SHARED ${SOURCES}) set_target_properties(${TARGET} PROPERTIES VERSION ${CMAKE_PROJECT_VERSION}) -target_link_libraries(${TARGET} ignite-binary ignite-network ${ODBC_LIBRARIES}) +target_link_libraries(${TARGET} ignite-common-objlib ignite-binary-objlib ignite-network-objlib ${ODBC_LIBRARIES}) + +if (WIN32) + target_link_libraries(${TARGET} odbccp32 shlwapi) + + remove_definitions(-DUNICODE=1) + add_definitions(-DTARGET_MODULE_FULL_NAME="${TARGET}") +endif() + +if (MSVC_VERSION GREATER_EQUAL 1900) + target_link_libraries(${TARGET} legacy_stdio_definitions) +endif() target_include_directories(${TARGET} INTERFACE include) diff --git a/modules/platforms/cpp/thin-client-test/CMakeLists.txt b/modules/platforms/cpp/thin-client-test/CMakeLists.txt index 1e4e062a149..f7576d81556 100644 --- a/modules/platforms/cpp/thin-client-test/CMakeLists.txt +++ b/modules/platforms/cpp/thin-client-test/CMakeLists.txt @@ -2,6 +2,11 @@ project(ignite-thin-client-tests) set(TARGET ${PROJECT_NAME}) +if (WIN32) + set(Boost_USE_STATIC_LIBS ON) + set(Boost_USE_MULTITHREADED ON) +endif() + find_package(Boost 1.53 REQUIRED COMPONENTS unit_test_framework chrono thread system) include_directories(include ${Boost_INCLUDE_DIRS} ${JNI_INCLUDE_DIRS})