# Copyright (c) 2023 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/ohos.gni") import("//foundation/resourceschedule/ffrt/ffrt_io_task_scheuduler.gni") defines = [] if (ffrt_io_task_scheuduler) { defines += [ "FFRT_IO_TASK_SCHEDULER" ] } config("ffrt_config") { visibility = [ ":*" ] include_dirs = [ "interfaces", "interfaces/kits", "interfaces/inner_api", ] ffrt_defaults_cflags = [ "-g", "-D_FORTIFY_SOURCE=2", "-O2", "-fPIC", "-Wno-unused-variable", "-Wno-unused-function", "-Wno-unused-value", "-Wno-unused-private-field", "-Wno-shadow", "-Wno-float-equal", "-Wno-unused-parameter", "-DOHOS_STANDARD_SYSTEM", "-DTASKSTAT_LOG_ENABLE=0", "-DIDLE_WORKER_DESTRUCT", "-DOHOS_THREAD_STACK_DUMP", "-DUSE_OHOS_QOS", "-DFFRT_IO_TASK_SCHEDULER", "-DFFRT_PTHREAD_ENABLE", ] cflags = ffrt_defaults_cflags cflags_cc = ffrt_defaults_cflags cflags_cc += [ "-std=c++17" ] ffrt_debug_defines = [ "FFRT_LOG_LEVEL=3", "FFRT_BBOX_ENABLE", "FFRT_OH_EVENT_RECORD", "FFRT_CO_BACKTRACE_OH_ENABLE", "FFRT_OH_TRACE_ENABLE", "FFRT_TRACE_LEVEL=1", ] #ffrt_release_defines = [ # "FFRT_LOG_LEVEL=0", # "FFRT_RELEASE", #] defines += ffrt_debug_defines if (is_asan) { defines += [ "ASAN_MODE" ] } if (target_cpu == "arm") { defines += [ "APP_USE_ARM" ] } #defines += ffrt_release_defines } config("ffrt_inner_config") { include_dirs = [ "src", "src/dfx/log", "src/dfx/trace", "src/sched", "//third_party/jsoncpp/include", "//third_party/libunwind/include", ] if (is_ohos && is_clang && (target_cpu == "arm" || target_cpu == "arm64")) { cflags = [ "-flto=thin", "-fsplit-lto-unit", ] } } ohos_shared_library("libffrt") { public_configs = [ ":ffrt_config" ] configs = [ ":ffrt_inner_config" ] sources = [ "src/core/entity.cpp", "src/core/task.cpp", "src/core/task_io.cpp", "src/core/version_ctx.cpp", "src/dfx/bbox/bbox.cpp", "src/dfx/log/ffrt_log.cpp", "src/dfx/log/hmos/log_base.cpp", "src/dfx/trace/ffrt_trace.cpp", "src/dfx/watchdog/watchdog.cpp", "src/dm/dependence_manager.cpp", "src/dm/sdependence_manager.cpp", "src/eu/co2_context.c", "src/eu/co_routine.cpp", "src/eu/co_routine_factory.cpp", "src/eu/cpu_monitor.cpp", "src/eu/cpu_worker.cpp", "src/eu/cpuworker_manager.cpp", "src/eu/execute_unit.cpp", "src/eu/osattr_manager.cpp", "src/eu/qos_convert.cpp", "src/eu/qos_interface.cpp", "src/eu/rtg_ioctl.cpp", "src/eu/rtg_perf_ctrl.c", "src/eu/scpu_monitor.cpp", "src/eu/scpuworker_manager.cpp", "src/eu/sexecute_unit.cpp", "src/eu/worker_manager.cpp", "src/eu/worker_thread.cpp", "src/ipc/ipc.cpp", "src/queue/queue_monitor.cpp", "src/queue/serial_handler.cpp", "src/queue/serial_looper.cpp", "src/queue/serial_queue.cpp", "src/queue/serial_queue_api.cpp", "src/queue/serial_task.cpp", "src/sched/deadline.cpp", "src/sched/execute_ctx.cpp", "src/sched/frame_interval.cpp", "src/sched/interval.cpp", "src/sched/load_tracking.cpp", "src/sched/multi_workgroup.cpp", "src/sched/sched_deadline.cpp", "src/sched/scheduler.cpp", "src/sched/task_manager.cpp", "src/sched/task_state.cpp", "src/sync/condition_variable.cpp", "src/sync/delayed_worker.cpp", "src/sync/io_poller.cpp", "src/sync/mutex.cpp", "src/sync/perf_counter.cpp", "src/sync/poller.cpp", "src/sync/sleep.cpp", "src/sync/sync.cpp", "src/sync/thread.cpp", "src/sync/wait_queue.cpp", "src/tm/cpu_task.cpp", "src/tm/scpu_task.cpp", "src/tm/task_factory.cpp", "src/util/graph_check.cpp", "src/util/init.cpp", "src/util/spmc_queue.cpp", "src/util/worker_monitor.cpp", ] external_deps = [ "faultloggerd:libbacktrace_local", "faultloggerd:libdfx_dumpcatcher", "hilog:libhilog", "hisysevent:libhisysevent", ] deps = [ "//third_party/bounds_checking_function:libsec_shared", "//third_party/libunwind:libunwind", ] output_extension = "so" part_name = "ffrt" install_images = [ "system", "updater", ] innerapi_tags = [ "chipsetsdk", "sasdk", ] } ohos_shared_library("ffrt_ndk") { output_name = "ffrt" configs = [ ":ffrt_config", ":ffrt_inner_config", ] sources = [ "src/core/entity.cpp", "src/core/task.cpp", "src/core/task_io.cpp", "src/core/version_ctx.cpp", "src/dfx/bbox/bbox.cpp", "src/dfx/log/ffrt_log.cpp", "src/dfx/log/hmos/log_base.cpp", "src/dfx/trace/ffrt_trace.cpp", "src/dfx/watchdog/watchdog.cpp", "src/dm/dependence_manager.cpp", "src/dm/sdependence_manager.cpp", "src/eu/co2_context.c", "src/eu/co_routine.cpp", "src/eu/co_routine_factory.cpp", "src/eu/cpu_monitor.cpp", "src/eu/cpu_worker.cpp", "src/eu/cpuworker_manager.cpp", "src/eu/execute_unit.cpp", "src/eu/osattr_manager.cpp", "src/eu/qos_convert.cpp", "src/eu/qos_interface.cpp", "src/eu/rtg_ioctl.cpp", "src/eu/rtg_perf_ctrl.c", "src/eu/scpu_monitor.cpp", "src/eu/scpuworker_manager.cpp", "src/eu/sexecute_unit.cpp", "src/eu/worker_manager.cpp", "src/eu/worker_thread.cpp", "src/queue/queue_monitor.cpp", "src/queue/serial_handler.cpp", "src/queue/serial_looper.cpp", "src/queue/serial_queue.cpp", "src/queue/serial_queue_api.cpp", "src/queue/serial_task.cpp", "src/sched/deadline.cpp", "src/sched/execute_ctx.cpp", "src/sched/frame_interval.cpp", "src/sched/interval.cpp", "src/sched/load_tracking.cpp", "src/sched/multi_workgroup.cpp", "src/sched/sched_deadline.cpp", "src/sched/scheduler.cpp", "src/sched/task_manager.cpp", "src/sched/task_state.cpp", "src/sync/condition_variable.cpp", "src/sync/delayed_worker.cpp", "src/sync/io_poller.cpp", "src/sync/mutex.cpp", "src/sync/perf_counter.cpp", "src/sync/poller.cpp", "src/sync/sleep.cpp", "src/sync/sync.cpp", "src/sync/thread.cpp", "src/sync/wait_queue.cpp", "src/tm/cpu_task.cpp", "src/tm/scpu_task.cpp", "src/tm/task_factory.cpp", "src/util/graph_check.cpp", "src/util/init.cpp", "src/util/spmc_queue.cpp", "src/util/worker_monitor.cpp", ] external_deps = [ "faultloggerd:libbacktrace_local", "faultloggerd:libdfx_dumpcatcher", "hilog:libhilog", "hisysevent:libhisysevent", ] deps = [ "//third_party/bounds_checking_function:libsec_shared", "//third_party/libunwind:libunwind", ] part_name = "ffrt" subsystem_name = "resourceschedule" innerapi_tags = [ "ndk" ] }