• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
14enable_language(ASM)
15
16if(PANDA_WITH_TESTS)
17    get_target_property(ALL_ARK_SOURCES_VAR arkruntime_static SOURCES)
18    get_target_property(ALL_ARK_INCLUDE_DIRECTORIES_VAR arkruntime_static INCLUDE_DIRECTORIES)
19    get_target_property(ALL_ARK_LINK_LIBRARIES_VAR arkruntime_static LINK_LIBRARIES)
20
21    set(ARK_ABSOLUTE_PATH_SOURCE)
22    foreach(SRC ${ALL_ARK_SOURCES_VAR})
23        string(FIND ${SRC} "TARGET_OBJECTS" RESULT)
24        if("${RESULT}" STREQUAL "-1" AND NOT IS_ABSOLUTE ${SRC})
25            set(SRC ${CMAKE_CURRENT_SOURCE_DIR}/runtime/${SRC})
26        endif()
27        string(FIND ${SRC} "irtoc" RESULT)
28        if(NOT "${RESULT}" STREQUAL "-1")
29            SET_SOURCE_FILES_PROPERTIES(${SRC} PROPERTIES
30                EXTERNAL_OBJECT true
31                GENERATED true
32            )
33        endif()
34        list(APPEND ARK_ABSOLUTE_PATH_SOURCE ${SRC})
35    endforeach()
36
37    add_library(arkruntime_for_relayout_static STATIC ${ARK_ABSOLUTE_PATH_SOURCE})
38    target_include_directories(arkruntime_for_relayout_static PUBLIC ${ALL_ARK_INCLUDE_DIRECTORIES_VAR})
39    target_compile_definitions(arkruntime_for_relayout_static PUBLIC PANDA_ENABLE_RELAYOUT_PROFILE)
40    set_source_files_properties(${ARK_ABSOLUTE_PATH_SOURCE} PROPERTIES COMPILE_FLAGS "-Wno-shadow -Wno-unused-parameter")
41
42    add_dependencies(arkruntime_for_relayout_static
43        intrinsics_gen_arkruntime
44        runtime_intrinsics_inl
45        isa_gen_pandaverification
46        messages_gen_pandaverification
47        arkstdlib
48        asm_defines_generator
49        entrypoints_gen
50        irtoc_fastpath
51        irtoc_interpreter
52        ${irtoc_target}
53    )
54
55    if (PANDA_WITH_ECMASCRIPT)
56        add_dependencies(arkruntime_for_relayout_static ecmastdlib_inline_h)
57        add_dependencies(arkruntime_for_relayout_static ecma_intrinsics_gen_arkruntime)
58    endif()
59
60    if(PANDA_TARGET_ARM32_ABI_SOFT OR PANDA_TARGET_ARM32_ABI_SOFTFP)
61        add_dependencies(arkruntime_for_relayout_static bridge_dispatch_arm bridge_dispatch_dyn_arm)
62    elseif (PANDA_TARGET_ARM32_ABI_HARD)
63        add_dependencies(arkruntime_for_relayout_static bridge_dispatch_armhf bridge_dispatch_dyn_arm)
64    elseif(PANDA_TARGET_ARM64)
65        add_dependencies(arkruntime_for_relayout_static bridge_dispatch_aarch64 bridge_dispatch_dyn_aarch64)
66        target_compile_options(arkruntime_for_relayout_static PUBLIC "-march=armv8-a+crc")
67    elseif(PANDA_TARGET_X86)
68        add_dependencies(arkruntime_for_relayout_static bridge_dispatch_x86)
69    elseif(PANDA_TARGET_AMD64)
70        add_dependencies(arkruntime_for_relayout_static bridge_dispatch_amd64 bridge_dispatch_dyn_amd64)
71    endif()
72
73    target_link_libraries(arkruntime_for_relayout_static ${ALL_ARK_LINK_LIBRARIES_VAR})
74    set_property(TARGET arkruntime_for_relayout_static PROPERTY POSITION_INDEPENDENT_CODE ON)
75endif()
76