[Openmp-commits] [PATCH] D93290: [OpenMP][NFC] Use CMake Variables

Atmn Patel via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Tue Dec 15 03:21:40 PST 2020


atmnpatel created this revision.
atmnpatel added a reviewer: jdoerfert.
Herald added subscribers: guansong, yaxunl, mgorny.
atmnpatel requested review of this revision.
Herald added subscribers: openmp-commits, sstefan1.
Herald added a project: OpenMP.

This patchs adds the use of CMake variables to add subdirectories and
include directories. In addition, it renames CMake variable to a more
meaningful name that I intend to also define in its parent scope in a
later patch. Both of these variables will be used to have a clean CMake
for the upcoming remote offloading plugin.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D93290

Files:
  openmp/libomptarget/CMakeLists.txt
  openmp/libomptarget/src/CMakeLists.txt


Index: openmp/libomptarget/src/CMakeLists.txt
===================================================================
--- openmp/libomptarget/src/CMakeLists.txt
+++ openmp/libomptarget/src/CMakeLists.txt
@@ -12,19 +12,19 @@
 
 libomptarget_say("Building offloading runtime library libomptarget.")
 
-set(src_files
-  api.cpp
-  device.cpp
-  interface.cpp
-  MemoryManager.cpp
-  rtl.cpp
-  omptarget.cpp
+set(LIBOMPTARGET_SRC_FILES
+  ${CMAKE_CURRENT_SOURCE_DIR}/api.cpp
+  ${CMAKE_CURRENT_SOURCE_DIR}/device.cpp
+  ${CMAKE_CURRENT_SOURCE_DIR}/interface.cpp
+  ${CMAKE_CURRENT_SOURCE_DIR}/MemoryManager.cpp
+  ${CMAKE_CURRENT_SOURCE_DIR}/rtl.cpp
+  ${CMAKE_CURRENT_SOURCE_DIR}/omptarget.cpp
 )
 
 # Build libomptarget library with libdl dependency. Add LLVMSupport
 # dependency if building in-tree with profiling enabled.
 if(OPENMP_STANDALONE_BUILD OR (NOT OPENMP_ENABLE_LIBOMPTARGET_PROFILING))
-  add_library(omptarget SHARED ${src_files})
+  add_library(omptarget SHARED ${LIBOMPTARGET_SRC_FILES})
   target_link_libraries(omptarget
     ${CMAKE_DL_LIBS}
     "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/exports")
@@ -32,7 +32,7 @@
   set(LLVM_LINK_COMPONENTS
     Support
     )
-  add_llvm_library(omptarget SHARED ${src_files}
+  add_llvm_library(omptarget SHARED ${LIBOMPTARGET_SRC_FILES}
       LINK_LIBS ${CMAKE_DL_LIBS}
       "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/exports"
       )
Index: openmp/libomptarget/CMakeLists.txt
===================================================================
--- openmp/libomptarget/CMakeLists.txt
+++ openmp/libomptarget/CMakeLists.txt
@@ -59,10 +59,12 @@
   add_definitions(-DOMPTARGET_DEBUG)
 endif()
 
-include_directories(include)
+set(LIBOMPTARGET_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include)
+include_directories(${LIBOMPTARGET_INCLUDE_DIR})
 
 # Build target agnostic offloading library.
-add_subdirectory(src)
+set(LIBOMPTARGET_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src)
+add_subdirectory(${LIBOMPTARGET_SRC_DIR})
 
 # Retrieve the path to the resulting library so that it can be used for 
 # testing.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D93290.311854.patch
Type: text/x-patch
Size: 2074 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20201215/49b343bb/attachment.bin>


More information about the Openmp-commits mailing list