Files
pytorch/test/mobile/custom_build/CMakeLists.txt
Nikita Shulga 493c7fa66f [Cmake] Make PyTorch buildable by CMake-4.x (#150203)
By turning on compatibility mode for protobuf, nnpack, PSimd and FP16, ittapi, TensorPipe and Gloo
Update CMake requirements

 Revert 0ece461ccafe5649d2d0f058ff5477765fd56499 and b0901d62ae2c2e909f91401eacebf3731df20cbe to test that it actually works

TODO:
  - Update/get rid of those libraries

Fixes https://github.com/pytorch/pytorch/issues/150149

Pull Request resolved: https://github.com/pytorch/pytorch/pull/150203
Approved by: https://github.com/clee2000
2025-03-29 01:39:13 +00:00

25 lines
558 B
CMake

cmake_minimum_required(VERSION 3.15)
project(custom_build_project)
set(CMAKE_CXX_STANDARD 17 CACHE STRING "The C++ standard whose features are requested to build this target.")
# Find torch library
find_package(Torch REQUIRED)
# Main executable
add_executable(Predictor predictor.cpp)
target_include_directories(Predictor PUBLIC ${TORCH_INCLUDE_DIRS})
find_package(Threads REQUIRED)
target_link_libraries(Predictor
-Wl,-s
-Wl,--gc-sections
-Wl,--whole-archive
${TORCH_LIBRARIES}
-Wl,--no-whole-archive
Threads::Threads
${CMAKE_DL_LIBS}
)