changeset 89:62752402edbb

azure build for Windows platform
author Alain Mazy <alain@mazy.be>
date Mon, 28 Nov 2022 14:57:54 +0100
parents 43c2644e55a4
children d65580d2e9ca
files Azure/AzureBlobStoragePlugin.cpp Azure/CMakeLists.txt
diffstat 2 files changed, 13 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/Azure/AzureBlobStoragePlugin.cpp	Mon Nov 21 08:58:13 2022 +0100
+++ b/Azure/AzureBlobStoragePlugin.cpp	Mon Nov 28 14:57:54 2022 +0100
@@ -26,7 +26,6 @@
 #include "cpprest/rawptrstream.h"
 #include "cpprest/details/basic_types.h"
 
-
 // Create aliases to make the code easier to read.
 namespace as = azure::storage;
 
@@ -178,7 +177,7 @@
 bool IsSasTokenAccountLevel(utility::string_t sasToken)
 {
   // Use cpprestsdk's utility::string_t here since the expected argument is the return value of
-  // as::storage_credentials::sas_token(), which is type utility::string_t
+  // as::storage_credentials::sas_token(), which is type utility::string_t (which is a std::wstring on Windows and a std::string on Linux)
   size_t newIdx = 0;
   size_t prevIdx = 0;
   while ((newIdx = sasToken.find('&', prevIdx)) != utility::string_t::npos)
@@ -188,8 +187,15 @@
 
     size_t equalsIdx = kvpair.find('=');
     utility::string_t key = kvpair.substr(0, equalsIdx);
-    if (key == "srt") // only account SAS has this parameter
+  #ifdef WIN32
+    const wchar_t* srt = L"srt";
+  #else
+    const char* srt = "srt";
+  #endif
+//    if (key == utility::string_t(srt, srt + strlen(srt))) // only account SAS has this parameter
+    if (key == srt) // only account SAS has this parameter
       return true;
+
   }
 
   return false;
--- a/Azure/CMakeLists.txt	Mon Nov 21 08:58:13 2022 +0100
+++ b/Azure/CMakeLists.txt	Mon Nov 28 14:57:54 2022 +0100
@@ -54,7 +54,6 @@
   ${ORTHANC_FRAMEWORK_ROOT}/../../OrthancServer/Plugins/Samples/Common
   )
 
-
 find_package(cryptopp CONFIG REQUIRED)
 
 # Azure stuff (from https://github.com/Microsoft/vcpkg/issues/6277)
@@ -77,13 +76,13 @@
   set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Zi")
   set (CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /DEBUG /OPT:REF /OPT:ICF")
 
+  message(INFO "WASTORAGE_INCLUDE_DIR ${WASTORAGE_INCLUDE_DIR}")
+
   add_definitions(-D_NO_WASTORAGE_API=1)   # from https://github.com/Azure/azure-storage-cpp/issues/263
 endif()
 
+include_directories(${WASTORAGE_INCLUDE_DIR})
 
-if (NOT WIN32)
-  include_directories(${WASTORAGE_INCLUDE_DIR})
-endif()
 
 set(COMMON_SOURCES
     ${CMAKE_SOURCE_DIR}/../Common/IStorage.h
@@ -129,7 +128,7 @@
 else()
   target_link_libraries(OrthancAzureBlobStorage
     PRIVATE
-    cryptopp-static
+    cryptopp::cryptopp
     ${OPENSSL_LIBRARY}
     ${WASTORAGE_LIBRARY} 
     ${CPPREST_LIBRARY}