1# Copyright (c) 2021-2025 Huawei Device Co., Ltd. 2# Licensed under the Apache License, Version 2.0 (the "License"); 3# you may not use this file except in compliance with the License. 4# You may obtain a copy of the License at 5# 6# http://www.apache.org/licenses/LICENSE-2.0 7# 8# Unless required by applicable law or agreed to in writing, software 9# distributed under the License is distributed on an "AS IS" BASIS, 10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11# See the License for the specific language governing permissions and 12# limitations under the License. 13 14get_target_property(YAML_FILES plugin_options_gen PLUGIN_OPTIONS_YAML_FILES) 15 16set(GEN_PLUGIN_OPTIONS_YAML ${PANDA_BINARY_ROOT}/plugin_options.yaml) 17add_custom_command(OUTPUT ${GEN_PLUGIN_OPTIONS_YAML} 18 COMMENT "Merge yaml files: ${YAML_FILES}" 19 COMMAND ${PANDA_ROOT}/templates/concat_yamls.sh "${GEN_PLUGIN_OPTIONS_YAML}" ${YAML_FILES} 20 DEPENDS ${YAML_FILES} 21) 22add_custom_target(plugin_options_merge DEPENDS ${GEN_PLUGIN_OPTIONS_YAML}) 23 24get_target_property(MERGE_PLUGINS merge_plugins PLUGINS) 25foreach(plugin_file ${MERGE_PLUGINS}) 26 27 string(REGEX REPLACE "[/\\.]" "_" plugin_target ${plugin_file}) 28 set(plugin_target_files "${plugin_target}__files") 29 30 get_target_property(PLUGIN_FILES ${plugin_target_files} PLUGIN_FILES) 31 get_target_property(PLUGINS_BINARY_DIR ${plugin_target_files} GENERATED_DIR) 32 file(MAKE_DIRECTORY ${PLUGINS_BINARY_DIR}) 33 34 if (PLUGIN_FILES) 35 add_custom_command(OUTPUT ${PLUGINS_BINARY_DIR}/${plugin_file} 36 COMMAND cat ${PLUGIN_FILES} > ${PLUGINS_BINARY_DIR}/${plugin_file} 37 DEPENDS ${PLUGIN_FILES} 38 ) 39 else() 40 add_custom_command(OUTPUT ${PLUGINS_BINARY_DIR}/${plugin_file} 41 COMMAND touch ${PLUGINS_BINARY_DIR}/${plugin_file} 42 ) 43 endif() 44 45 46 add_custom_target(${plugin_target} DEPENDS ${PLUGINS_BINARY_DIR}/${plugin_file}) 47 add_dependencies(merge_plugins ${plugin_target}) 48endforeach() 49 50add_dependencies(panda_gen_files merge_plugins) 51 52include(assembler/extensions/AssemblerExtPostPlugins.cmake) 53include(bytecode_optimizer/templates/BytecodeOptPostPlugins.cmake) 54include(runtime/RuntimeLanguageContextPostPlugins.cmake) 55include(runtime/RuntimeIntrinsicsPostPlugins.cmake) 56include(runtime/RuntimeEntrypointsPostPlugins.cmake) 57include(runtime/RuntimeIrtocPostPlugins.cmake) 58include(runtime/RuntimeOptionsPostPlugins.cmake) 59include(libpandabase/LibpandabasePostPlugins.cmake) 60include(libpandafile/LibpandafilePostPlugins.cmake) 61include(compiler/CompilerInstTemplatesPostPlugins.cmake) 62include(compiler/CompilerIntrinsicsPostPlugins.cmake) 63include(compiler/CompilerOptionsPostPlugins.cmake) 64include(compiler/CompilerInstTestPostPlugins.cmake) 65include(disassembler/DisassemblerPostPlugins.cmake) 66include(abc2program/Abc2ProgramPostPlugins.cmake) 67include(isa/IsaPostPlugins.cmake) 68include(irtoc/templates/IrtocPostPlugins.cmake) 69include(verification/VerifierPostPlugins.cmake) 70if (PANDA_BUILD_LLVM_BACKEND) 71 include(libllvmbackend/LLVMBackendPostPlugins.cmake) 72endif() 73