[PATCH] D41685: [test-suite, CUDA] Make sure we use the thrust library from test external dir.

Artem Belevich via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 8 10:11:07 PST 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL322013: [test-suite, CUDA] Make sure we use the thrust library from test external dir. (authored by tra, committed by ).

Repository:
  rL LLVM

https://reviews.llvm.org/D41685

Files:
  test-suite/trunk/External/CUDA/CMakeLists.txt


Index: test-suite/trunk/External/CUDA/CMakeLists.txt
===================================================================
--- test-suite/trunk/External/CUDA/CMakeLists.txt
+++ test-suite/trunk/External/CUDA/CMakeLists.txt
@@ -61,6 +61,7 @@
     llvm_test_run()
   endif()
   llvm_test_executable(${_executable} ${_sources})
+  target_compile_options(${_executable} PUBLIC ${VariantCPPFLAGS})
   if(VariantLibs)
     target_link_libraries(${_executable} ${VariantLibs})
   endif()
@@ -98,7 +99,8 @@
   llvm_test_run(--verbose ${_ExtraThrustTestArgs})
   llvm_test_executable(${_executable} ${TestSource})
   target_link_libraries(${_executable} ${VariantLibs})
-  target_compile_options(${_executable} PUBLIC ${THRUST_CPPFLAGS})
+  target_compile_options(${_executable} BEFORE PUBLIC ${THRUST_CPPFLAGS})
+  target_compile_options(${_executable} PUBLIC ${VariantCPPFLAGS})
   list(APPEND THRUST_VARIANT_TESTS ${_executable})
 endmacro()
 
@@ -111,7 +113,8 @@
     # test framework is common for all tests, so we build it once as a
     # library.
     add_library(ThrustTestFrameworkLib-${VariantSuffix} STATIC ${ThrustTestFramework})
-    append_compile_flags(ThrustTestFrameworkLib-${VariantSuffix} ${CPPFLAGS} ${THRUST_CPPFLAGS})
+    target_compile_options(ThrustTestFrameworkLib-${VariantSuffix} BEFORE PRIVATE ${THRUST_CPPFLAGS})
+    target_compile_options(ThrustTestFrameworkLib-${VariantSuffix} PRIVATE ${VariantCPPFLAGS})
     add_dependencies(ThrustTestFrameworkLib-${VariantSuffix} timeit-host fpcmp-host)
     list(APPEND VariantLibs ThrustTestFrameworkLib-${VariantSuffix})
 
@@ -133,8 +136,12 @@
     # overhead, so it's actually way slower than running all tests
     # sequentially.
     llvm_test_run(--verbose ${_ExtraThrustTestArgs})
+    # CUDA SDK comes with its own version of thrust in its include directory.
+    # In order to use the thrust library we want, its include path must precede
+    # that of the CUDA SDK include path.
     llvm_test_executable(${_ThrustMainTarget} ${ThrustTestFramework} ${ThrustAllTestSources})
-    target_compile_options(${_ThrustMainTarget} PUBLIC ${THRUST_CPPFLAGS})
+    target_compile_options(${_ThrustMainTarget} BEFORE PUBLIC ${THRUST_CPPFLAGS})
+    target_compile_options(${_executable} PUBLIC ${VariantCPPFLAGS})
     target_link_libraries(${_ThrustMainTarget} ${VariantLibs})
   endif()
   add_dependencies(cuda-tests-${VariantSuffix} cuda-tests-thrust-${VariantSuffix})
@@ -148,7 +155,7 @@
     COMMENT "Build CUDA test variant ${VariantSuffix}")
 
   set(VariantLibs ${_Cuda_Libs} ${_Stdlib_Libs})
-  list(APPEND CPPFLAGS ${_Cuda_CPPFLAGS} ${_Std_CPPFLAGS} ${_Stdlib_CPPFLAGS})
+  set(VariantCPPFLAGS ${_Cuda_CPPFLAGS} ${_Std_CPPFLAGS} ${_Stdlib_CPPFLAGS})
   list(APPEND LDFLAGS ${_Cuda_LDFLAGS} ${_Std_LDFLAGS} ${_Stdlib_LDFLAGS})
 
   # Create a separate test target for simple tests that can be built/tested quickly.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D41685.128948.patch
Type: text/x-patch
Size: 2888 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180108/f61b6519/attachment.bin>


More information about the llvm-commits mailing list