Browse Source

Link with iomp5 on Apple instead of libomp for better interopreability with Anaconda

master
Trevor Irons 5 years ago
parent
commit
b059847017
3 changed files with 30 additions and 16 deletions
  1. 5
    1
      CMake/SuperBuild.cmake
  2. 17
    13
      CMakeLists.txt
  3. 8
    2
      Modules/DCIP/CMakeLists.txt

+ 5
- 1
CMake/SuperBuild.cmake View File

@@ -21,9 +21,10 @@ if (yaml-cpp_FOUND)
21 21
     message( STATUS "YAML-CPP was found ${yaml-cpp_FOUND}" )
22 22
 else()
23 23
     message( STATUS "YAML-CPP WAS NOT FOUND, BUILDING" )
24
+
24 25
     ExternalProject_Add(YAML_CPP
25 26
         GIT_REPOSITORY  "https://github.com/jbeder/yaml-cpp.git"
26
-        GIT_TAG "master" # "yaml-cpp-0.6.2", # "master" 
27
+        GIT_TAG "yaml-cpp-0.6.3"  # "master" 
27 28
         UPDATE_COMMAND ""
28 29
         PATCH_COMMAND ""
29 30
         PREFIX ${CMAKE_CURRENT_BINARY_DIR}/external/yaml-cpp
@@ -34,6 +35,9 @@ else()
34 35
                    -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}
35 36
                    -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} 
36 37
                    -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} 
38
+                   -DCMAKE_CXX_STANDARD=14
39
+                   -DCMAKE_CXX_STANDARD_REQUIRED=ON
40
+                   -DCMAKE_CXX_EXTENSIONS=OFF
37 41
     )
38 42
 endif()
39 43
 

+ 17
- 13
CMakeLists.txt View File

@@ -281,21 +281,25 @@ SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
281 281
 if (LEMMA_USE_OPENMP)
282 282
 
283 283
     if(APPLE)
284
-        if(CMAKE_C_COMPILER_ID MATCHES "Clang")
285
-            set(OpenMP_C "${CMAKE_C_COMPILER}")
286
-            set(OpenMP_C_FLAGS "-fopenmp=libomp -Wno-unused-command-line-argument")
287
-            set(OpenMP_C_LIB_NAMES "libomp" "libgomp" "libiomp5")
288
-            set(OpenMP_libomp_LIBRARY ${OpenMP_C_LIB_NAMES})
289
-            set(OpenMP_libgomp_LIBRARY ${OpenMP_C_LIB_NAMES})
290
-            set(OpenMP_libiomp5_LIBRARY ${OpenMP_C_LIB_NAMES})
291
-        endif()
284
+        #if(CMAKE_C_COMPILER_ID MATCHES "Clang")
285
+        #    set(OpenMP_C "${CMAKE_C_COMPILER}")
286
+        #    set(OpenMP_C_FLAGS "-fopenmp=libomp -Wno-unused-command-line-argument")
287
+        #    set(OpenMP_C_LIB_NAMES "libomp" "libgomp" "libiomp5")
288
+        #    set(OpenMP_libomp_LIBRARY ${OpenMP_C_LIB_NAMES})
289
+        #    set(OpenMP_libgomp_LIBRARY ${OpenMP_C_LIB_NAMES})
290
+        #    set(OpenMP_libiomp5_LIBRARY ${OpenMP_C_LIB_NAMES})
291
+        #endif()
292 292
         if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
293
+            find_library( libiomp5 NAMES  libiomp5.dylib PATHS "/anaconda3/lib/" REQUIRED )
293 294
             set(OpenMP_CXX "${CMAKE_CXX_COMPILER}")
294
-            set(OpenMP_CXX_FLAGS "-fopenmp=libomp -Wno-unused-command-line-argument")
295
-            set(OpenMP_CXX_LIB_NAMES "libomp" "libgomp" "libiomp5")
296
-            set(OpenMP_libomp_LIBRARY ${OpenMP_CXX_LIB_NAMES})
297
-            set(OpenMP_libgomp_LIBRARY ${OpenMP_CXX_LIB_NAMES})
298
-            set(OpenMP_libiomp5_LIBRARY ${OpenMP_CXX_LIB_NAMES})
295
+            set(OpenMP_CXX_FLAGS "-fopenmp=libiomp5 -Wno-unused-command-line-argument")
296
+            set(OpenMP_CXX_LIB_NAMES "libiomp5") #"libomp" "libgomp" "libiomp5")
297
+            #set(OpenMP_libomp_LIBRARY ${OpenMP_CXX_LIB_NAMES})
298
+            #set(OpenMP_libgomp_LIBRARY ${OpenMP_CXX_LIB_NAMES})
299
+            set(OpenMP_libiomp5_LIBRARY libiomp5 )# ${OpenMP_CXX_LIB_NAMES})
300
+            set(OpenMP_LIBRARIES  libiomp5)
301
+            link_directories("/anaconda3/lib")
302
+    #        find_package(OpenMP REQUIRED)
299 303
     #         set(OpenMP_CXX_FLAGS "-Xpreprocessor -fopenmp -I/usr/local/opt/libomp/include")
300 304
     #         " -DOpenMP_CXX_LIB_NAMES=\"omp\" -DOpenMP_omp_LIBRARY=/usr/local/opt/libomp/lib/libomp.dylib ")
301 305
     #         set(OpenMP_CXX_LIB_NAMES "omp") # "libgomp" "libiomp5")

+ 8
- 2
Modules/DCIP/CMakeLists.txt View File

@@ -1,11 +1,15 @@
1
-# Configure EMSchur3D 
1
+option ( LEMMA_MODULE_DCIP TRUE )
2
+
3
+if (LEMMA_MODULE_DCIP)
4
+
5
+# Configure DCIP 
2 6
 set(DCIP_VERSION_MAJOR "0")
3 7
 set(DCIP_VERSION_MINOR "0")
4 8
 set(DCIP_VERSION_PATCH "1")
5 9
 set(DCIP_VERSION "\"${DCIP_VERSION_MAJOR}.${DCIP_VERSION_MINOR}.${DCIP_VERSION_PATCH}\"")
6 10
 set(DCIP_VERSION_NOQUOTES "${DCIP_VERSION_MAJOR}.${DCIP_VERSION_MINOR}.${DCIP_VERSION_PATCH}")
7 11
 
8
-option ( LEMMA_MODULE_DCIP TRUE )
12
+
9 13
 
10 14
 configure_file (
11 15
 	"${CMAKE_CURRENT_SOURCE_DIR}/config/DCIPConfig.h.in"
@@ -48,3 +52,5 @@ install ( FILES  ${PROJECT_BINARY_DIR}/include/DCIPConfig.h   DESTINATION ${CMAK
48 52
 	#if (LEMMA_BUILD_EXAMPLES)
49 53
 	#	add_subdirectory(examples)
50 54
 	#endif()
55
+
56
+endif()

Loading…
Cancel
Save