]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Build TBB directly into deal.II
authormaier <maier@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 13 Sep 2012 16:17:41 +0000 (16:17 +0000)
committermaier <maier@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 13 Sep 2012 16:17:41 +0000 (16:17 +0000)
git-svn-id: https://svn.dealii.org/branches/branch_cmake@26357 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/CMakeLists.txt
deal.II/contrib/cmake/configure/configure_threads.cmake
deal.II/contrib/tbb/CMakeLists.txt [deleted file]
deal.II/contrib/tbb/tbb30_104oss/src/CMakeLists.txt [new file with mode: 0644]

index 71393156fbb1f5b4b9453dffbce2400a9c4cc15d..7217e87ae25cdc8e9cf8ca2e6f7b0bb74be620d2 100644 (file)
@@ -85,7 +85,7 @@ OPTION(DEAL_II_WITH_NETCDF
 
 OPTION(DEAL_II_WITH_THREADS
   "Build deal.II with support for threads. This pulls in libtbb as a dependency."
-  OFF)
+  ON)
 
 OPTION(DEAL_II_WITH_UMFPACK
   "Build deal.II with support for UMFPACK, BLAS and LAPACK."
@@ -117,7 +117,7 @@ OPTION(DEAL_II_FORCE_CONTRIB_BOOST
 
 OPTION(DEAL_II_FORCE_CONTRIB_TBB
   "Always use the bundled tbb library instead of an external one."
-  OFF)
+  ON)
 
 OPTION(DEAL_II_FORCE_CONTRIB_UMFPACK
   "Always use the bundled umfpack library instead of an external one."
index 4ff92808b8551fd4eee3838ec5afcaf4b5a395fe..0d060eac4dcda0282d19ab977009638e87279485 100644 (file)
@@ -88,19 +88,20 @@ ENDIF()
 
 IF(DEAL_II_FORCE_CONTRIB_TBB OR NOT TBB_FOUND)
 
-  # TODO: The same as with everything else...
+  #
+  # Add tbb directly to the object files of deal.II
+  #
 
-  SET(libtbb_directory "tbb30_104oss")
+  INCLUDE_DIRECTORIES(
+    ${CMAKE_SOURCE_DIR}/contrib/tbb/tbb30_104oss/include
+    )
 
-  # compile and link the contrib tbb library:
-  ADD_SUBDIRECTORY(contrib/tbb)
+  ADD_SUBDIRECTORY(${CMAKE_SOURCE_DIR}/contrib/tbb/tbb30_104oss/src)
 
-  # set TBB_LIBRARY and TBB_DEBUG_LIBRARY to the full path of the
-  # _installed_ library location:
+  LIST(APPEND deal_ii_additional_object_files
+    $<TARGET_OBJECTS:obj_tbb>
+    )
 
-  SET(TBB_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/contrib/tbb/${libtbb_directory}/include)
-  SET(TBB_LIBRARY ${CMAKE_INSTALL_PREFIX}/lib/libtbb.so)
-  SET(TBB_DEBUG_LIBRARY ${CMAKE_INSTALL_PREFIX}/lib/libtbb_debug.so)
 ENDIF()
 
 INCLUDE_DIRECTORIES(${TBB_INCLUDE_DIR})
diff --git a/deal.II/contrib/tbb/CMakeLists.txt b/deal.II/contrib/tbb/CMakeLists.txt
deleted file mode 100644 (file)
index bb4de17..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-ADD_CUSTOM_COMMAND(
-  OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${libtbb_directory}
-  COMMAND ${CMAKE_COMMAND} -E copy_directory
-            ${CMAKE_CURRENT_SOURCE_DIR}/${libtbb_directory}
-            ${CMAKE_CURRENT_BINARY_DIR}/${libtbb_directory}
-  )
-
-ADD_CUSTOM_COMMAND(
-  #
-  # This makes me very, very sad:
-  #
-  OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${libtbb_directory}/build
-  COMMAND "make"
-  DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${libtbb_directory}
-  WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${libtbb_directory}
-  )
-
-ADD_CUSTOM_TARGET(tbb ALL
-  DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${libtbb_directory}
-          ${CMAKE_CURRENT_BINARY_DIR}/${libtbb_directory}/build
-  )
-
-ADD_DEPENDENCIES(deal_ii_target_dependencies tbb)
-
-INSTALL(
-  DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${libtbb_directory}/include/tbb
-  DESTINATION include
-  )
-
-INSTALL(
-  CODE "FILE(GLOB libtbb_so_files ${CMAKE_CURRENT_BINARY_DIR}/${libtbb_directory}/build/*/*.so*)"
-  CODE "FILE(INSTALL \${libtbb_so_files} DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)" #TODO
-  )
diff --git a/deal.II/contrib/tbb/tbb30_104oss/src/CMakeLists.txt b/deal.II/contrib/tbb/tbb30_104oss/src/CMakeLists.txt
new file mode 100644 (file)
index 0000000..4fd425a
--- /dev/null
@@ -0,0 +1,73 @@
+#
+# TODO: Check whether we do the right thing on all targets.
+#
+
+INCLUDE_DIRECTORIES(
+  ${CMAKE_CURRENT_SOURCE_DIR}/rml/include
+  )
+
+FILE(WRITE "${CMAKE_CURRENT_BINARY_DIR}/version_string.tmp"
+  "#define __TBB_VERSION_STRINGS \"Empty\""
+  )
+
+SET(src_tbb
+  tbb/arena.cpp
+  tbb/cache_aligned_allocator.cpp
+  tbb/concurrent_hash_map.cpp
+  tbb/concurrent_monitor.cpp
+  tbb/concurrent_queue.cpp
+  tbb/concurrent_vector.cpp
+  tbb/condition_variable.cpp
+  tbb/critical_section.cpp
+  tbb/dynamic_link.cpp
+  tbb/governor.cpp
+  tbb/itt_notify.cpp
+  tbb/market.cpp
+  tbb/mutex.cpp
+  tbb/observer_proxy.cpp
+  tbb/pipeline.cpp
+  tbb/private_server.cpp
+  tbb/queuing_mutex.cpp
+  tbb/queuing_rw_mutex.cpp
+  tbb/reader_writer_lock.cpp
+  tbb/recursive_mutex.cpp
+  tbb/scheduler.cpp
+  tbb/spin_mutex.cpp
+  tbb/spin_rw_mutex.cpp
+  tbb/task.cpp
+  tbb/task_group_context.cpp
+  tbb/tbb_main.cpp
+  tbb/tbb_misc.cpp
+  tbb/tbb_statistics.cpp
+  tbb/tbb_thread.cpp
+  tbbmalloc/backend.cpp
+  tbbmalloc/backref.cpp
+  tbbmalloc/frontend.cpp
+  tbbmalloc/large_objects.cpp
+  tbbmalloc/proxy.cpp
+  tbbmalloc/tbb_function_replacement.cpp
+  tbbmalloc/tbbmalloc.cpp
+  )
+
+ADD_LIBRARY(obj_tbb OBJECT ${src_tbb})
+
+
+#
+# Add necessary definitions:
+#
+
+IF(NOT CMAKE_SYSTEM_NAME MATCHES "Darwin")
+  SET(TBB_COMPILE_FLAGS "${TBB_COMPILE_FLAGS} -DDO_ITT_NOTIFY")
+ENDIF()
+
+IF(CMAKE_BUILD_TYPE MATCHES "Debug")
+  SET(TBB_COMPILE_FLAGS "${TBB_COMPILE_FLAGS} -DTBB_USE_DEBUG")
+ENDIF()
+
+IF(DEAL_II_USE_MT_POSIX)
+  SET(TBB_COMPILE_FLAGS "${TBB_COMPILE_FLAGS} -DUSE_PTHREAD")
+ENDIF()
+
+SET_TARGET_PROPERTIES(obj_tbb PROPERTIES
+  COMPILE_FLAGS ${TBB_COMPILE_FLAGS})
+

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.