2020-09-05 12:49:54 +03:00
|
|
|
# Copyright (c) Microsoft Corporation.
|
|
|
|
# Licensed under the MIT License.
|
|
|
|
|
|
|
|
add_subdirectory(models)
|
|
|
|
|
|
|
|
set(SRC main.cpp)
|
|
|
|
|
|
|
|
file(GLOB nnfusion_core_files nnfusion/core/*.cpp)
|
2020-11-23 09:42:53 +03:00
|
|
|
file(GLOB nnfusion_common_files nnfusion/common/*.cpp)
|
2020-09-05 12:49:54 +03:00
|
|
|
file(GLOB nnfusion_engine_files nnfusion/engine/*.cpp)
|
|
|
|
file(GLOB nnfusion_inventory_files nnfusion/inventory/*.cpp)
|
|
|
|
file(GLOB nnfusion_kernels_files nnfusion/kernels/*.cpp)
|
|
|
|
file(GLOB nnfusion_testutil_files nnfusion/test_util/*.cpp)
|
|
|
|
if (ONNX_FRONTEND)
|
|
|
|
list(APPEND nnfusion_frontend_files nnfusion/frontend/onnx_import.cpp)
|
|
|
|
endif()
|
|
|
|
if (TENSORFLOW_FRONTEND)
|
|
|
|
list(APPEND nnfusion_frontend_files nnfusion/frontend/tensorflow_import.cpp)
|
|
|
|
endif()
|
|
|
|
if (TORCHSCRIPT_FRONTEND)
|
|
|
|
list(APPEND nnfusion_frontend_files nnfusion/frontend/torchscript_import.cpp)
|
|
|
|
endif()
|
|
|
|
list(APPEND SRC ${nnfusion_core_files}
|
|
|
|
${nnfusion_engine_files}
|
2020-11-23 09:42:53 +03:00
|
|
|
${nnfusion_common_files}
|
2020-09-05 12:49:54 +03:00
|
|
|
${nnfusion_inventory_files}
|
|
|
|
${nnfusion_kernels_files}
|
|
|
|
${nnfusion_testutil_files}
|
|
|
|
${nnfusion_frontend_files}
|
|
|
|
)
|
|
|
|
|
|
|
|
add_executable(unit-test ${SRC})
|
|
|
|
|
|
|
|
target_include_directories(unit-test PRIVATE ".")
|
|
|
|
|
|
|
|
if (ONNX_FRONTEND)
|
|
|
|
target_include_directories(unit-test PRIVATE ${ONNXPROTO_INCLUDE})
|
|
|
|
target_link_libraries(unit-test PRIVATE onnx_import_interface onnx_import onnx_proto)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if (TENSORFLOW_FRONTEND)
|
|
|
|
target_include_directories(unit-test PRIVATE ${TFPROTO_INCLUDE})
|
|
|
|
target_link_libraries(unit-test PRIVATE tensorflow_import_interface tensorflow_import tensorflow_proto)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if (TORCHSCRIPT_FRONTEND)
|
|
|
|
target_include_directories(unit-test PRIVATE ${TORCH_INCLUDE_DIRS})
|
|
|
|
target_link_libraries(unit-test PRIVATE torchscript_import_interface torchscript_import frontend_util)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if (ONNX_FRONTEND)
|
|
|
|
target_include_directories(unit-test PRIVATE ${ONNXPROTO_INCLUDE})
|
|
|
|
target_link_libraries(unit-test PRIVATE onnx_import_interface onnx_import onnx_proto)
|
|
|
|
endif()
|
|
|
|
|
2021-11-08 06:57:36 +03:00
|
|
|
target_link_libraries(unit-test PRIVATE
|
|
|
|
-Wl,--whole-archive
|
|
|
|
# Common feature
|
|
|
|
nnfusion_common
|
|
|
|
nnfusion_util
|
|
|
|
nnfusion_cache_manager
|
|
|
|
nnfusion_operators
|
|
|
|
nnfusion_serialize
|
|
|
|
nnfusion_graph
|
|
|
|
nnfusion_ir
|
|
|
|
# Engine related
|
|
|
|
nnfusion_engine_base
|
|
|
|
nnfusion_engine_profiler
|
|
|
|
nnfusion_engine_device
|
|
|
|
nnfusion_engine_pass
|
|
|
|
nnfusion_engine_pass_graph
|
|
|
|
nnfusion_engine_pass_graph_blockfusion
|
|
|
|
nnfusion_engine_pass_graph_subgraph_fusion
|
|
|
|
nnfusion_engine_pass_graph_autodiff
|
|
|
|
# Kernels and Operators
|
|
|
|
contrib_custom_operators
|
|
|
|
kernels_registration
|
|
|
|
kernels_cuda
|
|
|
|
kernels_cpu
|
|
|
|
kernels_hlsl
|
|
|
|
# Depends
|
|
|
|
-Wl,--no-whole-archive
|
|
|
|
protobuf::libprotobuf
|
|
|
|
dl
|
2022-03-08 12:27:09 +03:00
|
|
|
${GFLAGS}
|
|
|
|
${SQLITE3}
|
2021-11-08 06:57:36 +03:00
|
|
|
GTest::GTest
|
|
|
|
Threads::Threads
|
|
|
|
)
|
2020-09-05 12:49:54 +03:00
|
|
|
|
|
|
|
add_custom_target(unit-test-check
|
|
|
|
COMMAND ${PROJECT_BINARY_DIR}/test/unit-test \${ARGS}
|
|
|
|
DEPENDS unit-test
|
|
|
|
)
|
|
|
|
|
|
|
|
add_custom_target(check
|
|
|
|
DEPENDS
|
|
|
|
style-check
|
|
|
|
unit-test-check
|
|
|
|
)
|