# -----------------------------------------------------------------------------------------------------------
# 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.
# -----------------------------------------------------------------------------------------------------------

set(src_list
    ${CMAKE_CURRENT_SOURCE_DIR}/adapter_acl.cc
    ${CMAKE_CURRENT_SOURCE_DIR}/alg_env_config.cc
    ${CMAKE_CURRENT_SOURCE_DIR}/param_check.cc
    ${CMAKE_CURRENT_SOURCE_DIR}/inconsistent_check.cc
    ${CMAKE_CURRENT_SOURCE_DIR}/utils.cc
    ${CMAKE_CURRENT_SOURCE_DIR}/alg_type.cc
    ${CMAKE_CURRENT_SOURCE_DIR}/adapter_error_manager_pub.cc
    ${CMAKE_CURRENT_SOURCE_DIR}/config_log.cc
    ${CMAKE_CURRENT_SOURCE_DIR}/log.cc
    ${CMAKE_CURRENT_SOURCE_DIR}/sal.cc
    ${CMAKE_CURRENT_SOURCE_DIR}/hccl_mc2.cc
    ${CMAKE_CURRENT_SOURCE_DIR}/compat.cc
)

# 在静态模式下添加 static_restore.cc
message(STATUS "STATIC_MODE = ${STATIC_MODE}")
if(STATIC_MODE)
    list(APPEND src_list ${CMAKE_CURRENT_SOURCE_DIR}/static_restore.cc)
    message(STATUS "Added static_restore.cc to src_list")
endif()

message(STATUS "src_list contains ${src_list}")

if(TARGET hccl)
    target_sources(hccl PRIVATE
        ${src_list}
    )
endif()

add_subdirectory(hcomm_dlsym)