Repository navigation
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
51 lines (46 loc) · 1.88 KB
/
Copy pathCMakeLists.txt
File metadata and controls
51 lines (46 loc) · 1.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# Copyright (c) Advanced Micro Devices, Inc. All rights reserved.
#
# SPDX-License-Identifier: MIT
function(hipobj_add_example name)
hipobj_add_executable(
NAME ${name}
SRCS ${ARGN})
# Clang's -Wunsafe-buffer-usage wants std::span and the like in place of
# pointer arithmetic, indexing argv, and C library calls such as
# std::strtoull(). The examples are written to C++11, which has no
# std::span, so they can't comply.
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
target_compile_options(${name} PRIVATE -Wno-unsafe-buffer-usage)
endif()
target_include_directories(${name} PRIVATE
${PROJECT_SOURCE_DIR}/include
${PROJECT_SOURCE_DIR}/src
${PROJECT_SOURCE_DIR}/src/common
${PROJECT_SOURCE_DIR}/src/rdma
${PROJECT_SOURCE_DIR}/src/s3)
target_link_libraries(${name} PRIVATE
hipobj hip::host dl)
endfunction()
# The programs are built here but not installed. HIPOBJInstall.cmake
# installs their sources, with CMakeLists.install.cmake as their
# CMakeLists.txt, for users to build against the installed hipObject.
hipobj_add_example(get-version get-version.cpp)
# It needs no GPU or NIC, so the tests run it
if(BUILD_TESTING)
add_test(NAME hipobj-example-get-version
COMMAND get-version)
endif()
find_package(CURL QUIET)
if(CURL_FOUND)
hipobj_add_example(get-object get-object.cpp s3_curl_ops.cpp)
hipobj_add_example(put-object put-object.cpp s3_curl_ops.cpp)
target_compile_definitions(get-object PRIVATE HIPOBJ_HAVE_CURL)
target_compile_definitions(put-object PRIVATE HIPOBJ_HAVE_CURL)
target_link_libraries(get-object PRIVATE CURL::libcurl)
target_link_libraries(put-object PRIVATE CURL::libcurl)
message(STATUS "hipObject examples: libcurl enabled (--live mode)")
else()
hipobj_add_example(get-object get-object.cpp)
hipobj_add_example(put-object put-object.cpp)
message(STATUS "hipObject examples: libcurl not found (stub mode only)")
endif()