]> Creatis software - crea.git/commitdiff
#3392 vtk9itk5wx3-macos
authorEduardo DAVILA <davila@creatis.insa-lyon.fr>
Wed, 3 Aug 2022 11:06:31 +0000 (13:06 +0200)
committerEduardo DAVILA <davila@creatis.insa-lyon.fr>
Wed, 3 Aug 2022 11:06:31 +0000 (13:06 +0200)
cmake/CREAMacro_FindAndUseLibraries.cmake
cmake/CREAMacro_FindAndUseVTK.cmake

index e5976cd3a823da0f8fc19be0049044f760fc04d4..96cf5ec8b7081169325f54957058ee76959369bd 100644 (file)
@@ -61,6 +61,63 @@ IF(USE_VTK)
 ENDIF(USE_VTK)
 #-----------------------------------------------------------------------------
 
+#-----------------------------------------------------------------------------
+IF(USE_OPENMP)
+  IF(APPLE)
+    set(CMAKE_THREAD_LIBS_INIT "-lpthread")
+    set(CMAKE_HAVE_THREADS_LIBRARY 1)
+    set(CMAKE_USE_WIN32_THREADS_INIT 0)
+    set(CMAKE_USE_PTHREADS_INIT 1)
+    set(THREADS_PREFER_PTHREAD_FLAG ON)
+  ENDIF()
+  find_package(Threads REQUIRED)
+
+### Find OpenMP
+if(APPLE )
+    if(CMAKE_C_COMPILER_ID MATCHES "Clang")
+        set(OpenMP_C "${CMAKE_C_COMPILER}")
+        set(OpenMP_C_FLAGS "-Xclang -fopenmp=libomp -Wno-unused-command-line-argument")
+        set(OpenMP_C_LIB_NAMES "libomp" "libgomp" "libiomp5")
+        set(OpenMP_libomp_LIBRARY ${OpenMP_C_LIB_NAMES})
+        set(OpenMP_libgomp_LIBRARY ${OpenMP_C_LIB_NAMES})
+        set(OpenMP_libiomp5_LIBRARY ${OpenMP_C_LIB_NAMES})
+    endif()
+    if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
+      set(OpenMP_CXX "${CMAKE_CXX_COMPILER}")
+#      set(OpenMP_CXX_FLAGS "-fopenmp=libomp -Wno-unused-command-line-argument")
+      set(OpenMP_CXX_FLAGS "-Xclang -fopenmp -Wno-unused-command-line-argument")
+      set(OpenMP_CXX_LIB_NAMES "libomp" "libgomp" "libiomp5")
+      set(OpenMP_libomp_LIBRARY ${OpenMP_CXX_LIB_NAMES})
+#EED 2022/05/15
+      set(OpenMP_libomp_LIBRARY_crea libomp.dylib )      
+#      set(OpenMP_libiomp5_LIBRARY ${OpenMP_CXX_LIB_NAMES})
+    endif()
+endif()
+  find_package(OpenMP REQUIRED)
+if (OPENMP_FOUND)
+#    include_directories("${OPENMP_INCLUDES}")
+
+message(EEE oooopppeeennnn OPENMP_LIBRARIES ${OPENMP_LIBRARIES} )
+message(EEE oooopppeeennnn OPENMP_LIBRARIES ${OPENMP_LIBRARIES} )
+message(EEE oooopppeeennnn OPENMP_LIBRARIES ${OPENMP_LIBRARIES} )
+message(EEE oooopppeeennnn OPENMP_LIBRARIES ${OPENMP_LIBRARIES} )
+message(EEE oooopppeeennnn OPENMP_LIBRARIES ${OPENMP_LIBRARIES} )
+message(EEE oooopppeeennnn OPENMP_LIBRARIES ${OPENMP_LIBRARIES} )
+message(EEE oooopppeeennnn OPENMP_LIBRARIES ${OPENMP_LIBRARIES} )
+
+    link_directories( /opt/local/lib/libomp  ) 
+    set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
+    set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
+    # set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
+endif(OPENMP_FOUND)
+
+
+ENDIF(USE_OPENMP)
+
+#-----------------------------------------------------------------------------
+
+
+
 #-----------------------------------------------------------------------------
 IF(USE_KWWIDGETS)
   IF(NOT KWWidgets_FOUND)
index 9541f57cd80c5c39cd8183dab81b43e3de1a35a0..7224685dafd9ed3ee13d190dd63c9cfc105d46ad 100644 (file)
@@ -1,7 +1,7 @@
 # ---------------------------------------------------------------------
 #
 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image 
-#                        pour la Santé©
+#                        pour la Sant
 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
@@ -56,7 +56,6 @@ INCLUDE_DIRECTORIES(include ${VTK_INCLUDE_DIRS} )
                #MESSAGE("${GTK2_INCLUDE_DIRS}")
                INCLUDE_DIRECTORIES(${GTK2_INCLUDE_DIRS})
                LINK_LIBRARIES(${GTK2_LIBRARIES})
-message("EED CREAMacro_FindAndUseVTK.cmake  GTK2_INCLUDE_DIRS "${GTK2_INCLUDE_DIRS} )
 message("EED CREAMacro_FindAndUseVTK.cmake  GTK2_VERSION "${GTK2_VERSION} )
                # Can I require all my user to have the gl lib on linux, even if they do not really need it...
                SET(WXGLCANVASLIBS "gl")
@@ -218,9 +217,6 @@ ENDIF("${VTK_MAJOR_VERSION}" LESS 6)
 #          vtkViewsQt
 #          vtkNetCDF_cxx       
 #              )
-    message("EED-a vtk libraries: "${VTK_LIBRARIES})
-    message("EED-start vtk include dirs: "${VTK_INCLUDE_DIRS})
-    message("EED-end")
     
        ENDIF(WIN32)