赞
踩
使用clion写c++,使用cmake编译 libtorch,使用的是ubuntu 20.04系统。
untitled_torch0221
/home/yuzn/下载/cpp_lib/libtorch-cxx11-abi-shared-with-deps-1.10.2+cu113/libtorch
find_package(PythonInterp REQUIRED)
cmake_minimum_required(VERSION 3.22)
project(untitled_torch0221)
set(CMAKE_CXX_STANDARD 14)
add_executable(untitled_torch0221 main.cpp)
set(CMAKE_PREFIX_PATH /home/yuzn/下载/cpp_lib/libtorch-cxx11-abi-shared-with-deps-1.10.2+cu113/libtorch)
include_directories(/home/yuzn/下载/cpp_lib/libtorch-cxx11-abi-shared-with-deps-1.10.2+cu113/libtorch/include)
include_directories(/home/yuzn/下载/cpp_lib/libtorch-cxx11-abi-shared-with-deps-1.10.2+cu113/libtorch/include/csrc/api/include)
find_package(Torch REQUIRED)
target_link_libraries(untitled_torch0221 "${TORCH_LIBRARIES}")
set_property(TARGET untitled_torch0221 PROPERTY CXX_STANDARD 14)
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。