[Openmp-commits] [PATCH] D45220: [OpenMP] Search llvm package to find bc file compiler and linker if not specified by a user
Guansong Zhang via Phabricator via Openmp-commits
openmp-commits at lists.llvm.org
Tue Apr 3 11:38:43 PDT 2018
guansong created this revision.
guansong added a reviewer: grokos.
guansong added a project: OpenMP.
Herald added subscribers: openmp-commits, mgorny.
This is a small improvement over the command line option to specify compiler and linker for bc files processing.
It includes considerations for both built and installed version of clang and also search the the path for the build compiler used for the runtime.
Repository:
rOMP OpenMP
https://reviews.llvm.org/D45220
Files:
libomptarget/cmake/Modules/LibomptargetGetDependencies.cmake
Index: libomptarget/cmake/Modules/LibomptargetGetDependencies.cmake
===================================================================
--- libomptarget/cmake/Modules/LibomptargetGetDependencies.cmake
+++ libomptarget/cmake/Modules/LibomptargetGetDependencies.cmake
@@ -158,3 +158,69 @@
LIBOMPTARGET_DEP_CUDA_DRIVER_LIBRARIES)
mark_as_advanced(LIBOMPTARGET_DEP_CUDA_DRIVER_LIBRARIES)
+
+################################################################################
+# Looking for device bc compiler
+################################################################################
+if (LIBOMPTARGET_NVPTX_ENABLE_BCLIB)
+ if (LIBOMPTARGET_NVPTX_CUDA_COMPILER AND LIBOMPTARGET_NVPTX_CUDA_LINKER)
+ #message(STATUS "Defined compiler ${LIBOMPTARGET_NVPTX_CUDA_COMPILER}")
+ #message(STATUS "Defined linker ${LIBOMPTARGET_NVPTX_CUDA_LINKER}")
+ else()
+ if (LIBOMPTARGET_NVPTX_CUDA_COMPILER)
+ get_filename_component(LIBOMPTARGET_NVPTX_CUDA_COMPILER_BINDIR ${LIBOMPTARGET_NVPTX_CUDA_COMPILER} DIRECTORY)
+ get_filename_component(LIBOMPTARGET_NVPTX_CUDA_COMPILER_DIR ${LIBOMPTARGET_NVPTX_CUDA_COMPILER_BINDIR} DIRECTORY)
+ #message(STATUS "Defined compiler dir ${LIBOMPTARGET_NVPTX_CUDA_COMPILER_DIR}")
+ endif()
+
+ if (LIBOMPTARGET_NVPTX_CUDA_LINKER)
+ get_filename_component(LIBOMPTARGET_NVPTX_CUDA_LINKER_BINDIR ${LIBOMPTARGET_NVPTX_CUDA_LINKER} DIRECTORY)
+ get_filename_component(LIBOMPTARGET_NVPTX_CUDA_LINKER_DIR ${LIBOMPTARGET_NVPTX_CUDA_LINKER_BINDIR} DIRECTORY)
+ #message(STATUS "Defined linker dir ${LIBOMPTARGET_NVPTX_CUDA_LINKER_DIR}")
+ endif()
+
+ if (CMAKE_CXX_COMPILER)
+ get_filename_component(CMAKE_CXX_COMPILER_BINDIR ${CMAKE_CXX_COMPILER} DIRECTORY)
+ get_filename_component(CMAKE_CXX_COMPILER_DIR ${CMAKE_CXX_COMPILER_BINDIR} DIRECTORY)
+ #message(STATUS "Default compiler dir ${CMAKE_CXX_COMPILER_DIR}")
+ endif()
+
+ find_package(LLVM QUIET CONFIG
+ PATHS
+ ${LIBOMPTARGET_NVPTX_CUDA_COMPILER_DIR}
+ ${LIBOMPTARGET_NVPTX_CUDA_LINKER_DIR}
+ ${CMAKE_CXX_COMPILER_DIR}
+ NO_DEFAULT_PATH
+ )
+
+ if (LLVM_DIR)
+ message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}. Configure: ${LLVM_DIR}/LLVMConfig.cmake")
+ #message(STATUS " LLVM LLVM_INSTALL_PREFIX: ${LLVM_INSTALL_PREFIX}")
+
+ set(LLVM_DIR_FOUND ${LLVM_DIR})
+ set(LLVM_INSTALL_PREFIX ${LLVM_INSTALL_PREFIX})
+ set(LLVM_MAIN_INCDIR ${LLVM_BUILD_MAIN_INCLUDE_DIR})
+
+ if (LLVM_INSTALL_PREFIX)
+ set(LLVM_BINDIR ${LLVM_INSTALL_PREFIX}/bin)
+ set(LLVM_INCDIR ${LLVM_INSTALL_PREFIX}/include)
+ set(LLVM_LIBDIR ${LLVM_INSTALL_PREFIX}/lib)
+ else()
+ set(LLVM_BINDIR ${LLVM_BUILD_BINARY_DIR}/bin)
+ set(LLVM_INCDIR ${LLVM_BUILD_BINARY_DIR}/include)
+ set(LLVM_LIBDIR ${LLVM_LIBRARY_DIRS})
+ endif()
+
+ if (NOT LIBOMPTARGET_NVPTX_CUDA_COMPILER)
+ set(LIBOMPTARGET_NVPTX_CUDA_COMPILER ${LLVM_BINDIR}/clang++)
+ endif()
+
+ if (NOT LIBOMPTARGET_NVPTX_CUDA_LINKER)
+ set(LIBOMPTARGET_NVPTX_CUDA_LINKER ${LLVM_BINDIR}/llvm-link)
+ endif()
+ endif()
+ endif()
+endif()
+
+
+
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45220.140836.patch
Type: text/x-patch
Size: 3120 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20180403/43903814/attachment-0001.bin>
More information about the Openmp-commits
mailing list