]>
Commit | Line | Data |
---|---|---|
1d09f67e TL |
1 | # Licensed to the Apache Software Foundation (ASF) under one |
2 | # or more contributor license agreements. See the NOTICE file | |
3 | # distributed with this work for additional information | |
4 | # regarding copyright ownership. The ASF licenses this file | |
5 | # to you under the Apache License, Version 2.0 (the | |
6 | # "License"); you may not use this file except in compliance | |
7 | # with the License. You may obtain a copy of the License at | |
8 | # | |
9 | # http://www.apache.org/licenses/LICENSE-2.0 | |
10 | # | |
11 | # Unless required by applicable law or agreed to in writing, | |
12 | # software distributed under the License is distributed on an | |
13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | |
14 | # KIND, either express or implied. See the License for the | |
15 | # specific language governing permissions and limitations | |
16 | # under the License. | |
17 | ||
18 | # | |
19 | # arrow_cuda | |
20 | # | |
21 | ||
22 | add_custom_target(arrow_cuda-all) | |
23 | add_custom_target(arrow_cuda) | |
24 | add_custom_target(arrow_cuda-benchmarks) | |
25 | add_custom_target(arrow_cuda-tests) | |
26 | add_dependencies(arrow_cuda-all arrow_cuda arrow_cuda-tests arrow_cuda-benchmarks) | |
27 | ||
28 | if(DEFINED ENV{CUDA_HOME}) | |
29 | set(CUDA_TOOLKIT_ROOT_DIR "$ENV{CUDA_HOME}") | |
30 | endif() | |
31 | ||
32 | find_package(CUDA REQUIRED) | |
33 | include_directories(SYSTEM ${CUDA_INCLUDE_DIRS}) | |
34 | ||
35 | set(ARROW_CUDA_SRCS cuda_arrow_ipc.cc cuda_context.cc cuda_internal.cc cuda_memory.cc) | |
36 | ||
37 | set(ARROW_CUDA_SHARED_LINK_LIBS ${CUDA_CUDA_LIBRARY}) | |
38 | ||
39 | add_arrow_lib(arrow_cuda | |
40 | CMAKE_PACKAGE_NAME | |
41 | ArrowCUDA | |
42 | PKG_CONFIG_NAME | |
43 | arrow-cuda | |
44 | SOURCES | |
45 | ${ARROW_CUDA_SRCS} | |
46 | OUTPUTS | |
47 | ARROW_CUDA_LIBRARIES | |
48 | SHARED_LINK_FLAGS | |
49 | ${ARROW_VERSION_SCRIPT_FLAGS} # Defined in cpp/arrow/CMakeLists.txt | |
50 | SHARED_LINK_LIBS | |
51 | arrow_shared | |
52 | ${ARROW_CUDA_SHARED_LINK_LIBS} | |
53 | # Static arrow_cuda must also link against CUDA shared libs | |
54 | STATIC_LINK_LIBS | |
55 | ${ARROW_CUDA_SHARED_LINK_LIBS}) | |
56 | ||
57 | add_dependencies(arrow_cuda ${ARROW_CUDA_LIBRARIES}) | |
58 | ||
59 | foreach(LIB_TARGET ${ARROW_CUDA_LIBRARIES}) | |
60 | target_compile_definitions(${LIB_TARGET} PRIVATE ARROW_EXPORTING) | |
61 | endforeach() | |
62 | ||
63 | # CUDA build version | |
64 | configure_file(cuda_version.h.in "${CMAKE_CURRENT_BINARY_DIR}/cuda_version.h" @ONLY) | |
65 | ||
66 | install(FILES "${CMAKE_CURRENT_BINARY_DIR}/cuda_version.h" | |
67 | DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/arrow/gpu") | |
68 | ||
69 | arrow_install_all_headers("arrow/gpu") | |
70 | ||
71 | if(ARROW_BUILD_SHARED) | |
72 | set(ARROW_CUDA_LIBRARY arrow_cuda_shared) | |
73 | else() | |
74 | set(ARROW_CUDA_LIBRARY arrow_cuda_static) | |
75 | endif() | |
76 | ||
77 | set(ARROW_CUDA_TEST_LINK_LIBS ${ARROW_CUDA_LIBRARY} ${ARROW_TEST_LINK_LIBS}) | |
78 | ||
79 | if(ARROW_BUILD_TESTS) | |
80 | add_arrow_test(cuda_test STATIC_LINK_LIBS ${ARROW_CUDA_TEST_LINK_LIBS} NO_VALGRIND) | |
81 | endif() | |
82 | ||
83 | if(ARROW_BUILD_BENCHMARKS) | |
84 | cuda_add_executable(arrow-cuda-benchmark cuda_benchmark.cc) | |
85 | target_link_libraries(arrow-cuda-benchmark ${ARROW_CUDA_LIBRARY} GTest::gtest | |
86 | ${ARROW_BENCHMARK_LINK_LIBS}) | |
87 | add_dependencies(arrow_cuda-benchmarks arrow-cuda-benchmark) | |
88 | endif() |