1b1994897Sopenharmony_ci# Copyright (c) 2021-2022 Huawei Device Co., Ltd. 2b1994897Sopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License"); 3b1994897Sopenharmony_ci# you may not use this file except in compliance with the License. 4b1994897Sopenharmony_ci# You may obtain a copy of the License at 5b1994897Sopenharmony_ci# 6b1994897Sopenharmony_ci# http://www.apache.org/licenses/LICENSE-2.0 7b1994897Sopenharmony_ci# 8b1994897Sopenharmony_ci# Unless required by applicable law or agreed to in writing, software 9b1994897Sopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS, 10b1994897Sopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11b1994897Sopenharmony_ci# See the License for the specific language governing permissions and 12b1994897Sopenharmony_ci# limitations under the License. 13b1994897Sopenharmony_ci 14b1994897Sopenharmony_ciset(LOGGER_FILE "${CMAKE_BINARY_DIR}/libpandabase/logger.yaml") 15b1994897Sopenharmony_ciset(LOGGER_CORE_FILE "${PROJECT_SOURCE_DIR}/libpandabase/templates/logger.yaml") 16b1994897Sopenharmony_ciset(LOGGER_GENERATOR "${PROJECT_SOURCE_DIR}/libpandabase/templates/logger_gen.rb") 17b1994897Sopenharmony_ci 18b1994897Sopenharmony_ciadd_custom_command(OUTPUT ${LOGGER_FILE} 19b1994897Sopenharmony_ci COMMENT "Generate logger.yaml" 20b1994897Sopenharmony_ci COMMAND ${LOGGER_GENERATOR} -d "${LOGGER_CORE_FILE}" -p "${GEN_PLUGIN_OPTIONS_YAML}" -o ${LOGGER_FILE} 21b1994897Sopenharmony_ci DEPENDS ${LOGGER_GENERATOR} ${LOGGER_CORE_FILE} plugin_options_merge 22b1994897Sopenharmony_ci) 23b1994897Sopenharmony_ciadd_custom_target(logger_yaml_gen DEPENDS ${LOGGER_FILE}) 24b1994897Sopenharmony_ci 25b1994897Sopenharmony_ciset(LOGGER_TEMPLATES 26b1994897Sopenharmony_ci logger_enum_gen.h.erb 27b1994897Sopenharmony_ci logger_impl_gen.inc.erb 28b1994897Sopenharmony_ci) 29b1994897Sopenharmony_ci 30b1994897Sopenharmony_ciadd_custom_target(logger_gen) 31b1994897Sopenharmony_ci 32b1994897Sopenharmony_ciforeach(TEMPLATE ${LOGGER_TEMPLATES}) 33b1994897Sopenharmony_ci get_filename_component(OUTPUT_FILENAME ${TEMPLATE} NAME_WLE) 34b1994897Sopenharmony_ci set(OUTPUT ${CMAKE_BINARY_DIR}/libpandabase/generated/${OUTPUT_FILENAME}) 35b1994897Sopenharmony_ci 36b1994897Sopenharmony_ci panda_gen_file( 37b1994897Sopenharmony_ci DATAFILE ${LOGGER_FILE} 38b1994897Sopenharmony_ci TEMPLATE ${PROJECT_SOURCE_DIR}/libpandabase/templates/${TEMPLATE} 39b1994897Sopenharmony_ci OUTPUTFILE ${OUTPUT} 40b1994897Sopenharmony_ci REQUIRES ${PROJECT_SOURCE_DIR}/libpandabase/templates/logger.rb 41b1994897Sopenharmony_ci EXTRA_DEPENDENCIES logger_yaml_gen 42b1994897Sopenharmony_ci ) 43b1994897Sopenharmony_ci add_custom_target(logger_gen_${OUTPUT_FILENAME} DEPENDS ${OUTPUT}) 44b1994897Sopenharmony_ci add_dependencies(logger_gen logger_gen_${OUTPUT_FILENAME}) 45b1994897Sopenharmony_ciendforeach() 46b1994897Sopenharmony_ci 47b1994897Sopenharmony_ciadd_dependencies(arkassembler assembler_extensions) 48b1994897Sopenharmony_ci 49b1994897Sopenharmony_ciif(PANDA_ENABLE_LTO AND PANDA_ARKBASE_LTO) 50b1994897Sopenharmony_ci set(ARKBASE_TARGETS arkbase arkbase_lto) 51b1994897Sopenharmony_cielse() 52b1994897Sopenharmony_ci set(ARKBASE_TARGETS arkbase) 53b1994897Sopenharmony_ciendif() 54b1994897Sopenharmony_ci 55b1994897Sopenharmony_ciforeach(TARGET ${ARKBASE_TARGETS}) 56b1994897Sopenharmony_ci add_dependencies(${TARGET} logger_gen) 57b1994897Sopenharmony_ciendforeach() 58