Merged
feat(cmake): 在现有分类遍历中补充独立 DSL 入口 #15388
feat(cmake): 在现有分类遍历中补充独立 DSL 入口 #15388
Merged
zyh_gitcodeAdd on 3 days ago
Total: 15 files changed+43-11
@@ -31,6 +31,8 @@ foreach(SUB_DIR ${CURRENT_DIRS})
31 else()31 else()
32 if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${SUB_DIR}/op_host/CMakeLists.txt")32 if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${SUB_DIR}/op_host/CMakeLists.txt")
33 add_subdirectory(${SUB_DIR}/op_host)33 add_subdirectory(${SUB_DIR}/op_host)
34+ elseif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${SUB_DIR}/op_dsl/CMakeLists.txt")
35+ add_subdirectory(${SUB_DIR}/op_dsl)
34 endif()36 endif()
35 endif()37 endif()
36endforeach()38endforeach()
@@ -30,6 +30,8 @@ foreach(SUB_DIR ${CURRENT_DIRS})
30 else()30 else()
31 if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${SUB_DIR}/op_host/CMakeLists.txt")31 if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${SUB_DIR}/op_host/CMakeLists.txt")
32 add_subdirectory(${SUB_DIR}/op_host)32 add_subdirectory(${SUB_DIR}/op_host)
33+ elseif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${SUB_DIR}/op_dsl/CMakeLists.txt")
34+ add_subdirectory(${SUB_DIR}/op_dsl)
33 endif()35 endif()
34 endif()36 endif()
35-endforeach()37+endforeach()
@@ -14,5 +14,7 @@ foreach(SUBDIR ${SUBDIRECTORIES})
14 # 检查子目录中是否存在 CMakeLists.txt14 # 检查子目录中是否存在 CMakeLists.txt
15 if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIR}/CMakeLists.txt)15 if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIR}/CMakeLists.txt)
16 add_subdirectory(${SUBDIR})16 add_subdirectory(${SUBDIR})
17+ elseif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIR}/op_dsl/CMakeLists.txt")
18+ add_subdirectory(${SUBDIR}/op_dsl)
17 endif()19 endif()
18-endforeach()20+endforeach()
@@ -14,5 +14,7 @@ foreach(SUBDIR ${SUBDIRECTORIES})
14 # 检查子目录中是否存在 CMakeLists.txt14 # 检查子目录中是否存在 CMakeLists.txt
15 if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIR}/CMakeLists.txt)15 if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIR}/CMakeLists.txt)
16 add_subdirectory(${SUBDIR})16 add_subdirectory(${SUBDIR})
17+ elseif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIR}/op_dsl/CMakeLists.txt")
18+ add_subdirectory(${SUBDIR}/op_dsl)
17 endif()19 endif()
18endforeach()20endforeach()
@@ -1,9 +1,9 @@
1# ----------------------------------------------------------------------------1# ----------------------------------------------------------------------------
2# Copyright (c) 2025 Huawei Technologies Co., Ltd.2# Copyright (c) 2025 Huawei Technologies Co., Ltd.
3-# This program is free software, you can redistribute it and/or modify it under the terms and conditions of 3+# This program is free software, you can redistribute it and/or modify it under the terms and conditions of
4# CANN Open Software License Agreement Version 2.0 (the "License").4# CANN Open Software License Agreement Version 2.0 (the "License").
5# Please refer to the License for details. You may not use this file except in compliance with the License.5# Please refer to the License for details. You may not use this file except in compliance with the License.
6-# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, 6+# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
7# INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.7# INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
8# See LICENSE in the root of the software repository for the full text of the License.8# See LICENSE in the root of the software repository for the full text of the License.
9# ----------------------------------------------------------------------------9# ----------------------------------------------------------------------------
@@ -14,5 +14,7 @@ foreach(SUBDIR ${SUBDIRECTORIES})
14 # 检查子目录中是否存在 CMakeLists.txt14 # 检查子目录中是否存在 CMakeLists.txt
15 if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIR}/CMakeLists.txt)15 if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIR}/CMakeLists.txt)
16 add_subdirectory(${SUBDIR})16 add_subdirectory(${SUBDIR})
17+ elseif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIR}/op_dsl/CMakeLists.txt")
18+ add_subdirectory(${SUBDIR}/op_dsl)
17 endif()19 endif()
18-endforeach()20+endforeach()
@@ -14,5 +14,7 @@ foreach(SUBDIR ${SUBDIRECTORIES})
14 # 检查子目录中是否存在 CMakeLists.txt14 # 检查子目录中是否存在 CMakeLists.txt
15 if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIR}/CMakeLists.txt)15 if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIR}/CMakeLists.txt)
16 add_subdirectory(${SUBDIR})16 add_subdirectory(${SUBDIR})
17+ elseif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIR}/op_dsl/CMakeLists.txt")
18+ add_subdirectory(${SUBDIR}/op_dsl)
17 endif()19 endif()
18endforeach()20endforeach()
@@ -14,5 +14,7 @@ foreach(SUBDIR ${SUBDIRECTORIES})
14 # 检查子目录中是否存在 CMakeLists.txt14 # 检查子目录中是否存在 CMakeLists.txt
15 if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIR}/CMakeLists.txt)15 if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIR}/CMakeLists.txt)
16 add_subdirectory(${SUBDIR})16 add_subdirectory(${SUBDIR})
17+ elseif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIR}/op_dsl/CMakeLists.txt")
18+ add_subdirectory(${SUBDIR}/op_dsl)
17 endif()19 endif()
18-endforeach()20+endforeach()
@@ -14,5 +14,7 @@ foreach(SUBDIR ${SUBDIRECTORIES})
14 # 检查子目录中是否存在 CMakeLists.txt14 # 检查子目录中是否存在 CMakeLists.txt
15 if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIR}/CMakeLists.txt)15 if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIR}/CMakeLists.txt)
16 add_subdirectory(${SUBDIR})16 add_subdirectory(${SUBDIR})
17+ elseif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIR}/op_dsl/CMakeLists.txt")
18+ add_subdirectory(${SUBDIR}/op_dsl)
17 endif()19 endif()
18-endforeach()20+endforeach()
@@ -17,6 +17,8 @@ else()
17 # 检查子目录中是否存在 CMakeLists.txt17 # 检查子目录中是否存在 CMakeLists.txt
18 if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIR}/CMakeLists.txt)18 if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIR}/CMakeLists.txt)
19 add_subdirectory(${SUBDIR})19 add_subdirectory(${SUBDIR})
20+ elseif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIR}/op_dsl/CMakeLists.txt")
21+ add_subdirectory(${SUBDIR}/op_dsl)
20 endif()22 endif()
21 endforeach()23 endforeach()
22endif()24endif()
@@ -15,6 +15,8 @@ foreach(SUB_DIR ${CURRENT_DIRS})
15 else()15 else()
16 if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${SUB_DIR}/op_host/CMakeLists.txt")16 if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${SUB_DIR}/op_host/CMakeLists.txt")
17 add_subdirectory(${SUB_DIR}/op_host)17 add_subdirectory(${SUB_DIR}/op_host)
18+ elseif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${SUB_DIR}/op_dsl/CMakeLists.txt")
19+ add_subdirectory(${SUB_DIR}/op_dsl)
18 endif()20 endif()
19 endif()21 endif()
20endforeach()22endforeach()
@@ -31,6 +31,8 @@ foreach(SUB_DIR ${CURRENT_DIRS})
31 else()31 else()
32 if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${SUB_DIR}/op_host/CMakeLists.txt")32 if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${SUB_DIR}/op_host/CMakeLists.txt")
33 add_subdirectory(${SUB_DIR}/op_host)33 add_subdirectory(${SUB_DIR}/op_host)
34+ elseif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${SUB_DIR}/op_dsl/CMakeLists.txt")
35+ add_subdirectory(${SUB_DIR}/op_dsl)
34 endif()36 endif()
35 endif()37 endif()
36endforeach()38endforeach()
@@ -15,10 +15,14 @@ set(MC2_EXCLUDE_DIRS 3rd common)
15# 先遍历算子目录15# 先遍历算子目录
16foreach(SUBDIR ${SUBDIRECTORIES})16foreach(SUBDIR ${SUBDIRECTORIES})
17 # 检查子目录中是否存在 CMakeLists.txt17 # 检查子目录中是否存在 CMakeLists.txt
18- if(NOT ${SUBDIR} IN_LIST MC2_EXCLUDE_DIRS18+ if(NOT ${SUBDIR} IN_LIST MC2_EXCLUDE_DIRS)
19- AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIR}/CMakeLists.txt19+ if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIR}/CMakeLists.txt)
20- )20+ add_subdirectory(${SUBDIR})
21- add_subdirectory(${SUBDIR})21+ elseif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIR}/op_dsl/CMakeLists.txt")
22+ add_subdirectory(${SUBDIR}/op_dsl)
23+ else()
24+ continue()
25+ endif()
22 if(DEFINED ${SUBDIR}_depends)26 if(DEFINED ${SUBDIR}_depends)
23 set(${SUBDIR}_depends "${${SUBDIR}_depends}" PARENT_SCOPE)27 set(${SUBDIR}_depends "${${SUBDIR}_depends}" PARENT_SCOPE)
24 endif()28 endif()
@@ -24,6 +24,8 @@ foreach(SUB_DIR ${CURRENT_DIRS})
24 else()24 else()
25 if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${SUB_DIR}/op_host/CMakeLists.txt")25 if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${SUB_DIR}/op_host/CMakeLists.txt")
26 add_subdirectory(${SUB_DIR}/op_host)26 add_subdirectory(${SUB_DIR}/op_host)
27+ elseif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${SUB_DIR}/op_dsl/CMakeLists.txt")
28+ add_subdirectory(${SUB_DIR}/op_dsl)
27 endif()29 endif()
28 endif()30 endif()
29endforeach()31endforeach()
@@ -18,6 +18,8 @@ else()
18 # 检查子目录中是否存在 CMakeLists.txt18 # 检查子目录中是否存在 CMakeLists.txt
19 if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIR}/CMakeLists.txt)19 if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIR}/CMakeLists.txt)
20 add_subdirectory(${SUBDIR})20 add_subdirectory(${SUBDIR})
21+ elseif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIR}/op_dsl/CMakeLists.txt")
22+ add_subdirectory(${SUBDIR}/op_dsl)
21 endif()23 endif()
22 endforeach()24 endforeach()
23endif()25endif()
@@ -15,6 +15,8 @@ foreach(SUB_DIR ${CURRENT_DIRS})
15 else()15 else()
16 if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${SUB_DIR}/op_host/CMakeLists.txt")16 if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${SUB_DIR}/op_host/CMakeLists.txt")
17 add_subdirectory(${SUB_DIR}/op_host)17 add_subdirectory(${SUB_DIR}/op_host)
18+ elseif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${SUB_DIR}/op_dsl/CMakeLists.txt")
19+ add_subdirectory(${SUB_DIR}/op_dsl)
18 endif()20 endif()
19 endif()21 endif()
20endforeach()22endforeach()