使用clion写c++,使用cmake编译 libtorch,使用的是ubuntu 20.04系统。
-
- 其中项目名称叫
untitled_torch0221
- 其中项目名称叫
-
- libtorch文件夹路径为:
/home/yuzn/下载/cpp_lib/libtorch-cxx11-abi-shared-with-deps-1.10.2+cu113/libtorch
- 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)

1109

被折叠的 条评论
为什么被折叠?



