github.com/johnnyeven/libtools@v0.0.0-20191126065708-61829c1adf46/third_party/mlir/tools/mlir-cuda-runner/CMakeLists.txt (about) 1 set(LLVM_OPTIONAL_SOURCES 2 cuda-runtime-wrappers.cpp 3 mlir-cuda-runner.cpp 4 ) 5 6 if(MLIR_CUDA_RUNNER_ENABLED) 7 if (NOT ("NVPTX" IN_LIST LLVM_TARGETS_TO_BUILD)) 8 message(SEND_ERROR 9 "Building the mlir cuda runner requires the NVPTX backend") 10 endif() 11 12 # Configure CUDA runner support. Using check_language first allows us to give 13 # a custom error message. 14 include(CheckLanguage) 15 check_language(CUDA) 16 if (CMAKE_CUDA_COMPILER) 17 enable_language(CUDA) 18 else() 19 message(SEND_ERROR 20 "Building the mlir cuda runner requires a working CUDA install") 21 endif() 22 23 # We need the libcuda.so library. 24 find_library(CUDA_RUNTIME_LIBRARY cuda) 25 26 add_llvm_library(cuda-runtime-wrappers SHARED 27 cuda-runtime-wrappers.cpp 28 ) 29 target_include_directories(cuda-runtime-wrappers 30 PRIVATE ${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES} 31 LLVMSupport 32 ) 33 target_link_libraries(cuda-runtime-wrappers 34 LLVMSupport 35 ${CUDA_RUNTIME_LIBRARY} 36 ) 37 38 set(FULL_LINK_LIBS 39 MLIRAffineOps 40 MLIRControlFlowToCFG 41 MLIRGPU 42 MLIRGPUtoCUDATransforms 43 MLIRGPUtoNVVMTransforms 44 MLIRLLVMIR 45 MLIRStandardOps 46 MLIRStandardToLLVM 47 MLIRTargetLLVMIR 48 MLIRTransforms 49 MLIRTranslation 50 ) 51 set(LIBS 52 MLIRIR 53 MLIRParser 54 MLIREDSC 55 MLIRAnalysis 56 MLIRExecutionEngine 57 MLIRJitRunner 58 MLIRSupport 59 LLVMCore 60 LLVMSupport 61 ${CUDA_RUNTIME_LIBRARY} 62 ) 63 add_llvm_executable(mlir-cuda-runner 64 mlir-cuda-runner.cpp 65 ) 66 add_dependencies(mlir-cuda-runner cuda-runtime-wrappers) 67 target_include_directories(mlir-cuda-runner 68 PRIVATE ${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES} 69 ) 70 llvm_update_compile_flags(mlir-cuda-runner) 71 whole_archive_link(mlir-cuda-runner ${FULL_LINK_LIBS}) 72 target_link_libraries(mlir-cuda-runner PRIVATE ${FULL_LINK_LIBS} ${LIBS}) 73 74 endif()