1# Copyright (c) 2021-2022 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 14set(VERIFICATION_SOURCES_DIR ${PANDA_ROOT}/verification) 15 16include(${VERIFICATION_SOURCES_DIR}/type/Type.cmake) 17include(${VERIFICATION_SOURCES_DIR}/value/Value.cmake) 18include(${VERIFICATION_SOURCES_DIR}/cflow/Cflow.cmake) 19include(${VERIFICATION_SOURCES_DIR}/util/Util.cmake) 20include(${VERIFICATION_SOURCES_DIR}/absint/AbsInt.cmake) 21include(${VERIFICATION_SOURCES_DIR}/config/Config.cmake) 22include(${VERIFICATION_SOURCES_DIR}/jobs/Jobs.cmake) 23include(${VERIFICATION_SOURCES_DIR}/cache/Cache.cmake) 24 25set(VERIFIER_SOURCES 26 ${VERIFICATION_SOURCES_DIR}/verification_options.cpp 27 ${TYPE_SOURCES} 28 ${VALUE_SOURCES} 29 ${CFLOW_SOURCES} 30 ${UTIL_SOURCES} 31 ${ABSINT_SOURCES} 32 ${CONFIG_SOURCES} 33 ${JOBS_SOURCES} 34 ${VERIFIER_CACHE_SOURCES} 35) 36 37set(VERIFIER_TESTS_SOURCES 38 ${TYPE_TESTS_SOURCES} 39 ${VALUE_TESTS_SOURCES} 40 ${CFLOW_TESTS_SOURCES} 41 ${UTIL_TESTS_SOURCES} 42 ${ABSINT_TESTS_SOURCES} 43 ${JOBS_TESTS_SOURCES} 44) 45 46set(VERIFIER_RAPIDCHECK_TESTS_SOURCES 47 ${UTIL_RAPIDCHECK_TESTS_SOURCES} 48) 49 50set(VERIFIER_INCLUDE_DIR ${VERIFICATION_SOURCES_DIR} 51 ${PANDA_BINARY_ROOT}/verification/gen/include) 52 53function(add_verification_includes) 54 set(prefix ARG) 55 set(noValues) 56 set(singleValues TARGET) 57 set(multiValues) 58 cmake_parse_arguments(${prefix} 59 "${noValues}" 60 "${singleValues}" 61 "${multiValues}" 62 ${ARGN}) 63 64 if (NOT DEFINED ARG_TARGET) 65 message(FATAL_ERROR "Mandatory TARGET argument is not defined.") 66 endif() 67 68 add_dependencies(${ARG_TARGET} isa_gen_pandaverification) 69 70 target_include_directories(${ARG_TARGET} 71 PUBLIC ${VERIFIER_INCLUDE_DIR} 72 PUBLIC ${VERIFIER_GEN_INCLUDE_DIR} 73 ) 74endfunction() 75 76function(add_verification_sources) 77 set(prefix ARG) 78 set(noValues) 79 set(singleValues TARGET) 80 set(multiValues) 81 cmake_parse_arguments(${prefix} 82 "${noValues}" 83 "${singleValues}" 84 "${multiValues}" 85 ${ARGN}) 86 87 if (NOT DEFINED ARG_TARGET) 88 message(FATAL_ERROR "Mandatory TARGET argument is not defined.") 89 endif() 90 91 target_sources(${ARG_TARGET} 92 PUBLIC ${VERIFIER_SOURCES} 93 ) 94endfunction() 95 96function(add_pandaverification) 97 set(prefix ARG) 98 set(noValues) 99 set(singleValues TARGET) 100 set(multiValues) 101 cmake_parse_arguments(${prefix} 102 "${noValues}" 103 "${singleValues}" 104 "${multiValues}" 105 ${ARGN}) 106 107 if (NOT DEFINED ARG_TARGET) 108 message(FATAL_ERROR "Mandatory TARGET argument is not defined.") 109 endif() 110 111 add_verification_sources(TARGET ${ARG_TARGET}) 112 add_verification_includes(TARGET ${ARG_TARGET}) 113endfunction() 114