[Openmp-commits] [PATCH] D62841: [openmp] Use libffi only when LLVM_ENABLE_FFI is on

Taewook Oh via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Mon Jun 3 23:18:50 PDT 2019


twoh created this revision.
twoh added reviewers: grokos, hyviquel, Hahnfeld.
Herald added subscribers: openmp-commits, jdoerfert, guansong, mgorny.
Herald added a project: OpenMP.

Currently libomptarget enables the use of libffi if the library is found, even when LLVM_ENABLE_FFI cmake variable is set to OFF. As this may confuse the users, guard libomptarget's use of libffi with LLVM_ENABLE_FFI.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D62841

Files:
  openmp/libomptarget/cmake/Modules/LibomptargetGetDependencies.cmake


Index: openmp/libomptarget/cmake/Modules/LibomptargetGetDependencies.cmake
===================================================================
--- openmp/libomptarget/cmake/Modules/LibomptargetGetDependencies.cmake
+++ openmp/libomptarget/cmake/Modules/LibomptargetGetDependencies.cmake
@@ -65,37 +65,39 @@
 
 pkg_check_modules(LIBOMPTARGET_SEARCH_LIBFFI QUIET libffi)
 
-find_path (
-  LIBOMPTARGET_DEP_LIBFFI_INCLUDE_DIR
-  NAMES
-    ffi.h
-  HINTS
-    ${LIBOMPTARGET_SEARCH_LIBFFI_INCLUDEDIR}
-    ${LIBOMPTARGET_SEARCH_LIBFFI_INCLUDE_DIRS}
-  PATHS
-    /usr/include
-    /usr/local/include
-    /opt/local/include
-    /sw/include
-    ENV CPATH)
-
-# Don't bother look for the library if the header files were not found.
-if (LIBOMPTARGET_DEP_LIBFFI_INCLUDE_DIR)
-  find_library (
-      LIBOMPTARGET_DEP_LIBFFI_LIBRARIES
+if( LLVM_ENABLE_FFI )
+  find_path (
+    LIBOMPTARGET_DEP_LIBFFI_INCLUDE_DIR
     NAMES
-      ffi
+      ffi.h
     HINTS
-      ${LIBOMPTARGET_SEARCH_LIBFFI_LIBDIR}
-      ${LIBOMPTARGET_SEARCH_LIBFFI_LIBRARY_DIRS}
+      ${LIBOMPTARGET_SEARCH_LIBFFI_INCLUDEDIR}
+      ${LIBOMPTARGET_SEARCH_LIBFFI_INCLUDE_DIRS}
     PATHS
-      /usr/lib
-      /usr/local/lib
-      /opt/local/lib
-      /sw/lib
-      ENV LIBRARY_PATH
-      ENV LD_LIBRARY_PATH)
-endif()
+      /usr/include
+      /usr/local/include
+      /opt/local/include
+      /sw/include
+      ENV CPATH)
+  
+  # Don't bother look for the library if the header files were not found.
+  if (LIBOMPTARGET_DEP_LIBFFI_INCLUDE_DIR)
+    find_library (
+        LIBOMPTARGET_DEP_LIBFFI_LIBRARIES
+      NAMES
+        ffi
+      HINTS
+        ${LIBOMPTARGET_SEARCH_LIBFFI_LIBDIR}
+        ${LIBOMPTARGET_SEARCH_LIBFFI_LIBRARY_DIRS}
+      PATHS
+        /usr/lib
+        /usr/local/lib
+        /opt/local/lib
+        /sw/lib
+        ENV LIBRARY_PATH
+        ENV LD_LIBRARY_PATH)
+  endif()
+endif( LLVM_ENABLE_FFI )
 
 set(LIBOMPTARGET_DEP_LIBFFI_INCLUDE_DIRS ${LIBOMPTARGET_DEP_LIBFFI_INCLUDE_DIR})
 find_package_handle_standard_args(


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D62841.202860.patch
Type: text/x-patch
Size: 2035 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20190604/6d7c8ad4/attachment.bin>


More information about the Openmp-commits mailing list