Skip to content

CMake wrapper for installing LibTorch (PyTorch C++ API)

Notifications You must be signed in to change notification settings

ori-drs/torch_cpp

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

LibTorch install script for CMake

This CMake project is basically an install script for LibTorch (PyTorch C++ API). It downloads the binary archieve and installs headers, libraries and CMake configurations files to the corresponding INCLUDEDIR, LIBDIR and DATADIR directories.

The package can be used as part of a pure CMake catkin or colcon workspace by including:

  <buildtool_depend>cmake</buildtool_depend>
  <depend>torch_cpp</depend>
  <export>
    <build_type>cmake</build_type>
  </export>

in your package.xml. The relevant files will then be installed within the workspace target folder (install or devel).

Usage in a CMake project:

find_package(Torch REQUIRED)
target_link_libraries(${PROJECT_NAME} PUBLIC torch)
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 14)
target_link_options(${PROJECT_NAME} PUBLIC ${TORCH_CXX_FLAGS})

About

CMake wrapper for installing LibTorch (PyTorch C++ API)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • CMake 96.0%
  • C++ 4.0%