diff --git a/CMakeLists.txt b/CMakeLists.txt index a6846c8f..ae2543f3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -53,8 +53,8 @@ set(DEPS_DIRECTORY ${PROJECT_SOURCE_DIR}/deps) add_subdirectory(${DEPS_DIRECTORY}/arena-sdk) add_subdirectory(${DEPS_DIRECTORY}/json) -add_subdirectory(${DEPS_DIRECTORY}/opencv) -# add_subdirectory(${DEPS_DIRECTORY}/torch) +# add_subdirectory(${DEPS_DIRECTORY}/opencv) +add_subdirectory(${DEPS_DIRECTORY}/torch) # ============================= # ============================= diff --git a/deps/opencv/CMakeLists.txt.stackoverflow b/deps/opencv/CMakeLists.txt.stackoverflow index bb88bf70..a820e97e 100644 --- a/deps/opencv/CMakeLists.txt.stackoverflow +++ b/deps/opencv/CMakeLists.txt.stackoverflow @@ -1,4 +1,5 @@ +# https://github.com/opencv/opencv/issues/20548 include(FetchContent) FetchContent_Declare( opencv diff --git a/deps/torch/CMakeLists.txt b/deps/torch/CMakeLists.txt index 3b5072cf..d72c24f1 100644 --- a/deps/torch/CMakeLists.txt +++ b/deps/torch/CMakeLists.txt @@ -1,20 +1,23 @@ include(FetchContent) Set(FETCHCONTENT_QUIET FALSE) -# https://github.com/ArthurSonzogni/nlohmann_json_cmake_fetchcontent FetchContent_Declare(Torch URL https://download.pytorch.org/libtorch/cpu/libtorch-cxx11-abi-shared-with-deps-2.1.0%2Bcpu.zip ) # URL https://download.pytorch.org/libtorch/nightly/cpu/libtorch-shared-with-deps-latest.zip FetchContent_MakeAvailable(Torch) -# find_package(Torch REQUIRED) + +# message(FATAL_ERROR ${CMAKE_BINARY_DIR}) +set(Torch_DIR "${CMAKE_BINARY_DIR}/_deps/torch-src/share/cmake/Torch/") +find_package(Torch REQUIRED) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TORCH_CXX_FLAGS}") target_link_libraries(${PROJECT_NAME} PRIVATE "${TORCH_LIBRARIES}" ) -include_directories(SYSTEM ${TORCH_INCLUDE_DIRS}) +target_include_directories(${PROJECT_NAME} PRIVATE ${TORCH_INCLUDE_DIRS}) # find_package(Torch REQUIRED) # set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TORCH_CXX_FLAGS}")