From c649f25f94af7ae0d4ea0e0c34bdc304654f360b Mon Sep 17 00:00:00 2001 From: vagin ivan Date: Wed, 19 Oct 2022 15:50:23 +0300 Subject: [PATCH] Fix GN build for OHOS Signed-off-by: vagin ivan --- BUILD.gn | 17 ++++++++--------- aot/BUILD.gn | 4 ++-- parser/ETSparser.cpp | 6 +++--- parser/ETSparser.h | 10 +++++++--- 4 files changed, 20 insertions(+), 17 deletions(-) diff --git a/BUILD.gn b/BUILD.gn index 60b4520b5..2647f2f86 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -17,9 +17,9 @@ import("//build/ohos.gni") config("libes2panda_public_config") { include_dirs = [ "$target_gen_dir", - "$ark_root/ark-third-party/icu/icu4c/source/common", - "$ark_root/ark-third-party/icu/icu4c/source/i18n", - "$ark_root/ark-third-party/icu/icu4c/source/", + "$ark_third_party_root/icu/icu4c/source/common", + "$ark_third_party_root/icu/icu4c/source/i18n", + "$ark_third_party_root/icu/icu4c/source/", ] } @@ -360,13 +360,13 @@ ohos_shared_library("libes2panda") { "$ark_root/assembler:libarkassembler", "$ark_root/libpandabase:libarkbase", "$ark_root/libpandafile:libarkfile", - "$ark_root/ark-third-party/icu:shared_icui18n", - "$ark_root/ark-third-party/icu:shared_icuuc", + "$ark_third_party_root/icu/icu4c:shared_icui18n", + "$ark_third_party_root/icu/icu4c:shared_icuuc", ] relative_install_dir = "ark" output_extension = "so" - subsystem_name = "ark" + subsystem_name = "$ark_subsystem_name" } ohos_static_library("libes2panda_frontend_static") { @@ -380,10 +380,9 @@ ohos_static_library("libes2panda_frontend_static") { ":gen_es2panda_lexer_keywords_h", ":gen_es2panda_compiler_signatures_h", "$ark_root/assembler:libarkassembler_frontend_static", - "$ark_root/libpandabase:libarkbase_frontend_static", "$ark_root/libpandafile:libarkfile_frontend_static", - "$ark_root/ark-third-party/icu:static_icui18n", - "$ark_root/ark-third-party/icu:static_icuuc", + "$ark_third_party_root/icu/icu4c:static_icui18n", + "$ark_third_party_root/icu/icu4c:static_icuuc", ] } diff --git a/aot/BUILD.gn b/aot/BUILD.gn index ca96a6540..fe60b5d6f 100644 --- a/aot/BUILD.gn +++ b/aot/BUILD.gn @@ -50,11 +50,11 @@ ohos_executable("es2panda") { libs = ["//prebuilts/clang/ohos/darwin-x86_64/llvm/lib/libc++.1.0.dylib"] } - if (!is_mingw && !ark_standalone_build && !is_mac) { + if (!is_mingw && !ark_standalone_build && !is_mac && !is_ohos) { libs = [ libcpp_static_lib ] } install_enable = true - subsystem_name = "ark" + subsystem_name = "$ark_subsystem_name" } diff --git a/parser/ETSparser.cpp b/parser/ETSparser.cpp index 85ca4303a..bb4eb0412 100644 --- a/parser/ETSparser.cpp +++ b/parser/ETSparser.cpp @@ -92,7 +92,7 @@ #include "libpandabase/os/file.h" #include "generated/signatures.h" -#ifdef ANDROID +#ifdef USE_FTW #include #else #if __has_include() @@ -195,7 +195,7 @@ ArenaVector ETSParser::PrepareExternalGlobalClass() return statements; } -#ifdef ANDROID +#ifdef USE_FTW static bool endsWith(const char *src, const char *suffix, const size_t len_suffix) { if (src == nullptr || suffix == nullptr) { @@ -235,7 +235,7 @@ std::vector ETSParser::CollectExternalSources() ThrowSyntaxError("Incorrect std lib path."); } -#ifdef ANDROID +#ifdef USE_FTW nftw(stdLib.c_str(), NFTWCallBack, 16, 0); // NOLINT(readability-magic-numbers) return std::move(externalSourcePaths_); #else diff --git a/parser/ETSparser.h b/parser/ETSparser.h index 381e09e26..702bfee3d 100644 --- a/parser/ETSparser.h +++ b/parser/ETSparser.h @@ -18,7 +18,11 @@ #include "TypedParser.h" -#ifdef ANDROID +#if defined PANDA_TARGET_MOBILE || defined PANDA_TARGET_UNIX || defined PANDA_TARGET_ARM32 +#define USE_FTW +#endif + +#ifdef USE_FTW struct FTW; #endif @@ -43,7 +47,7 @@ private: void ParsePackageDeclaration(ArenaVector &statements); ArenaVector ParseTopLevelStatements(ArenaVector &statements); void ParseTopLevelDeclaration(ArenaVector &statements); -#ifdef ANDROID +#ifdef USE_FTW static int NFTWCallBack(const char *fpath, const struct stat * /*unused*/, int tflag, struct FTW * /*unused*/); #endif std::vector CollectExternalSources(); @@ -179,7 +183,7 @@ private: private: parser::Program *globalProgram_; -#ifdef ANDROID +#ifdef USE_FTW static std::vector externalSourcePaths_; #endif }; -- Gitee