xref: /aosp_15_r20/external/pytorch/test/mobile/nnc/CMakeLists.txt (revision da0073e96a02ea20f0ac840b70461e3646d07c45)
1set(MOBILE_NNC_TEST_ROOT ${TORCH_ROOT}/test/mobile/nnc)
2
3set(MOBILE_NNC_TEST_SRCS
4  ${MOBILE_NNC_TEST_ROOT}/test_context.cpp
5  ${MOBILE_NNC_TEST_ROOT}/test_nnc_backend.cpp
6  ${MOBILE_NNC_TEST_ROOT}/test_registry.cpp
7)
8
9add_executable(test_mobile_nnc
10  ${TORCH_ROOT}/test/cpp/lite_interpreter_runtime/main.cpp
11  ${MOBILE_NNC_TEST_SRCS}
12)
13
14target_link_libraries(test_mobile_nnc PRIVATE torch gtest)
15target_include_directories(test_mobile_nnc PRIVATE ${ATen_CPU_INCLUDE})
16target_compile_definitions(test_mobile_nnc PRIVATE USE_GTEST)
17
18add_executable(aot_model_compiler_test
19  ${TORCH_ROOT}/binaries/aot_model_compiler.cc
20)
21
22target_link_libraries(aot_model_compiler_test PRIVATE torch)
23target_include_directories(aot_model_compiler_test PRIVATE ${ATen_CPU_INCLUDE})
24
25if(INSTALL_TEST)
26  install(TARGETS test_mobile_nnc DESTINATION bin)
27  install(TARGETS aot_model_compiler_test DESTINATION bin)
28  # Install PDB files for MSVC builds
29  if(MSVC AND BUILD_SHARED_LIBS)
30    install(FILES $<TARGET_PDB_FILE:test_mobile_nnc> DESTINATION bin OPTIONAL)
31  endif()
32endif()
33