From fd5e19444cef565f0b6198e514b1c2727cd55272 Mon Sep 17 00:00:00 2001 From: ihsandemir Date: Mon, 15 Feb 2021 17:41:59 +0300 Subject: [PATCH 1/8] Added Hazelcast C++ client (https://github.com/hazelcast/hazelcast-cpp-client) port for Hazelcast in-memory database. --- .../fix-cmake-targets.patch | 270 ++++++++++++++++++ ports/hazelcast-cpp-client/portfile.cmake | 31 ++ ports/hazelcast-cpp-client/vcpkg.json | 29 ++ 3 files changed, 330 insertions(+) create mode 100644 ports/hazelcast-cpp-client/fix-cmake-targets.patch create mode 100644 ports/hazelcast-cpp-client/portfile.cmake create mode 100644 ports/hazelcast-cpp-client/vcpkg.json diff --git a/ports/hazelcast-cpp-client/fix-cmake-targets.patch b/ports/hazelcast-cpp-client/fix-cmake-targets.patch new file mode 100644 index 00000000000000..97abe7301b8f17 --- /dev/null +++ b/ports/hazelcast-cpp-client/fix-cmake-targets.patch @@ -0,0 +1,270 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 6e0e99ae69..b8b425fd84 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -56,10 +56,6 @@ option(WITH_OPENSSL + "Build with OpenSSL. Setting this option to ON enables SSL-related features." + OFF) + +-option(BUILD_STATIC_LIB +- "Build static library." +- OFF) +- + option(BUILD_SHARED_LIB + "Build shared library." + ON) +@@ -76,12 +72,6 @@ option(BUILD_EXAMPLES + "Build examples." + OFF) + +-# exit with an error message if none of BUILD_SHARED_LIB and BUILD_STATIC_LIB was set. +-if ((NOT BUILD_SHARED_LIB) AND (NOT BUILD_STATIC_LIB)) +- message(FATAL_ERROR +- "Set at least one of BUILD_SHARED_LIB and BUILD_STATIC_LIB to ON.") +-endif () +- + # find dependencies + + # find Threads +@@ -103,17 +93,17 @@ if (WITH_OPENSSL) + endif () + + +-function(add_hazelcast_library name type) ++function(add_hazelcast_library type) + # add the library target + add_library( +- ${name} ++ ${PROJECT_NAME} + ${type} + ${SOURCE_FILES} ${HEADER_FILES} + ) + + # set library's version and soversion + set_target_properties( +- ${name} ++ ${PROJECT_NAME} + PROPERTIES + VERSION ${PROJECT_VERSION} + SOVERSION ${PROJECT_VERSION} +@@ -121,21 +111,21 @@ function(add_hazelcast_library name type) + + # library requires c++11 + target_compile_features( +- ${name} ++ ${PROJECT_NAME} + PUBLIC cxx_std_11 + ) + + # links the library against the system's thread library +- target_link_libraries(${name} PUBLIC Threads::Threads) ++ target_link_libraries(${PROJECT_NAME} PUBLIC Threads::Threads) + + # add Boost::thread and Boost::chrono as dependencies + target_link_libraries( +- ${name} ++ ${PROJECT_NAME} + PUBLIC Boost::boost Boost::thread Boost::chrono + ) + # set the Boost thread version + target_compile_definitions( +- ${name} ++ ${PROJECT_NAME} + PUBLIC BOOST_THREAD_VERSION=5 + ) + +@@ -143,26 +133,26 @@ function(add_hazelcast_library name type) + # Both we and the user defines HZ_BUILD_WITH_SSL. + if (WITH_OPENSSL) + target_compile_definitions( +- ${name} ++ ${PROJECT_NAME} + PUBLIC HZ_BUILD_WITH_SSL + ) +- target_link_libraries(${name} PUBLIC OpenSSL::SSL OpenSSL::Crypto) ++ target_link_libraries(${PROJECT_NAME} PUBLIC OpenSSL::SSL OpenSSL::Crypto) + endif() + + # MSVC-specific compiler flags + if (MSVC) +- target_compile_options(${name} PRIVATE /bigobj) ++ target_compile_options(${PROJECT_NAME} PRIVATE /bigobj) + endif () + + # windows-specific compile flags + if (WIN32) + # speeds the build process +- target_compile_definitions(${name} PRIVATE WIN32_LEAN_AND_MEAN) ++ target_compile_definitions(${PROJECT_NAME} PRIVATE WIN32_LEAN_AND_MEAN) + endif () + + # add include directories + target_include_directories( +- ${name} ++ ${PROJECT_NAME} + PUBLIC + $ + $ +@@ -172,7 +162,7 @@ function(add_hazelcast_library name type) + + # add compile flags for version and git commit information + target_compile_definitions( +- ${name} ++ ${PROJECT_NAME} + PRIVATE + HAZELCAST_VERSION="${PROJECT_VERSION}" + HAZELCAST_GIT_COMMIT_DATE=${GIT_COMMIT_DATE} +@@ -180,13 +170,13 @@ function(add_hazelcast_library name type) + ) + + if (DISABLE_LOGGING) +- target_compile_definitions(${name} PUBLIC HZ_LOGGING_DISABLED) ++ target_compile_definitions(${PROJECT_NAME} PUBLIC HZ_LOGGING_DISABLED) + endif () + +- set_target_properties(${name} PROPERTIES DEFINE_SYMBOL HAZELCAST_EXPORTS) ++ set_target_properties(${PROJECT_NAME} PROPERTIES DEFINE_SYMBOL HAZELCAST_EXPORTS) + + generate_export_header( +- ${name} ++ ${PROJECT_NAME} + BASE_NAME hazelcast + EXPORT_MACRO_NAME HAZELCAST_API + EXPORT_FILE_NAME include/hazelcast/util/export.h +@@ -195,13 +185,13 @@ function(add_hazelcast_library name type) + ) + + if (type STREQUAL "STATIC") +- target_compile_definitions(${name} PUBLIC HAZELCAST_USE_STATIC) ++ target_compile_definitions(${PROJECT_NAME} PUBLIC HAZELCAST_USE_STATIC) + endif() + + # install library target + install( +- TARGETS ${name} +- EXPORT ${name}-targets ++ TARGETS ${PROJECT_NAME} ++ EXPORT ${PROJECT_NAME}-targets + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +@@ -210,15 +200,15 @@ function(add_hazelcast_library name type) + + # install the -targets.cmake file + install( +- EXPORT ${name}-targets +- FILE ${name}-targets.cmake +- NAMESPACE hazelcast:: +- DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${name} ++ EXPORT ${PROJECT_NAME}-targets ++ FILE ${PROJECT_NAME}-targets.cmake ++ NAMESPACE ${PROJECT_NAME}:: ++ DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake + ) + + # configure -config-version.cmake file + write_basic_package_version_file( +- ${name}-config-version.cmake ++ ${PROJECT_NAME}-config-version.cmake + VERSION ${PROJECT_VERSION} + COMPATIBILITY SameMajorVersion + ) +@@ -228,41 +218,28 @@ function(add_hazelcast_library name type) + set(LIBRARY_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR}) + configure_package_config_file( + cmake/config.cmake.in +- ${name}-config.cmake +- INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${name} ++ ${PROJECT_NAME}-config.cmake ++ INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake + PATH_VARS INCLUDE_INSTALL_DIR LIBRARY_INSTALL_DIR + ) + + # install -config.cmake and -config-version.cmake files + install( + FILES +- ${CMAKE_BINARY_DIR}/${name}-config.cmake +- ${CMAKE_BINARY_DIR}/${name}-config-version.cmake +- DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${name} ++ ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake ++ ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake ++ DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake + ) + endfunction() + +-# the base name for shared and static libraries +-set(BASE_LIBRARY_NAME hazelcastcxx) +-# add the _ssl suffix to the base name if building WITH_OPENSSL +-if (WITH_OPENSSL) +- set(BASE_LIBRARY_NAME ${BASE_LIBRARY_NAME}_ssl) +-endif() +- +-# set the names for the shared and static libraries +-set(SHARED_LIBRARY_NAME ${BASE_LIBRARY_NAME}) +-set(STATIC_LIBRARY_NAME ${BASE_LIBRARY_NAME}_static) +- +-# add static library if requested +-if (BUILD_STATIC_LIB) +- add_hazelcast_library(${STATIC_LIBRARY_NAME} STATIC) +-endif() +- +-# add shared library if requested ++# add library + if (BUILD_SHARED_LIB) +- add_hazelcast_library(${SHARED_LIBRARY_NAME} SHARED) ++ set(LIB_TYPE SHARED) ++else() ++ set(LIB_TYPE STATIC) + endif() + ++add_hazelcast_library(${LIB_TYPE}) + + # install header files, this applies both to the shared and the static library + install( +@@ -275,23 +252,16 @@ install( + FILES_MATCHING PATTERN "*.h" + ) + +-# since shared and static libraries can be requested for the build at the same time, +-# we need a default one to use for tests and examples. +-# the static library is preferred to the shared library, because it is OFF by default. +-if (BUILD_STATIC_LIB) +- set(DEFAULT_LIBRARY_FOR_TESTS_AND_EXAMPLES ${STATIC_LIBRARY_NAME}) +-else () +- set(DEFAULT_LIBRARY_FOR_TESTS_AND_EXAMPLES ${SHARED_LIBRARY_NAME}) +-endif () ++set(DEFAULT_LIBRARY_FOR_TESTS_AND_EXAMPLES ${PROJECT_NAME}) + + if (BUILD_TESTS) +- set(LIBRARY_FOR_TESTS ${DEFAULT_LIBRARY_FOR_TESTS_AND_EXAMPLES}) ++ set(LIBRARY_FOR_TESTS ${PROJECT_NAME}) + + add_subdirectory(hazelcast/test) + endif () + + if (BUILD_EXAMPLES) +- set(LIBRARY_FOR_EXAMPLES ${DEFAULT_LIBRARY_FOR_TESTS_AND_EXAMPLES}) ++ set(LIBRARY_FOR_EXAMPLES ${PROJECT_NAME}) + + add_subdirectory(examples) + endif () +diff --git a/cmake/config.cmake.in b/cmake/config.cmake.in +index 4f7e5d8dd4..b85e31051c 100644 +--- a/cmake/config.cmake.in ++++ b/cmake/config.cmake.in +@@ -8,10 +8,10 @@ if (@WITH_OPENSSL@) + find_dependency(OpenSSL) + endif() + +-include(${CMAKE_CURRENT_LIST_DIR}/@name@-targets.cmake) ++include(${CMAKE_CURRENT_LIST_DIR}/hazelcast-cpp-client-targets.cmake) + +-set_and_check(@name@_INCLUDE_DIRS @PACKAGE_INCLUDE_INSTALL_DIR@) +-set_and_check(@name@_LIBRARY_DIRS @PACKAGE_LIBRARY_INSTALL_DIR@) +-set(@name@_LIBRARIES hazelcast::@name@) ++set_and_check(hazelcast-cpp-client_INCLUDE_DIRS @PACKAGE_INCLUDE_INSTALL_DIR@) ++set_and_check(hazelcast-cpp-client_LIBRARY_DIRS @PACKAGE_LIBRARY_INSTALL_DIR@) ++set(hazelcast-cpp-client_LIBRARIES hazelcast-cpp-client::hazelcast-cpp-client) + +-check_required_components(@name@) ++check_required_components(hazelcast-cpp-client) diff --git a/ports/hazelcast-cpp-client/portfile.cmake b/ports/hazelcast-cpp-client/portfile.cmake new file mode 100644 index 00000000000000..d1649251f64c9e --- /dev/null +++ b/ports/hazelcast-cpp-client/portfile.cmake @@ -0,0 +1,31 @@ +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO hazelcast/hazelcast-cpp-client + REF v4.0.0 + SHA512 fe58db4356eded6b433c21314586de4284d538e29cbcd979da141377432756d71f13224be1e07a12317dc8bf202791ad68c02c730dfd066a178d33278620dd26 + HEAD_REF master + PATCHES + fix-cmake-targets.patch +) + +vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS + openssl WITH_OPENSSL + example BUILD_EXAMPLES +) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA + OPTIONS ${FEATURE_OPTIONS} +) + +vcpkg_install_cmake() + +vcpkg_copy_pdbs() + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) + +vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/${HZ_LIB_NAME}) + +# Handle copyright +file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) \ No newline at end of file diff --git a/ports/hazelcast-cpp-client/vcpkg.json b/ports/hazelcast-cpp-client/vcpkg.json new file mode 100644 index 00000000000000..93b444708e4427 --- /dev/null +++ b/ports/hazelcast-cpp-client/vcpkg.json @@ -0,0 +1,29 @@ +{ + "name": "hazelcast-cpp-client", + "version-string": "4.0.0", + "description": "C++ client library for Hazelcast in-memory database.", + "homepage": "https://github.com/hazelcast/hazelcast-cpp-client", + "documentation": "http://hazelcast.github.io/hazelcast-cpp-client/index.html", + "dependencies": [ + "boost-any", + "boost-asio", + "boost-chrono", + "boost-format", + "boost-optional", + "boost-property-tree", + "boost-system", + "boost-thread", + "boost-uuid" + ], + "features": { + "example": { + "description": "Build examples for Hazelcast C++ client" + }, + "openssl": { + "description": "Build hazelcast C++ client with SSL support", + "dependencies": [ + "openssl" + ] + } + } +} From 9cbb6cf20d87eb9f7e96413b1f846d5815e7704a Mon Sep 17 00:00:00 2001 From: ihsandemir Date: Tue, 16 Feb 2021 19:03:26 +0300 Subject: [PATCH 2/8] Fixed the patch (The generated cmake files destination is corrected.) --- ports/hazelcast-cpp-client/fix-cmake-targets.patch | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ports/hazelcast-cpp-client/fix-cmake-targets.patch b/ports/hazelcast-cpp-client/fix-cmake-targets.patch index 97abe7301b8f17..57c8eacb1c9d29 100644 --- a/ports/hazelcast-cpp-client/fix-cmake-targets.patch +++ b/ports/hazelcast-cpp-client/fix-cmake-targets.patch @@ -159,7 +159,7 @@ index 6e0e99ae69..b8b425fd84 100644 + EXPORT ${PROJECT_NAME}-targets + FILE ${PROJECT_NAME}-targets.cmake + NAMESPACE ${PROJECT_NAME}:: -+ DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake ++ DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME} ) # configure -config-version.cmake file @@ -176,7 +176,7 @@ index 6e0e99ae69..b8b425fd84 100644 - ${name}-config.cmake - INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${name} + ${PROJECT_NAME}-config.cmake -+ INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake ++ INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME} PATH_VARS INCLUDE_INSTALL_DIR LIBRARY_INSTALL_DIR ) @@ -188,7 +188,7 @@ index 6e0e99ae69..b8b425fd84 100644 - DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${name} + ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake + ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake -+ DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake ++ DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME} ) endfunction() From 52229c4a9c9e6f71b8ab307b8aacb31bfad647c8 Mon Sep 17 00:00:00 2001 From: ihsandemir Date: Thu, 18 Feb 2021 00:05:14 +0300 Subject: [PATCH 3/8] Updated the patch. see https://github.com/hazelcast/hazelcast-cpp-client/pull/812 --- .../fix-cmake-targets.patch | 326 +++++++++++++++++- ports/hazelcast-cpp-client/portfile.cmake | 2 +- 2 files changed, 315 insertions(+), 13 deletions(-) diff --git a/ports/hazelcast-cpp-client/fix-cmake-targets.patch b/ports/hazelcast-cpp-client/fix-cmake-targets.patch index 57c8eacb1c9d29..767b3ffbbc88f3 100644 --- a/ports/hazelcast-cpp-client/fix-cmake-targets.patch +++ b/ports/hazelcast-cpp-client/fix-cmake-targets.patch @@ -1,8 +1,8 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt -index 6e0e99ae69..b8b425fd84 100644 +index 6e0e99ae69..4a12498aef 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -56,10 +56,6 @@ option(WITH_OPENSSL +@@ -56,11 +56,7 @@ option(WITH_OPENSSL "Build with OpenSSL. Setting this option to ON enables SSL-related features." OFF) @@ -10,9 +10,11 @@ index 6e0e99ae69..b8b425fd84 100644 - "Build static library." - OFF) - - option(BUILD_SHARED_LIB +-option(BUILD_SHARED_LIB ++option(BUILD_SHARED_LIBS "Build shared library." ON) + @@ -76,12 +72,6 @@ option(BUILD_EXAMPLES "Build examples." OFF) @@ -209,9 +211,10 @@ index 6e0e99ae69..b8b425fd84 100644 -endif() - -# add shared library if requested -+# add library - if (BUILD_SHARED_LIB) +-if (BUILD_SHARED_LIB) - add_hazelcast_library(${SHARED_LIBRARY_NAME} SHARED) ++# add library ++if (BUILD_SHARED_LIBS) + set(LIB_TYPE SHARED) +else() + set(LIB_TYPE STATIC) @@ -221,7 +224,7 @@ index 6e0e99ae69..b8b425fd84 100644 # install header files, this applies both to the shared and the static library install( -@@ -275,23 +252,16 @@ install( +@@ -275,23 +252,10 @@ install( FILES_MATCHING PATTERN "*.h" ) @@ -233,21 +236,117 @@ index 6e0e99ae69..b8b425fd84 100644 -else () - set(DEFAULT_LIBRARY_FOR_TESTS_AND_EXAMPLES ${SHARED_LIBRARY_NAME}) -endif () -+set(DEFAULT_LIBRARY_FOR_TESTS_AND_EXAMPLES ${PROJECT_NAME}) - +- if (BUILD_TESTS) - set(LIBRARY_FOR_TESTS ${DEFAULT_LIBRARY_FOR_TESTS_AND_EXAMPLES}) -+ set(LIBRARY_FOR_TESTS ${PROJECT_NAME}) - +- add_subdirectory(hazelcast/test) endif () if (BUILD_EXAMPLES) - set(LIBRARY_FOR_EXAMPLES ${DEFAULT_LIBRARY_FOR_TESTS_AND_EXAMPLES}) -+ set(LIBRARY_FOR_EXAMPLES ${PROJECT_NAME}) - +- add_subdirectory(examples) endif () +diff --git a/README.md b/README.md +index 664b66da20..6f46b216ad 100644 +--- a/README.md ++++ b/README.md +@@ -252,18 +252,17 @@ You can provide additional configuration options using the `-DVARIABLE=VALUE` sy + Here are all the options that are supported: + * `WITH_OPENSSL` : Set to `ON` to build the library with SSL support. + This will require [OpenSSL](https://www.openssl.org) to be installed on your system. The default is `OFF`. +-* `BUILD_STATIC_LIB` : Set to `ON` or `OFF` depending on whether you want the static library. The default is `OFF`. +-* `BUILD_SHARED_LIB` : Set to `ON` or `OFF` depending on whether you want the shared library. The default is `ON`. ++* `BUILD_SHARED_LIBS` : Set to `ON` or `OFF` depending on whether you want the shared(ON) or static(OFF) library. The default is `ON`. + * `DISABLE_LOGGING` : Setting this option to `ON` disables logging. The default is `OFF`. + + ##### 1.1.5.2.1 Example Configuration Commands + Build only the static library with SSL support: + ```sh +-cmake .. -DWITH_OPENSSL=ON -DBUILD_SHARED_LIB=OFF -DBUILD_STATIC_LIB=ON ++cmake .. -DWITH_OPENSSL=ON -DBUILD_SHARED_LIBS=OFF + ``` +-Build both the shared and static library without SSL support: ++Build both the shared library without SSL support: + ```sh +-cmake .. -DWITH_OPENSSL=OFF -DBUILD_SHARED_LIB=ON -DBUILD_STATIC_LIB=ON ++cmake .. -DWITH_OPENSSL=OFF + ``` + + ## 1.2. Starting Hazelcast IMDG Cluster +@@ -354,22 +353,17 @@ If you are not, then read the instructions specific to your platform: + A Hazelcast IMDG C++ client installation comes with package configuration files for CMake. + If your project is using CMake, you can easily find and link against the client library: + ```cmake +-find_package(hazelcastcxx) ++find_package(hazelcast-cpp-client CONFIG REQUIRED) + +-target_link_libraries(mytarget PUBLIC hazelcast::hazelcastcxx) +-``` +- +-The package name depends on the specific library type you want to use. +-Options are `hazelcastcxx`, `hazelcastcxx_ssl`, `hazelcastcxx_static`, and `hazelcastcxx_ssl_static`. ++target_link_libraries(mytarget PRIVATE hazelcast-cpp-client) ++``` + + Make sure you add the installation prefix of the client library to `CMAKE_PREFIX_PATH` + if you are using a custom installation location. + + #### 1.3.2. Linux and MacOS Users +-You can pass the `-lhazelcastcxx` or `-lhazelcastcxx_ssl` option to the compiler to link against ++You can pass the `-lhazelcast-cpp-client` option to the compiler to link against + the client library. The name of library depends on how it was configured during build time. +-If the library was built with `-DWITH_OPENSSL=ON`, then the name is `hazelcastcxx_ssl`. +-If it was built with `-DWITH_OPENSSL=OFF`, then the name is `hazelcastcxx`. + + The client library depends on Boost.Thread and Boost.Chrono. + You should also link your program against these libraries using `-lboost_thread` and `-lboost_chrono`. +@@ -381,7 +375,7 @@ Here is how you can compile an example from the examples directory: + g++ -std=c++11 \ + examples/path/to/example.cpp \ + -DBOOST_THREAD_VERSION=5 \ +- -lhazelcastcxx -lboost_thread -lboost_chrono ++ -lhazelcast-cpp-client -lboost_thread -lboost_chrono + ``` + + If a custom installation directory was used during installation, then you may also need to use the `-L` and `-I` +@@ -390,7 +384,7 @@ options to add the library and include paths to the compiler's search path. + g++ -std=c++11 \ + examples/path/to/example.cpp \ + -I /path/to/install/include -L /path/to/install/lib \ +- -lhazelcastcxx -lboost_thread -lboost_chrono ++ -lhazelcast-cpp-client -lboost_thread -lboost_chrono + ``` + + #### 1.3.3. Windows Users +@@ -402,7 +396,7 @@ for necessary features such as futures and future continuations to be enabled. + The following is a command that can be used to compile an example from the examples directory. + ```bat + cl.exe path\to\example.cpp ^ +- C:\path\to\hazelcast\lib\hazelcastcxx.lib ^ ++ C:\path\to\hazelcast\lib\hazelcast-cpp-client.lib ^ + C:\path\to\boost\lib\boost_thread.lib C:\path\to\boost\lib\boost_chrono.lib ^ + /EHsc /DBOOST_THREAD_VERSION=5 ^ + /I C:\path\to\hazelcast\include /I C:\path\to\boost\include +@@ -596,7 +590,7 @@ Let's manipulate a distributed map on a cluster using the client. + Save the following file as `IT.cpp` and compile it using a command similar to the following (Linux g++ compilation is used for demonstration): + + ```C++ +-g++ IT.cpp -o IT -lhazelcastcxx -lboost_thread -lboost_chrono -DBOOST_THREAD_VERSION=5 ++g++ IT.cpp -o IT -lhazelcast-cpp-client -lboost_thread -lboost_chrono -DBOOST_THREAD_VERSION=5 + ``` + Then, you can run the application using the following command: + +@@ -651,7 +645,7 @@ Now create a `Sales.cpp` file, compile and run it as shown below. + **Compile:** + + ```C++ +-g++ Sales.cpp -o Sales -lhazelcastcxx -lboost_thread -lboost_chrono -DBOOST_THREAD_VERSION=5 ++g++ Sales.cpp -o Sales -lhazelcast-cpp-client -lboost_thread -lboost_chrono -DBOOST_THREAD_VERSION=5 + ``` + **Run** + diff --git a/cmake/config.cmake.in b/cmake/config.cmake.in index 4f7e5d8dd4..b85e31051c 100644 --- a/cmake/config.cmake.in @@ -268,3 +367,206 @@ index 4f7e5d8dd4..b85e31051c 100644 -check_required_components(@name@) +check_required_components(hazelcast-cpp-client) +diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt +index 69ffd61611..c11cf9ca7c 100644 +--- a/examples/CMakeLists.txt ++++ b/examples/CMakeLists.txt +@@ -25,24 +25,18 @@ project (hazelcast-cpp-client-examples + set(CMAKE_CXX_STANDARD 11) + set(CMAKE_CXX_STANDARD_REQUIRED ON) + +-if (NOT LIBRARY_FOR_EXAMPLES) +- message(FATAL_ERROR "Specify LIBRARY_FOR_EXAMPLES") +-endif() +- +-if (NOT TARGET ${LIBRARY_FOR_EXAMPLES}) +- message(STATUS "${LIBRARY_FOR_EXAMPLES} is not a valid target, using find_package to find it.") +- find_package(${LIBRARY_FOR_EXAMPLES} REQUIRED) +- # the found target will have the namespace hazelcast:: +- set(LIBRARY_FOR_EXAMPLES hazelcast::${LIBRARY_FOR_EXAMPLES}) ++if (NOT TARGET hazelcast-cpp-client) ++ message(STATUS "hazelcast-cpp-client is not a valid target, using find_package to find it.") ++ find_package(hazelcast-cpp-client REQUIRED) ++ link_libraries(hazelcast-cpp-client::hazelcast-cpp-client) # TODO find a better way to do this ++else() ++ link_libraries(hazelcast-cpp-client) # TODO find a better way to do this + endif() + + if (MSVC) + add_compile_options(/bigobj) + endif() + +-message(STATUS "Examples will be built with ${LIBRARY_FOR_EXAMPLES}") +-link_libraries(${LIBRARY_FOR_EXAMPLES}) # TODO find a better way to do this +- + add_subdirectory(transactions) + add_subdirectory(spi) + add_subdirectory(serialization) +@@ -64,7 +58,7 @@ add_subdirectory(authentication) + add_subdirectory(cp) + add_subdirectory(soak-test) + +-if (${LIBRARY_FOR_EXAMPLES} MATCHES "_ssl") ++if (${WITH_OPENSSL}) + add_subdirectory(tls) + add_subdirectory(aws) + endif () +diff --git a/hazelcast/test/src/CMakeLists.txt b/hazelcast/test/src/CMakeLists.txt +index fd8c5c727e..fac75ce99c 100644 +--- a/hazelcast/test/src/CMakeLists.txt ++++ b/hazelcast/test/src/CMakeLists.txt +@@ -7,8 +7,7 @@ set(GOOGLETEST_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/hazelcast/test/googletest/googlet + + add_executable(client_test ${HZ_TEST_SOURCES} ${HZ_TEST_HEADERS}) + +-message(STATUS "${LIBRARY_FOR_TESTS} will be tested.") +-target_link_libraries(client_test PRIVATE ${LIBRARY_FOR_TESTS} gtest) ++target_link_libraries(client_test PRIVATE hazelcast-cpp-client gtest) + + IF (${CMAKE_SYSTEM_NAME} MATCHES "Linux") + find_package(Thrift QUIET) +diff --git a/hazelcast/test/src/HazelcastTests1.cpp b/hazelcast/test/src/HazelcastTests1.cpp +index 884d6f9479..0c401d6392 100644 +--- a/hazelcast/test/src/HazelcastTests1.cpp ++++ b/hazelcast/test/src/HazelcastTests1.cpp +@@ -488,7 +488,7 @@ namespace hazelcast { + static void SetUpTestCase() { + instance = new HazelcastServer(*g_srvFactory); + client = new hazelcast_client{new_client(get_config()).get()}; +- client2 = new hazelcast_client{new_client(std::move(get_config())).get()}; ++ client2 = new hazelcast_client{new_client(get_config()).get()}; + } + + static void TearDownTestCase() { +diff --git a/hazelcast/test/src/HazelcastTests3.cpp b/hazelcast/test/src/HazelcastTests3.cpp +index c5bd444ba6..1143a9b95b 100644 +--- a/hazelcast/test/src/HazelcastTests3.cpp ++++ b/hazelcast/test/src/HazelcastTests3.cpp +@@ -606,7 +606,7 @@ namespace hazelcast { + instance1 = new HazelcastServer(*g_srvFactory); + instance2 = new HazelcastServer(*g_srvFactory); + client = new hazelcast_client{new_client(get_config()).get()}; +- client2 = new hazelcast_client{new_client(std::move(get_config())).get()}; ++ client2 = new hazelcast_client{new_client(get_config()).get()}; + } + + static void TearDownTestCase() { +@@ -820,7 +820,7 @@ namespace hazelcast { + + void create_no_near_cache_context() { + client_ = std::unique_ptr( +- new hazelcast_client{new_client(std::move(get_config())).get()}); ++ new hazelcast_client{new_client(get_config()).get()}); + no_near_cache_map_ = client_->get_replicated_map(get_test_name()).get(); + } + +diff --git a/hazelcast/test/src/HazelcastTests8.cpp b/hazelcast/test/src/HazelcastTests8.cpp +index 7de0a313bc..6a7d234022 100644 +--- a/hazelcast/test/src/HazelcastTests8.cpp ++++ b/hazelcast/test/src/HazelcastTests8.cpp +@@ -248,7 +248,7 @@ namespace hazelcast { + + void create_no_near_cache_context() { + client_ = std::unique_ptr( +- new hazelcast_client{new_client(std::move(get_config())).get()}); ++ new hazelcast_client{new_client(get_config()).get()}); + no_near_cache_map_ = client_->get_map(get_test_name()).get(); + } + +diff --git a/scripts/do-all-unix.sh b/scripts/do-all-unix.sh +index 19d18d61cb..36f689bdef 100755 +--- a/scripts/do-all-unix.sh ++++ b/scripts/do-all-unix.sh +@@ -24,20 +24,16 @@ fi + + DESTINATION=$(pwd)/destination + +-# set BUILD_STATIC_LIB and BUILD_SHARED_LIB depending on LIBRARY_TYPE +-BUILD_STATIC_LIB=OFF +-BUILD_SHARED_LIB=OFF +-if [ "$LIBRARY_TYPE" == "SHARED" ]; then +- BUILD_SHARED_LIB=ON; +-elif [ "$LIBRARY_TYPE" == "STATIC" ]; then +- BUILD_STATIC_LIB=ON; ++# set BUILD_SHARED_LIBS depending on LIBRARY_TYPE ++BUILD_SHARED_LIBS=ON ++if [ "$LIBRARY_TYPE" == "STATIC" ]; then ++ BUILD_SHARED_LIBS=OFF; + fi + + ./scripts/build-unix.sh \ + -DCMAKE_BUILD_TYPE=$BUILD_TYPE \ + -DCMAKE_INSTALL_PREFIX=$DESTINATION \ +- -DBUILD_STATIC_LIB=$BUILD_STATIC_LIB \ +- -DBUILD_SHARED_LIB=$BUILD_SHARED_LIB \ ++ -DBUILD_SHARED_LIBS=$BUILD_SHARED_LIBS \ + -DWITH_OPENSSL=$WITH_OPENSSL \ + -DBUILD_TESTS=ON \ + -DBUILD_EXAMPLES=OFF +@@ -53,16 +49,5 @@ fi + + export BUILD_DIR=build-examples + +-# compute the library name depending on the parameters +-# hazelcastcxx, hazelcastcxx_ssl_static, hazecast_static etc. +-LIBRARY_FOR_EXAMPLES="hazelcastcxx" +-if [ "$WITH_OPENSSL" == "ON" ]; then +- LIBRARY_FOR_EXAMPLES="${LIBRARY_FOR_EXAMPLES}_ssl" +-fi +-if [ "$LIBRARY_TYPE" == "STATIC" ]; then +- LIBRARY_FOR_EXAMPLES="${LIBRARY_FOR_EXAMPLES}_static" +-fi +- + ./scripts/verify-installation-unix.sh \ +- -DCMAKE_PREFIX_PATH=$DESTINATION \ +- -DLIBRARY_FOR_EXAMPLES=$LIBRARY_FOR_EXAMPLES ++ -DCMAKE_PREFIX_PATH=$DESTINATION -DWITH_OPENSSL=$WITH_OPENSSL +diff --git a/scripts/do-all-windows.bat b/scripts/do-all-windows.bat +index 6eb9ccdc6f..73599b3835 100644 +--- a/scripts/do-all-windows.bat ++++ b/scripts/do-all-windows.bat +@@ -13,21 +13,16 @@ set BUILD_CONFIGURATION=%BUILD_TYPE% + + set DESTINATION=%cd%\destination + +-@REM set BUILD_STATIC_LIB and BUILD_SHARED_LIB depending on LIBRARY_TYPE +-set BUILD_STATIC_LIB=OFF +-set BUILD_SHARED_LIB=OFF +-if "%LIBRARY_TYPE%" == "SHARED" ( +- set BUILD_SHARED_LIB=ON +-) ++@REM set BUILD_SHARED_LIBS depending on LIBRARY_TYPE ++set BUILD_SHARED_LIBS=ON + if "%LIBRARY_TYPE%" == "STATIC" ( +- set BUILD_STATIC_LIB=ON ++ set BUILD_SHARED_LIBS=OFF + ) + + call .\scripts\build-windows.bat ^ + -DCMAKE_CONFIGURATION_TYPES=%BUILD_TYPE% ^ + -DCMAKE_INSTALL_PREFIX=%DESTINATION% ^ +- -DBUILD_STATIC_LIB=%BUILD_STATIC_LIB% ^ +- -DBUILD_SHARED_LIB=%BUILD_SHARED_LIB% ^ ++ -DBUILD_SHARED_LIBS=%BUILD_SHARED_LIBS% ^ + -DWITH_OPENSSL=%WITH_OPENSSL% ^ + -DBUILD_TESTS=ON ^ + -DBUILD_EXAMPLES=OFF ^ +@@ -37,17 +32,7 @@ call .\scripts\test-windows.bat || exit /b 1 + + set BUILD_DIR=build-examples + +-@REM compute the library name depending on the parameters +-@REM hazelcastcxx, hazelcastcxx_ssl_static, hazecast_static etc. +-set LIBRARY_FOR_EXAMPLES=hazelcastcxx +-if "%WITH_OPENSSL%" == "ON" ( +- set LIBRARY_FOR_EXAMPLES=%LIBRARY_FOR_EXAMPLES%_ssl +-) +-if "%LIBRARY_TYPE%" == "STATIC" ( +- set LIBRARY_FOR_EXAMPLES=%LIBRARY_FOR_EXAMPLES%_static +-) +- + call .\scripts\verify-installation-windows.bat ^ + -DCMAKE_PREFIX_PATH=%DESTINATION% ^ +- -DLIBRARY_FOR_EXAMPLES=%LIBRARY_FOR_EXAMPLES% ^ ++ -DWITH_OPENSSL=%WITH_OPENSSL% ^ + || exit /b 1 diff --git a/ports/hazelcast-cpp-client/portfile.cmake b/ports/hazelcast-cpp-client/portfile.cmake index d1649251f64c9e..c737ce5654ac60 100644 --- a/ports/hazelcast-cpp-client/portfile.cmake +++ b/ports/hazelcast-cpp-client/portfile.cmake @@ -25,7 +25,7 @@ vcpkg_copy_pdbs() file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) -vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/${HZ_LIB_NAME}) +vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/hazelcast-cpp-client) # Handle copyright file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) \ No newline at end of file From 92482910ad41528c67337dd5f13bc165e6c1549b Mon Sep 17 00:00:00 2001 From: ihsandemir Date: Thu, 18 Feb 2021 14:07:27 +0300 Subject: [PATCH 4/8] Disable uwp support. --- ports/hazelcast-cpp-client/vcpkg.json | 1 + 1 file changed, 1 insertion(+) diff --git a/ports/hazelcast-cpp-client/vcpkg.json b/ports/hazelcast-cpp-client/vcpkg.json index 93b444708e4427..6ec28de28590a0 100644 --- a/ports/hazelcast-cpp-client/vcpkg.json +++ b/ports/hazelcast-cpp-client/vcpkg.json @@ -4,6 +4,7 @@ "description": "C++ client library for Hazelcast in-memory database.", "homepage": "https://github.com/hazelcast/hazelcast-cpp-client", "documentation": "http://hazelcast.github.io/hazelcast-cpp-client/index.html", + "supports": "!uwp", "dependencies": [ "boost-any", "boost-asio", From 410061dc339b4ad863e4646a2b40c4336dffac1c Mon Sep 17 00:00:00 2001 From: ihsandemir Date: Fri, 19 Feb 2021 12:22:22 +0300 Subject: [PATCH 5/8] Added the missing version file for hazelcast-cpp-client. --- versions/baseline.json | 4 ++++ versions/h-/hazelcast-cpp-client.json | 9 +++++++++ 2 files changed, 13 insertions(+) create mode 100644 versions/h-/hazelcast-cpp-client.json diff --git a/versions/baseline.json b/versions/baseline.json index 3b21c70d6dcce7..c74f315dd288dc 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -2376,6 +2376,10 @@ "baseline": "2019-08-10", "port-version": 0 }, + "hazelcast-cpp-client": { + "baseline": "4.0.0", + "port-version": 0 + }, "hdf5": { "baseline": "1.12.0", "port-version": 0 diff --git a/versions/h-/hazelcast-cpp-client.json b/versions/h-/hazelcast-cpp-client.json new file mode 100644 index 00000000000000..e03fde68cfc5ea --- /dev/null +++ b/versions/h-/hazelcast-cpp-client.json @@ -0,0 +1,9 @@ +{ + "versions": [ + { + "git-tree": "eed8eb57211b9ef3e2df9d7e33e9d5fa5cf06199", + "version-string": "4.0.0", + "port-version": 0 + } + ] +} From e64346ea8f2fbf7b4dd06768cde039e17f128877 Mon Sep 17 00:00:00 2001 From: Robert Schumacher Date: Fri, 19 Feb 2021 12:56:28 -0800 Subject: [PATCH 6/8] [hazelcast-cpp-client] Avoid checking in large patch file --- .../fix-cmake-targets.patch | 572 ------------------ ports/hazelcast-cpp-client/portfile.cmake | 10 +- ports/hazelcast-cpp-client/vcpkg.json | 4 +- versions/h-/hazelcast-cpp-client.json | 4 +- 4 files changed, 8 insertions(+), 582 deletions(-) delete mode 100644 ports/hazelcast-cpp-client/fix-cmake-targets.patch diff --git a/ports/hazelcast-cpp-client/fix-cmake-targets.patch b/ports/hazelcast-cpp-client/fix-cmake-targets.patch deleted file mode 100644 index 767b3ffbbc88f3..00000000000000 --- a/ports/hazelcast-cpp-client/fix-cmake-targets.patch +++ /dev/null @@ -1,572 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 6e0e99ae69..4a12498aef 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -56,11 +56,7 @@ option(WITH_OPENSSL - "Build with OpenSSL. Setting this option to ON enables SSL-related features." - OFF) - --option(BUILD_STATIC_LIB -- "Build static library." -- OFF) -- --option(BUILD_SHARED_LIB -+option(BUILD_SHARED_LIBS - "Build shared library." - ON) - -@@ -76,12 +72,6 @@ option(BUILD_EXAMPLES - "Build examples." - OFF) - --# exit with an error message if none of BUILD_SHARED_LIB and BUILD_STATIC_LIB was set. --if ((NOT BUILD_SHARED_LIB) AND (NOT BUILD_STATIC_LIB)) -- message(FATAL_ERROR -- "Set at least one of BUILD_SHARED_LIB and BUILD_STATIC_LIB to ON.") --endif () -- - # find dependencies - - # find Threads -@@ -103,17 +93,17 @@ if (WITH_OPENSSL) - endif () - - --function(add_hazelcast_library name type) -+function(add_hazelcast_library type) - # add the library target - add_library( -- ${name} -+ ${PROJECT_NAME} - ${type} - ${SOURCE_FILES} ${HEADER_FILES} - ) - - # set library's version and soversion - set_target_properties( -- ${name} -+ ${PROJECT_NAME} - PROPERTIES - VERSION ${PROJECT_VERSION} - SOVERSION ${PROJECT_VERSION} -@@ -121,21 +111,21 @@ function(add_hazelcast_library name type) - - # library requires c++11 - target_compile_features( -- ${name} -+ ${PROJECT_NAME} - PUBLIC cxx_std_11 - ) - - # links the library against the system's thread library -- target_link_libraries(${name} PUBLIC Threads::Threads) -+ target_link_libraries(${PROJECT_NAME} PUBLIC Threads::Threads) - - # add Boost::thread and Boost::chrono as dependencies - target_link_libraries( -- ${name} -+ ${PROJECT_NAME} - PUBLIC Boost::boost Boost::thread Boost::chrono - ) - # set the Boost thread version - target_compile_definitions( -- ${name} -+ ${PROJECT_NAME} - PUBLIC BOOST_THREAD_VERSION=5 - ) - -@@ -143,26 +133,26 @@ function(add_hazelcast_library name type) - # Both we and the user defines HZ_BUILD_WITH_SSL. - if (WITH_OPENSSL) - target_compile_definitions( -- ${name} -+ ${PROJECT_NAME} - PUBLIC HZ_BUILD_WITH_SSL - ) -- target_link_libraries(${name} PUBLIC OpenSSL::SSL OpenSSL::Crypto) -+ target_link_libraries(${PROJECT_NAME} PUBLIC OpenSSL::SSL OpenSSL::Crypto) - endif() - - # MSVC-specific compiler flags - if (MSVC) -- target_compile_options(${name} PRIVATE /bigobj) -+ target_compile_options(${PROJECT_NAME} PRIVATE /bigobj) - endif () - - # windows-specific compile flags - if (WIN32) - # speeds the build process -- target_compile_definitions(${name} PRIVATE WIN32_LEAN_AND_MEAN) -+ target_compile_definitions(${PROJECT_NAME} PRIVATE WIN32_LEAN_AND_MEAN) - endif () - - # add include directories - target_include_directories( -- ${name} -+ ${PROJECT_NAME} - PUBLIC - $ - $ -@@ -172,7 +162,7 @@ function(add_hazelcast_library name type) - - # add compile flags for version and git commit information - target_compile_definitions( -- ${name} -+ ${PROJECT_NAME} - PRIVATE - HAZELCAST_VERSION="${PROJECT_VERSION}" - HAZELCAST_GIT_COMMIT_DATE=${GIT_COMMIT_DATE} -@@ -180,13 +170,13 @@ function(add_hazelcast_library name type) - ) - - if (DISABLE_LOGGING) -- target_compile_definitions(${name} PUBLIC HZ_LOGGING_DISABLED) -+ target_compile_definitions(${PROJECT_NAME} PUBLIC HZ_LOGGING_DISABLED) - endif () - -- set_target_properties(${name} PROPERTIES DEFINE_SYMBOL HAZELCAST_EXPORTS) -+ set_target_properties(${PROJECT_NAME} PROPERTIES DEFINE_SYMBOL HAZELCAST_EXPORTS) - - generate_export_header( -- ${name} -+ ${PROJECT_NAME} - BASE_NAME hazelcast - EXPORT_MACRO_NAME HAZELCAST_API - EXPORT_FILE_NAME include/hazelcast/util/export.h -@@ -195,13 +185,13 @@ function(add_hazelcast_library name type) - ) - - if (type STREQUAL "STATIC") -- target_compile_definitions(${name} PUBLIC HAZELCAST_USE_STATIC) -+ target_compile_definitions(${PROJECT_NAME} PUBLIC HAZELCAST_USE_STATIC) - endif() - - # install library target - install( -- TARGETS ${name} -- EXPORT ${name}-targets -+ TARGETS ${PROJECT_NAME} -+ EXPORT ${PROJECT_NAME}-targets - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} -@@ -210,15 +200,15 @@ function(add_hazelcast_library name type) - - # install the -targets.cmake file - install( -- EXPORT ${name}-targets -- FILE ${name}-targets.cmake -- NAMESPACE hazelcast:: -- DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${name} -+ EXPORT ${PROJECT_NAME}-targets -+ FILE ${PROJECT_NAME}-targets.cmake -+ NAMESPACE ${PROJECT_NAME}:: -+ DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME} - ) - - # configure -config-version.cmake file - write_basic_package_version_file( -- ${name}-config-version.cmake -+ ${PROJECT_NAME}-config-version.cmake - VERSION ${PROJECT_VERSION} - COMPATIBILITY SameMajorVersion - ) -@@ -228,41 +218,28 @@ function(add_hazelcast_library name type) - set(LIBRARY_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR}) - configure_package_config_file( - cmake/config.cmake.in -- ${name}-config.cmake -- INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${name} -+ ${PROJECT_NAME}-config.cmake -+ INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME} - PATH_VARS INCLUDE_INSTALL_DIR LIBRARY_INSTALL_DIR - ) - - # install -config.cmake and -config-version.cmake files - install( - FILES -- ${CMAKE_BINARY_DIR}/${name}-config.cmake -- ${CMAKE_BINARY_DIR}/${name}-config-version.cmake -- DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${name} -+ ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake -+ ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake -+ DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME} - ) - endfunction() - --# the base name for shared and static libraries --set(BASE_LIBRARY_NAME hazelcastcxx) --# add the _ssl suffix to the base name if building WITH_OPENSSL --if (WITH_OPENSSL) -- set(BASE_LIBRARY_NAME ${BASE_LIBRARY_NAME}_ssl) --endif() -- --# set the names for the shared and static libraries --set(SHARED_LIBRARY_NAME ${BASE_LIBRARY_NAME}) --set(STATIC_LIBRARY_NAME ${BASE_LIBRARY_NAME}_static) -- --# add static library if requested --if (BUILD_STATIC_LIB) -- add_hazelcast_library(${STATIC_LIBRARY_NAME} STATIC) --endif() -- --# add shared library if requested --if (BUILD_SHARED_LIB) -- add_hazelcast_library(${SHARED_LIBRARY_NAME} SHARED) -+# add library -+if (BUILD_SHARED_LIBS) -+ set(LIB_TYPE SHARED) -+else() -+ set(LIB_TYPE STATIC) - endif() - -+add_hazelcast_library(${LIB_TYPE}) - - # install header files, this applies both to the shared and the static library - install( -@@ -275,23 +252,10 @@ install( - FILES_MATCHING PATTERN "*.h" - ) - --# since shared and static libraries can be requested for the build at the same time, --# we need a default one to use for tests and examples. --# the static library is preferred to the shared library, because it is OFF by default. --if (BUILD_STATIC_LIB) -- set(DEFAULT_LIBRARY_FOR_TESTS_AND_EXAMPLES ${STATIC_LIBRARY_NAME}) --else () -- set(DEFAULT_LIBRARY_FOR_TESTS_AND_EXAMPLES ${SHARED_LIBRARY_NAME}) --endif () -- - if (BUILD_TESTS) -- set(LIBRARY_FOR_TESTS ${DEFAULT_LIBRARY_FOR_TESTS_AND_EXAMPLES}) -- - add_subdirectory(hazelcast/test) - endif () - - if (BUILD_EXAMPLES) -- set(LIBRARY_FOR_EXAMPLES ${DEFAULT_LIBRARY_FOR_TESTS_AND_EXAMPLES}) -- - add_subdirectory(examples) - endif () -diff --git a/README.md b/README.md -index 664b66da20..6f46b216ad 100644 ---- a/README.md -+++ b/README.md -@@ -252,18 +252,17 @@ You can provide additional configuration options using the `-DVARIABLE=VALUE` sy - Here are all the options that are supported: - * `WITH_OPENSSL` : Set to `ON` to build the library with SSL support. - This will require [OpenSSL](https://www.openssl.org) to be installed on your system. The default is `OFF`. --* `BUILD_STATIC_LIB` : Set to `ON` or `OFF` depending on whether you want the static library. The default is `OFF`. --* `BUILD_SHARED_LIB` : Set to `ON` or `OFF` depending on whether you want the shared library. The default is `ON`. -+* `BUILD_SHARED_LIBS` : Set to `ON` or `OFF` depending on whether you want the shared(ON) or static(OFF) library. The default is `ON`. - * `DISABLE_LOGGING` : Setting this option to `ON` disables logging. The default is `OFF`. - - ##### 1.1.5.2.1 Example Configuration Commands - Build only the static library with SSL support: - ```sh --cmake .. -DWITH_OPENSSL=ON -DBUILD_SHARED_LIB=OFF -DBUILD_STATIC_LIB=ON -+cmake .. -DWITH_OPENSSL=ON -DBUILD_SHARED_LIBS=OFF - ``` --Build both the shared and static library without SSL support: -+Build both the shared library without SSL support: - ```sh --cmake .. -DWITH_OPENSSL=OFF -DBUILD_SHARED_LIB=ON -DBUILD_STATIC_LIB=ON -+cmake .. -DWITH_OPENSSL=OFF - ``` - - ## 1.2. Starting Hazelcast IMDG Cluster -@@ -354,22 +353,17 @@ If you are not, then read the instructions specific to your platform: - A Hazelcast IMDG C++ client installation comes with package configuration files for CMake. - If your project is using CMake, you can easily find and link against the client library: - ```cmake --find_package(hazelcastcxx) -+find_package(hazelcast-cpp-client CONFIG REQUIRED) - --target_link_libraries(mytarget PUBLIC hazelcast::hazelcastcxx) --``` -- --The package name depends on the specific library type you want to use. --Options are `hazelcastcxx`, `hazelcastcxx_ssl`, `hazelcastcxx_static`, and `hazelcastcxx_ssl_static`. -+target_link_libraries(mytarget PRIVATE hazelcast-cpp-client) -+``` - - Make sure you add the installation prefix of the client library to `CMAKE_PREFIX_PATH` - if you are using a custom installation location. - - #### 1.3.2. Linux and MacOS Users --You can pass the `-lhazelcastcxx` or `-lhazelcastcxx_ssl` option to the compiler to link against -+You can pass the `-lhazelcast-cpp-client` option to the compiler to link against - the client library. The name of library depends on how it was configured during build time. --If the library was built with `-DWITH_OPENSSL=ON`, then the name is `hazelcastcxx_ssl`. --If it was built with `-DWITH_OPENSSL=OFF`, then the name is `hazelcastcxx`. - - The client library depends on Boost.Thread and Boost.Chrono. - You should also link your program against these libraries using `-lboost_thread` and `-lboost_chrono`. -@@ -381,7 +375,7 @@ Here is how you can compile an example from the examples directory: - g++ -std=c++11 \ - examples/path/to/example.cpp \ - -DBOOST_THREAD_VERSION=5 \ -- -lhazelcastcxx -lboost_thread -lboost_chrono -+ -lhazelcast-cpp-client -lboost_thread -lboost_chrono - ``` - - If a custom installation directory was used during installation, then you may also need to use the `-L` and `-I` -@@ -390,7 +384,7 @@ options to add the library and include paths to the compiler's search path. - g++ -std=c++11 \ - examples/path/to/example.cpp \ - -I /path/to/install/include -L /path/to/install/lib \ -- -lhazelcastcxx -lboost_thread -lboost_chrono -+ -lhazelcast-cpp-client -lboost_thread -lboost_chrono - ``` - - #### 1.3.3. Windows Users -@@ -402,7 +396,7 @@ for necessary features such as futures and future continuations to be enabled. - The following is a command that can be used to compile an example from the examples directory. - ```bat - cl.exe path\to\example.cpp ^ -- C:\path\to\hazelcast\lib\hazelcastcxx.lib ^ -+ C:\path\to\hazelcast\lib\hazelcast-cpp-client.lib ^ - C:\path\to\boost\lib\boost_thread.lib C:\path\to\boost\lib\boost_chrono.lib ^ - /EHsc /DBOOST_THREAD_VERSION=5 ^ - /I C:\path\to\hazelcast\include /I C:\path\to\boost\include -@@ -596,7 +590,7 @@ Let's manipulate a distributed map on a cluster using the client. - Save the following file as `IT.cpp` and compile it using a command similar to the following (Linux g++ compilation is used for demonstration): - - ```C++ --g++ IT.cpp -o IT -lhazelcastcxx -lboost_thread -lboost_chrono -DBOOST_THREAD_VERSION=5 -+g++ IT.cpp -o IT -lhazelcast-cpp-client -lboost_thread -lboost_chrono -DBOOST_THREAD_VERSION=5 - ``` - Then, you can run the application using the following command: - -@@ -651,7 +645,7 @@ Now create a `Sales.cpp` file, compile and run it as shown below. - **Compile:** - - ```C++ --g++ Sales.cpp -o Sales -lhazelcastcxx -lboost_thread -lboost_chrono -DBOOST_THREAD_VERSION=5 -+g++ Sales.cpp -o Sales -lhazelcast-cpp-client -lboost_thread -lboost_chrono -DBOOST_THREAD_VERSION=5 - ``` - **Run** - -diff --git a/cmake/config.cmake.in b/cmake/config.cmake.in -index 4f7e5d8dd4..b85e31051c 100644 ---- a/cmake/config.cmake.in -+++ b/cmake/config.cmake.in -@@ -8,10 +8,10 @@ if (@WITH_OPENSSL@) - find_dependency(OpenSSL) - endif() - --include(${CMAKE_CURRENT_LIST_DIR}/@name@-targets.cmake) -+include(${CMAKE_CURRENT_LIST_DIR}/hazelcast-cpp-client-targets.cmake) - --set_and_check(@name@_INCLUDE_DIRS @PACKAGE_INCLUDE_INSTALL_DIR@) --set_and_check(@name@_LIBRARY_DIRS @PACKAGE_LIBRARY_INSTALL_DIR@) --set(@name@_LIBRARIES hazelcast::@name@) -+set_and_check(hazelcast-cpp-client_INCLUDE_DIRS @PACKAGE_INCLUDE_INSTALL_DIR@) -+set_and_check(hazelcast-cpp-client_LIBRARY_DIRS @PACKAGE_LIBRARY_INSTALL_DIR@) -+set(hazelcast-cpp-client_LIBRARIES hazelcast-cpp-client::hazelcast-cpp-client) - --check_required_components(@name@) -+check_required_components(hazelcast-cpp-client) -diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt -index 69ffd61611..c11cf9ca7c 100644 ---- a/examples/CMakeLists.txt -+++ b/examples/CMakeLists.txt -@@ -25,24 +25,18 @@ project (hazelcast-cpp-client-examples - set(CMAKE_CXX_STANDARD 11) - set(CMAKE_CXX_STANDARD_REQUIRED ON) - --if (NOT LIBRARY_FOR_EXAMPLES) -- message(FATAL_ERROR "Specify LIBRARY_FOR_EXAMPLES") --endif() -- --if (NOT TARGET ${LIBRARY_FOR_EXAMPLES}) -- message(STATUS "${LIBRARY_FOR_EXAMPLES} is not a valid target, using find_package to find it.") -- find_package(${LIBRARY_FOR_EXAMPLES} REQUIRED) -- # the found target will have the namespace hazelcast:: -- set(LIBRARY_FOR_EXAMPLES hazelcast::${LIBRARY_FOR_EXAMPLES}) -+if (NOT TARGET hazelcast-cpp-client) -+ message(STATUS "hazelcast-cpp-client is not a valid target, using find_package to find it.") -+ find_package(hazelcast-cpp-client REQUIRED) -+ link_libraries(hazelcast-cpp-client::hazelcast-cpp-client) # TODO find a better way to do this -+else() -+ link_libraries(hazelcast-cpp-client) # TODO find a better way to do this - endif() - - if (MSVC) - add_compile_options(/bigobj) - endif() - --message(STATUS "Examples will be built with ${LIBRARY_FOR_EXAMPLES}") --link_libraries(${LIBRARY_FOR_EXAMPLES}) # TODO find a better way to do this -- - add_subdirectory(transactions) - add_subdirectory(spi) - add_subdirectory(serialization) -@@ -64,7 +58,7 @@ add_subdirectory(authentication) - add_subdirectory(cp) - add_subdirectory(soak-test) - --if (${LIBRARY_FOR_EXAMPLES} MATCHES "_ssl") -+if (${WITH_OPENSSL}) - add_subdirectory(tls) - add_subdirectory(aws) - endif () -diff --git a/hazelcast/test/src/CMakeLists.txt b/hazelcast/test/src/CMakeLists.txt -index fd8c5c727e..fac75ce99c 100644 ---- a/hazelcast/test/src/CMakeLists.txt -+++ b/hazelcast/test/src/CMakeLists.txt -@@ -7,8 +7,7 @@ set(GOOGLETEST_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/hazelcast/test/googletest/googlet - - add_executable(client_test ${HZ_TEST_SOURCES} ${HZ_TEST_HEADERS}) - --message(STATUS "${LIBRARY_FOR_TESTS} will be tested.") --target_link_libraries(client_test PRIVATE ${LIBRARY_FOR_TESTS} gtest) -+target_link_libraries(client_test PRIVATE hazelcast-cpp-client gtest) - - IF (${CMAKE_SYSTEM_NAME} MATCHES "Linux") - find_package(Thrift QUIET) -diff --git a/hazelcast/test/src/HazelcastTests1.cpp b/hazelcast/test/src/HazelcastTests1.cpp -index 884d6f9479..0c401d6392 100644 ---- a/hazelcast/test/src/HazelcastTests1.cpp -+++ b/hazelcast/test/src/HazelcastTests1.cpp -@@ -488,7 +488,7 @@ namespace hazelcast { - static void SetUpTestCase() { - instance = new HazelcastServer(*g_srvFactory); - client = new hazelcast_client{new_client(get_config()).get()}; -- client2 = new hazelcast_client{new_client(std::move(get_config())).get()}; -+ client2 = new hazelcast_client{new_client(get_config()).get()}; - } - - static void TearDownTestCase() { -diff --git a/hazelcast/test/src/HazelcastTests3.cpp b/hazelcast/test/src/HazelcastTests3.cpp -index c5bd444ba6..1143a9b95b 100644 ---- a/hazelcast/test/src/HazelcastTests3.cpp -+++ b/hazelcast/test/src/HazelcastTests3.cpp -@@ -606,7 +606,7 @@ namespace hazelcast { - instance1 = new HazelcastServer(*g_srvFactory); - instance2 = new HazelcastServer(*g_srvFactory); - client = new hazelcast_client{new_client(get_config()).get()}; -- client2 = new hazelcast_client{new_client(std::move(get_config())).get()}; -+ client2 = new hazelcast_client{new_client(get_config()).get()}; - } - - static void TearDownTestCase() { -@@ -820,7 +820,7 @@ namespace hazelcast { - - void create_no_near_cache_context() { - client_ = std::unique_ptr( -- new hazelcast_client{new_client(std::move(get_config())).get()}); -+ new hazelcast_client{new_client(get_config()).get()}); - no_near_cache_map_ = client_->get_replicated_map(get_test_name()).get(); - } - -diff --git a/hazelcast/test/src/HazelcastTests8.cpp b/hazelcast/test/src/HazelcastTests8.cpp -index 7de0a313bc..6a7d234022 100644 ---- a/hazelcast/test/src/HazelcastTests8.cpp -+++ b/hazelcast/test/src/HazelcastTests8.cpp -@@ -248,7 +248,7 @@ namespace hazelcast { - - void create_no_near_cache_context() { - client_ = std::unique_ptr( -- new hazelcast_client{new_client(std::move(get_config())).get()}); -+ new hazelcast_client{new_client(get_config()).get()}); - no_near_cache_map_ = client_->get_map(get_test_name()).get(); - } - -diff --git a/scripts/do-all-unix.sh b/scripts/do-all-unix.sh -index 19d18d61cb..36f689bdef 100755 ---- a/scripts/do-all-unix.sh -+++ b/scripts/do-all-unix.sh -@@ -24,20 +24,16 @@ fi - - DESTINATION=$(pwd)/destination - --# set BUILD_STATIC_LIB and BUILD_SHARED_LIB depending on LIBRARY_TYPE --BUILD_STATIC_LIB=OFF --BUILD_SHARED_LIB=OFF --if [ "$LIBRARY_TYPE" == "SHARED" ]; then -- BUILD_SHARED_LIB=ON; --elif [ "$LIBRARY_TYPE" == "STATIC" ]; then -- BUILD_STATIC_LIB=ON; -+# set BUILD_SHARED_LIBS depending on LIBRARY_TYPE -+BUILD_SHARED_LIBS=ON -+if [ "$LIBRARY_TYPE" == "STATIC" ]; then -+ BUILD_SHARED_LIBS=OFF; - fi - - ./scripts/build-unix.sh \ - -DCMAKE_BUILD_TYPE=$BUILD_TYPE \ - -DCMAKE_INSTALL_PREFIX=$DESTINATION \ -- -DBUILD_STATIC_LIB=$BUILD_STATIC_LIB \ -- -DBUILD_SHARED_LIB=$BUILD_SHARED_LIB \ -+ -DBUILD_SHARED_LIBS=$BUILD_SHARED_LIBS \ - -DWITH_OPENSSL=$WITH_OPENSSL \ - -DBUILD_TESTS=ON \ - -DBUILD_EXAMPLES=OFF -@@ -53,16 +49,5 @@ fi - - export BUILD_DIR=build-examples - --# compute the library name depending on the parameters --# hazelcastcxx, hazelcastcxx_ssl_static, hazecast_static etc. --LIBRARY_FOR_EXAMPLES="hazelcastcxx" --if [ "$WITH_OPENSSL" == "ON" ]; then -- LIBRARY_FOR_EXAMPLES="${LIBRARY_FOR_EXAMPLES}_ssl" --fi --if [ "$LIBRARY_TYPE" == "STATIC" ]; then -- LIBRARY_FOR_EXAMPLES="${LIBRARY_FOR_EXAMPLES}_static" --fi -- - ./scripts/verify-installation-unix.sh \ -- -DCMAKE_PREFIX_PATH=$DESTINATION \ -- -DLIBRARY_FOR_EXAMPLES=$LIBRARY_FOR_EXAMPLES -+ -DCMAKE_PREFIX_PATH=$DESTINATION -DWITH_OPENSSL=$WITH_OPENSSL -diff --git a/scripts/do-all-windows.bat b/scripts/do-all-windows.bat -index 6eb9ccdc6f..73599b3835 100644 ---- a/scripts/do-all-windows.bat -+++ b/scripts/do-all-windows.bat -@@ -13,21 +13,16 @@ set BUILD_CONFIGURATION=%BUILD_TYPE% - - set DESTINATION=%cd%\destination - --@REM set BUILD_STATIC_LIB and BUILD_SHARED_LIB depending on LIBRARY_TYPE --set BUILD_STATIC_LIB=OFF --set BUILD_SHARED_LIB=OFF --if "%LIBRARY_TYPE%" == "SHARED" ( -- set BUILD_SHARED_LIB=ON --) -+@REM set BUILD_SHARED_LIBS depending on LIBRARY_TYPE -+set BUILD_SHARED_LIBS=ON - if "%LIBRARY_TYPE%" == "STATIC" ( -- set BUILD_STATIC_LIB=ON -+ set BUILD_SHARED_LIBS=OFF - ) - - call .\scripts\build-windows.bat ^ - -DCMAKE_CONFIGURATION_TYPES=%BUILD_TYPE% ^ - -DCMAKE_INSTALL_PREFIX=%DESTINATION% ^ -- -DBUILD_STATIC_LIB=%BUILD_STATIC_LIB% ^ -- -DBUILD_SHARED_LIB=%BUILD_SHARED_LIB% ^ -+ -DBUILD_SHARED_LIBS=%BUILD_SHARED_LIBS% ^ - -DWITH_OPENSSL=%WITH_OPENSSL% ^ - -DBUILD_TESTS=ON ^ - -DBUILD_EXAMPLES=OFF ^ -@@ -37,17 +32,7 @@ call .\scripts\test-windows.bat || exit /b 1 - - set BUILD_DIR=build-examples - --@REM compute the library name depending on the parameters --@REM hazelcastcxx, hazelcastcxx_ssl_static, hazecast_static etc. --set LIBRARY_FOR_EXAMPLES=hazelcastcxx --if "%WITH_OPENSSL%" == "ON" ( -- set LIBRARY_FOR_EXAMPLES=%LIBRARY_FOR_EXAMPLES%_ssl --) --if "%LIBRARY_TYPE%" == "STATIC" ( -- set LIBRARY_FOR_EXAMPLES=%LIBRARY_FOR_EXAMPLES%_static --) -- - call .\scripts\verify-installation-windows.bat ^ - -DCMAKE_PREFIX_PATH=%DESTINATION% ^ -- -DLIBRARY_FOR_EXAMPLES=%LIBRARY_FOR_EXAMPLES% ^ -+ -DWITH_OPENSSL=%WITH_OPENSSL% ^ - || exit /b 1 diff --git a/ports/hazelcast-cpp-client/portfile.cmake b/ports/hazelcast-cpp-client/portfile.cmake index c737ce5654ac60..610c3574441b72 100644 --- a/ports/hazelcast-cpp-client/portfile.cmake +++ b/ports/hazelcast-cpp-client/portfile.cmake @@ -1,20 +1,18 @@ vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO hazelcast/hazelcast-cpp-client - REF v4.0.0 - SHA512 fe58db4356eded6b433c21314586de4284d538e29cbcd979da141377432756d71f13224be1e07a12317dc8bf202791ad68c02c730dfd066a178d33278620dd26 + REF 57ece8e82c4380472b4acff948db6a86ff0648b1 # v4.0.0 + fixes + SHA512 eb11677883f237e27562dfcd0f0e7e19ed439f8b0e13ca02942d2351b99ec54d4496cbaf8c3aaa08304b799f921641d51286bb7b7d4c6a0f1ff58cf954f3596f HEAD_REF master - PATCHES - fix-cmake-targets.patch ) vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS - openssl WITH_OPENSSL + openssl WITH_OPENSSL example BUILD_EXAMPLES ) vcpkg_configure_cmake( - SOURCE_PATH ${SOURCE_PATH} + SOURCE_PATH "${SOURCE_PATH}" PREFER_NINJA OPTIONS ${FEATURE_OPTIONS} ) diff --git a/ports/hazelcast-cpp-client/vcpkg.json b/ports/hazelcast-cpp-client/vcpkg.json index 6ec28de28590a0..e2b99fe7fa327e 100644 --- a/ports/hazelcast-cpp-client/vcpkg.json +++ b/ports/hazelcast-cpp-client/vcpkg.json @@ -1,11 +1,11 @@ { "name": "hazelcast-cpp-client", - "version-string": "4.0.0", + "version-semver": "4.0.0", "description": "C++ client library for Hazelcast in-memory database.", "homepage": "https://github.com/hazelcast/hazelcast-cpp-client", "documentation": "http://hazelcast.github.io/hazelcast-cpp-client/index.html", "supports": "!uwp", - "dependencies": [ + "$dependencies": [ "boost-any", "boost-asio", "boost-chrono", diff --git a/versions/h-/hazelcast-cpp-client.json b/versions/h-/hazelcast-cpp-client.json index e03fde68cfc5ea..46c928ce84c5a7 100644 --- a/versions/h-/hazelcast-cpp-client.json +++ b/versions/h-/hazelcast-cpp-client.json @@ -1,8 +1,8 @@ { "versions": [ { - "git-tree": "eed8eb57211b9ef3e2df9d7e33e9d5fa5cf06199", - "version-string": "4.0.0", + "git-tree": "7f12e0d5a4c3a3ff52d0b87531d315c03afd270c", + "version-semver": "4.0.0", "port-version": 0 } ] From 6f0ab2aa0171cf87065ddb9749eef268ade3b327 Mon Sep 17 00:00:00 2001 From: NancyLi1013 Date: Sat, 20 Feb 2021 01:51:32 -0800 Subject: [PATCH 7/8] Format vcpkg.json --- ports/hazelcast-cpp-client/vcpkg.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/hazelcast-cpp-client/vcpkg.json b/ports/hazelcast-cpp-client/vcpkg.json index e2b99fe7fa327e..1001c3d9724963 100644 --- a/ports/hazelcast-cpp-client/vcpkg.json +++ b/ports/hazelcast-cpp-client/vcpkg.json @@ -5,7 +5,7 @@ "homepage": "https://github.com/hazelcast/hazelcast-cpp-client", "documentation": "http://hazelcast.github.io/hazelcast-cpp-client/index.html", "supports": "!uwp", - "$dependencies": [ + "dependencies": [ "boost-any", "boost-asio", "boost-chrono", From 74b7968ecb655bded744e01dc9c37f5d30ea03b9 Mon Sep 17 00:00:00 2001 From: ihsandemir Date: Mon, 22 Feb 2021 12:15:44 +0300 Subject: [PATCH 8/8] Updated the version for the latest commit using the command `./vcpkg x-add-version --overwrite-version hazelcast-cpp-client`. --- versions/h-/hazelcast-cpp-client.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/h-/hazelcast-cpp-client.json b/versions/h-/hazelcast-cpp-client.json index 46c928ce84c5a7..84fd69b46811e2 100644 --- a/versions/h-/hazelcast-cpp-client.json +++ b/versions/h-/hazelcast-cpp-client.json @@ -1,7 +1,7 @@ { "versions": [ { - "git-tree": "7f12e0d5a4c3a3ff52d0b87531d315c03afd270c", + "git-tree": "d0f516ea034e3c58e0c1621f4230445eb303a1b0", "version-semver": "4.0.0", "port-version": 0 }