[llvm-branch-commits] [openmp] 907886c - [OpenMP][Libomptarget][NFC] Use CMake Variables

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Dec 16 16:17:57 PST 2020


Author: Atmn
Date: 2020-12-16T19:05:15-05:00
New Revision: 907886cc5b3a72250246f96bc6e6c11bd76b4cf6

URL: https://github.com/llvm/llvm-project/commit/907886cc5b3a72250246f96bc6e6c11bd76b4cf6
DIFF: https://github.com/llvm/llvm-project/commit/907886cc5b3a72250246f96bc6e6c11bd76b4cf6.diff

LOG: [OpenMP][Libomptarget][NFC] Use CMake Variables

This patchs adds CMake variables to add subdirectories and include
directories for libomptarget and explicitly gives the location of source
files.

Differential Revision: https://reviews.llvm.org/D93290

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/openmp/libomptarget/CMakeLists.txt b/openmp/libomptarget/CMakeLists.txt
index 7ef0bafdf3c6..4d6ebb4381bc 100644
--- a/openmp/libomptarget/CMakeLists.txt
+++ b/openmp/libomptarget/CMakeLists.txt
@@ -59,10 +59,12 @@ if(LIBOMPTARGET_ENABLE_DEBUG)
   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.

diff  --git a/openmp/libomptarget/src/CMakeLists.txt b/openmp/libomptarget/src/CMakeLists.txt
index 586589da401d..894b5ec6f21b 100644
--- a/openmp/libomptarget/src/CMakeLists.txt
+++ b/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 @@ else()
   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"
       )


        


More information about the llvm-branch-commits mailing list