浏览代码

Merge branch 'master' of https://lemma.codes/Lemma

iss7
Trevor Irons 5 年前
父节点
当前提交
0321d73c56
共有 1 个文件被更改,包括 32 次插入24 次删除
  1. 32
    24
      CMakeLists.txt

+ 32
- 24
CMakeLists.txt 查看文件

@@ -289,38 +289,46 @@ SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
289 289
 
290 290
 if (LEMMA_USE_OPENMP)
291 291
 
292
-            #    if(APPLE)
293
-            #if(CMAKE_C_COMPILER_ID MATCHES "Clang")
294
-            #set(OpenMP_C "${CMAKE_C_COMPILER}")
295
-            #set(OpenMP_C_FLAGS "-fopenmp=libomp -Wno-unused-command-line-argument")
296
-            #set(OpenMP_C_LIB_NAMES "libomp" "libgomp" "libiomp5")
297
-            #set(OpenMP_libomp_LIBRARY ${OpenMP_C_LIB_NAMES})
298
-            #set(OpenMP_libgomp_LIBRARY ${OpenMP_C_LIB_NAMES})
299
-            #set(OpenMP_libiomp5_LIBRARY ${OpenMP_C_LIB_NAMES})
300
-            #endif()
301
-            #        if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
302
-            #            set(OpenMP_CXX "${CMAKE_CXX_COMPILER}")
303
-            #            set(OpenMP_CXX_FLAGS "-Xpreprocessor -fopenmp -I/usr/local/opt/libomp/include")
304
-            #" -DOpenMP_CXX_LIB_NAMES=\"omp\" -DOpenMP_omp_LIBRARY=/usr/local/opt/libomp/lib/libomp.dylib ")
305
-            #            set(OpenMP_CXX_LIB_NAMES "omp") # "libgomp" "libiomp5")
306
-            #            set(OpenMP_libomp_LIBRARY "/usr/local/opt/libomp/lib/libomp.dylib") #${OpenMP_CXX_LIB_NAMES})
307
-            #set(OpenMP_libgomp_LIBRARY ${OpenMP_CXX_LIB_NAMES})
308
-            #set(OpenMP_libiomp5_LIBRARY ${OpenMP_CXX_LIB_NAMES})
309
-            #        endif()
310
-            #    endif()
292
+    if(APPLE)
293
+        if(CMAKE_C_COMPILER_ID MATCHES "Clang")
294
+            set(OpenMP_C "${CMAKE_C_COMPILER}")
295
+            set(OpenMP_C_FLAGS "-fopenmp=libomp -Wno-unused-command-line-argument")
296
+            set(OpenMP_C_LIB_NAMES "libomp" "libgomp" "libiomp5")
297
+            set(OpenMP_libomp_LIBRARY ${OpenMP_C_LIB_NAMES})
298
+            set(OpenMP_libgomp_LIBRARY ${OpenMP_C_LIB_NAMES})
299
+            set(OpenMP_libiomp5_LIBRARY ${OpenMP_C_LIB_NAMES})
300
+        endif()
301
+        if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
302
+            set(OpenMP_CXX "${CMAKE_CXX_COMPILER}")
303
+            set(OpenMP_CXX_FLAGS "-fopenmp=libomp -Wno-unused-command-line-argument")
304
+            set(OpenMP_CXX_LIB_NAMES "libomp" "libgomp" "libiomp5")
305
+            set(OpenMP_libomp_LIBRARY ${OpenMP_CXX_LIB_NAMES})
306
+            set(OpenMP_libgomp_LIBRARY ${OpenMP_CXX_LIB_NAMES})
307
+            set(OpenMP_libiomp5_LIBRARY ${OpenMP_CXX_LIB_NAMES})
308
+    #         set(OpenMP_CXX_FLAGS "-Xpreprocessor -fopenmp -I/usr/local/opt/libomp/include")
309
+    #         " -DOpenMP_CXX_LIB_NAMES=\"omp\" -DOpenMP_omp_LIBRARY=/usr/local/opt/libomp/lib/libomp.dylib ")
310
+    #         set(OpenMP_CXX_LIB_NAMES "omp") # "libgomp" "libiomp5")
311
+    #         set(OpenMP_libomp_LIBRARY "/usr/local/opt/libomp/lib/libomp.dylib") #${OpenMP_CXX_LIB_NAMES})
312
+    #         set(OpenMP_libgomp_LIBRARY ${OpenMP_CXX_LIB_NAMES})
313
+    #         set(OpenMP_libiomp5_LIBRARY ${OpenMP_CXX_LIB_NAMES})
314
+        endif()
315
+    endif()
311 316
 
312 317
     if (CMAKE_CROSSCOMPILING)
313 318
         set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fopenmp")
314 319
         set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp")
315 320
         set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fopenmp")
316
-        add_definitions(-DLEMMAUSEOMP) # -DEIGEN_DONT_VECTORIZE )
317 321
     else()
318 322
         find_package(OpenMP REQUIRED)
319
-        set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
320
-        set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
321
-        set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
322
-        add_definitions(-DLEMMAUSEOMP) # -DEIGEN_DONT_VECTORIZE)
323
+        if (OPENMP_FOUND)
324
+            # include_directories("${OPENMP_INCLUDES}")
325
+            link_directories("${OPENMP_LIBRARIES}")
326
+            set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
327
+            set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
328
+            set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
329
+        endif()
323 330
     endif()
331
+    add_definitions(-DLEMMAUSEOMP) # -DEIGEN_DONT_VECTORIZE)
324 332
 endif()
325 333
 
326 334
 configure_file (

正在加载...
取消
保存