]> git.proxmox.com Git - ceph.git/blame - ceph/src/arrow/cpp/src/arrow/gpu/CMakeLists.txt
import quincy 17.2.0
[ceph.git] / ceph / src / arrow / cpp / src / arrow / gpu / CMakeLists.txt
CommitLineData
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
22add_custom_target(arrow_cuda-all)
23add_custom_target(arrow_cuda)
24add_custom_target(arrow_cuda-benchmarks)
25add_custom_target(arrow_cuda-tests)
26add_dependencies(arrow_cuda-all arrow_cuda arrow_cuda-tests arrow_cuda-benchmarks)
27
28if(DEFINED ENV{CUDA_HOME})
29 set(CUDA_TOOLKIT_ROOT_DIR "$ENV{CUDA_HOME}")
30endif()
31
32find_package(CUDA REQUIRED)
33include_directories(SYSTEM ${CUDA_INCLUDE_DIRS})
34
35set(ARROW_CUDA_SRCS cuda_arrow_ipc.cc cuda_context.cc cuda_internal.cc cuda_memory.cc)
36
37set(ARROW_CUDA_SHARED_LINK_LIBS ${CUDA_CUDA_LIBRARY})
38
39add_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
57add_dependencies(arrow_cuda ${ARROW_CUDA_LIBRARIES})
58
59foreach(LIB_TARGET ${ARROW_CUDA_LIBRARIES})
60 target_compile_definitions(${LIB_TARGET} PRIVATE ARROW_EXPORTING)
61endforeach()
62
63# CUDA build version
64configure_file(cuda_version.h.in "${CMAKE_CURRENT_BINARY_DIR}/cuda_version.h" @ONLY)
65
66install(FILES "${CMAKE_CURRENT_BINARY_DIR}/cuda_version.h"
67 DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/arrow/gpu")
68
69arrow_install_all_headers("arrow/gpu")
70
71if(ARROW_BUILD_SHARED)
72 set(ARROW_CUDA_LIBRARY arrow_cuda_shared)
73else()
74 set(ARROW_CUDA_LIBRARY arrow_cuda_static)
75endif()
76
77set(ARROW_CUDA_TEST_LINK_LIBS ${ARROW_CUDA_LIBRARY} ${ARROW_TEST_LINK_LIBS})
78
79if(ARROW_BUILD_TESTS)
80 add_arrow_test(cuda_test STATIC_LINK_LIBS ${ARROW_CUDA_TEST_LINK_LIBS} NO_VALGRIND)
81endif()
82
83if(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)
88endif()