1# Copyright (c) 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
14import("//build/ohos.gni")
15import("//build/ohos/ace/ace.gni")
16import("//foundation/resourceschedule/work_scheduler/workscheduler.gni")
17
18ohos_shared_library("cj_work_scheduler_ffi") {
19  branch_protector_ret = "pac_ret"
20
21  sanitize = {
22    cfi = true
23    cfi_cross_dso = true
24    debug = false
25  }
26
27  include_dirs = [
28    "${worksched_root_path}/utils/native/include",
29    "${worksched_root_path}/frameworks/include",
30  ]
31
32  if (!defined(defines)) {
33    defines = []
34  }
35
36  if (product_name != "ohos-sdk") {
37    deps = [
38      "${worksched_frameworks_path}:workschedclient",
39      "${worksched_utils_path}:workschedutils",
40    ]
41    external_deps = [
42      "ability_base:base",
43      "ability_base:want",
44      "hilog:libhilog",
45      "napi:ace_napi",
46      "napi:cj_bind_ffi",
47    ]
48    sources = [ "work_scheduler/work_scheduler_ffi.cpp" ]
49  } else {
50    defines += [ "PREVIEWER" ]
51    sources = [ "work_scheduler/work_scheduler_mock.cpp" ]
52    external_deps = [ "napi:cj_bind_ffi" ]
53  }
54
55  if (current_os == "ohos") {
56    defines += [ "OHOS_PLATFORM" ]
57  }
58
59  if (current_os == "mingw") {
60    defines += [ "WINDOWS_PLATFORM" ]
61  }
62
63  innerapi_tags = [ "platformsdk" ]
64  subsystem_name = "resourceschedule"
65  part_name = "${worksched_native_part_name}"
66}
67