1# Copyright (c) 2023 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.
13import("//build/ohos.gni")
14
15config("gaussdb_rd_config") {
16  visibility = [ ":*" ]
17  include_dirs = [
18    "src/common/include",
19    "src/executor/include",
20    "src/executor/document",
21    "src/oh_adapter/include",
22    "src/oh_adapter/src",
23    "src/interface/include",
24  ]
25
26  defines = [
27    "SQLITE_ENABLE_SNAPSHOT",
28    "SQLITE_HAS_CODEC",
29    "SQLITE_ENABLE_JSON1",
30    "USING_HILOG_LOGGER",
31    "USE_SQLITE_SYMBOLS",
32    "SQLITE_ENABLE_DROPTABLE_CALLBACK",
33  ]
34  if (is_debug) {
35    defines += [ "TRACE_SQLITE_EXECUTE" ]
36  }
37}
38
39config("gaussdb_rd_public_config") {
40  visibility = [ "*:*" ]
41  include_dirs = [
42    "include",
43    "include/grd_base",
44    "include/grd_document",
45    "include/grd_kv",
46  ]
47}
48
49group("build_module") {
50  deps = [ ":gaussdb_rd" ]
51}
52
53ohos_static_library("gaussdb_rd") {
54  branch_protector_ret = "pac_ret"
55  sanitize = {
56    ubsan = true
57    boundary_sanitize = true
58    cfi = true
59    cfi_cross_dso = true
60    debug = false
61  }
62  sources = [
63    "src/common/src/collection_option.cpp",
64    "src/common/src/db_config.cpp",
65    "src/common/src/grd_api_manager.cpp",
66    "src/common/src/json_common.cpp",
67    "src/common/src/os_api.cpp",
68    "src/common/src/rd_log_print.cpp",
69    "src/executor/base/grd_db_api.cpp",
70    "src/executor/base/grd_db_api_inner.cpp",
71    "src/executor/document/check_common.cpp",
72    "src/executor/document/grd_document_api.cpp",
73    "src/executor/document/grd_document_api_inner.cpp",
74    "src/executor/document/grd_resultset_api.cpp",
75    "src/executor/document/grd_resultset_api_inner.cpp",
76    "src/executor/kv/grd_kv_api.cpp",
77    "src/executor/kv/grd_kv_api_inner.cpp",
78    "src/interface/src/collection.cpp",
79    "src/interface/src/doc_errno.cpp",
80    "src/interface/src/document_key.cpp",
81    "src/interface/src/document_store.cpp",
82    "src/interface/src/document_store_manager.cpp",
83    "src/interface/src/projection_tree.cpp",
84    "src/interface/src/result_set.cpp",
85    "src/interface/src/result_set_common.cpp",
86    "src/oh_adapter/src/kv_store_manager.cpp",
87    "src/oh_adapter/src/rd_json_object.cpp",
88    "src/oh_adapter/src/rd_sqlite_utils.cpp",
89    "src/oh_adapter/src/sqlite_store_executor_impl.cpp",
90  ]
91
92  configs = [ ":gaussdb_rd_config" ]
93  public_configs = [ ":gaussdb_rd_public_config" ]
94
95  ldflags = [ "-Wl,--exclude-libs,ALL" ]
96  cflags_cc = [
97    "-fvisibility=hidden",
98    "-std=c++17",
99  ]
100
101  external_deps = [
102    "c_utils:utils",
103    "hilog:libhilog",
104    "hisysevent:libhisysevent",
105    "hitrace:hitrace_meter",
106  ]
107
108  public_external_deps = [
109    "cJSON:cjson",
110    "sqlite:sqlite",
111  ]
112
113  subsystem_name = "distributeddatamgr"
114  part_name = "kv_store"
115}
116