-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Integrate minio-cpp from main (#275)
All the headers in src/3rdParty/minio-cpp/inc are taken without modification from [minio/minio-cpp](https://github.com/minio/minio-cpp/tree/cd4ef14955201d5ce81e54155ef0980f7c644864). Additions to vcpkg.json are temporary until minio-cpp push a new release to vcpkg.
- Loading branch information
Showing
28 changed files
with
3,564 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
add_subdirectory(minio-cpp) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
set(pwd ${CMAKE_CURRENT_LIST_DIR}) | ||
|
||
set(lib "unknown-minio-cpp-lib") | ||
|
||
if(WIN32) | ||
set(lib "${pwd}/lib/win64/miniocpp.lib") | ||
set(libd "${pwd}/lib/win64/miniocpp-debug.lib") | ||
elseif(APPLE) | ||
set(lib "${pwd}/lib/osx/libminiocpp.a") | ||
set(libd "${pwd}/lib/osx/libminiocpp-debug.a") | ||
elseif(LINUX) | ||
set(lib "${pwd}/lib/linux-amd64/libminiocpp.a") | ||
set(libd "${pwd}/lib/linux-amd64/libminiocpp-debug.a") | ||
endif() | ||
|
||
find_package(OpenSSL REQUIRED) | ||
find_package(unofficial-curlpp CONFIG REQUIRED) | ||
find_package(unofficial-inih CONFIG REQUIRED) | ||
find_package(nlohmann_json CONFIG REQUIRED) | ||
find_package(pugixml CONFIG REQUIRED) | ||
find_package(ZLIB REQUIRED) | ||
|
||
list(APPEND MINIO_CPP_LIBS | ||
unofficial::curlpp::curlpp | ||
unofficial::inih::inireader | ||
nlohmann_json::nlohmann_json | ||
pugixml | ||
OpenSSL::SSL OpenSSL::Crypto | ||
ZLIB::ZLIB | ||
) | ||
|
||
if (WIN32) | ||
list(APPEND MINIO_CPP_LIBS wsock32) | ||
list(APPEND MINIO_CPP_LIBS ws2_32) | ||
endif() | ||
|
||
message(STATUS "minio-cpp: ${pwd}") | ||
set(tgt miniocpp::miniocpp) | ||
add_library(${tgt} STATIC IMPORTED GLOBAL) | ||
target_include_directories(${tgt} INTERFACE ${pwd}/inc) | ||
target_link_libraries(${tgt} INTERFACE ${MINIO_CPP_LIBS}) | ||
set_target_properties(${tgt} PROPERTIES | ||
IMPORTED_LOCATION ${lib} | ||
IMPORTED_LOCATION_DEBUG ${libd} | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# MinIO C++ client | ||
|
||
This repository includes headers and pre-build binaries for the MinIO C++ client SDK. | ||
It was built from | ||
commit [cd4ef14955201d5ce81e54155ef0980f7c644864](https://github.com/minio/minio-cpp/tree/cd4ef14955201d5ce81e54155ef0980f7c644864). | ||
In the base CMakeLists.txt, it was necessary to change `STATIC` to `MODULE` in the `add_library` command to build the | ||
shared library. | ||
|
||
## Building | ||
|
||
### Windows | ||
|
||
To generate the solution file, run the following command: | ||
|
||
```shell | ||
cmake . -B build -DMINIO_CPP_TEST=OFF -DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake" -DVCPKG_INSTALLED_DIR=vcpkg_installed -DVCPKG_TARGET_TRIPLET=x64-windows-static | ||
``` | ||
|
||
Then, open the solution file in Visual Studio. | ||
Open the Solution Explorer, select `miniocpp` and right-click on it. | ||
Select `Configuration Properties > C/C++ > Code Generation`. | ||
For Release type builds, include RelWithDebInfo, change the `Runtime Library` to `Multi-threaded (/MT)` in order to | ||
statically link the MSVC runtime. | ||
For Debug builds, change the `Runtime Library` to `Multi-threaded Debug (/MTd)`. | ||
Finally, build the solution. | ||
|
||
### macOS | ||
|
||
To generate the universal binary, you will need to build the library for both x86_64 and arm64 architectures. | ||
Run the following commands: | ||
|
||
```shell | ||
# Build for x86_64 | ||
cmake . -B build-x64 -DMINIO_CPP_TEST=OFF -DCMAKE_TOOLCHAIN_FILE="${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" -DVCPKG_INSTALLED_DIR=vcpkg-x64 -DVCPKG_TARGET_TRIPLET=x64-osx -DCMAKE_OSX_ARCHITECTURES="x86_64" -DCMAKE_BUILD_TYPE=Release # or Debug | ||
cmake --build build-x64 --config Release # or Debug | ||
# Repeat the process for arm64 | ||
cmake . -B build-arm64 -DMINIO_CPP_TEST=OFF -DCMAKE_TOOLCHAIN_FILE="${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" -DVCPKG_INSTALLED_DIR=vcpkg-arm64 -DVCPKG_TARGET_TRIPLET=arm64-osx -DCMAKE_OSX_ARCHITECTURES="arm64" -DCMAKE_BUILD_TYPE=Release # or Debug | ||
cmake --build build-arm64 --config Release # or Debug | ||
# Create the universal binary | ||
lipo -create build-x64/libminiocpp.a build-arm64/libminiocpp.a -output libminiocpp.a | ||
``` | ||
|
||
### Linux | ||
|
||
To generate the shared library, run the following command: | ||
|
||
```shell | ||
cmake . -B build -DMINIO_CPP_TEST=OFF -DCMAKE_TOOLCHAIN_FILE="${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" -DCMAKE_BUILD_TYPE=Release # or Debug | ||
cmake --build build --config Release # or Debug | ||
``` |
Oops, something went wrong.