1set(TORCH_RPC_TEST_DIR "${TORCH_ROOT}/test/cpp/rpc") 2set(TORCH_RPC_TEST_SOURCES 3 ${TORCH_ROOT}/test/cpp/common/main.cpp 4 ${TORCH_RPC_TEST_DIR}/e2e_test_base.cpp 5 ${TORCH_RPC_TEST_DIR}/test_wire_serialization.cpp 6) 7set(TORCH_RPC_TEST_DEPENDENCY_LIBS 8 torch gtest 9) 10 11if(USE_GLOO) 12 list(APPEND TORCH_RPC_TEST_SOURCES 13 ${TORCH_RPC_TEST_DIR}/test_e2e_tensorpipe.cpp 14 ) 15endif() 16 17if(USE_TENSORPIPE) 18 list(APPEND TORCH_RPC_TEST_SOURCES 19 ${TORCH_RPC_TEST_DIR}/test_tensorpipe_serialization.cpp 20 ) 21 list(APPEND TORCH_RPC_TEST_DEPENDENCY_LIBS 22 tensorpipe 23 ) 24endif() 25 26add_executable(test_cpp_rpc ${TORCH_RPC_TEST_SOURCES}) 27target_include_directories( 28 test_cpp_rpc PRIVATE 29 ${ATen_CPU_INCLUDE}) 30target_include_directories( 31 test_cpp_rpc PRIVATE 32 $<BUILD_INTERFACE:${TORCH_SRC_DIR}/csrc/distributed>) 33target_link_libraries(test_cpp_rpc PRIVATE ${TORCH_RPC_TEST_DEPENDENCY_LIBS}) 34 35if(USE_CUDA) 36 target_compile_definitions(test_cpp_rpc PRIVATE "USE_CUDA") 37endif() 38 39if(INSTALL_TEST) 40 install(TARGETS test_cpp_rpc DESTINATION bin) 41 # Install PDB files for MSVC builds 42 if(MSVC AND BUILD_SHARED_LIBS) 43 install(FILES $<TARGET_PDB_FILE:test_cpp_rpc> DESTINATION bin OPTIONAL) 44 endif() 45endif() 46