changeset 918:ac8f68cbdbb6 mac

build cont
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 24 Feb 2014 16:09:06 +0100
parents 312d04beb0a2
children 637cb73152dd
files Core/Toolbox.cpp MacOsX.txt OrthancServer/DicomProtocol/DicomUserConnection.cpp Resources/CMake/BoostConfiguration.cmake Resources/CMake/Compiler.cmake Resources/CMake/DcmtkConfiguration.cmake Resources/CMake/GoogleLogConfiguration.cmake Resources/CMake/LibCurlConfiguration.cmake UnitTestsSources/UnitTestsMain.cpp
diffstat 9 files changed, 49 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/Core/Toolbox.cpp	Mon Feb 24 15:10:30 2014 +0100
+++ b/Core/Toolbox.cpp	Mon Feb 24 16:09:06 2014 +0100
@@ -161,7 +161,7 @@
   {
 #if defined(_WIN32)
     ::Sleep(static_cast<DWORD>(microSeconds / static_cast<uint64_t>(1000)));
-#elif defined(__linux)
+#elif defined(__linux) || defined(__APPLE__)
     usleep(microSeconds);
 #else
 #error Support your platform here
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MacOsX.txt	Mon Feb 24 16:09:06 2014 +0100
@@ -0,0 +1,8 @@
+mkdir Build
+cd Build
+cmake -GXcode -DCMAKE_OSX_DEPLOYMENT_TARGET=10.8 -DSTATIC_BUILD=ON -DSTANDALONE_BUILD=ON ..
+xcodebuild
+./Debug/UnitTests
+
+xcodebuild -configuration Release
+./Release/UnitTests
--- a/OrthancServer/DicomProtocol/DicomUserConnection.cpp	Mon Feb 24 15:10:30 2014 +0100
+++ b/OrthancServer/DicomProtocol/DicomUserConnection.cpp	Mon Feb 24 16:09:06 2014 +0100
@@ -58,6 +58,11 @@
 #endif 
 
 
+#if !defined(HOST_NAME_MAX) && defined(_POSIX_HOST_NAME_MAX)
+#define HOST_NAME_MAX _POSIX_HOST_NAME_MAX
+#endif
+
+
 static const char* DEFAULT_PREFERRED_TRANSFER_SYNTAX = UID_LittleEndianImplicitTransferSyntax;
 
 namespace Orthanc
--- a/Resources/CMake/BoostConfiguration.cmake	Mon Feb 24 15:10:30 2014 +0100
+++ b/Resources/CMake/BoostConfiguration.cmake	Mon Feb 24 16:09:06 2014 +0100
@@ -53,8 +53,8 @@
     )
 
   set(BOOST_SOURCES)
-  if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR
-      ${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
+
+  if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
     list(APPEND BOOST_SOURCES
       ${BOOST_SOURCES_DIR}/libs/thread/src/pthread/once.cpp
       ${BOOST_SOURCES_DIR}/libs/thread/src/pthread/thread.cpp
@@ -77,6 +77,15 @@
     add_definitions(
       -DBOOST_LOCALE_WITH_WCONV=1
       )
+
+  elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
+    list(APPEND BOOST_SOURCES
+      ${BOOST_SOURCES_DIR}/libs/thread/src/pthread/once.cpp
+      ${BOOST_SOURCES_DIR}/libs/thread/src/pthread/thread.cpp
+      )
+
+    aux_source_directory(${BOOST_SOURCES_DIR}/libs/locale/src/posix BOOST_SOURCES)
+
   else()
     message(FATAL_ERROR "Support your platform here")
   endif()
@@ -94,6 +103,12 @@
     ${BOOST_SOURCES_DIR}/libs/system/src/error_code.cpp
     )
 
+  if (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
+    list(REMOVE_ITEM BOOST_SOURCES
+      ${BOOST_SOURCES_DIR}/libs/locale/src/encoding/codepage.cpp
+      )
+  endif()
+
   list(APPEND THIRD_PARTY_SOURCES ${BOOST_SOURCES})
 
   add_definitions(
--- a/Resources/CMake/Compiler.cmake	Mon Feb 24 15:10:30 2014 +0100
+++ b/Resources/CMake/Compiler.cmake	Mon Feb 24 16:09:06 2014 +0100
@@ -69,6 +69,11 @@
     SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--allow-multiple-definition -static-libgcc -static-libstdc++")
   endif()
 
+elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
+  add_definitions(
+    -D_XOPEN_SOURCE=1
+    )
+
 endif()
 
 
--- a/Resources/CMake/DcmtkConfiguration.cmake	Mon Feb 24 15:10:30 2014 +0100
+++ b/Resources/CMake/DcmtkConfiguration.cmake	Mon Feb 24 16:09:06 2014 +0100
@@ -38,7 +38,8 @@
 
   # Source for the logging facility of DCMTK
   AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/oflog/libsrc DCMTK_SOURCES)
-  if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
+  if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR
+      ${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
     list(REMOVE_ITEM DCMTK_SOURCES 
       ${DCMTK_SOURCES_DIR}/oflog/libsrc/windebap.cc
       ${DCMTK_SOURCES_DIR}/oflog/libsrc/winsock.cc
--- a/Resources/CMake/GoogleLogConfiguration.cmake	Mon Feb 24 15:10:30 2014 +0100
+++ b/Resources/CMake/GoogleLogConfiguration.cmake	Mon Feb 24 16:09:06 2014 +0100
@@ -92,6 +92,12 @@
         ${CMAKE_SOURCE_DIR}/Resources/CMake/GoogleLogConfigurationLSB.h
         ${GOOGLE_LOG_SOURCES_DIR}/src/config.h
         COPYONLY)
+    elseif ("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
+      # Install the specific configuration for Mac OS
+      configure_file(
+        ${CMAKE_SOURCE_DIR}/Resources/CMake/GoogleLogConfigurationDarwin.h
+        ${GOOGLE_LOG_SOURCES_DIR}/src/config.h
+        COPYONLY)
     else()
       configure_file(
         ${CMAKE_SOURCE_DIR}/Resources/CMake/GoogleLogConfiguration.h
--- a/Resources/CMake/LibCurlConfiguration.cmake	Mon Feb 24 15:10:30 2014 +0100
+++ b/Resources/CMake/LibCurlConfiguration.cmake	Mon Feb 24 16:09:06 2014 +0100
@@ -40,7 +40,8 @@
       )
   endif()
 
-  if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
+  if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR
+      ${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
     if ("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
       SET(TMP_OS "x86_64")
     else()
--- a/UnitTestsSources/UnitTestsMain.cpp	Mon Feb 24 15:10:30 2014 +0100
+++ b/UnitTestsSources/UnitTestsMain.cpp	Mon Feb 24 16:09:06 2014 +0100
@@ -570,6 +570,9 @@
 #if defined(_WIN32)
   ASSERT_EQ(Endianness_Little, Toolbox::DetectEndianness());
 
+#elif defined(__APPLE__)
+  ASSERT_EQ(Endianness_Little, Toolbox::DetectEndianness());
+
 #elif defined(__linux)
 
 #if !defined(__BYTE_ORDER)