• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2021-2024 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)
34
35if (PANDA_COMPILER_TARGET_AARCH32)
36    if (PANDA_TARGET_ARM64)
37        message(FATAL_ERROR "Unimplemented multi-build aarch32 on aarch64-target")
38    endif()
39    if (PANDA_TARGET_X86)
40        message(FATAL_ERROR "Unimplemented multi-build aarch32 on x86-build-target")
41    endif()
42    # ABI must be defined for build on non-arm archs
43    if (NOT(PANDA_TARGET_ARM32_ABI_SOFT OR PANDA_TARGET_ARM32_ABI_SOFTFP OR PANDA_TARGET_ARM32_ABI_HARD))
44        panda_set_flag(PANDA_TARGET_ARM32_ABI_SOFTFP)
45    endif()
46endif()
47
48if (PANDA_COMPILER_TARGET_AARCH64)
49    if (PANDA_TARGET_ARM32)
50        message(FATAL_ERROR "Unimplemented multi-build aarch64 on aarch32-target")
51    endif()
52    if (PANDA_TARGET_X86)
53        message(FATAL_ERROR "Unimplemented multi-build aarch64 on x86-build-target")
54    endif()
55endif()
56
57message(STATUS "Compiler backends status:")
58message(STATUS "PANDA_COMPILER_MULTI_TARGET = ${PANDA_COMPILER_MULTI_TARGET}")
59message(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}")
60