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(PANDA_COMPILER_MULTI_TARGET OFF) 15 16# Define function just to restrict the scope of variables 17function(panda_check_compiler_multi_target) 18 set(compiler_any_target OFF) 19 foreach(target X86 X86_64 AARCH32 AARCH64) 20 set(target_name "PANDA_COMPILER_TARGET_${target}") 21 if(compiler_any_target AND ${target_name}) 22 set(PANDA_COMPILER_MULTI_TARGET ON PARENT_SCOPE) 23 endif() 24 if(${target_name}) 25 set(compiler_any_target ON) 26 endif() 27 endforeach() 28endfunction() 29panda_check_compiler_multi_target() 30 31panda_promote_to_definitions( 32 PANDA_COMPILER_MULTI_TARGET 33 PANDA_COMPILER_CFI 34) 35 36if (PANDA_COMPILER_TARGET_AARCH32) 37 if (PANDA_TARGET_ARM64) 38 message(ERROR "Unimplemented multi-build aarch32 on aarch64-target") 39 endif() 40 if (PANDA_TARGET_X86) 41 message(ERROR "Unimplemented multi-build aarch32 on x86-build-target") 42 endif() 43 # ABI must be defined for build on non-arm archs 44 if (NOT(PANDA_TARGET_ARM32_ABI_SOFT OR PANDA_TARGET_ARM32_ABI_SOFTFP OR PANDA_TARGET_ARM32_ABI_HARD)) 45 panda_set_flag(PANDA_TARGET_ARM32_ABI_SOFTFP) 46 endif() 47endif() 48 49if (PANDA_COMPILER_TARGET_AARCH64) 50 if (PANDA_TARGET_ARM32) 51 message(ERROR "Unimplemented multi-build aarch64 on aarch32-target") 52 endif() 53 if (PANDA_TARGET_X86) 54 message(ERROR "Unimplemented multi-build aarch64 on x86-build-target") 55 endif() 56endif() 57 58message(STATUS "Compiler backends status:") 59message(STATUS "PANDA_COMPILER_MULTI_TARGET = ${PANDA_COMPILER_MULTI_TARGET}") 60message(STATUS "PANDA_COMPILER_TARGET: X86=${PANDA_COMPILER_TARGET_X86} X86_64=${PANDA_COMPILER_TARGET_X86_64} AARCH32=${PANDA_COMPILER_TARGET_AARCH32} AARCH64=${PANDA_COMPILER_TARGET_AARCH64}") 61