changeset 568:3f27814104f7 laaw

compile with msvc
author jodogne
date Wed, 25 Sep 2013 12:45:33 +0200
parents 6a3e2ca7a7a0
children 701d748cf327
files CMakeLists.txt Core/Compression/ZipWriter.cpp Core/Toolbox.cpp
diffstat 3 files changed, 29 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/CMakeLists.txt	Tue Sep 24 15:12:51 2013 +0200
+++ b/CMakeLists.txt	Wed Sep 25 12:45:33 2013 +0200
@@ -268,12 +268,16 @@
   include_directories(${ORTHANC_ROOT}/OrthancCppClient/Package/Laaw)
 
   if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
-    if (${CMAKE_SIZEOF_VOID_P} EQUAL 4)
-      set(ORTHANC_CPP_CLIENT_AUX ${ORTHANC_ROOT}/OrthancCppClient/Package/AUTOGENERATED/Windows32.def)
-    elseif (${CMAKE_SIZEOF_VOID_P} EQUAL 8)
-      set(ORTHANC_CPP_CLIENT_AUX ${ORTHANC_ROOT}/OrthancCppClient/Package/AUTOGENERATED/Windows64.def)
+    if (CMAKE_CROSS_COMPILING)
+      if (${CMAKE_SIZEOF_VOID_P} EQUAL 4)
+        set(ORTHANC_CPP_CLIENT_AUX ${ORTHANC_ROOT}/OrthancCppClient/Package/AUTOGENERATED/Windows32.def)
+      elseif (${CMAKE_SIZEOF_VOID_P} EQUAL 8)
+        set(ORTHANC_CPP_CLIENT_AUX ${ORTHANC_ROOT}/OrthancCppClient/Package/AUTOGENERATED/Windows64.def)
+      else()
+        message(FATAL_ERROR "Support your platform here")
+      endif()
     else()
-      message(FATAL_ERROR "Support your platform here")
+      set(ORTHANC_CPP_CLIENT_AUX ${OPENSSL_SOURCES})
     endif()
   else()
     set(ORTHANC_CPP_CLIENT_AUX ${OPENSSL_SOURCES})
@@ -308,15 +312,14 @@
       )
     target_link_libraries(OrthancClient pthread)
   elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
-    target_link_libraries(OrthancClient OpenSSL)
-
-    if (${CMAKE_COMPILER_IS_GNUCXX})
+    if (CMAKE_CROSS_COMPILING)
+      target_link_libraries(OrthancClient OpenSSL)
       set_target_properties(OrthancClient
         PROPERTIES LINK_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--allow-multiple-definition -static-libgcc -static-libstdc++"
         )
       target_link_libraries(OrthancClient ws2_32)
     else()
-      message(FATAL_ERROR "Support Visual Studio here")
+      #message(FATAL_ERROR "Support Visual Studio here")
     endif()
   else()
     message(FATAL_ERROR "Support your platform here")
--- a/Core/Compression/ZipWriter.cpp	Tue Sep 24 15:12:51 2013 +0200
+++ b/Core/Compression/ZipWriter.cpp	Wed Sep 25 12:45:33 2013 +0200
@@ -29,11 +29,15 @@
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  **/
 
+#ifdef _WIN32
+#define NOMINMAX
+#endif
 
 #include "ZipWriter.h"
 
 #include "../../Resources/minizip/zip.h"
 #include <boost/date_time/posix_time/posix_time.hpp>
+#include <limits>
 
 #include "../OrthancException.h"
 
--- a/Core/Toolbox.cpp	Tue Sep 24 15:12:51 2013 +0200
+++ b/Core/Toolbox.cpp	Wed Sep 25 12:45:33 2013 +0200
@@ -68,6 +68,19 @@
 #include "../Resources/sha1/sha1.h"
 
 
+#ifdef _MSC_VER
+// Patch for the missing "_strtoll" symbol when compiling with Visual Studio
+extern "C"
+{
+int64_t _strtoi64(const char *nptr, char **endptr, int base);
+int64_t strtoll(const char *nptr, char **endptr, int base)
+{
+    return _strtoi64(nptr, endptr, base);
+} 
+}
+#endif
+
+
 #if BOOST_HAS_LOCALE == 0
 namespace
 {