# Copyright 2016 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/toolchain/win/midl.gni")
import("//build/util/lastchange.gni")
import("//build/win/message_compiler.gni")
import("//media/media_options.gni")
import("//remoting/build/config/remoting_build.gni")
import("//remoting/host/installer/win/generate_clsids.gni")
group("all") {
testonly = true
deps = [
":remoting_console",
":remoting_desktop",
":remoting_me2me_host",
":remoting_native_messaging_host",
"//remoting/host/security_key:remote_security_key",
]
}
# Reference this manifest to indicate that a process is per-monitor DPI aware.
dpi_aware_manifest = "//remoting/host/win/dpi_aware.manifest"
# Reference this manifest to give the binary the uiAccess privilege.
enable_uiaccess_manifest = "//remoting/host/win/enable_uiaccess.manifest"
enable_uiaccess_require_admin_manifest =
"//remoting/host/win/enable_uiaccess_require_admin.manifest"
# Depending on this target gives a default executable manifest with the addition
# of the requestedExecutionLevel of requireAdministrator.
windows_manifest("elevated_exe_manifest") {
sources = [
common_controls_manifest,
default_compatibility_manifest,
require_administrator_manifest,
]
}
# Depending on this target gives a default executable manifest with the addition
# of the DPI aware tag.
windows_manifest("dpi_aware_exe_manifest") {
sources = [
as_invoker_manifest,
common_controls_manifest,
default_compatibility_manifest,
dpi_aware_manifest,
]
}
# Depending on this target gives a default executable manifest with the addition
# of the DPI aware tag and a requestedExecutionLevel of requireAdministrator.
windows_manifest("dpi_aware_elevated_exe_manifest") {
sources = [
common_controls_manifest,
default_compatibility_manifest,
dpi_aware_manifest,
require_administrator_manifest,
]
}
# Depending on this target gives the executable a default manifest with the
# addition of the DPI aware tag and enables uiAccess.
windows_manifest("dpi_aware_uiaccess_exe_manifest") {
sources = [
common_controls_manifest,
default_compatibility_manifest,
dpi_aware_manifest,
enable_uiaccess_manifest,
]
}
# Depending on this target gives the executable a default manifest with the
# addition of the DPI aware tag and enables uiAccess.
windows_manifest("dpi_aware_uiaccess_require_admin_exe_manifest") {
sources = [
common_controls_manifest,
default_compatibility_manifest,
dpi_aware_manifest,
enable_uiaccess_require_admin_manifest,
]
}
source_set("security_descriptor") {
sources = [
"security_descriptor.cc",
"security_descriptor.h",
]
deps = [ "//remoting/base" ]
}
source_set("acl_util") {
sources = [
"acl_util.cc",
"acl_util.h",
]
deps = [ "//base" ]
}
source_set("trust_util") {
sources = [
"trust_util.cc",
"trust_util.h",
]
deps = [ "//base" ]
libs = [ "Wintrust.lib" ]
}
source_set("win") {
sources = [
"audio_volume_filter_win.cc",
"audio_volume_filter_win.h",
"com_imported_mstscax.h",
"com_security.cc",
"com_security.h",
"core_resource.h",
"default_audio_device_change_detector.cc",
"default_audio_device_change_detector.h",
"etw_trace_consumer.h",
"evaluate_3d_display_mode.cc",
"evaluate_3d_display_mode.h",
"evaluate_d3d.cc",
"evaluate_d3d.h",
"host_event_file_logger.h",
"host_event_logger.h",
"host_event_windows_event_logger.h",
"host_service.h",
"launch_process_with_token.cc",
"launch_process_with_token.h",
"rdp_client.cc",
"rdp_client.h",
"rdp_client_window.cc",
"rdp_client_window.h",
"session_action_executor.cc",
"session_action_executor.h",
"session_desktop_environment.cc",
"session_desktop_environment.h",
"session_input_injector.cc",
"session_input_injector.h",
"simple_task_dialog.cc",
"simple_task_dialog.h",
"unprivileged_process_delegate.h",
"window_station_and_desktop.cc",
"window_station_and_desktop.h",
"windows_event_logger.cc",
"windows_event_logger.h",
"worker_process_launcher.cc",
"worker_process_launcher.h",
"wts_session_change_observer.cc",
"wts_session_change_observer.h",
"wts_session_process_delegate.h",
"wts_terminal_monitor.cc",
"wts_terminal_monitor.h",
"wts_terminal_observer.h",
]
configs += [
"//build/config/compiler:wexit_time_destructors",
"//remoting/build/config:version",
]
if (is_clang) {
# TODO(thakis): Remove this once midl.exe no longer produces nonstandard
# C++ (see the enums in com_imported_mstscax.h).
cflags = [ "-Wno-microsoft-enum-forward-reference" ]
}
defines = [ "WEBRTC_CHROMIUM_BUILD" ]
public_deps = [ ":security_descriptor" ]
deps = [
"//base:i18n",
"//components/policy/core/common",
"//crypto",
"//ipc",
"//remoting/base",
"//remoting/host:ipc_constants",
"//remoting/host/base",
"//remoting/host/mojom",
"//remoting/host/security_key",
"//remoting/host/win:messages",
"//remoting/host/win:remoting_lib_idl",
"//remoting/protocol",
"//remoting/resources",
"//services/device/wake_lock/power_save_blocker",
"//third_party/webrtc_overrides:webrtc_component",
"//third_party/wtl",
"//ui/base",
"//ui/events:dom_keycode_converter",
"//ui/events/platform",
]
if (!is_ios) {
deps += [ "//components/policy:generated" ]
}
}
source_set("unit_tests") {
testonly = true
sources = [
"event_trace_data.cc",
"event_trace_data.h",
"event_trace_data_unittest.cc",
"rdp_client_unittest.cc",
"worker_process_launcher_unittest.cc",
]
deps = [
":elevated_native_messaging_host",
":win",
"//base/test:test_support",
"//ipc",
"//remoting/host:common",
"//remoting/host:test_support",
"//remoting/host/base",
"//remoting/host/it2me:common",
"//remoting/host/mojom",
"//remoting/host/native_messaging",
"//remoting/host/security_key:unit_tests",
"//remoting/host/setup:common",
"//remoting/proto",
"//remoting/resources",
"//skia",
"//testing/gmock",
"//testing/gtest",
]
}
RDP_DESKTOP_SESSION_PLACEHOLDER_CLSID =
"PLACEHOLDER-GUID-6741fd0a-6a8a-5838-a35e-8088697e2088"
midl("remoting_lib_idl") {
sources = [ "chromoting_lib.templ" ]
dynamic_guids =
"$RDP_DESKTOP_SESSION_PLACEHOLDER_CLSID=$rdp_desktop_session_clsid"
writes_tlb = true
}
config("MIDL_config") {
if (is_clang) {
cflags = [
# MIDL generated code has a habit of omitting optional braces.
"-Wno-missing-braces",
# Source files generated by the MIDL compiler trigger warnings with
# -Wincompatible-pointer-types enabled.
"-Wno-incompatible-pointer-types",
# Generated code contains unused variables.
"-Wno-unused-variable",
# PROXYFILE_LIST_START is an extern with initializer.
"-Wno-extern-initializer",
]
}
}
static_library("remoting_lib_ps") {
sources = [
"$target_gen_dir/chromoting_lib.dlldata.c",
"$target_gen_dir/chromoting_lib_p.c",
]
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [
"//build/config/compiler:no_chromium_code",
# Must be after no_chromium_code so the -Wno flags appear after the /W3
# added by no_chromium_code.
":MIDL_config",
]
defines = [
"ENTRY_PREFIX=Ps",
"REGISTER_PROXY_DLL",
]
deps = [ ":remoting_lib_idl" ]
}
# Makes the .mc file from the .mc.jinja file.
remoting_localize("messages_localizing") {
sources = [ "host_messages.mc.jinja2" ]
locale_list = remoting_locales_without_pseudolocales
locale_dir = resources_locale_dir
encoding = "utf-16"
# This target is funny. It only produces one file and the output doesn't
# match the input. We want to generate remoting_host_messages.mc from
# host_messages.mg.jinja2. GN complains if it doesn't see a pattern in the
# output, so the following pattern produces the name we want with a template
# based on the input.
#
# TODO: This is for GYP compat. We should just make the names match instead.
output = "$target_gen_dir/remoting_{{source_name_part}}"
}
# Makes the .h/.rc files from the .mc file.
message_compiler("messages") {
compile_generated_code = false
sources = get_target_outputs(":messages_localizing")
deps = [ ":messages_localizing" ]
}
executable("remoting_console") {
configs += [ "//build/config/compiler:wexit_time_destructors" ]
defines = host_predefines + [ "REMOTING_HOST_BINARY=BINARY_HOST_ME2ME" ]
deps = [
":dpi_aware_exe_manifest",
":remoting_core",
":remoting_windows_resources",
"//base:clang_profiling_buildflags",
"//remoting/host:host_main_headers",
]
sources = [
"$root_gen_dir/remoting/version.rc",
"entry_point.cc",
]
if (!is_asan && !use_clang_profiling) {
no_default_deps = true
ldflags = [
"/ENTRY:HostEntryPoint",
# "/NODEFAULTLIB",
]
}
}
executable("remoting_me2me_host") {
configs += [
"//build/config/compiler:wexit_time_destructors",
"//build/config/win:windowed",
"//remoting/build/config:remoting_me2me_host",
]
defines = host_predefines + [ "REMOTING_HOST_BINARY=BINARY_HOST_ME2ME" ]
deps = [
":dpi_aware_exe_manifest",
":remoting_core",
":remoting_windows_resources",
"//base:clang_profiling_buildflags",
"//remoting/host:host_main_headers",
]
sources = [
"$root_gen_dir/remoting/version.rc",
"entry_point.cc",
]
output_name = "remoting_host"
if (!is_asan && !use_clang_profiling) {
no_default_deps = true
ldflags = [
"/ENTRY:HostEntryPoint",
# "/NODEFAULTLIB",
]
}
}
source_set("elevated_native_messaging_host") {
sources = [
"elevated_native_messaging_host.cc",
"elevated_native_messaging_host.h",
"launch_native_messaging_host_process.cc",
"launch_native_messaging_host_process.h",
]
deps = [
":security_descriptor",
"//base",
"//extensions/browser/api/messaging:native_messaging",
"//ipc",
"//remoting/host/base",
"//remoting/host/native_messaging",
]
}
shared_library("remoting_core") {
configs += [
"//build/config/compiler:wexit_time_destructors",
"//remoting/build/config:host_implementation",
"//remoting/build/config:version",
]
sources = [
"$root_gen_dir/remoting/core.rc",
"$root_gen_dir/remoting/host/win/remoting_host_messages.rc",
"$root_gen_dir/remoting/version.rc",
"//remoting/host/desktop_process_main.cc",
"chromoting_lib.rc",
"chromoting_module.cc",
"chromoting_module.h",
"core.cc",
"etw_trace_consumer.cc",
"etw_trace_controller.cc",
"etw_trace_controller.h",
"event_trace_data.cc",
"event_trace_data.h",
"host_event_file_logger.cc",
"host_event_windows_event_logger.cc",
"host_service.cc",
"rdp_desktop_session.cc",
"rdp_desktop_session.h",
"unprivileged_process_delegate.cc",
"wts_session_process_delegate.cc",
]
public_deps = [ ":elevated_native_messaging_host" ]
deps = [
":messages",
":remoting_lib_idl",
":remoting_lib_ps",
":remoting_windows_resources",
":win",
"//base",
"//base:base_static",
"//base:i18n",
"//build:chromeos_buildflags",
"//build/win:default_exe_manifest",
"//ipc",
"//mojo/core/embedder:embedder",
"//mojo/public/cpp/platform",
"//mojo/public/cpp/system",
"//net",
"//remoting/base",
"//remoting/base:authorization",
"//remoting/base:breakpad",
"//remoting/host:host",
"//remoting/host:host_main_headers",
"//remoting/host:implementation",
"//remoting/host:ipc_constants",
"//remoting/host:resources",
"//remoting/host:settings",
"//remoting/host/base",
"//remoting/host/it2me:common",
"//remoting/host/mojom",
"//remoting/host/native_messaging",
"//remoting/host/setup",
"//remoting/protocol",
"//sandbox/win:sandbox", # Should always use Windows version
"//services/network:network_service",
"//services/network/public/cpp",
"//services/network/public/mojom",
"//third_party/webrtc_overrides:webrtc_component",
"//ui/base",
"//url",
]
ldflags = [
"/EXPORT:DllGetClassObject=PsDllGetClassObject,PRIVATE",
"/EXPORT:DllCanUnloadNow=PsDllCanUnloadNow,PRIVATE",
"/EXPORT:DllRegisterServer=PsDllRegisterServer,PRIVATE",
"/EXPORT:DllUnregisterServer=PsDllUnregisterServer,PRIVATE",
]
libs = [
"comctl32.lib",
"rpcns4.lib",
"rpcrt4.lib",
"uuid.lib",
"wtsapi32.lib",
]
if (is_clang) {
cflags = [ "-Wno-header-hygiene" ]
}
}
executable("remoting_desktop") {
configs += [
"//build/config/compiler:wexit_time_destructors",
"//build/config/win:windowed",
]
defines = host_predefines + [ "REMOTING_HOST_BINARY=BINARY_DESKTOP" ]
deps = [
":remoting_core",
":remoting_windows_resources",
"//base:clang_profiling_buildflags",
"//remoting/host:host_main_headers",
]
if (is_official_build) {
deps += [ ":dpi_aware_uiaccess_require_admin_exe_manifest" ]
} else {
deps += [ ":dpi_aware_exe_manifest" ]
}
sources = [
"$root_gen_dir/remoting/version.rc",
"entry_point.cc",
]
if (!is_asan && !use_clang_profiling) {
no_default_deps = true
ldflags = [
"/ENTRY:HostEntryPoint",
# "/NODEFAULTLIB",
]
}
}
executable("remoting_native_messaging_host") {
configs += [ "//build/config/compiler:wexit_time_destructors" ]
defines =
host_predefines + [ "REMOTING_HOST_BINARY=BINARY_NATIVE_MESSAGING_HOST" ]
deps = [
":remoting_core",
":remoting_windows_resources",
"//build/win:default_exe_manifest",
"//remoting/host/setup:native_messaging_host_main_headers",
]
sources = [
"$root_gen_dir/remoting/version.rc",
"../setup/me2me_native_messaging_host_entry_point.cc",
]
}
remoting_localize("remoting_windows_resources") {
deps = [ "//remoting/resources" ]
sources = [
"core.rc.jinja2",
"version.rc.jinja2",
]
variables = [
rebase_path(chrome_version_file),
rebase_path(remoting_version_file),
rebase_path(lastchange_file),
]
output = "$root_gen_dir/remoting/{{source_name_part}}"
locale_dir = resources_locale_dir
encoding = "utf-16"
locale_list = remoting_locales_without_pseudolocales
}