]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Porting to Windows: Enable thread support for native Windows targets (mingw so far)
authormaier <maier@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 13 Mar 2013 23:47:22 +0000 (23:47 +0000)
committermaier <maier@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 13 Mar 2013 23:47:22 +0000 (23:47 +0000)
git-svn-id: https://svn.dealii.org/trunk@28893 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/bundled/CMakeLists.txt
deal.II/bundled/boost-1.49.0/libs/thread/src/CMakeLists.txt
deal.II/bundled/tbb30_104oss/src/CMakeLists.txt
deal.II/cmake/checks/check_01_system_features.cmake
deal.II/cmake/configure/configure_1_threads.cmake
deal.II/include/deal.II/base/std_cxx1x/shared_ptr.h

index 97fb672f78a35275e254590176c128daeb3d6019..2035f528bb39efa149196e1489458f3b6884fe45 100644 (file)
@@ -66,14 +66,11 @@ ENDIF()
 #
 # Threading Building Blocks library
 #
-IF(NOT CMAKE_SYSTEM_NAME MATCHES "CYGWIN" AND
-   NOT CMAKE_SYSTEM_NAME MATCHES "Windows")
-  SET(FEATURE_THREADS_HAVE_BUNDLED TRUE)
-  SET(TBB_FOLDER "${CMAKE_SOURCE_DIR}/bundled/tbb30_104oss")
-  OPTION(DEAL_II_FORCE_BUNDLED_THREADS
-    "Always use the bundled tbb library instead of an external one."
-    OFF)
-ENDIF()
+SET(FEATURE_THREADS_HAVE_BUNDLED TRUE)
+OPTION(DEAL_II_FORCE_BUNDLED_THREADS
+  "Always use the bundled tbb library instead of an external one."
+  OFF)
+SET(TBB_FOLDER "${CMAKE_SOURCE_DIR}/bundled/tbb30_104oss")
 
 IF(FEATURE_THREADS_BUNDLED_CONFIGURED)
   INSTALL(DIRECTORY ${TBB_FOLDER}/include/tbb
index 5813b0616892593741faef403843da4c80c2faa4..7a87dfb93181a30c6bef12a92213828ca60f9694 100644 (file)
@@ -19,28 +19,20 @@ IF(DEAL_II_USE_MT_POSIX)
     )
 ELSE()
   SET(src_boost_thread
-    win32/once.cpp
     win32/thread.cpp
+    win32/tss_dll.cpp
+    win32/tss_pe.cpp
     )
 ENDIF()
 
 DEAL_II_ADD_LIBRARY(obj_boost_thread OBJECT ${src_boost_thread})
+DEAL_II_ADD_DEFINITIONS(obj_boost_thread
+  "BOOST_THREAD_BUILD_LIB" "BOOST_ALL_NO_LIB"
+  )
 
-IF(DEAL_II_USE_MT_POSIX)
-
-  # TODO: Necessary?
-    # include <boost/cstdint.hpp>
-
-    # ifndef UINTMAX_C
-    #   define UINTMAX_C(x) x ## ULL
-    # endif
-
-  DEAL_II_ADD_DEFINITIONS(obj_boost_thread
-    "BOOST_THREAD_BUILD_LIB" "BOOST_ALL_NO_LIB"
-    )
+IF(CMAKE_SYSTEM_NAME MATCHES "Windows")
+  DEAL_II_ADD_DEFINITIONS(obj_boost_thread "BOOST_HAS_WINTHREADS")
 ELSE()
-  DEAL_II_ADD_DEFINITIONS(obj_boost_thread
-    "BOOST_THREAD_BUILD_LIB" "BOOST_ALL_NO_LIB" "BOOST_THREAD_POSIX"
-    )
+  DEAL_II_ADD_DEFINITIONS(obj_boost_thread "BOOST_THREAD_POSIX")
 ENDIF()
 
index 5ecc1ee4e0d96d8351fea24087f3df54a37fd84a..73bf87e16edf3fe41164554b8fb44ad92a972ae2 100644 (file)
@@ -57,31 +57,21 @@ SET(src_tbb
   tbb/tbb_statistics.cpp
   tbb/tbb_thread.cpp
   )
+DEAL_II_ADD_LIBRARY(obj_tbb OBJECT ${src_tbb})
 
 #
 # Add necessary definitions:
 #
-SET(obj_tbb_DEFINITIONS)
-IF(NOT CMAKE_SYSTEM_NAME MATCHES "Darwin")
-  LIST(APPEND obj_tbb_DEFINITIONS "DO_ITT_NOTIFY")
-ENDIF()
 
-IF(DEAL_II_USE_MT_POSIX)
-  LIST(APPEND obj_tbb_DEFINITIONS "USE_PTHREAD")
-ENDIF()
+IF(CMAKE_SYSTEM_NAME MATCHES "Windows")
+  DEAL_II_ADD_DEFINITIONS(obj_tbb "USE_WINTHREAD")
 
-IF(CMAKE_SYSTEM_NAME MATCHES "CYGWIN")
-  MESSAGE(FATAL_ERROR "No support for internal tbb and CYGWIN atm.")
-  #LIST(APPEND obj_tbb_DEFINITIONS
-  #  "USE_WINTHREAD"
-  #  "_WIN32"
-  #  "__MSVCRT_VERSION__=0x0700"
-  #  )
-  #ENABLE_IF_SUPPORTED(CMAKE_CXX_FLAGS "-msse")
-  #ENABLE_IF_SUPPORTED(CMAKE_CXX_FLAGS "-mthreads")
-ENDIF()
+ELSE()
 
-DEAL_II_ADD_LIBRARY(obj_tbb OBJECT ${src_tbb})
+  DEAL_II_ADD_DEFINITIONS(obj_tbb "USE_PTHREAD")
 
-DEAL_II_ADD_DEFINITIONS(obj_tbb ${obj_tbb_DEFINITIONS})
+  IF(NOT CMAKE_SYSTEM_NAME MATCHES "Darwin")
+    DEAL_II_ADD_DEFINITIONS(obj_tbb "DO_ITT_NOTIFY")
+  ENDIF()
+ENDIF()
 
index fbf041238725a56b4ef28ee07aab3dc6e0245371..a942bf48202ff23dcb4acb73a6a16ec089efbeb4 100644 (file)
@@ -81,7 +81,6 @@ IF(CMAKE_SYSTEM_NAME MATCHES "Windows")
   #
   SET(DEAL_II_MSVC TRUE)
 
-
   #
   # Disable shared libraries on native Windows targets for the moment.
   #
index cee03a7dee73f5b0b932a454b11e12cd722c92f4..b1f5decacd7256772353ae50f83301a459ad0d17 100644 (file)
@@ -55,7 +55,14 @@ MACRO(SETUP_THREADING)
   #
   # Set up some posix thread specific configuration toggles:
   #
-  IF(CMAKE_USE_PTHREADS_INIT)
+  IF(NOT CMAKE_SYSTEM_NAME MATCHES "Windows")
+
+    IF(NOT CMAKE_USE_PTHREADS_INIT)
+      MESSAGE(FATAL_ERROR
+        "\nInternal configuration error: Not on Windows but posix thread support unavailable\n\n"
+        )
+    ENDIF()
+
     SET(DEAL_II_USE_MT_POSIX TRUE)
 
     #
@@ -76,11 +83,17 @@ MACRO(SETUP_THREADING)
     "
     DEAL_II_HAVE_MT_POSIX_BARRIERS)
     STRIP_FLAG(CMAKE_REQUIRED_FLAGS "${CMAKE_THREAD_LIBS_INIT}")
-
     IF(NOT DEAL_II_HAVE_MT_POSIX_BARRIERS)
       SET(DEAL_II_USE_MT_POSIX_NO_BARRIERS TRUE)
     ENDIF()
 
+  ELSE()
+
+    #
+    # Poor Windows:
+    #
+    SET(DEAL_II_USE_MT_POSIX FALSE)
+    SET(DEAL_II_USE_MT_POSIX_NO_BARRIERS TRUE)
   ENDIF()
 
 ENDMACRO()
index 9babfec48e3dda132e5c98f8629f119e73245ffb..d51ccb5a2b8442757b4382a369546de1ae6f0889 100644 (file)
@@ -30,6 +30,7 @@ DEAL_II_NAMESPACE_CLOSE
 #else
 
 #include <boost/shared_ptr.hpp>
+#include <boost/enable_shared_from_this.hpp>
 DEAL_II_NAMESPACE_OPEN
 namespace std_cxx1x
 {

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.