Created
October 15, 2025 08:41
-
-
Save tejainece/958d76f83c6987d509fc942225211115 to your computer and use it in GitHub Desktop.
Compile libtorch example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| cmake_minimum_required(VERSION 3.31.6) | |
| project(libtorch_examples) | |
| set(libtorch_VERSION 2.8.0) | |
| find_package(Torch ${libtorch_VERSION} PATHS ../libtorch_linux) | |
| if(NOT Torch_FOUND) | |
| else() | |
| message(STATUS "libtorch ${libtorch_VERSION} - found") | |
| endif() | |
| macro(add_example name) | |
| add_executable(${name} ${name}.cpp) | |
| target_include_directories(${name} PRIVATE ../libtorch_linux/include) | |
| target_include_directories(${name} PRIVATE ../libtorch_linux/include/torch/csrc/api/include) | |
| target_link_libraries(${name} ${TORCH_LIBRARIES}) | |
| endmacro() | |
| add_example(ctorch) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment