1# Copyright (c) 2021-2023 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 14if(CMAKE_CROSSCOMPILING) 15 return() 16endif() 17 18add_custom_target(es2panda_tests_options) 19add_dependencies(es2panda_tests es2panda_tests_options) 20 21function(check_option_help_otput target_name INPUT_ARGS OUTPUT_HELP_LINE) 22 separate_arguments(INPUT_ARGS) 23 add_custom_target(es2panda_check_opts_${target_name} 24 COMMENT "es2panda: checking option ${INPUT_ARGS}" 25 COMMAND es2panda ${INPUT_ARGS} 2> ${CMAKE_BINARY_DIR}/es2panda_check_opts_${target_name}.out || true 26 COMMAND grep -q ${OUTPUT_HELP_LINE} ${CMAKE_BINARY_DIR}/es2panda_check_opts_${target_name}.out 27 DEPENDS es2panda 28 ) 29 30 add_dependencies(es2panda_tests_options es2panda_check_opts_${target_name}) 31endfunction() 32 33check_option_help_otput(bco_opt "--help" "bco-optimizer:") 34check_option_help_otput(bco_opt_help "--bco-optimizer --help" "bytecode-opt-peepholes:") 35check_option_help_otput(comp_opt "--help" "bco-compiler:") 36check_option_help_otput(comp_opt_help "--bco-compiler --help" "compiler-disasm-dump:") 37