# Copyright (c) 2022 Huawei Device Co., Ltd.. All rights reserved. # 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/ohos.gni") import("//foundation/graphic/graphic_2d/graphic_config.gni") import("$graphic_2d_root/rosen/modules/2d_engine/rosen_text/config.gni") if (enable_text_gine) { config("rosen_text_public_config") { include_dirs = [ "export", "$graphic_2d_root/rosen/modules/2d_graphics/include", "$graphic_2d_root/rosen/modules/2d_graphics/src", "$graphic_2d_root/rosen/modules/2d_graphics/src/drawing", "$graphic_2d_root/rosen/modules/2d_graphics/src/drawing/engine_adapter", "//third_party/bounds_checking_function/include/", "$rosen_root/modules/texgine/texgine_drawing/src", "$graphic_2d_root/rosen/modules", "$graphic_2d_root/rosen/modules/render_service_client", "$graphic_2d_root/rosen/modules/render_service_client/core", "$graphic_2d_root/rosen/modules/render_service_base", "$graphic_2d_root/rosen/modules/render_service_base/include", "$graphic_2d_root/rosen/modules/platform/image_native", ] } defines = [ "USE_GRAPHIC_TEXT_GINE" ] ohos_shared_library("rosen_text") { include_dirs = [ "$graphic_2d_root/rosen/modules/2d_graphics/include" ] public_deps = [ ":rosen_text_inner" ] public_configs = [ "$graphic_2d_root/rosen/modules/2d_graphics:2d_graphics_config" ] platform = current_os if (platform == "mingw") { platform = "windows" } if (platform == "ohos") { deps = [ "$graphic_2d_root/rosen/modules/2d_graphics:2d_graphics" ] } else { deps = [ "$graphic_2d_root/rosen/modules/2d_graphics:2d_graphics_new" ] } part_name = "graphic_2d" subsystem_name = "graphic" } ohos_source_set("rosen_text_inner") { if (use_texgine) { public_deps = [ ":rosen_text_texgine" ] } else if (use_skia_txt) { public_deps = [ ":rosen_text_skia" ] } else { public_deps = [ ":rosen_text_txt" ] } part_name = "graphic_2d" subsystem_name = "graphic" } ohos_source_set("rosen_text_texgine") { public_configs = [ ":rosen_text_public_config" ] defines += [ "USE_GRAPHIC_TEXT_GINE" ] cflags = [ "-std=c++17" ] include_dirs = [ "$rosen_root/modules/render_service_base/include" ] sources = [ "adapter/common/text_style.cpp", "adapter/common/typography_style.cpp", "adapter/texgine/convert.cpp", "adapter/texgine/font_collection.cpp", "adapter/texgine/typography.cpp", "adapter/texgine/typography_create.cpp", ] if (defined(use_rosen_drawing) && use_rosen_drawing) { defines += [ "USE_ROSEN_DRAWING" ] if (ace_enable_gpu) { defines += [ "ACE_ENABLE_GPU" ] } } deps = [ "$graphic_2d_root/rosen/modules/texgine:libtexgine_source" ] part_name = "graphic_2d" subsystem_name = "graphic" } ohos_source_set("rosen_text_txt") { public_configs = [ ":rosen_text_public_config" ] include_dirs = [ "$flutter_root/engine", "$rosen_root/modules/render_service_base/include", ] defines += [ "USE_GRAPHIC_TEXT_GINE", "WINDOWS_PLATFORM", ] cflags = [ "-std=c++17" ] if (defined(use_new_skia) && use_new_skia) { include_dirs += [ "$flutter_root/txt/src" ] } else { include_dirs += [ "$flutter_root/engine/flutter/third_party/txt/src" ] } sources = [ "adapter/common/text_style.cpp", "adapter/common/typography_style.cpp", "adapter/txt/convert.cpp", "adapter/txt/font_collection.cpp", "adapter/txt/typography.cpp", "adapter/txt/typography_create.cpp", ] platform = current_os if (platform == "mingw") { platform = "windows" } if (defined(use_rosen_drawing) && use_rosen_drawing) { defines += [ "USE_ROSEN_DRAWING" ] if (ace_enable_gpu) { defines += [ "ACE_ENABLE_GPU" ] } } deps = [ "$skia_root_new:skia_$platform" ] part_name = "graphic_2d" subsystem_name = "graphic" } ohos_source_set("rosen_text_skia") { public_configs = [ ":rosen_text_public_config" ] include_dirs = [ "$rosen_root/modules/render_service_base/include", "$rosen_root/modules/2d_engine/rosen_text/skia_txt", "$rosen_root/modules/2d_engine/rosen_text/skia_txt/txt/src", ] defines += [ "USE_GRAPHIC_TEXT_GINE", "WINDOWS_PLATFORM", ] cflags = [ "-std=c++17" ] sources = [ "adapter/common/text_style.cpp", "adapter/common/typography_style.cpp", "adapter/skia_txt/convert.cpp", "adapter/skia_txt/font_collection.cpp", "adapter/skia_txt/typography.cpp", "adapter/skia_txt/typography_create.cpp", ] platform = current_os if (platform == "mingw") { platform = "windows" } if (defined(use_rosen_drawing) && use_rosen_drawing) { defines += [ "USE_ROSEN_DRAWING" ] if (ace_enable_gpu) { defines += [ "ACE_ENABLE_GPU" ] } } deps = [ "$graphic_2d_root/rosen/modules/texgine:libtexgine_source", "$skia_root_new:skia_$platform", "./skia_txt:skia_libtxt_$platform", ] part_name = "graphic_2d" subsystem_name = "graphic" } } else { ## Build librosen_text.so config("rosen_text_config") { include_dirs = [ "$rosen_2d_engine_root" ] } ohos_shared_library("rosen_text") { public_configs = [ ":rosen_text_config" ] public_deps = [ "ui:rosen_text_ui" ] part_name = "graphic_2d" subsystem_name = "graphic" } }