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(GEN_INCLUDE_DIR "${PANDA_BINARY_ROOT}/runtime/include") 15 16# Add icu dependency and initialization 17add_custom_command(OUTPUT ${GEN_INCLUDE_DIR}/init_icu_gen.cpp 18 COMMAND ${PANDA_ROOT}/runtime/templates/substitute_icu_path.rb 19 ${PANDA_ROOT}/runtime/templates/init_icu_gen.cpp.erb 20 ${GEN_INCLUDE_DIR}/init_icu_gen.cpp ${PANDA_THIRD_PARTY_SOURCES_DIR} 21 DEPENDS ${PANDA_ROOT}/runtime/templates/init_icu_gen.cpp.erb) 22 23add_custom_target(init_icu_gen_cpp 24 DEPENDS ${GEN_INCLUDE_DIR}/init_icu_gen.cpp) 25 26add_dependencies(arkruntime_obj init_icu_gen_cpp) 27add_dependencies(panda_gen_files init_icu_gen_cpp) 28 29# Runtime uses unicode and i18n. 30set(ICU_INCLUDE_DIR 31 ${PANDA_THIRD_PARTY_SOURCES_DIR}/icu/icu4c/source/common 32 ${PANDA_THIRD_PARTY_SOURCES_DIR}/icu/icu4c/source/i18n 33 ${PANDA_THIRD_PARTY_SOURCES_DIR}/icu/icu4c/source 34 ${PANDA_THIRD_PARTY_SOURCES_DIR}/icu 35) 36 37set(ICU_LIB_TYPE SHARED) 38if (PANDA_TARGET_MOBILE OR PANDA_TARGET_OHOS) 39 set(ICU_LIB_TYPE STATIC) 40endif() 41 42panda_add_library(init_icu ${ICU_LIB_TYPE} ${PANDA_ROOT}/runtime/init_icu.cpp) 43panda_target_include_directories(init_icu 44 PUBLIC ${GEN_INCLUDE_DIR} 45 PUBLIC ${PANDA_ROOT}/runtime/ 46) 47 48panda_target_include_directories(init_icu SYSTEM PUBLIC ${ICU_INCLUDE_DIR}) 49 50add_dependencies(init_icu init_icu_gen_cpp) 51 52panda_target_include_directories(arkruntime_interpreter_impl 53 SYSTEM PRIVATE ${ICU_INCLUDE_DIR} 54) 55 56panda_target_include_directories(csa_tests_arkruntime_interpreter_impl 57 SYSTEM PRIVATE ${ICU_INCLUDE_DIR} 58) 59 60if (TARGET arkruntime_test_interpreter_impl) 61 panda_target_include_directories(arkruntime_test_interpreter_impl 62 SYSTEM PRIVATE ${ICU_INCLUDE_DIR} 63 ) 64endif() 65 66panda_target_include_directories(asm_defines 67 SYSTEM PRIVATE ${ICU_INCLUDE_DIR} 68) 69 70panda_target_link_libraries(arkruntime_obj init_icu hmicuuc.z hmicui18n.z) 71