developtools_hdc/BUILD.gn

233 lines
5.5 KiB
Plaintext
Raw Normal View History

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")
HDC_PATH = "//developtools/hdc_standard"
import("//developtools/hdc_standard/hdc.gni")
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",
]
if (hdc_support_uart) {
hdc_common_sources += [ "${HDC_PATH}/src/common/uart.cpp" ]
}
2021-06-01 16:04:36 +00:00
config("hdc_config") {
include_dirs = [ "${HDC_PATH}/src/common" ]
cflags_cc = [ "-std=c++17" ]
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") {
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",
"src/daemon/system_depend.cpp",
2021-06-01 16:04:36 +00:00
]
sources += hdc_common_sources
defines = [ "HARMONY_PROJECT" ]
2021-06-01 16:04:36 +00:00
if (hdc_debug) {
defines += [ "HDC_DEBUG" ]
}
if (hdc_support_uart) {
defines += [ "HDC_SUPPORT_UART" ]
sources += [ "src/daemon/daemon_uart.cpp" ]
}
if (js_jdwp_connect) {
defines += [ "JS_JDWP_CONNECT" ]
}
2021-06-01 16:04:36 +00:00
configs = [ ":hdc_config" ]
deps = [
"//third_party/libuv:uv_static",
"//third_party/lz4:liblz4_static",
"//third_party/openssl:libcrypto_static",
2021-06-01 16:04:36 +00:00
"//utils/native/base:utils",
]
if (hdc_jdwp_test) {
defines += [ "SIMULATE_JDWP" ]
deps += [ "${HDC_PATH}/src/test/jdwp:jdwp_test" ]
}
external_deps = [
"init:libbegetutil",
"startup_l2:syspara",
]
2021-06-01 16:04:36 +00:00
include_dirs = [
"${HDC_PATH}/daemon",
"//utils/native/base/include",
"//third_party/lz4/lib",
"//third_party/openssl/include",
"//third_party/libuv",
]
install_images = [
"system",
"updater",
]
2021-06-01 16:04:36 +00:00
install_enable = true
subsystem_name = "developtools"
part_name = "hdc_standard"
}
ohos_executable("hdc_std") {
use_exceptions = true
ldflags = []
libs = []
2021-06-01 16:04:36 +00:00
configs = [ ":hdc_config" ]
defines = [
"HDC_HOST",
"HARMONY_PROJECT",
]
if (is_mac) {
defines += [ "HOST_MAC" ]
}
if (hdc_debug) {
defines += [ "HDC_DEBUG" ]
}
2021-06-01 16:04:36 +00:00
cflags_cc = [
"-Wno-error",
"-Wno-error=unused-variable",
"-Wno-unused-variable",
]
sources = [
"src/host/client.cpp",
"src/host/host_app.cpp",
"src/host/host_forward.cpp",
"src/host/host_tcp.cpp",
"src/host/host_unity.cpp",
"src/host/host_usb.cpp",
"src/host/main.cpp",
"src/host/server.cpp",
"src/host/server_for_client.cpp",
"src/host/translate.cpp",
]
sources += hdc_common_sources
if (hdc_support_uart) {
defines += [ "HDC_SUPPORT_UART" ]
sources += [ "src/host/host_uart.cpp" ]
}
2021-06-01 16:04:36 +00:00
deps = [
"//third_party/libusb:libusb",
2021-06-01 16:04:36 +00:00
"//third_party/libuv:uv_static",
"//third_party/lz4:liblz4_static",
"//third_party/openssl:libcrypto_static",
2021-06-01 16:04:36 +00:00
"//utils/native/base:utilsecurec",
]
include_dirs = [
"${HDC_PATH}/daemon",
"//utils/native/base/include",
"//third_party/lz4/lib",
"//third_party/openssl/include",
"//third_party/libuv",
]
if (is_mingw) {
static_link = true
# 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) {
static_link = true
defines += [ "HOST_LINUX" ]
ldflags += [
"-Wl,--whole-archive",
"-lpthread",
"-latomic",
"-ldl",
"-lrt",
"-Wl,--no-whole-archive",
]
cflags_cc += [ "-g" ]
}
2021-06-01 16:04:36 +00:00
subsystem_name = "developtools"
part_name = "hdc_standard"
}
group("hdc_target_standard") {
deps = [
":hdc_std",
":hdcd",
]
}
group("hdc_target_standard_linux") {
deps = [ ":hdc_std(//build/toolchain/linux:clang_x64)" ]
}
group("hdc_target_standard_mingw") {
deps = [ ":hdc_std(//build/toolchain/mingw:mingw_x86_64)" ]
}
group("hdc_target_standard_all") {
deps = [
":hdc_target_standard",
":hdc_target_standard_linux",
":hdc_target_standard_mingw",
]
}
group("hdc_target_standard_windows") {
deps = [
":hdc_target_standard",
":hdc_target_standard_mingw",
]
}
group("hdc_all") {
testonly = true
deps = [
":hdc_target_standard_all",
"test:HdcJdwpTest",
"test:hdc_unittest",
]
}