


# The package pulls in all the necessary torch libraries, # so there is no need to also add `find_package(Torch)` here.

List (APPEND CMAKE_PREFIX_PATH "/path/to/opencv/vision" ) # The first thing do is to tell cmake to find the TorchVision library. Include_directories ( $ ) # This due to LibTorch's version is the one included in the Python # package that links to Python.įind_package (Python3 COMPONENTS Development ) # Add torchvision libraries List (APPEND CMAKE_PREFIX_PATH "/path/to/vision" ) # set OpenCV_DIR variable equal to the path to the cmake # files within the previously installed opencv program set (OpenCV_DIR /path/to/opencv/install/lib/cmake/opencv4 ) # Tell compiler to use C++ 14 features which is needed because # Clang version is often behind in the XCode installation set (CMAKE_CXX_STANDARD 14 ) # configure the necessary common CMake environment variables # needed to include and link the OpenCV program into this # demo project, namely OpenCV_INCLUDE_DIRS and OpenCV_LIBSįind_package ( OpenCV REQUIRED ) # tell the build to include the headers from OpenCV List (APPEND CMAKE_PREFIX_PATH "/path/to/libtorch" ) Project (torch-demo ) #set(CMAKE_OSX_ARCHITECTURES "x86_64") # CMakeLists.txt # Older versions of CMake are likely to work just fine but, since # I don't know where to cut off I just use the version I'm usingĬmake_minimum_required (VERSION "3.17" ) # name of this example project
