# -----------------------------------------------------------------------------------------------------------
# Copyright (c) 2025 Huawei Technologies Co., Ltd.
# This program is free software, you can redistribute it and/or modify it under the terms and conditions of
# CANN Open Software License Agreement Version 2.0 (the "License").
# Please refer to the License for details. You may not use this file except in compliance with the License.
# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
# INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
# See LICENSE in the root of the software repository for the full text of the License.
# -----------------------------------------------------------------------------------------------------------
pybind11_add_module(pypto_impl
MODULE
pybind11.cpp
bindings/torch_tensor_converter.cpp
bindings/enum.cpp
bindings/element.cpp
bindings/tensor.cpp
bindings/symbolic_scalar.cpp
bindings/controller.cpp
bindings/operation.cpp
bindings/runtime.cpp
bindings/cost_model.cpp
bindings/pass_config.cpp
bindings/function.cpp
bindings/distributed.cpp
bindings/platform.cpp
bindings/utils.cpp
bindings/ir/ir.cpp
bindings/ir/builder.cpp
bindings/ir/logging.cpp
)
target_include_directories(pypto_impl
PRIVATE
${CMAKE_CURRENT_LIST_DIR}
)
target_compile_definitions(pypto_impl
PRIVATE
$<BUILD_INTERFACE:$<$<BOOL:${BUILD_WITH_CANN}>:BUILD_WITH_CANN>>
)
# 所依赖的本项目 so 均在 pypto 包 __init__.py 中加载, 此处不再 link
target_link_libraries(pypto_impl
PRIVATE
json
c_sec
intf_pub_cxx17
tile_fwk_intf_pub
)
if (TARGET c_sec_shared)
add_dependencies(pypto_impl c_sec_shared)
endif ()
PTO_Fwk_GenerateGCovConfigJson(TARGET pypto_impl)