2021-06-01 16:04:36 +00:00
|
|
|
# Copyright (C) 2021 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")
|
2022-04-26 09:35:01 +00:00
|
|
|
HDC_PATH = "//developtools/hdc"
|
|
|
|
import("//developtools/hdc/hdc.gni")
|
2021-06-01 16:04:36 +00:00
|
|
|
|
2022-06-24 10:34:27 +00:00
|
|
|
py_out_dir = "$root_out_dir/gen/" + rebase_path(".", "//")
|
|
|
|
|
2022-04-22 02:53:36 +00:00
|
|
|
declare_args() {
|
|
|
|
# suggestion: uv threads number from 16 - 256
|
|
|
|
hdcd_uv_thread_size = 16
|
|
|
|
hdc_uv_thread_size = 128
|
|
|
|
}
|
|
|
|
|
2021-06-01 16:04:36 +00:00
|
|
|
hdc_common_sources = [
|
|
|
|
"${HDC_PATH}/src/common/async_cmd.cpp",
|
|
|
|
"${HDC_PATH}/src/common/auth.cpp",
|
|
|
|
"${HDC_PATH}/src/common/base.cpp",
|
|
|
|
"${HDC_PATH}/src/common/channel.cpp",
|
|
|
|
"${HDC_PATH}/src/common/debug.cpp",
|
|
|
|
"${HDC_PATH}/src/common/file.cpp",
|
|
|
|
"${HDC_PATH}/src/common/file_descriptor.cpp",
|
|
|
|
"${HDC_PATH}/src/common/forward.cpp",
|
|
|
|
"${HDC_PATH}/src/common/session.cpp",
|
|
|
|
"${HDC_PATH}/src/common/task.cpp",
|
|
|
|
"${HDC_PATH}/src/common/tcp.cpp",
|
|
|
|
"${HDC_PATH}/src/common/transfer.cpp",
|
|
|
|
"${HDC_PATH}/src/common/usb.cpp",
|
|
|
|
]
|
2022-06-24 10:34:27 +00:00
|
|
|
|
|
|
|
hash_sources = [
|
|
|
|
"${HDC_PATH}/scripts/hdc_hash_gen.py",
|
|
|
|
"${HDC_PATH}/src/common/base.cpp",
|
|
|
|
"${HDC_PATH}/src/common/channel.h",
|
|
|
|
"${HDC_PATH}/src/common/session.h",
|
|
|
|
"${HDC_PATH}/src/common/transfer.h",
|
|
|
|
]
|
|
|
|
|
2022-02-09 06:11:30 +00:00
|
|
|
if (hdc_support_uart) {
|
|
|
|
hdc_common_sources += [ "${HDC_PATH}/src/common/uart.cpp" ]
|
|
|
|
}
|
2021-06-01 16:04:36 +00:00
|
|
|
config("hdc_config") {
|
2022-06-24 10:34:27 +00:00
|
|
|
include_dirs = [
|
|
|
|
"${HDC_PATH}/src/common",
|
|
|
|
"${py_out_dir}",
|
|
|
|
]
|
2021-06-01 16:04:36 +00:00
|
|
|
cflags_cc = [ "-std=c++17" ]
|
2022-02-09 06:11:30 +00:00
|
|
|
if (is_mingw) {
|
|
|
|
cflags_cc += [ "-Wno-inconsistent-dllimport" ] # in mingw some sec api will
|
|
|
|
# overwrite by utilsecurec
|
|
|
|
}
|
2021-06-01 16:04:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ohos_executable("hdcd") {
|
2022-02-09 06:11:30 +00:00
|
|
|
use_exceptions = true
|
2021-06-01 16:04:36 +00:00
|
|
|
sources = [
|
|
|
|
"src/daemon/daemon.cpp",
|
|
|
|
"src/daemon/daemon_app.cpp",
|
|
|
|
"src/daemon/daemon_forward.cpp",
|
|
|
|
"src/daemon/daemon_tcp.cpp",
|
|
|
|
"src/daemon/daemon_unity.cpp",
|
|
|
|
"src/daemon/daemon_usb.cpp",
|
|
|
|
"src/daemon/jdwp.cpp",
|
|
|
|
"src/daemon/main.cpp",
|
|
|
|
"src/daemon/shell.cpp",
|
2021-12-16 15:51:24 +00:00
|
|
|
"src/daemon/system_depend.cpp",
|
2021-06-01 16:04:36 +00:00
|
|
|
]
|
|
|
|
sources += hdc_common_sources
|
|
|
|
|
2022-04-22 02:53:36 +00:00
|
|
|
defines = [
|
|
|
|
"HARMONY_PROJECT",
|
|
|
|
"USE_CONFIG_UV_THREADS",
|
|
|
|
"SIZE_THREAD_POOL=$hdcd_uv_thread_size",
|
|
|
|
]
|
2021-06-01 16:04:36 +00:00
|
|
|
|
2022-02-09 06:11:30 +00:00
|
|
|
if (hdc_debug) {
|
|
|
|
defines += [ "HDC_DEBUG" ]
|
|
|
|
}
|
|
|
|
if (hdc_support_uart) {
|
|
|
|
defines += [ "HDC_SUPPORT_UART" ]
|
|
|
|
sources += [ "src/daemon/daemon_uart.cpp" ]
|
|
|
|
}
|
2021-12-02 11:44:46 +00:00
|
|
|
if (js_jdwp_connect) {
|
|
|
|
defines += [ "JS_JDWP_CONNECT" ]
|
|
|
|
}
|
2021-06-01 16:04:36 +00:00
|
|
|
configs = [ ":hdc_config" ]
|
|
|
|
|
|
|
|
deps = [
|
2022-07-21 07:15:46 +00:00
|
|
|
"//third_party/libuv:uv",
|
2021-06-01 16:04:36 +00:00
|
|
|
"//third_party/lz4:liblz4_static",
|
2022-07-21 12:51:12 +00:00
|
|
|
"//third_party/openssl:libcrypto_shared",
|
2021-06-01 16:04:36 +00:00
|
|
|
]
|
2022-01-13 07:07:24 +00:00
|
|
|
|
2022-06-24 10:34:27 +00:00
|
|
|
deps += [ ":hdc_hash_gen" ]
|
|
|
|
|
2022-02-09 06:11:30 +00:00
|
|
|
if (hdc_jdwp_test) {
|
|
|
|
defines += [ "SIMULATE_JDWP" ]
|
|
|
|
deps += [ "${HDC_PATH}/src/test/jdwp:jdwp_test" ]
|
|
|
|
}
|
|
|
|
|
2022-07-26 07:36:35 +00:00
|
|
|
external_deps = [
|
|
|
|
"c_utils:utilsbase",
|
|
|
|
"init:libbegetutil",
|
|
|
|
]
|
2022-01-13 07:07:24 +00:00
|
|
|
|
2021-06-01 16:04:36 +00:00
|
|
|
include_dirs = [
|
|
|
|
"${HDC_PATH}/daemon",
|
2022-03-21 02:18:27 +00:00
|
|
|
"//third_party/bounds_checking_function/include",
|
2021-06-01 16:04:36 +00:00
|
|
|
"//third_party/lz4/lib",
|
|
|
|
"//third_party/openssl/include",
|
|
|
|
"//third_party/libuv",
|
|
|
|
]
|
2022-06-24 10:34:27 +00:00
|
|
|
|
|
|
|
if (build_selinux) {
|
|
|
|
deps += [ "//third_party/selinux:libselinux" ]
|
|
|
|
include_dirs += [ "//third_party/selinux/libselinux/include" ]
|
|
|
|
defines += [ "SURPPORT_SELINUX" ]
|
|
|
|
}
|
|
|
|
|
2022-06-27 02:24:24 +00:00
|
|
|
if (hdc_version_check) {
|
|
|
|
defines += [ "HDC_VERSION_CHECK" ]
|
|
|
|
}
|
|
|
|
|
2022-01-14 02:47:56 +00:00
|
|
|
install_images = [
|
|
|
|
"system",
|
2022-01-14 03:17:14 +00:00
|
|
|
"updater",
|
2022-01-14 02:47:56 +00:00
|
|
|
]
|
2022-01-13 07:07:24 +00:00
|
|
|
|
2022-04-20 07:03:26 +00:00
|
|
|
ldflags = [ "-rdynamic" ]
|
|
|
|
|
2021-06-01 16:04:36 +00:00
|
|
|
install_enable = true
|
|
|
|
subsystem_name = "developtools"
|
2022-04-26 09:35:01 +00:00
|
|
|
part_name = "hdc"
|
2021-06-01 16:04:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ohos_executable("hdc_std") {
|
2022-02-09 06:11:30 +00:00
|
|
|
use_exceptions = true
|
|
|
|
ldflags = []
|
|
|
|
libs = []
|
2021-06-01 16:04:36 +00:00
|
|
|
configs = [ ":hdc_config" ]
|
|
|
|
defines = [
|
|
|
|
"HDC_HOST",
|
|
|
|
"HARMONY_PROJECT",
|
2022-04-22 02:53:36 +00:00
|
|
|
"USE_CONFIG_UV_THREADS",
|
|
|
|
"SIZE_THREAD_POOL=$hdc_uv_thread_size",
|
2021-06-01 16:04:36 +00:00
|
|
|
]
|
2021-09-13 09:30:00 +00:00
|
|
|
if (is_mac) {
|
|
|
|
defines += [ "HOST_MAC" ]
|
|
|
|
}
|
2022-02-09 06:11:30 +00:00
|
|
|
if (hdc_debug) {
|
|
|
|
defines += [ "HDC_DEBUG" ]
|
|
|
|
}
|
2021-06-01 16:04:36 +00:00
|
|
|
sources = [
|
|
|
|
"src/host/client.cpp",
|
2022-09-23 09:10:14 +00:00
|
|
|
"src/host/ext_client.cpp",
|
2021-06-01 16:04:36 +00:00
|
|
|
"src/host/host_app.cpp",
|
|
|
|
"src/host/host_forward.cpp",
|
|
|
|
"src/host/host_tcp.cpp",
|
|
|
|
"src/host/host_unity.cpp",
|
2022-06-22 01:47:04 +00:00
|
|
|
"src/host/host_updater.cpp",
|
2022-06-24 01:49:03 +00:00
|
|
|
"src/host/host_usb.cpp",
|
2021-06-01 16:04:36 +00:00
|
|
|
"src/host/main.cpp",
|
|
|
|
"src/host/server.cpp",
|
|
|
|
"src/host/server_for_client.cpp",
|
|
|
|
"src/host/translate.cpp",
|
|
|
|
]
|
|
|
|
sources += hdc_common_sources
|
2022-02-09 06:11:30 +00:00
|
|
|
if (hdc_support_uart) {
|
|
|
|
defines += [ "HDC_SUPPORT_UART" ]
|
|
|
|
sources += [ "src/host/host_uart.cpp" ]
|
|
|
|
}
|
2021-06-01 16:04:36 +00:00
|
|
|
|
|
|
|
deps = [
|
2022-03-21 02:18:27 +00:00
|
|
|
"//third_party/bounds_checking_function:libsec_static",
|
2021-08-10 09:50:09 +00:00
|
|
|
"//third_party/libusb:libusb",
|
2022-07-21 12:51:12 +00:00
|
|
|
"//third_party/libuv:uv_static",
|
2021-06-01 16:04:36 +00:00
|
|
|
"//third_party/lz4:liblz4_static",
|
2021-08-06 07:02:15 +00:00
|
|
|
"//third_party/openssl:libcrypto_static",
|
2021-06-01 16:04:36 +00:00
|
|
|
]
|
|
|
|
|
2022-06-24 10:34:27 +00:00
|
|
|
deps += [ ":hdc_hash_gen" ]
|
|
|
|
|
2021-06-01 16:04:36 +00:00
|
|
|
include_dirs = [
|
|
|
|
"${HDC_PATH}/daemon",
|
2022-03-21 02:18:27 +00:00
|
|
|
"//third_party/bounds_checking_function/include",
|
2021-06-01 16:04:36 +00:00
|
|
|
"//third_party/lz4/lib",
|
|
|
|
"//third_party/openssl/include",
|
|
|
|
"//third_party/libuv",
|
|
|
|
]
|
2022-02-09 06:11:30 +00:00
|
|
|
|
2022-06-24 10:34:27 +00:00
|
|
|
if (!(is_mingw || is_mac) && build_selinux) {
|
|
|
|
deps += [ "//third_party/selinux:libselinux" ]
|
|
|
|
include_dirs += [ "//third_party/selinux/libselinux/include" ]
|
|
|
|
defines += [ "SURPPORT_SELINUX" ]
|
|
|
|
}
|
|
|
|
|
2022-06-27 02:24:24 +00:00
|
|
|
if (hdc_version_check) {
|
|
|
|
defines += [ "HDC_VERSION_CHECK" ]
|
|
|
|
}
|
|
|
|
|
2022-02-09 06:11:30 +00:00
|
|
|
if (is_mingw) {
|
2022-02-14 03:51:29 +00:00
|
|
|
static_link = false
|
2022-02-09 06:11:30 +00:00
|
|
|
|
|
|
|
# we should use something we define , not just _WIN32 (this will defined in some windows header)
|
|
|
|
defines += [ "HOST_MINGW" ] # we define this for mingw
|
|
|
|
defines += [ "WIN32_LEAN_AND_MEAN" ]
|
|
|
|
libs += [ "setupapi" ]
|
|
|
|
ldflags += [
|
|
|
|
"-Wl,--whole-archive",
|
|
|
|
"-lpthread",
|
|
|
|
"-Wl,--no-whole-archive",
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
|
|
|
if (is_linux) {
|
2022-02-14 03:51:29 +00:00
|
|
|
static_link = false
|
2022-02-09 06:11:30 +00:00
|
|
|
defines += [ "HOST_LINUX" ]
|
|
|
|
ldflags += [
|
|
|
|
"-Wl,--whole-archive",
|
|
|
|
"-lpthread",
|
|
|
|
"-latomic",
|
|
|
|
"-ldl",
|
|
|
|
"-lrt",
|
|
|
|
"-Wl,--no-whole-archive",
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
2021-06-01 16:04:36 +00:00
|
|
|
subsystem_name = "developtools"
|
2022-04-26 09:35:01 +00:00
|
|
|
part_name = "hdc"
|
2021-06-01 16:04:36 +00:00
|
|
|
}
|
|
|
|
|
2022-04-26 09:35:01 +00:00
|
|
|
group("hdc_target") {
|
2021-06-01 16:04:36 +00:00
|
|
|
deps = [
|
|
|
|
":hdc_std",
|
|
|
|
":hdcd",
|
|
|
|
]
|
|
|
|
}
|
2022-02-09 06:11:30 +00:00
|
|
|
|
2022-04-26 09:35:01 +00:00
|
|
|
group("hdc_target_all") {
|
|
|
|
deps = [ ":hdc_target" ]
|
2022-02-09 06:11:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
group("hdc_all") {
|
|
|
|
testonly = true
|
2022-04-26 09:35:01 +00:00
|
|
|
deps = [ ":hdc_target_all" ]
|
2022-02-09 06:11:30 +00:00
|
|
|
}
|
2022-06-24 10:34:27 +00:00
|
|
|
|
|
|
|
action("hdc_hash_gen") {
|
|
|
|
script = "${HDC_PATH}/scripts/hdc_hash_gen.py"
|
|
|
|
sources = hash_sources
|
|
|
|
outputs = [ "$py_out_dir" ]
|
|
|
|
args = [
|
|
|
|
"-f",
|
|
|
|
"hdc_hash_gen.h",
|
|
|
|
"-i",
|
|
|
|
rebase_path(".", root_build_dir),
|
|
|
|
"-o",
|
2022-08-01 03:22:07 +00:00
|
|
|
rebase_path("$py_out_dir" + "/", root_build_dir),
|
2022-06-24 10:34:27 +00:00
|
|
|
]
|
|
|
|
public_configs = [ ":hdc_config" ]
|
|
|
|
}
|