diff --git a/build/templates/cxx/cxx.gni b/build/templates/cxx/cxx.gni index 570327a755da2e01512ba89ddebfdc7254f49e69..7f81a0868a106af081d4785d12cca7cbd1fb460d 100755 --- a/build/templates/cxx/cxx.gni +++ b/build/templates/cxx/cxx.gni @@ -223,6 +223,7 @@ template("ohos_shared_library") { "configs", "subsystem_name", "install_enable", + "license_file", "part_name", "output_dir", "install_images", diff --git a/build/templates/cxx/external_deps_handler.py b/build/templates/cxx/external_deps_handler.py index 86cfb387e4adc58eb40c8841e8d7a4d0bdfc2800..58057e1fae55edc75ee0e530ea3d13e3ff30a45c 100755 --- a/build/templates/cxx/external_deps_handler.py +++ b/build/templates/cxx/external_deps_handler.py @@ -153,6 +153,11 @@ def main(): config_info = read_json_file("{}foundation/arkui/napi/bundle.json".format(args.root_src_dir)) target_name = dep.split(":")[1] deps.append(get_full_path_from_target_name(config_info, target_name)) + elif dep.startswith("vixl"): + config_info = read_json_file("{}arkcompiler/toolchain/build/third_party_gn/" \ + "vixl/dummy_bundle.json".format(args.root_src_dir)) + target_name = dep.split(":")[1] + deps.append(get_full_path_from_target_name(config_info, target_name)) else: print("Component in which the external_dep defined is ommited in the logic of {}!".format(__file__)) sys.exit(1) diff --git a/build/third_party_gn/asmjit/BUILD.gn b/build/third_party_gn/asmjit/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..0ee0a477dc86ba6db077be2aac7b524f222fa7dc --- /dev/null +++ b/build/third_party_gn/asmjit/BUILD.gn @@ -0,0 +1,167 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("$build_root/ark.gni") + +ark_root = "//arkcompiler/runtime_core/static_core/" + +config("asmjit_public_config") { + include_dirs = [ + "//third_party/asmjit/src", + ] +} + +config("asmjit_config") { + cflags_cc = [ + "-Wno-bitwise-instead-of-logical", + "-Wno-unused-but-set-variable", + "-Wno-deprecated-copy" + ] +} + +asmjit_sources = [ + "//third_party/asmjit/src/asmjit/asmjit.h", + + "//third_party/asmjit/src/asmjit/core.h", + "//third_party/asmjit/src/asmjit/core/api-build_p.h", + "//third_party/asmjit/src/asmjit/core/api-config.h", + "//third_party/asmjit/src/asmjit/core/arch.cpp", + "//third_party/asmjit/src/asmjit/core/arch.h", + "//third_party/asmjit/src/asmjit/core/assembler.cpp", + "//third_party/asmjit/src/asmjit/core/assembler.h", + "//third_party/asmjit/src/asmjit/core/builder.cpp", + "//third_party/asmjit/src/asmjit/core/builder.h", + "//third_party/asmjit/src/asmjit/core/callconv.cpp", + "//third_party/asmjit/src/asmjit/core/callconv.h", + "//third_party/asmjit/src/asmjit/core/codebuffer.h", + "//third_party/asmjit/src/asmjit/core/codebufferwriter_p.h", + "//third_party/asmjit/src/asmjit/core/codeholder.cpp", + "//third_party/asmjit/src/asmjit/core/codeholder.h", + "//third_party/asmjit/src/asmjit/core/compiler.cpp", + "//third_party/asmjit/src/asmjit/core/compiler.h", + "//third_party/asmjit/src/asmjit/core/constpool.cpp", + "//third_party/asmjit/src/asmjit/core/constpool.h", + "//third_party/asmjit/src/asmjit/core/cpuinfo.cpp", + "//third_party/asmjit/src/asmjit/core/cpuinfo.h", + "//third_party/asmjit/src/asmjit/core/datatypes.h", + "//third_party/asmjit/src/asmjit/core/emitter.cpp", + "//third_party/asmjit/src/asmjit/core/emitter.h", + "//third_party/asmjit/src/asmjit/core/emitterutils.cpp", + "//third_party/asmjit/src/asmjit/core/emitterutils_p.h", + "//third_party/asmjit/src/asmjit/core/environment.cpp", + "//third_party/asmjit/src/asmjit/core/environment.h", + "//third_party/asmjit/src/asmjit/core/errorhandler.cpp", + "//third_party/asmjit/src/asmjit/core/errorhandler.h", + "//third_party/asmjit/src/asmjit/core/features.h", + "//third_party/asmjit/src/asmjit/core/formatter.cpp", + "//third_party/asmjit/src/asmjit/core/formatter.h", + "//third_party/asmjit/src/asmjit/core/func.cpp", + "//third_party/asmjit/src/asmjit/core/func.h", + "//third_party/asmjit/src/asmjit/core/globals.cpp", + "//third_party/asmjit/src/asmjit/core/globals.h", + "//third_party/asmjit/src/asmjit/core/inst.cpp", + "//third_party/asmjit/src/asmjit/core/inst.h", + "//third_party/asmjit/src/asmjit/core/jitallocator.cpp", + "//third_party/asmjit/src/asmjit/core/jitallocator.h", + "//third_party/asmjit/src/asmjit/core/jitruntime.cpp", + "//third_party/asmjit/src/asmjit/core/jitruntime.h", + "//third_party/asmjit/src/asmjit/core/logger.cpp", + "//third_party/asmjit/src/asmjit/core/logger.h", + "//third_party/asmjit/src/asmjit/core/misc_p.h", + "//third_party/asmjit/src/asmjit/core/operand.cpp", + "//third_party/asmjit/src/asmjit/core/operand.h", + "//third_party/asmjit/src/asmjit/core/osutils.cpp", + "//third_party/asmjit/src/asmjit/core/osutils.h", + "//third_party/asmjit/src/asmjit/core/raassignment_p.h", + "//third_party/asmjit/src/asmjit/core/rabuilders_p.h", + "//third_party/asmjit/src/asmjit/core/radefs_p.h", + "//third_party/asmjit/src/asmjit/core/ralocal.cpp", + "//third_party/asmjit/src/asmjit/core/ralocal_p.h", + "//third_party/asmjit/src/asmjit/core/rapass.cpp", + "//third_party/asmjit/src/asmjit/core/rapass_p.h", + "//third_party/asmjit/src/asmjit/core/rastack.cpp", + "//third_party/asmjit/src/asmjit/core/rastack_p.h", + "//third_party/asmjit/src/asmjit/core/string.cpp", + "//third_party/asmjit/src/asmjit/core/string.h", + "//third_party/asmjit/src/asmjit/core/support.cpp", + "//third_party/asmjit/src/asmjit/core/support.h", + "//third_party/asmjit/src/asmjit/core/target.cpp", + "//third_party/asmjit/src/asmjit/core/target.h", + "//third_party/asmjit/src/asmjit/core/type.cpp", + "//third_party/asmjit/src/asmjit/core/type.h", + "//third_party/asmjit/src/asmjit/core/virtmem.cpp", + "//third_party/asmjit/src/asmjit/core/virtmem.h", + "//third_party/asmjit/src/asmjit/core/zone.cpp", + "//third_party/asmjit/src/asmjit/core/zone.h", + "//third_party/asmjit/src/asmjit/core/zonehash.cpp", + "//third_party/asmjit/src/asmjit/core/zonehash.h", + "//third_party/asmjit/src/asmjit/core/zonelist.cpp", + "//third_party/asmjit/src/asmjit/core/zonelist.h", + "//third_party/asmjit/src/asmjit/core/zonestack.cpp", + "//third_party/asmjit/src/asmjit/core/zonestack.h", + "//third_party/asmjit/src/asmjit/core/zonestring.h", + "//third_party/asmjit/src/asmjit/core/zonetree.cpp", + "//third_party/asmjit/src/asmjit/core/zonetree.h", + "//third_party/asmjit/src/asmjit/core/zonevector.cpp", + "//third_party/asmjit/src/asmjit/core/zonevector.h", + + "//third_party/asmjit/src/asmjit/x86.h", + "//third_party/asmjit/src/asmjit/x86/x86archdata.cpp", + "//third_party/asmjit/src/asmjit/x86/x86archdata_p.h", + "//third_party/asmjit/src/asmjit/x86/x86assembler.cpp", + "//third_party/asmjit/src/asmjit/x86/x86assembler.h", + "//third_party/asmjit/src/asmjit/x86/x86builder.cpp", + "//third_party/asmjit/src/asmjit/x86/x86builder.h", + "//third_party/asmjit/src/asmjit/x86/x86callconv.cpp", + "//third_party/asmjit/src/asmjit/x86/x86callconv_p.h", + "//third_party/asmjit/src/asmjit/x86/x86compiler.cpp", + "//third_party/asmjit/src/asmjit/x86/x86compiler.h", + "//third_party/asmjit/src/asmjit/x86/x86emitter.h", + "//third_party/asmjit/src/asmjit/x86/x86features.cpp", + "//third_party/asmjit/src/asmjit/x86/x86features.h", + "//third_party/asmjit/src/asmjit/x86/x86formatter.cpp", + "//third_party/asmjit/src/asmjit/x86/x86formatter_p.h", + "//third_party/asmjit/src/asmjit/x86/x86globals.h", + "//third_party/asmjit/src/asmjit/x86/x86internal.cpp", + "//third_party/asmjit/src/asmjit/x86/x86internal_p.h", + "//third_party/asmjit/src/asmjit/x86/x86instdb.cpp", + "//third_party/asmjit/src/asmjit/x86/x86instdb.h", + "//third_party/asmjit/src/asmjit/x86/x86instdb_p.h", + "//third_party/asmjit/src/asmjit/x86/x86instapi.cpp", + "//third_party/asmjit/src/asmjit/x86/x86instapi_p.h", + "//third_party/asmjit/src/asmjit/x86/x86operand.cpp", + "//third_party/asmjit/src/asmjit/x86/x86operand.h", + "//third_party/asmjit/src/asmjit/x86/x86rapass.cpp", + "//third_party/asmjit/src/asmjit/x86/x86rapass_p.h", +] + +asmjit_configs = [ + ":asmjit_public_config", + "$ark_root:ark_config", + "$ark_root/libpandabase:arkbase_public_config", + ":asmjit_config", +] + +ohos_static_library("libasmjit") { + sources = asmjit_sources + configs = asmjit_configs + deps = [ "$ark_root/libpandabase:libarktsbase" ] + subsystem_name = "ark_subsystem_name" +} + +ohos_static_library("libasmjit_frontend_static") { + sources = asmjit_sources + configs = asmjit_configs + deps = [ "$ark_root/libpandabase:libarktsbase_frontend_static" ] + subsystem_name = "ark_subsystem_name" +} diff --git a/build/third_party_gn/asmjit/dummy_bundle.json b/build/third_party_gn/asmjit/dummy_bundle.json new file mode 100644 index 0000000000000000000000000000000000000000..a06133e2f5d226cc4494775c37cf74115c9c70d9 --- /dev/null +++ b/build/third_party_gn/asmjit/dummy_bundle.json @@ -0,0 +1,22 @@ +{ + "component": { + "build": { + "inner_kits": [ + { + "header": { + "header_base": "//third_party/asmjit", + "header_files": "" + }, + "name": "//arkcompiler/toolchain/build/third_party_gn/asmjit:libasmjit" + }, + { + "header": { + "header_base": "//third_party/zlib", + "header_files": "" + }, + "name": "//arkcompiler/toolchain/build/third_party_gn/asmjit:libasmjit_frontend_static" + } + ] + } + } +} diff --git a/build/third_party_gn/elfio/BUILD.gn b/build/third_party_gn/elfio/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..8ebd5b11460e7221e27b42910f1c43826b55023a --- /dev/null +++ b/build/third_party_gn/elfio/BUILD.gn @@ -0,0 +1,36 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("$build_root/ark.gni") + +config("elfio_public_config") { + include_dirs = [ "//third_party/elfio" ] +} + +ohos_shared_library("elfio") { + sources = [ + "./c_wrapper/elfio_c_wrapper.cpp", + "//third_party/elfio/elfio/elfio_demo.cpp", + ] + + configs = [ ":elfio_public_config" ] + + include_dirs = [ + "./c_wrapper/", + "./elfio/", + "./", + ] + + subsystem_name = "thirdparty" + part_name = "elfio" +} diff --git a/build/third_party_gn/vixl/BUILD.gn b/build/third_party_gn/vixl/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..4908e1fd43557c3bae2a5f5416410d37a5385122 --- /dev/null +++ b/build/third_party_gn/vixl/BUILD.gn @@ -0,0 +1,129 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("$build_root/ark.gni") + +config("vixl_public_config") { + defines = [] + if (is_debug) { + defines += [ "VIXL_DEBUG" ] + } + + defines += [ "PANDA_BUILD" ] + + if (defined(ark_standalone_build) && ark_standalone_build) { + cflags_cc = [ "-Wno-bitwise-instead-of-logical" ] + } + + include_dirs = [ + "//third_party/vixl", + "//third_party/vixl/src", + ] + if (target_cpu == "arm") { + include_dirs += [ "//third_party/vixl/src/aarch32" ] + } else if (target_cpu == "arm64" || target_cpu == "amd64" || + target_cpu == "x64" || target_cpu == "x86_64") { + include_dirs += [ "//third_party/vixl/src/aarch64" ] + } +} + +ohos_static_library("libvixl") { + sources = [ + "//third_party/vixl/src/code-buffer-vixl.cc", + "//third_party/vixl/src/compiler-intrinsics-vixl.cc", + "//third_party/vixl/src/cpu-features.cc", + "//third_party/vixl/src/utils-vixl.cc", + ] + + defines = [] + cflags_cc = [ + "-std=c++17", + "-pedantic", + "-Wall", + "-Wextra", + "-Werror", + "-fno-rtti", + "-fno-exceptions", + "-Wno-invalid-offsetof", + + "-Wno-gnu-statement-expression", + "-Wno-unused-parameter", + "-Wno-unused-result", + "-Wno-deprecated-declarations", + ] + if (is_debug) { + cflags_cc += [ + "-Og", + "-ggdb3", + "-gdwarf-4", + ] + } + + if (is_asan) { + cflags_cc += [ "-g" ] + defines += [ "__SANITIZE_ADDRESS__" ] + } + + if (target_cpu == "arm") { + sources += [ + "//third_party/vixl/src/aarch32/assembler-aarch32.cc", + "//third_party/vixl/src/aarch32/constants-aarch32.cc", + "//third_party/vixl/src/aarch32/disasm-aarch32.cc", + "//third_party/vixl/src/aarch32/instructions-aarch32.cc", + "//third_party/vixl/src/aarch32/location-aarch32.cc", + "//third_party/vixl/src/aarch32/macro-assembler-aarch32.cc", + "//third_party/vixl/src/aarch32/operands-aarch32.cc", + ] + defines += [ "VIXL_INCLUDE_TARGET_A32" ] + } else if (target_cpu == "arm64" || target_cpu == "amd64" || + target_cpu == "x64" || target_cpu == "x86_64") { + sources += [ + "//third_party/vixl/src/aarch64/assembler-aarch64.cc", + "//third_party/vixl/src/aarch64/assembler-sve-aarch64.cc", + "//third_party/vixl/src/aarch64/cpu-aarch64.cc", + "//third_party/vixl/src/aarch64/cpu-features-auditor-aarch64.cc", + "//third_party/vixl/src/aarch64/decoder-aarch64.cc", + "//third_party/vixl/src/aarch64/disasm-aarch64.cc", + "//third_party/vixl/src/aarch64/instructions-aarch64.cc", + "//third_party/vixl/src/aarch64/logic-aarch64.cc", + "//third_party/vixl/src/aarch64/macro-assembler-aarch64.cc", + "//third_party/vixl/src/aarch64/macro-assembler-sve-aarch64.cc", + "//third_party/vixl/src/aarch64/operands-aarch64.cc", + "//third_party/vixl/src/aarch64/pointer-auth-aarch64.cc", + "//third_party/vixl/src/aarch64/simulator-aarch64.cc", + ] + defines += [ + "VIXL_INCLUDE_TARGET_A64", + "VIXL_INCLUDE_SIMULATOR_AARCH64", + ] + } + if (current_cpu == "arm") { + cflags_cc += [ + "-march=armv7-a", + "-mfloat-abi=softfp", + "-marm", + "-mfpu=vfp", + ] + } + + if (is_mac) { + cflags_cc += [ "-DVIXL_CODE_BUFFER_MALLOC" ] + } else { + cflags_cc += [ "-DVIXL_CODE_BUFFER_MMAP" ] + } + + public_configs = [ ":vixl_public_config" ] + + subsystem_name = "thirdparty" + part_name = "vixl" +} diff --git a/build/third_party_gn/vixl/dummy_bundle.json b/build/third_party_gn/vixl/dummy_bundle.json new file mode 100644 index 0000000000000000000000000000000000000000..2e9d151276adad077aaf751b9b11ad18da008514 --- /dev/null +++ b/build/third_party_gn/vixl/dummy_bundle.json @@ -0,0 +1,15 @@ +{ + "component": { + "build": { + "inner_kits": [ + { + "header": { + "header_base": "//third_party/vixl", + "header_files": "" + }, + "name": "//arkcompiler/toolchain/build/third_party_gn/vixl:libvixl" + } + ] + } + } +} diff --git a/build/third_party_gn/zydis/BUILD.gn b/build/third_party_gn/zydis/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..d958a6f7e38f0437a939815a8bab6a6910253895 --- /dev/null +++ b/build/third_party_gn/zydis/BUILD.gn @@ -0,0 +1,61 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("$build_root/ark.gni") + +config("zydis_public_config") { + include_dirs = [ + "//third_party/zydis/include", + "//third_party/zydis/zycore/include", + "//third_party/zydis/src", + ] +} + +ohos_static_library("libZydis") { + sources = [ + "//third_party/zydis/include/Zydis/Decoder.h", + "//third_party/zydis/include/Zydis/DecoderTypes.h", + "//third_party/zydis/include/Zydis/Formatter.h", + "//third_party/zydis/include/Zydis/FormatterBuffer.h", + "//third_party/zydis/include/Zydis/Internal/DecoderData.h", + "//third_party/zydis/include/Zydis/Internal/FormatterATT.h", + "//third_party/zydis/include/Zydis/Internal/FormatterBase.h", + "//third_party/zydis/include/Zydis/Internal/FormatterIntel.h", + "//third_party/zydis/include/Zydis/Internal/SharedData.h", + "//third_party/zydis/include/Zydis/Internal/String.h", + "//third_party/zydis/include/Zydis/MetaInfo.h", + "//third_party/zydis/include/Zydis/Mnemonic.h", + "//third_party/zydis/include/Zydis/Register.h", + "//third_party/zydis/include/Zydis/SharedTypes.h", + "//third_party/zydis/include/Zydis/ShortString.h", + "//third_party/zydis/include/Zydis/Status.h", + "//third_party/zydis/include/Zydis/Utils.h", + "//third_party/zydis/include/Zydis/Zydis.h", + "//third_party/zydis/src/Decoder.c", + "//third_party/zydis/src/DecoderData.c", + "//third_party/zydis/src/Formatter.c", + "//third_party/zydis/src/FormatterATT.c", + "//third_party/zydis/src/FormatterBase.c", + "//third_party/zydis/src/FormatterBuffer.c", + "//third_party/zydis/src/FormatterIntel.c", + "//third_party/zydis/src/MetaInfo.c", + "//third_party/zydis/src/Mnemonic.c", + "//third_party/zydis/src/Register.c", + "//third_party/zydis/src/SharedData.c", + "//third_party/zydis/src/String.c", + "//third_party/zydis/src/Utils.c", + "//third_party/zydis/src/Zydis.c", + ] + + configs = [ ":zydis_public_config" ] +} diff --git a/build/third_party_gn/zydis/dummy_bundle.json b/build/third_party_gn/zydis/dummy_bundle.json new file mode 100644 index 0000000000000000000000000000000000000000..28d6f1bcdc424a4d637f8abbf3cb10153ff7bceb --- /dev/null +++ b/build/third_party_gn/zydis/dummy_bundle.json @@ -0,0 +1,15 @@ +{ + "component": { + "build": { + "inner_kits": [ + { + "header": { + "header_base": "//third_party/zydis", + "header_files": "" + }, + "name": "//arkcompiler/toolchain/build/third_party_gn/zydis:libZydis" + } + ] + } + } +}