• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (C) 2025 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("//developtools/hdc/hdc.gni")
16
17config("hdc_config") {
18  include_dirs = [
19    "../src/common",
20  ]
21  cflags_cc = [ "-std=c++17" ]
22  if (is_mingw) {
23    cflags_cc += [ "-Wno-inconsistent-dllimport" ]  # in mingw some sec api will
24                                                    # overwrite by utilsecurec
25  }
26}
27
28ohos_executable("hdc_credential_exec") {
29  if (hdc_feature_support_credential) {
30    use_exceptions = true
31    ldflags = [
32      "-Wl,--whole-archive",
33      "-ldl",
34      "-lrt",
35      "-Wl,--no-whole-archive",
36    ]
37    libs = []
38    defines = []
39    configs = [ ":hdc_config" ]
40    deps = []
41
42    if (hdc_debug) {
43      defines += [ "HDC_DEBUG" ]
44    }
45    if (build_variant == "user") {
46      defines += [ "IS_RELEASE_VERSION" ]
47    }
48    sources = [
49      "main.cpp",
50    ]
51
52    external_deps = [
53      "openssl:libcrypto_shared",
54      "bounds_checking_function:libsec_shared",
55      "libuv:uv",
56    ]
57    if (product_name != "ohos-sdk") {
58      external_deps += [
59        "os_account:os_account_innerkits",
60        "os_account:account_iam_innerkits"
61      ]
62    }
63    if (is_ohos) {
64      sources += [
65        "../src/common/base.cpp",
66        "../src/common/credential_message.cpp",
67        "../src/common/hdc_huks.cpp",
68        "../src/common/password.cpp",
69        "credential_base.cpp",
70        "hdc_subscriber.cpp"
71      ]
72      external_deps += [ "huks:libhukssdk" ]
73      external_deps += [ "hilog:libhilog" ]
74      defines += [
75        "HDC_SUPPORT_ENCRYPT_PRIVATE_KEY",
76        "HDC_HILOG",
77        ]
78      install_images = [ "system" ]
79    }
80    output_name = "hdc_credential"
81  }
82  subsystem_name = "developtools"
83  part_name = "hdc"
84}
85
86group ("hdc_credential") {
87  if (hdc_feature_support_credential) {
88    deps = [ ":hdc_credential_exec" ]
89  }
90}