Browse Source

HPCC-9407 Add support for building in VS2012

Fixes HPCC-9407

Signed-off-by: Gordon Smith <gordon.smith@lexisnexis.com>
Gordon Smith 12 years ago
parent
commit
8edcf3d8a7

+ 63 - 49
cmake_modules/FindBOOST_REGEX.cmake

@@ -24,64 +24,78 @@
 #  BOOST_REGEX_LIBRARY_DIR - The directory containing libraries needed to use Boost regex
 
 IF (NOT BOOST_REGEX_FOUND)
-  IF (UNIX)
-    SET (boost_regex_lib "boost_regex-mt")
-    IF(Boost_USE_STATIC_LIBS)
-      SET (boost_regex_lib "libboost_regex-mt.a")
-    ENDIF()
-  ELSEIF(WIN32)
-    SET (boost_regex_lib "libboost_regex-vc90-mt.lib") # note - this may not be the lib we need, but should be in same place as it...
-  ENDIF()
-  IF (NOT "${EXTERNALS_DIRECTORY}" STREQUAL "")
+  IF (WIN32 AND USE_NATIVE_LIBRARIES)
+    set ( Boost_USE_STATIC_LIBS ON )
+    set ( Boost_USE_MULTITHREADED ON )
+    set ( Boost_USE_STATIC_RUNTIME OFF )
+    find_package( Boost COMPONENTS regex )
+    IF (Boost_FOUND)
+      set(BOOST_REGEX_FOUND TRUE)
+      set(BOOST_REGEX_LIBRARIES ${Boost_LIBRARIES})
+      set(BOOST_REGEX_INCLUDE_DIR ${Boost_INCLUDE_DIRS})
+      set(BOOST_REGEX_LIBRARY_DIR ${Boost_LIBRARY_DIRS})
+      link_directories(${BOOST_REGEX_LIBRARY_DIR})
+    ENDIF (Boost_FOUND)
+  ELSE (WIN32 AND USE_NATIVE_LIBRARIES)
     IF (UNIX)
-      IF (${ARCH64BIT} EQUAL 1)
+      SET (boost_regex_lib "boost_regex-mt")
+      IF(Boost_USE_STATIC_LIBS)
+        SET (boost_regex_lib "libboost_regex-mt.a")
+      ENDIF()
+    ELSEIF(WIN32)
+      SET (boost_regex_lib "libboost_regex-vc90-mt.lib") # note - this may not be the lib we need, but should be in same place as it...
+    ENDIF()
+    IF (NOT "${EXTERNALS_DIRECTORY}" STREQUAL "")
+      IF (UNIX)
+        IF (${ARCH64BIT} EQUAL 1)
         SET (osdir "linux-x86_64-gcc4")
-      ELSE()
+        ELSE()
         SET (osdir "linux-i686-gcc4")
+        ENDIF()
+      ELSEIF(WIN32)
+        SET (osdir "windows-i386-vc90")
+      ELSE()
+        SET (osdir "unknown")
       ENDIF()
-    ELSEIF(WIN32)
-      SET (osdir "windows-i386-vc90")
-    ELSE()
-      SET (osdir "unknown")
+      IF (NOT ("${osdir}" STREQUAL "unknown"))
+        FIND_PATH (BOOST_REGEX_INCLUDE_DIR NAMES boost/regex.h PATHS "${EXTERNALS_DIRECTORY}/boost/include" NO_DEFAULT_PATH)
+        FIND_LIBRARY (BOOST_REGEX_LIBRARIES NAMES ${boost_regex_lib} PATHS "${EXTERNALS_DIRECTORY}/boost/${osdir}/lib" NO_DEFAULT_PATH)
+      ENDIF() 
     ENDIF()
-    IF (NOT ("${osdir}" STREQUAL "unknown"))
-      FIND_PATH (BOOST_REGEX_INCLUDE_DIR NAMES boost/regex.h PATHS "${EXTERNALS_DIRECTORY}/boost/include" NO_DEFAULT_PATH)
-      FIND_LIBRARY (BOOST_REGEX_LIBRARIES NAMES ${boost_regex_lib} PATHS "${EXTERNALS_DIRECTORY}/boost/${osdir}/lib" NO_DEFAULT_PATH)
-    ENDIF() 
-  ENDIF()
 
-  # if we didn't find in externals, look in system include path
-  if (USE_NATIVE_LIBRARIES)
-     set(Boost_ADDITIONAL_VERSIONS "1.41" "1.41.0" "1.44.0")
-     set(Boost_USE_MULTITHREADED ON)
-     set (Boost_DETAILED_FAILURE_MSG ON)
-  # On centos we may have both boost-devel and boost141-devel installed. We need to look for the former first.
-     set(BOOST_ROOT "/usr/include/boost141")
-     set(BOOST_INCLUDEDIR "/usr/include/boost141")
-     if (${ARCH64BIT} EQUAL 1)
-       set(BOOST_LIBRARYDIR "/usr/lib64/boost141")
-     else()
-       set(BOOST_LIBRARYDIR "/usr/lib/boost141")
-     endif()
-     find_package( Boost 1.34.0 COMPONENTS regex )
-     if(Boost_FOUND)
+    # if we didn't find in externals, look in system include path
+    if (USE_NATIVE_LIBRARIES)
+       set(Boost_ADDITIONAL_VERSIONS "1.41" "1.41.0" "1.44.0")
+       set(Boost_USE_MULTITHREADED ON)
+       set (Boost_DETAILED_FAILURE_MSG ON)
+    # On centos we may have both boost-devel and boost141-devel installed. We need to look for the former first.
+       set(BOOST_ROOT "/usr/include/boost141")
+       set(BOOST_INCLUDEDIR "/usr/include/boost141")
+       if (${ARCH64BIT} EQUAL 1)
+         set(BOOST_LIBRARYDIR "/usr/lib64/boost141")
+       else()
+         set(BOOST_LIBRARYDIR "/usr/lib/boost141")
+       endif()
+       find_package( Boost 1.34.0 COMPONENTS regex )
+       if(Boost_FOUND)
          set(BOOST_REGEX_LIBRARIES ${Boost_LIBRARIES})
          set(BOOST_REGEX_INCLUDE_DIR ${Boost_INCLUDE_DIRS})
-     endif()
-  endif()
+       endif()
+    endif()
 
-  include(FindPackageHandleStandardArgs)
-  find_package_handle_standard_args(BOOST_REGEX DEFAULT_MSG
-    BOOST_REGEX_LIBRARIES 
-    BOOST_REGEX_INCLUDE_DIR
-  )
+    include(FindPackageHandleStandardArgs)
+    find_package_handle_standard_args(BOOST_REGEX DEFAULT_MSG
+      BOOST_REGEX_LIBRARIES 
+      BOOST_REGEX_INCLUDE_DIR
+    )
 
-  IF (BOOST_REGEX_FOUND)
-    IF (WIN32)
-      STRING(REPLACE "/${boost_regex_lib}" "" BOOST_REGEX_LIBRARY_DIR "${BOOST_REGEX_LIBRARIES}")
-      link_directories(${BOOST_REGEX_LIBRARY_DIR})
-      set (BOOST_REGEX_LIBRARIES "")  # the actual library to use is controlled by boost header files
+    IF (BOOST_REGEX_FOUND)
+      IF (WIN32)
+        STRING(REPLACE "/${boost_regex_lib}" "" BOOST_REGEX_LIBRARY_DIR "${BOOST_REGEX_LIBRARIES}")
+        link_directories(${BOOST_REGEX_LIBRARY_DIR})
+        set (BOOST_REGEX_LIBRARIES "")  # the actual library to use is controlled by boost header files
+      ENDIF()
     ENDIF()
-  ENDIF()
-  MARK_AS_ADVANCED(BOOST_REGEX_INCLUDE_DIR BOOST_REGEX_LIBRARIES)
+    MARK_AS_ADVANCED(BOOST_REGEX_INCLUDE_DIR BOOST_REGEX_LIBRARIES)
+  ENDIF (WIN32 AND USE_NATIVE_LIBRARIES)
 ENDIF()

+ 1 - 0
esp/services/ws_workunits/ws_workunitsHelpers.hpp

@@ -27,6 +27,7 @@
 
 #include <list>
 #include <vector>
+#include <functional>
 
 namespace ws_workunits {
 

+ 7 - 2
lib2/CMakeLists.txt

@@ -25,7 +25,9 @@ if (APPLE)
     list(APPEND DYLIBS ${BINUTILS_LIBRARIES})
 elseif (WIN32)
     #TODO:  Should find these dlls not assume them.
-    find_file (BOOST_REGEX_BIN "boost_regex-vc90-mt-1_44.dll" "${EXTERNALS_DIRECTORY}/boost/windows-i386-vc90/lib" NO_DEFAULT_PATH)
+    if (NOT USE_NATIVE_LIBRARIES)
+        find_file (BOOST_REGEX_BIN "boost_regex-vc90-mt-1_44.dll" "${EXTERNALS_DIRECTORY}/boost/windows-i386-vc90/lib" NO_DEFAULT_PATH)
+    endif (NOT USE_NATIVE_LIBRARIES)
     find_file (ICU_DT_BIN "icudt36.dll" "${EXTERNALS_DIRECTORY}/icu/bin" NO_DEFAULT_PATH)
     find_file (ICU_IN_BIN "icuin36.dll" "${EXTERNALS_DIRECTORY}/icu/bin" NO_DEFAULT_PATH)
     find_file (ICU_UC_BIN "icuuc36.dll" "${EXTERNALS_DIRECTORY}/icu/bin" NO_DEFAULT_PATH)
@@ -34,7 +36,10 @@ elseif (WIN32)
     find_file (XALAN_C_BIN "Xalan-C_1_10.dll" "${EXTERNALS_DIRECTORY}/xalan/xalan-c/bin" NO_DEFAULT_PATH)
     find_file (XALAN_MESSAGES_BIN "XalanMessages_1_10.dll" "${EXTERNALS_DIRECTORY}/xalan/xalan-c/bin" NO_DEFAULT_PATH)
     find_file (XERCES_C_BIN "xerces-c_2_7.dll" "${EXTERNALS_DIRECTORY}/xalan/xerces-c/bin" NO_DEFAULT_PATH)
-    set(DYLIBS ${BOOST_REGEX_BIN})
+    set(DYLIBS "")
+    if (NOT USE_NATIVE_LIBRARIES)
+        list(APPEND DYLIBS ${BOOST_REGEX_BIN})
+    endif (NOT USE_NATIVE_LIBRARIES)
     list(APPEND DYLIBS ${ICU_DT_BIN} ${ICU_IN_BIN} ${ICU_UC_BIN})
     list(APPEND DYLIBS ${OPENSSL_LIB_BIN} ${OPENSSL_SSL_BIN})
     list(APPEND DYLIBS ${XALAN_C_BIN} ${XALAN_MESSAGES_BIN})