diff Aws/AwsStaticConfiguration.cmake @ 161:f7654d481226

created Aws/mingw-compile.sh
author Sebastien Jodogne <s.jodogne@gmail.com>
date Sun, 23 Jun 2024 15:12:06 +0200
parents d3e7c86c3a4e
children
line wrap: on
line diff
--- a/Aws/AwsStaticConfiguration.cmake	Sun Jun 23 10:53:40 2024 +0200
+++ b/Aws/AwsStaticConfiguration.cmake	Sun Jun 23 15:12:06 2024 +0200
@@ -63,10 +63,34 @@
 SET(AWS_C_CAL_URL "https://orthanc.uclouvain.be/downloads/third-party-downloads/aws/aws-c-cal-${AWS_C_CAL_VERSION}.tar.gz")
 DownloadPackage(${AWS_C_CAL_MD5} ${AWS_C_CAL_URL} "${AWS_C_CAL_SOURCES_DIR}")
 
+
 SET(AWS_C_COMMON_SOURCES_DIR ${CMAKE_BINARY_DIR}/aws-c-common-${AWS_C_COMMON_VERSION})
 SET(AWS_C_COMMON_URL "https://orthanc.uclouvain.be/downloads/third-party-downloads/aws/aws-c-common-${AWS_C_COMMON_VERSION}.tar.gz")
+
+if (IS_DIRECTORY "${AWS_C_COMMON_SOURCES_DIR}")
+  set(FirstRun OFF)
+else()
+  set(FirstRun ON)
+endif()
+
 DownloadPackage(${AWS_C_COMMON_MD5} ${AWS_C_COMMON_URL} "${AWS_C_COMMON_SOURCES_DIR}")
 
+if (FirstRun)
+  # This is a patch for MinGW
+  execute_process(
+    COMMAND ${PATCH_EXECUTABLE} -p0 -N -i
+    ${CMAKE_CURRENT_LIST_DIR}/aws-c-common-${AWS_C_COMMON_VERSION}.patch
+    WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
+    RESULT_VARIABLE Failure
+    )
+
+  if (Failure)
+    message(FATAL_ERROR "Error while patching a file")
+  endif()
+endif()
+
+
+
 SET(AWS_C_COMPRESSION_SOURCES_DIR ${CMAKE_BINARY_DIR}/aws-c-compression-${AWS_C_COMPRESSION_VERSION})
 SET(AWS_C_COMPRESSION_URL "https://orthanc.uclouvain.be/downloads/third-party-downloads/aws/aws-c-compression-${AWS_C_COMPRESSION_VERSION}.tar.gz")
 DownloadPackage(${AWS_C_COMPRESSION_MD5} ${AWS_C_COMPRESSION_URL} "${AWS_C_COMPRESSION_SOURCES_DIR}")
@@ -99,6 +123,10 @@
     WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
     RESULT_VARIABLE Failure
     )
+
+  if (Failure)
+    message(FATAL_ERROR "Error while patching a file")
+  endif()
 endif()
 
 
@@ -134,6 +162,10 @@
     WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
     RESULT_VARIABLE Failure
     )
+
+  if (Failure)
+    message(FATAL_ERROR "Error while patching a file")
+  endif()
 endif()