diff --git a/.gn b/.gn index 20344202aca01c..e79375029debad 100644 --- a/.gn +++ b/.gn @@ -249,6 +249,7 @@ exec_script_whitelist = [ "//net/BUILD.gn", "//remoting/host/BUILD.gn", "//remoting/remoting_version.gni", + "//remoting/host/installer/win/generate_clsids.gni", "//third_party/angle/BUILD.gn", "//third_party/angle/src/tests/BUILD.gn", "//third_party/angle/src/vulkan_support/BUILD.gn", diff --git a/remoting/BUILD.gn b/remoting/BUILD.gn index 3d94643ffbe58d..c4c88d19baa7fc 100644 --- a/remoting/BUILD.gn +++ b/remoting/BUILD.gn @@ -21,8 +21,7 @@ group("remoting_all") { if (is_win) { deps += [ "//remoting:remoting_breakpad_tester", - "//remoting/host:remoting_console", - "//remoting/host:remoting_desktop", + "//remoting/host/win:all", ] if (is_chrome_branded) { @@ -55,13 +54,8 @@ group("remoting_all") { } } - # The same target is called differently on Linux. - # TODO(sergeyu): Rename it to remoting_native_messaging_host on all - # platforms. - if (is_win) { + if (is_win || (!is_chromeos && !is_android && !is_ios)) { deps += [ "//remoting/host:remoting_native_messaging_host" ] - } else if (!is_chromeos && !is_android) { - deps += [ "//remoting/host:native_messaging_host" ] } if (is_linux && !is_chromeos) { @@ -90,11 +84,20 @@ if (is_win) { "//remoting/host", ] + libs = [] + configs += [ "//build/config/compiler:wexit_time_destructors" ] sources = [ "tools/breakpad_tester_win.cc", ] + + if (is_win) { + libs += [ + "rpcrt4.lib", + "wtsapi32.lib", + ] + } } } @@ -183,6 +186,9 @@ test("remoting_unittests") { if (enable_remoting_host) { test("remoting_perftests") { + defines = [] + libs = [] + sources = [ "test/codec_perftest.cc", "test/protocol_perftest.cc", @@ -205,5 +211,14 @@ if (enable_remoting_host) { if (enable_webrtc) { deps += [ "//third_party/libjingle:libjingle_webrtc" ] } + + if (is_win) { + defines += [ "_ALT_NO_EXCEPTIONS" ] + + libs += [ + "rpcrt4.lib", + "wtsapi32.lib", + ] + } } } diff --git a/remoting/build/config/BUILD.gn b/remoting/build/config/BUILD.gn index dea58eb7f171a7..a06726775ca06e 100644 --- a/remoting/build/config/BUILD.gn +++ b/remoting/build/config/BUILD.gn @@ -4,6 +4,7 @@ import("//build/config/features.gni") import("//build/util/version.gni") +import("//remoting/remoting_options.gni") # TODO(nicholss): Move this and other defines to version.h.in. # Various remoting targets need this version definition. @@ -16,3 +17,19 @@ config("enable_webrtc_remoting_client") { defines = [ "ENABLE_WEBRTC_REMOTING_CLIENT=1" ] } } + +config("remoting_me2me_host") { + defines = [] + + if (is_mac && is_official_build) { + defines += [ "USE_REMOTING_MACOSX_INTERNAL" ] + } + + if (is_win && remoting_multi_process != 0 && remoting_rdp_session != 0) { + defines += [ "REMOTING_RDP_SESSION" ] + } + + if (remoting_multi_process != 0) { + defines += [ "REMOTING_MULTI_PROCESS" ] + } +} diff --git a/remoting/host/BUILD.gn b/remoting/host/BUILD.gn index 6b3f87c52f5eb1..2937af8f4d3f64 100644 --- a/remoting/host/BUILD.gn +++ b/remoting/host/BUILD.gn @@ -4,91 +4,44 @@ import("//remoting/build/config/remoting_build.gni") -process_version("remoting_version") { - template_file = "//remoting/host/version.h.in" - sources = [ - branding_path, - ] - output = "$target_gen_dir/version.h" -} +group("all_tests") { + testonly = true -if (is_win) { - import("//remoting/host/predefines_win.gni") -} else if (is_mac) { - import("//build/config/mac/rules.gni") - import("//third_party/icu/config.gni") + deps = [ + ":unit_tests", + ] } -if (is_win) { - # 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" +group("all") { + testonly = true - # Depending on this target gives the executable a default 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, - ] - type = "exe" + deps = [ + ":host", + ] + if (enable_me2me_host) { + deps += [ "//remoting/host:remoting_me2me_host" ] } - # Depending on this target gives the executable a default manifest with the - # addition of the DPI aware tag and requestedExecutionLevel of - # requireAdministrator. - windows_manifest("dpi_aware_elevated_exe_manifest") { - sources = [ - common_controls_manifest, - default_compatibility_manifest, - dpi_aware_manifest, - require_administrator_manifest, - ] - type = "exe" + if (is_chrome_branded) { + deps += [ ":remoting_host_branded" ] } - # 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, + if (!is_chromeos && !is_android && !is_ios) { + deps += [ + "//remoting/host:remoting_native_messaging_host", + "//remoting/host:remoting_native_messaging_manifests", + "//remoting/host:remoting_start_host", + "//remoting/host/it2me:remote_assistance_host", ] - type = "exe" } } -action("credits") { - # We put this in $root_build_dir/gen/remoting instead of - # $root_build_dir/gen/remoting/host (target_gen_dir) for - # compatibility w/ GYP, since the installer needs the file to - # be at the same location. - about_credits_file = "$root_build_dir/gen/remoting/CREDITS.txt" - script = "//tools/licenses.py" - - inputs = [ - "installer/credits.tmpl", - "installer/credits_entry.tmpl", - ] - - outputs = [ - about_credits_file, - ] - - args = [ - "credits", - rebase_path(about_credits_file, root_build_dir), - "--file-template", - rebase_path("installer/credits.tmpl", root_build_dir), - "--entry-template", - rebase_path("installer/credits_entry.tmpl", root_build_dir), +process_version("remoting_version") { + template_file = "//remoting/host/version.h.in" + sources = [ + branding_path, ] + output = "$target_gen_dir/version.h" } # This must be a static library instead of a source set because @@ -343,32 +296,6 @@ static_library("host") { "usage_stats_consent_win.cc", "username.cc", "username.h", - "win/com_imported_mstscax.tlh", - "win/com_security.cc", - "win/com_security.h", - "win/elevation_helpers.cc", - "win/elevation_helpers.h", - "win/launch_process_with_token.cc", - "win/launch_process_with_token.h", - "win/omaha.cc", - "win/omaha.h", - "win/rdp_client.cc", - "win/rdp_client.h", - "win/rdp_client_window.cc", - "win/rdp_client_window.h", - "win/security_descriptor.cc", - "win/security_descriptor.h", - "win/session_desktop_environment.cc", - "win/session_desktop_environment.h", - "win/session_input_injector.cc", - "win/session_input_injector.h", - "win/window_station_and_desktop.cc", - "win/window_station_and_desktop.h", - "win/worker_process_launcher.cc", - "win/worker_process_launcher.h", - "win/wts_terminal_monitor.cc", - "win/wts_terminal_monitor.h", - "win/wts_terminal_observer.h", ] libs = [] @@ -397,6 +324,8 @@ static_library("host") { "//ui/events/platform", ] + public_deps = [] + if (enable_configuration_policy) { deps += [ "//components/policy:generated" ] } @@ -500,9 +429,12 @@ static_library("host") { if (is_win) { deps += [ - ":messages", - ":remoting_lib_idl", + "//remoting/host/win", + "//remoting/host/win:messages", + "//remoting/host/win:remoting_lib_idl", ] + + public_deps += [ "//remoting/host/win" ] } if (enable_webrtc) { @@ -611,8 +543,6 @@ source_set("unit_tests") { "third_party_auth_config_unittest.cc", "token_validator_factory_impl_unittest.cc", "touch_injector_win_unittest.cc", - "win/rdp_client_unittest.cc", - "win/worker_process_launcher_unittest.cc", ] if (!use_x11 && is_linux) { @@ -627,14 +557,6 @@ source_set("unit_tests") { if (is_android) { sources -= [ "it2me/it2me_native_messaging_host_unittest.cc" ] } - if (is_win) { - sources += [ - "win/elevated_native_messaging_host.cc", - "win/elevated_native_messaging_host.h", - "win/launch_native_messaging_host_process.cc", - "win/launch_native_messaging_host_process.h", - ] - } configs += [ "//remoting/build/config:version" ] @@ -651,341 +573,33 @@ source_set("unit_tests") { "//testing/gmock", "//testing/gtest", ] + if (is_win) { + deps += [ "//remoting/host/win:unit_tests" ] + } if (enable_configuration_policy) { deps += [ "//components/policy/core/browser:test_support" ] } } -if (is_win) { - import("//build/toolchain/win/midl.gni") - import("//build/win/message_compiler.gni") - - # TODO(brettw) these should not be generated via exec_script. This should be - # part of the build process rather than the metabuild. Instead, a script - # should generate a header containing the #defines for this as well as the - # IDL file with the values. - clsids = exec_script("win/get_clsids.py", - [ - daemon_controller_guid, - rdp_desktop_session_guid, - chrome_version_full, - ], - "value") - daemon_controller_clsid = clsids[0] - rdp_desktop_session_clsid = clsids[1] - - action("generate_idl") { - script = "//build/util/version.py" - - inputs = [ - "win/chromoting_lib_idl.templ", - ] - outputs = [ - "$target_gen_dir/chromoting_lib.idl", - ] - - args = [ - "-e", - "DAEMON_CONTROLLER_CLSID='$daemon_controller_clsid'", - "-e", - "RDP_DESKTOP_SESSION_CLSID='$rdp_desktop_session_clsid'", - rebase_path(inputs[0], root_build_dir), - rebase_path(outputs[0], root_build_dir), - ] - } - - midl("remoting_lib_idl") { - sources = get_target_outputs(":generate_idl") - deps = [ - ":generate_idl", - ] - } - - 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") { - configs += [ ":MIDL_config" ] - - defines = [ - "ENTRY_PREFIX=Ps", - "REGISTER_PROXY_DLL", - ] - - deps = [ - ":remoting_lib_idl", - ] - - sources = [ - "$root_gen_dir/remoting/host/chromoting_lib.dlldata.c", - "$root_gen_dir/remoting/host/chromoting_lib_p.c", - ] - } - - # Makes the .mc file from the .mc.jinja file. - remoting_localize("messages_localizing") { - sources = [ - "win/host_messages.mc.jinja2", - ] - locales = remoting_locales - locale_dir = webapp_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 + [ "BINARY=BINARY_HOST_ME2ME" ] - - deps = [ - ":dpi_aware_exe_manifest", - ":remoting_core", - ":remoting_windows_resources", - ] - - sources = [ - "$root_gen_dir/remoting/version.rc", - "win/entry_point.cc", - ] - - ldflags = [ - "/ENTRY:HostEntryPoint", - # "/NODEFAULTLIB", - ] +group("remoting_host_branded") { + testonly = true + deps = [] + if (enable_remoting_host) { + deps += [ ":remoting_host_installation" ] } - - shared_library("remoting_core") { - configs += [ "//build/config/compiler:wexit_time_destructors" ] - - defines = host_predefines + [ - "_ATL_APARTMENT_THREADED", - "_ATL_CSTRING_EXPLICIT_CONSTRUCTORS", - "_ATL_NO_AUTOMATIC_NAMESPACE", - "_ATL_NO_EXCEPTIONS", - "BINARY=BINARY_CORE", - "DAEMON_CONTROLLER_CLSID=\"$daemon_controller_clsid\"", - "RDP_DESKTOP_SESSION_CLSID=\"$rdp_desktop_session_clsid\"", - "HOST_IMPLEMENTATION", - "ISOLATION_AWARE_ENABLED=1", - "STRICT", - "VERSION=$chrome_version_full", - ] - - if (remoting_multi_process != 0 && remoting_rdp_session != 0) { - defines += [ "REMOTING_RDP_SESSION" ] - } - - if (remoting_multi_process != 0) { - defines += [ "REMOTING_MULTI_PROCESS" ] - } - - deps = [ - ":host", - ":messages", - ":remoting_lib_idl", - ":remoting_lib_ps", - ":remoting_me2me_host_static", - ":remoting_windows_resources", - "//base", - "//base:base_static", - "//base/allocator", - "//base/third_party/dynamic_annotations", - "//build/win:default_exe_manifest", - "//ipc", - "//net", - "//remoting/base", - "//remoting/base:breakpad", - "//remoting/codec", - "//remoting/host/it2me:common", - "//remoting/host/native_messaging", - "//remoting/host/security_key:main", - "//remoting/host/setup", - "//remoting/protocol", - "//sandbox/win:sandbox", # Should always use Windows version - "//third_party/webrtc/modules/desktop_capture", - ] - - sources = [ - "$root_gen_dir/remoting/core.rc", - "$root_gen_dir/remoting/host/remoting_host_messages.rc", - "$root_gen_dir/remoting/version.rc", - "desktop_process_main.cc", - "host_main.cc", - "host_main.h", - "it2me/it2me_native_messaging_host_main.cc", - "it2me/it2me_native_messaging_host_main.h", - "setup/host_starter.cc", - "setup/host_starter.h", - "setup/me2me_native_messaging_host_main.cc", - "setup/me2me_native_messaging_host_main.h", - "setup/start_host_main.cc", - "setup/start_host_main.h", - "win/chromoting_lib.rc", - "win/chromoting_module.cc", - "win/chromoting_module.h", - "win/core.cc", - "win/core_resource.h", - "win/elevated_native_messaging_host.cc", - "win/elevated_native_messaging_host.h", - "win/host_service.cc", - "win/host_service.h", - "win/launch_native_messaging_host_process.cc", - "win/launch_native_messaging_host_process.h", - "win/omaha.cc", - "win/omaha.h", - "win/rdp_desktop_session.cc", - "win/rdp_desktop_session.h", - "win/unprivileged_process_delegate.cc", - "win/unprivileged_process_delegate.h", - "win/wts_session_process_delegate.cc", - "win/wts_session_process_delegate.h", - "worker_process_ipc_delegate.h", - ] - - ldflags = [ - "/EXPORT:DllGetClassObject=PsDllGetClassObject,PRIVATE", - "/EXPORT:DllCanUnloadNow=PsDllCanUnloadNow,PRIVATE", - "/EXPORT:DllRegisterServer=PsDllRegisterServer,PRIVATE", - "/EXPORT:DllUnregisterServer=PsDllUnregisterServer,PRIVATE", - ] - - libs = [ - "comctl32.lib", - "rpcns4.lib", - "rpcrt4.lib", - "sas.lib", - "uuid.lib", - "wtsapi32.lib", - ] - - if (is_clang) { - cflags = [ "-Wno-header-hygiene" ] - } + if (enable_me2me_host) { + deps += [ "//remoting/host:remoting_me2me_host_archive" ] } +} - executable("remoting_desktop") { - configs += [ - "//build/config/compiler:wexit_time_destructors", - "//build/config/win:windowed", - ] - - defines = host_predefines + [ "BINARY=BINARY_DESKTOP" ] - - deps = [ - ":remoting_core", - ":remoting_windows_resources", - ] - - if (is_official_build) { - deps += [ ":dpi_aware_elevated_exe_manifest" ] - } else { - deps += [ ":dpi_aware_exe_manifest" ] - } - - sources = [ - "$root_gen_dir/remoting/version.rc", - "win/entry_point.cc", - ] - - ldflags = [ - "/ENTRY:HostEntryPoint", - # "/NODEFAULTLIB", - ] - } - - executable("remoting_native_messaging_host") { - configs += [ "//build/config/compiler:wexit_time_destructors" ] - - defines = host_predefines + [ "BINARY=BINARY_NATIVE_MESSAGING_HOST" ] - - deps = [ - ":remoting_core", - ":remoting_windows_resources", - "//build/win:default_exe_manifest", - ] - - if (is_mac) { - foreach(locale, remoting_locales_with_underscores) { - deps += [ - ":native_messaging_host_strings_${locale}_bundle_data", - ":remoting_host_locale_${locale}_bundle_data", - ] - } - deps += [ - ":remoting_infoplist_strings", - "//remoting/resources:copy_locales", - ] +if (enable_remoting_host) { + group("remoting_host_installation") { + deps = [] + if (is_win) { + deps += [ "//remoting/host/installer/win:remoting_host_installation" ] } - - sources = [ - "$root_gen_dir/remoting/version.rc", - "setup/me2me_native_messaging_host_entry_point.cc", - ] } - - remoting_localize("remoting_windows_resources") { - deps = [ - "//remoting/resources", - ] - - sources = [ - "win/core.rc.jinja2", - "win/version.rc.jinja2", - ] - - # TODO(zijiehe): Export lastchange_path from - # //chrome/version.gni:process_version - variables = [ - rebase_path(chrome_version_file), - rebase_path(remoting_version_file), - rebase_path("//build/util/LASTCHANGE"), - ] - - output = "$root_gen_dir/remoting/{{source_name_part}}" - - locale_dir = webapp_locale_dir - - encoding = "utf-16" - - locales = remoting_locales - } - - # TODO(GYP) More Windows remoting targets from remoting_host_win.gypi } if (enable_remoting_host && !is_android) { @@ -1004,9 +618,9 @@ if (enable_remoting_host && !is_android) { defines = host_predefines + [ "BINARY=BINARY_REMOTING_START_HOST" ] deps += [ - ":remoting_core", - ":remoting_windows_resources", "//build/win:default_exe_manifest", + "//remoting/host/win:remoting_core", + "//remoting/host/win:remoting_windows_resources", ] } else { sources += [ @@ -1132,7 +746,10 @@ if (enable_me2me_host) { ] defines = [] - configs += [ "//remoting/build/config:version" ] + configs += [ + "//remoting/build/config:version", + "//remoting/build/config:remoting_me2me_host", + ] deps = [ "//base", @@ -1170,43 +787,18 @@ if (enable_me2me_host) { if (is_mac && is_official_build) { sources += [ "internal/internal_mac-inl.h" ] - defines += [ "USE_REMOTING_MACOSX_INTERNAL" ] - } - - if (is_win && remoting_multi_process != 0 && remoting_rdp_session != 0) { - defines += [ "REMOTING_RDP_SESSION" ] - } - - if (remoting_multi_process != 0) { - defines += [ "REMOTING_MULTI_PROCESS" ] } } if (is_win) { - executable("remoting_me2me_host") { - configs += [ - "//build/config/compiler:wexit_time_destructors", - "//build/config/win:windowed", - ] - - defines = host_predefines + [ "BINARY=BINARY_HOST_ME2ME" ] - + group("remoting_me2me_host") { deps = [ - ":dpi_aware_exe_manifest", - ":remoting_core", - ":remoting_windows_resources", + "//remoting/host/win:remoting_me2me_host", ] - - sources = [ - "$root_gen_dir/remoting/version.rc", - "win/entry_point.cc", - ] - - output_name = "remoting_host" - - ldflags = [ - "/ENTRY:HostEntryPoint", - # "/NODEFAULTLIB", + } + group("remoting_native_messaging_host") { + deps = [ + "//remoting/host/win:remoting_native_messaging_host", ] } } else { @@ -1249,7 +841,7 @@ if (enable_me2me_host) { ] public_deps = [ - ":credits", + "//remoting/host/installer:credits", ] if (icu_use_data_file) { @@ -1283,10 +875,10 @@ if (enable_me2me_host) { } deps = [ - ":credits", ":remoting_me2me_host_static", "//build/config/sanitizers:deps", "//remoting/base:breakpad", + "//remoting/host/installer:credits", "//remoting/resources", ] if (is_mac) { @@ -1351,6 +943,22 @@ if (enable_me2me_host) { } } + # The [remoting_]native_messaging_host target is called differently on + # Linux and Mac vs Windows. + # TODO(sergeyu): Rename it to remoting_native_messaging_host on all + # platforms. + # TODO(nicholss): To aid in the rename effort, I am adding a link to + # native_messaging_host from remoting_native_messaging_host so up stream + # build targets need to only know about remoting_native_messaging_host. + # The issue is changing the target changes the executable, we could force + # a name in the build target or we could update the install packages to use + # the new name. Holding off making that choice for now. + group("remoting_native_messaging_host") { + deps = [ + ":native_messaging_host", + ] + } + target(app_target_type, "native_messaging_host") { if (is_mac) { info_plist = "setup/native_messaging_host-Info.plist" @@ -1480,8 +1088,8 @@ if (enable_me2me_host) { ] deps = [ - ":native_messaging_host", ":remoting_me2me_host", + ":remoting_native_messaging_host", ":remoting_native_messaging_manifests", ":remoting_start_host", "//remoting/host/it2me:remote_assistance_host", @@ -1490,107 +1098,10 @@ if (enable_me2me_host) { ] } } else if (is_win) { - action("remoting_me2me_host_archive") { - script = "//remoting/host/installer/build-installer-archive.py" - + group("remoting_me2me_host_archive") { deps = [ - ":credits", - ":remoting_core", - ":remoting_desktop", - ":remoting_me2me_host", - ":remoting_native_messaging_host", - ":remoting_native_messaging_manifests", - ":remoting_start_host", - "it2me:remote_assistance_host", - "it2me:remote_assistance_host_uiaccess", - "//remoting/host/security_key:remote_security_key", - "//third_party/icu:icudata", + "//remoting/host/installer/win:remoting_me2me_host_archive", ] - - _output = "$root_out_dir/remoting-me2me-host-$target_os.zip" - - outputs = [ - _output, - ] - if (is_chrome_branded) { - _branding = "Chrome" - } else { - _branding = "Chromium" - } - - if (is_official_build) { - _official_build = "1" - } else { - _official_build = "0" - } - - # Due to GN build issue http://crbug.com/633650, we need to actively set - # inputs parameter to tell GN to depend on these files. So change to each - # following files will trigger this target to be rebuilt. - # TODO(zijiehe): Remove inputs parameter once bug 633650 has been - # addressed. - inputs = [ - "$root_out_dir/remote_assistance_host.exe", - "$root_out_dir/remote_assistance_host_uiaccess.exe", - "$root_out_dir/remote_security_key.exe", - "$root_out_dir/remoting_core.dll", - "$root_out_dir/remoting_desktop.exe", - "$root_out_dir/remoting_host.exe", - "$root_out_dir/remoting_native_messaging_host.exe", - "$root_out_dir/remoting_start_host.exe", - "$root_gen_dir/remoting/CREDITS.txt", - "$root_out_dir/remoting/com.google.chrome.remote_assistance.json", - "$root_out_dir/remoting/com.google.chrome.remote_desktop.json", - "$root_out_dir/icudtl.dat", - ] - - _generated_files = rebase_path(inputs, root_build_dir) - _generated_files += [ rebase_path("//remoting/resources/chromoting.ico") ] - - # _generated_dst_files must contain the same files in the same order as - # _generated_files, otherwise the Windows MSI will not be built correctly. - _generated_dst_files = [ - "files/remote_assistance_host.exe", - "files/remote_assistance_host_uiaccess.exe", - "files/remote_security_key.exe", - "files/remoting_core.dll", - "files/remoting_desktop.exe", - "files/remoting_host.exe", - "files/remoting_native_messaging_host.exe", - "files/remoting_start_host.exe", - "files/CREDITS.txt", - "files/com.google.chrome.remote_assistance.json", - "files/com.google.chrome.remote_desktop.json", - "files/icudtl.dat", - "files/chromoting.ico", - ] - - args = - [ - rebase_path("$root_gen_dir/remoting_installation", root_build_dir), - rebase_path(_output, root_build_dir), - "--source-file-roots", - rebase_path("//remoting/host/installer/win"), - "--source-files", - rebase_path("//remoting/host/installer/win/chromoting.wxs"), - rebase_path("//remoting/host/installer/win/parameters.json"), - - # Input files - "--generated-files", - ] + _generated_files + - [ - # Position of files in zip file - "--generated-files-dst", - ] + _generated_dst_files + - [ - # Defs - "--defs", - "BRANDING=$_branding", - "DAEMON_CONTROLLER_CLSID={$daemon_controller_clsid}", - "RDP_DESKTOP_SESSION_CLSID={$rdp_desktop_session_clsid}", - "VERSION=$chrome_version_full", - "OFFICIAL_BUILD=$_official_build", - ] } } else if (is_mac) { import("//build/config/zip.gni") @@ -1678,10 +1189,10 @@ if (enable_me2me_host) { ] deps = [ - ":native_messaging_host", ":remoting_host_prefpane.prefPane", ":remoting_host_uninstaller", ":remoting_me2me_host", + ":remoting_native_messaging_host", ":remoting_native_messaging_manifests", "//remoting/host/it2me:remote_assistance_host", ] @@ -1882,37 +1393,4 @@ if (enable_me2me_host) { group("remoting_me2me_host_archive") { } } - - if (is_win && is_chrome_branded) { - # We do not release a 64 bits binary. So to avoid any potential - # misunderstanding, we only build 32 bits MSI file. - if (!is_component_build && target_cpu == "x86") { - # The script uses "ia32" instead of "x86". - msi_script_arch = "ia32" - - action("remoting_host_installation") { - deps = [ - "//remoting/host:remoting_me2me_host_archive", - ] - script = "../tools/zip2msi.py" - outputs = [ - "$root_out_dir/chromoting.msi", - ] - args = [ - "--wix_path", - rebase_path("//third_party/wix"), - "--intermediate_dir", - rebase_path("$root_gen_dir/remoting_installation", root_build_dir), - "--target_arch", - msi_script_arch, - rebase_path("$root_out_dir/remoting-me2me-host-$current_os.zip", - root_build_dir), - rebase_path(outputs[0], root_build_dir), - ] - } - } else { - group("remoting_host_installation") { - } - } - } } diff --git a/remoting/host/desktop_session_win.cc b/remoting/host/desktop_session_win.cc index dd2e09696800e0..1025d8926dcecd 100644 --- a/remoting/host/desktop_session_win.cc +++ b/remoting/host/desktop_session_win.cc @@ -30,8 +30,6 @@ #include "ipc/ipc_message_macros.h" #include "ipc/ipc_platform_file.h" #include "remoting/base/auto_thread_task_runner.h" -// MIDL-generated declarations and definitions. -#include "remoting/host/chromoting_lib.h" #include "remoting/host/chromoting_messages.h" #include "remoting/host/daemon_process.h" #include "remoting/host/desktop_session.h" @@ -39,6 +37,8 @@ #include "remoting/host/ipc_constants.h" #include "remoting/host/sas_injector.h" #include "remoting/host/screen_resolution.h" +// MIDL-generated declarations and definitions. +#include "remoting/host/win/chromoting_lib.h" #include "remoting/host/win/host_service.h" #include "remoting/host/win/worker_process_launcher.h" #include "remoting/host/win/wts_session_process_delegate.h" diff --git a/remoting/host/host_event_logger_win.cc b/remoting/host/host_event_logger_win.cc index d99a01fa365343..70135aa9af09bd 100644 --- a/remoting/host/host_event_logger_win.cc +++ b/remoting/host/host_event_logger_win.cc @@ -19,7 +19,7 @@ #include "net/base/ip_endpoint.h" #include "remoting/host/host_status_monitor.h" #include "remoting/host/host_status_observer.h" -#include "remoting/host/remoting_host_messages.h" +#include "remoting/host/win/remoting_host_messages.h" #include "remoting/protocol/transport.h" namespace remoting { diff --git a/remoting/host/installer/BUILD.gn b/remoting/host/installer/BUILD.gn new file mode 100644 index 00000000000000..1004128f17fa2a --- /dev/null +++ b/remoting/host/installer/BUILD.gn @@ -0,0 +1,32 @@ +# Copyright 2016 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("//remoting/build/config/remoting_build.gni") + +action("credits") { + # We put this in $root_build_dir/gen/remoting instead of + # $root_build_dir/gen/remoting/host (target_gen_dir) for + # compatibility w/ GYP, since the installer needs the file to + # be at the same location. + about_credits_file = "$root_build_dir/gen/remoting/CREDITS.txt" + script = "//tools/licenses.py" + + inputs = [ + "credits.tmpl", + "credits_entry.tmpl", + ] + + outputs = [ + about_credits_file, + ] + + args = [ + "credits", + rebase_path(about_credits_file, root_build_dir), + "--file-template", + rebase_path("credits.tmpl", root_build_dir), + "--entry-template", + rebase_path("credits_entry.tmpl", root_build_dir), + ] +} diff --git a/remoting/host/installer/win/BUILD.gn b/remoting/host/installer/win/BUILD.gn new file mode 100644 index 00000000000000..31122c4ba198ea --- /dev/null +++ b/remoting/host/installer/win/BUILD.gn @@ -0,0 +1,142 @@ +# Copyright 2016 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("//remoting/build/config/remoting_build.gni") +import("//remoting/host/installer/win/generate_clsids.gni") +import("//build/toolchain/win/midl.gni") +import("//build/win/message_compiler.gni") + +action("remoting_me2me_host_archive") { + script = "//remoting/host/installer/build-installer-archive.py" + + deps = [ + "//remoting/host:remoting_native_messaging_manifests", + "//remoting/host:remoting_start_host", + "//remoting/host/installer:credits", + "//remoting/host/it2me:remote_assistance_host", + "//remoting/host/it2me:remote_assistance_host_uiaccess", + "//remoting/host/win:remoting_core", + "//remoting/host/win:remoting_desktop", + "//remoting/host/win:remoting_me2me_host", + "//remoting/host/win:remoting_native_messaging_host", + "//third_party/icu:icudata", + ] + + public_deps = [ + "//remoting/host/security_key:remote_security_key", + ] + + _output = "$root_out_dir/remoting-me2me-host-$target_os.zip" + + outputs = [ + _output, + ] + if (is_chrome_branded) { + _branding = "Chrome" + } else { + _branding = "Chromium" + } + + if (is_official_build) { + _official_build = "1" + } else { + _official_build = "0" + } + + # Due to GN build issue http://crbug.com/633650, we need to actively set + # inputs parameter to tell GN to depend on these files. So change to each + # following files will trigger this target to be rebuilt. + # TODO(zijiehe): Remove inputs parameter once bug 633650 has been + # addressed. + inputs = [ + "$root_out_dir/remote_assistance_host.exe", + "$root_out_dir/remote_security_key.exe", + "$root_out_dir/remoting_core.dll", + "$root_out_dir/remoting_desktop.exe", + "$root_out_dir/remoting_host.exe", + "$root_out_dir/remoting_native_messaging_host.exe", + "$root_out_dir/remoting_start_host.exe", + "$root_gen_dir/remoting/CREDITS.txt", + "$root_out_dir/remoting/com.google.chrome.remote_assistance.json", + "$root_out_dir/remoting/com.google.chrome.remote_desktop.json", + "$root_out_dir/icudtl.dat", + ] + + _generated_files = rebase_path(inputs, root_build_dir) + _generated_files += [ rebase_path("//remoting/resources/chromoting.ico") ] + + # _generated_dst_files must contain the same files in the same order as + # _generated_files, otherwise the Windows MSI will not be built correctly. + _generated_dst_files = [ + "files/remote_assistance_host.exe", + "files/remote_security_key.exe", + "files/remoting_core.dll", + "files/remoting_desktop.exe", + "files/remoting_host.exe", + "files/remoting_native_messaging_host.exe", + "files/remoting_start_host.exe", + "files/CREDITS.txt", + "files/com.google.chrome.remote_assistance.json", + "files/com.google.chrome.remote_desktop.json", + "files/icudtl.dat", + "files/chromoting.ico", + ] + + args = [ + rebase_path("$root_gen_dir/remoting_installation", root_build_dir), + rebase_path(_output, root_build_dir), + "--source-file-roots", + rebase_path("//remoting/host/installer/win"), + "--source-files", + rebase_path("//remoting/host/installer/win/chromoting.wxs"), + rebase_path("//remoting/host/installer/win/parameters.json"), + + # Input files + "--generated-files", + ] + _generated_files + + [ + # Position of files in zip file + "--generated-files-dst", + ] + _generated_dst_files + + [ + # Defs + "--defs", + "BRANDING=$_branding", + "DAEMON_CONTROLLER_CLSID={$daemon_controller_clsid}", + "RDP_DESKTOP_SESSION_CLSID={$rdp_desktop_session_clsid}", + "VERSION=$chrome_version_full", + "OFFICIAL_BUILD=$_official_build", + ] +} + +# We do not release a 64 bits binary. So to avoid any potential +# misunderstanding, we only build 32 bits MSI file. +if (is_chrome_branded && !is_component_build && target_cpu == "x86") { + # The script uses "ia32" instead of "x86". + msi_script_arch = "ia32" + + action("remoting_host_installation") { + deps = [ + "//remoting/host:remoting_me2me_host_archive", + ] + script = "//remoting/tools/zip2msi.py" + outputs = [ + "$root_out_dir/chromoting.msi", + ] + args = [ + "--wix_path", + rebase_path("//third_party/wix"), + "--intermediate_dir", + rebase_path("$root_gen_dir/remoting_installation", root_build_dir), + "--target_arch", + msi_script_arch, + rebase_path("$root_out_dir/remoting-me2me-host-$current_os.zip", + root_build_dir), + rebase_path(outputs[0], root_build_dir), + ] + } +} else { + group("remoting_host_installation") { + } +} diff --git a/remoting/host/installer/win/generate_clsids.gni b/remoting/host/installer/win/generate_clsids.gni new file mode 100644 index 00000000000000..2a39509dbc4d3d --- /dev/null +++ b/remoting/host/installer/win/generate_clsids.gni @@ -0,0 +1,19 @@ +# Copyright 2016 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("//remoting/build/config/remoting_build.gni") + +# TODO(brettw) these should not be generated via exec_script. This should be +# part of the build process rather than the metabuild. Instead, a script +# should generate a header containing the #defines for this as well as the +# IDL file with the values. +clsids = exec_script("//remoting/host/win/get_clsids.py", + [ + daemon_controller_guid, + rdp_desktop_session_guid, + chrome_version_full, + ], + "value") +daemon_controller_clsid = clsids[0] +rdp_desktop_session_clsid = clsids[1] diff --git a/remoting/host/it2me/BUILD.gn b/remoting/host/it2me/BUILD.gn index 5427ca556fb1b3..897d3d0c97944e 100644 --- a/remoting/host/it2me/BUILD.gn +++ b/remoting/host/it2me/BUILD.gn @@ -83,9 +83,9 @@ if (!is_chromeos && !is_android && enable_remoting_host) { deps = [ "//base/allocator", - "//remoting/host:dpi_aware_exe_manifest", - "//remoting/host:remoting_core", - "//remoting/host:remoting_windows_resources", + "//remoting/host/win:dpi_aware_exe_manifest", + "//remoting/host/win:remoting_core", + "//remoting/host/win:remoting_windows_resources", ] sources = [ @@ -109,8 +109,8 @@ if (!is_chromeos && !is_android && enable_remoting_host) { deps = [ "//base/allocator", - "//remoting/host:remoting_core", - "//remoting/host:remoting_windows_resources", + "//remoting/host/win:remoting_core", + "//remoting/host/win:remoting_windows_resources", ] sources = [ @@ -129,9 +129,9 @@ if (!is_chromeos && !is_android && enable_remoting_host) { # uiAccess requires a signed build to work correctly, so only enable the # manifest flag when the binary will be properly signed. if (is_official_build) { - deps += [ "//remoting/host:dpi_aware_uiaccess_exe_manifest" ] + deps += [ "//remoting/host/win:dpi_aware_uiaccess_exe_manifest" ] } else { - deps += [ "//remoting/host:dpi_aware_exe_manifest" ] + deps += [ "//remoting/host/win:dpi_aware_exe_manifest" ] } } } else { diff --git a/remoting/host/security_key/BUILD.gn b/remoting/host/security_key/BUILD.gn index 31b59b9a17bbac..8008b74d2fbb6a 100644 --- a/remoting/host/security_key/BUILD.gn +++ b/remoting/host/security_key/BUILD.gn @@ -62,8 +62,8 @@ if (is_win) { deps = [ "//build/win:default_exe_manifest", - "//remoting/host:remoting_core", - "//remoting/host:remoting_windows_resources", + "//remoting/host/win:remoting_core", + "//remoting/host/win:remoting_windows_resources", ] sources = [ diff --git a/remoting/host/setup/BUILD.gn b/remoting/host/setup/BUILD.gn index 2f49614a554022..75926e68e59e35 100644 --- a/remoting/host/setup/BUILD.gn +++ b/remoting/host/setup/BUILD.gn @@ -44,6 +44,6 @@ source_set("setup") { ] if (is_win) { - deps += [ "//remoting/host:remoting_lib_idl" ] + deps += [ "//remoting/host/win:remoting_lib_idl" ] } } diff --git a/remoting/host/win/BUILD.gn b/remoting/host/win/BUILD.gn new file mode 100644 index 00000000000000..e0888bcc220e1a --- /dev/null +++ b/remoting/host/win/BUILD.gn @@ -0,0 +1,476 @@ +# Copyright 2016 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("//remoting/build/config/remoting_build.gni") +import("//remoting/host/installer/win/generate_clsids.gni") +import("//build/toolchain/win/midl.gni") +import("//build/win/message_compiler.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" + +# 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, + ] + type = "exe" +} + +# 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, + ] + type = "exe" +} + +# 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, + ] + type = "exe" +} + +source_set("win") { + sources = [ + "com_imported_mstscax.tlh", + "com_security.cc", + "com_security.h", + "elevation_helpers.cc", + "elevation_helpers.h", + "launch_process_with_token.cc", + "launch_process_with_token.h", + "omaha.cc", + "omaha.h", + "rdp_client.cc", + "rdp_client.h", + "rdp_client_window.cc", + "rdp_client_window.h", + "security_descriptor.cc", + "security_descriptor.h", + "session_desktop_environment.cc", + "session_desktop_environment.h", + "session_input_injector.cc", + "session_input_injector.h", + "window_station_and_desktop.cc", + "window_station_and_desktop.h", + "worker_process_launcher.cc", + "worker_process_launcher.h", + "wts_terminal_monitor.cc", + "wts_terminal_monitor.h", + "wts_terminal_observer.h", + ] + + configs += [ + "//build/config/compiler:wexit_time_destructors", + "//remoting/build/config:version", + ] + + defines = [ "WEBRTC_CHROMIUM_BUILD" ] + + deps = [ + "//base:i18n", + "//components/policy/core/common", + "//content/public/common", + "//crypto", + "//device/power_save_blocker", + "//google_apis", + "//ipc", + "//remoting/base", + "//remoting/host/security_key", + "//remoting/host/win:messages", + "//remoting/host/win:remoting_lib_idl", + "//remoting/protocol", + "//remoting/resources", + "//ui/base", + "//ui/events:dom_keycode_converter", + "//ui/events/platform", + ] + + if (enable_configuration_policy) { + deps += [ "//components/policy:generated" ] + } + + if (enable_webrtc) { + deps += [ "//third_party/webrtc/modules/desktop_capture" ] + } +} + +source_set("unit_tests") { + testonly = true + + sources = [ + "elevated_native_messaging_host.cc", + "elevated_native_messaging_host.h", + "launch_native_messaging_host_process.cc", + "launch_native_messaging_host_process.h", + "rdp_client_unittest.cc", + "worker_process_launcher_unittest.cc", + ] + + deps = [ + "//remoting/host", + "//remoting/host:test_support", + "//remoting/host/it2me:common", + "//remoting/host/native_messaging", + "//remoting/host/security_key:unit_tests", + "//remoting/host/setup", + "//remoting/proto", + "//remoting/resources", + "//skia", + "//testing/gmock", + "//testing/gtest", + ] +} + +action("generate_idl") { + script = "//build/util/version.py" + + inputs = [ + "chromoting_lib_idl.templ", + ] + outputs = [ + "$target_gen_dir/chromoting_lib.idl", + ] + + args = [ + "-e", + "DAEMON_CONTROLLER_CLSID='$daemon_controller_clsid'", + "-e", + "RDP_DESKTOP_SESSION_CLSID='$rdp_desktop_session_clsid'", + rebase_path(inputs[0], root_build_dir), + rebase_path(outputs[0], root_build_dir), + ] +} + +midl("remoting_lib_idl") { + sources = get_target_outputs(":generate_idl") + deps = [ + ":generate_idl", + ] +} + +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") { + configs += [ ":MIDL_config" ] + + defines = [ + "ENTRY_PREFIX=Ps", + "REGISTER_PROXY_DLL", + ] + + deps = [ + ":remoting_lib_idl", + ] + + sources = [ + "$root_gen_dir/remoting/host/win/chromoting_lib.dlldata.c", + "$root_gen_dir/remoting/host/win/chromoting_lib_p.c", + ] +} + +# Makes the .mc file from the .mc.jinja file. +remoting_localize("messages_localizing") { + sources = [ + "host_messages.mc.jinja2", + ] + locales = remoting_locales + locale_dir = webapp_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 + [ "BINARY=BINARY_HOST_ME2ME" ] + + deps = [ + ":dpi_aware_exe_manifest", + ":remoting_core", + ":remoting_windows_resources", + ] + + sources = [ + "$root_gen_dir/remoting/version.rc", + "entry_point.cc", + ] + + 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 + [ "BINARY=BINARY_HOST_ME2ME" ] + + deps = [ + ":dpi_aware_exe_manifest", + ":remoting_core", + ":remoting_windows_resources", + ] + + sources = [ + "$root_gen_dir/remoting/version.rc", + "entry_point.cc", + ] + + output_name = "remoting_host" + + ldflags = [ "/ENTRY:HostEntryPoint" ] +} + +shared_library("remoting_core") { + configs += [ "//build/config/compiler:wexit_time_destructors" ] + + defines = host_predefines + [ + "_ATL_APARTMENT_THREADED", + "_ATL_CSTRING_EXPLICIT_CONSTRUCTORS", + "_ATL_NO_AUTOMATIC_NAMESPACE", + "_ATL_NO_EXCEPTIONS", + "BINARY=BINARY_CORE", + "DAEMON_CONTROLLER_CLSID=\"$daemon_controller_clsid\"", + "RDP_DESKTOP_SESSION_CLSID=\"$rdp_desktop_session_clsid\"", + "HOST_IMPLEMENTATION", + "ISOLATION_AWARE_ENABLED=1", + "STRICT", + "VERSION=$chrome_version_full", + ] + + if (remoting_multi_process != 0 && remoting_rdp_session != 0) { + defines += [ "REMOTING_RDP_SESSION" ] + } + + if (remoting_multi_process != 0) { + defines += [ "REMOTING_MULTI_PROCESS" ] + } + + 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", + "//remoting/host/host_main.cc", + "//remoting/host/host_main.h", + "//remoting/host/it2me/it2me_native_messaging_host_main.cc", + "//remoting/host/it2me/it2me_native_messaging_host_main.h", + "//remoting/host/setup/host_starter.cc", + "//remoting/host/setup/host_starter.h", + "//remoting/host/setup/me2me_native_messaging_host_main.cc", + "//remoting/host/setup/me2me_native_messaging_host_main.h", + "//remoting/host/setup/start_host_main.cc", + "//remoting/host/setup/start_host_main.h", + "//remoting/host/worker_process_ipc_delegate.h", + "chromoting_lib.rc", + "chromoting_module.cc", + "chromoting_module.h", + "core.cc", + "core_resource.h", + "elevated_native_messaging_host.cc", + "elevated_native_messaging_host.h", + "host_service.cc", + "host_service.h", + "launch_native_messaging_host_process.cc", + "launch_native_messaging_host_process.h", + "rdp_desktop_session.cc", + "rdp_desktop_session.h", + "unprivileged_process_delegate.cc", + "unprivileged_process_delegate.h", + "wts_session_process_delegate.cc", + "wts_session_process_delegate.h", + ] + + deps = [ + ":messages", + ":remoting_lib_idl", + ":remoting_lib_ps", + ":remoting_windows_resources", + ":win", + "//base", + "//base:base_static", + "//base/allocator", + "//base/third_party/dynamic_annotations", + "//build/win:default_exe_manifest", + "//ipc", + "//net", + "//remoting/base", + "//remoting/base:breakpad", + "//remoting/codec", + "//remoting/host:host", + "//remoting/host:remoting_me2me_host_static", + "//remoting/host/it2me:common", + "//remoting/host/native_messaging", + "//remoting/host/security_key:main", + "//remoting/host/setup", + "//remoting/protocol", + "//sandbox/win:sandbox", # Should always use Windows version + "//third_party/webrtc/modules/desktop_capture", + ] + + ldflags = [ + "/EXPORT:DllGetClassObject=PsDllGetClassObject,PRIVATE", + "/EXPORT:DllCanUnloadNow=PsDllCanUnloadNow,PRIVATE", + "/EXPORT:DllRegisterServer=PsDllRegisterServer,PRIVATE", + "/EXPORT:DllUnregisterServer=PsDllUnregisterServer,PRIVATE", + ] + + libs = [ + "comctl32.lib", + "rpcns4.lib", + "rpcrt4.lib", + "sas.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 + [ "BINARY=BINARY_DESKTOP" ] + + deps = [ + ":remoting_core", + ":remoting_windows_resources", + ] + + if (is_official_build) { + deps += [ ":dpi_aware_elevated_exe_manifest" ] + } else { + deps += [ ":dpi_aware_exe_manifest" ] + } + + sources = [ + "$root_gen_dir/remoting/version.rc", + "entry_point.cc", + ] + + ldflags = [ + "/ENTRY:HostEntryPoint", + # "/NODEFAULTLIB", + ] +} + +executable("remoting_native_messaging_host") { + configs += [ "//build/config/compiler:wexit_time_destructors" ] + + defines = host_predefines + [ "BINARY=BINARY_NATIVE_MESSAGING_HOST" ] + + deps = [ + ":remoting_core", + ":remoting_windows_resources", + "//build/win:default_exe_manifest", + ] + + 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", + ] + + # TODO(zijiehe): Export lastchange_path from + # //chrome/version.gni:process_version + variables = [ + rebase_path(chrome_version_file), + rebase_path(remoting_version_file), + rebase_path("//build/util/LASTCHANGE"), + ] + + output = "$root_gen_dir/remoting/{{source_name_part}}" + + locale_dir = webapp_locale_dir + + encoding = "utf-16" + + locales = remoting_locales +} +# TODO(GYP) More Windows remoting targets from remoting_host_win.gypi diff --git a/remoting/host/win/chromoting_lib.rc b/remoting/host/win/chromoting_lib.rc index d5c0b2b7a3526e..7ed5186c028f7f 100644 --- a/remoting/host/win/chromoting_lib.rc +++ b/remoting/host/win/chromoting_lib.rc @@ -2,4 +2,4 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -1 typelib "remoting/host/chromoting_lib.tlb" +1 typelib "remoting/host/win/chromoting_lib.tlb" diff --git a/remoting/host/win/chromoting_module.h b/remoting/host/win/chromoting_module.h index 4aa282103252d2..78d03a1ea71a71 100644 --- a/remoting/host/win/chromoting_module.h +++ b/remoting/host/win/chromoting_module.h @@ -14,7 +14,7 @@ #include "base/win/scoped_com_initializer.h" // chromoting_lib.h contains MIDL-generated declarations. -#include "remoting/host/chromoting_lib.h" +#include "remoting/host/win/chromoting_lib.h" namespace base { namespace win { diff --git a/remoting/host/win/rdp_desktop_session.h b/remoting/host/win/rdp_desktop_session.h index 0bfd7aefabf319..bba18893381d29 100644 --- a/remoting/host/win/rdp_desktop_session.h +++ b/remoting/host/win/rdp_desktop_session.h @@ -13,7 +13,7 @@ #include "base/win/scoped_comptr.h" // chromoting_lib.h contains MIDL-generated declarations. -#include "remoting/host/chromoting_lib.h" +#include "remoting/host/win/chromoting_lib.h" #include "remoting/host/win/rdp_client.h" namespace remoting { diff --git a/remoting/test/BUILD.gn b/remoting/test/BUILD.gn index 67d6eb420063a4..36243e9d3b8acc 100644 --- a/remoting/test/BUILD.gn +++ b/remoting/test/BUILD.gn @@ -185,6 +185,8 @@ if (enable_remoting_host && !is_android && !is_chromeos) { executable("it2me_standalone_host_main") { testonly = true + defines = [] + libs = [] sources = [ "it2me_standalone_host_main.cc", @@ -202,6 +204,15 @@ if (enable_remoting_host && !is_android && !is_chromeos) { deps += [ "//build/config/linux/gtk2" ] } } + + if (is_win) { + defines += [ "_ALT_NO_EXCEPTIONS" ] + + libs += [ + "rpcrt4.lib", + "wtsapi32.lib", + ] + } } } diff --git a/remoting/tools/BUILD.gn b/remoting/tools/BUILD.gn new file mode 100644 index 00000000000000..67f76533a96b26 --- /dev/null +++ b/remoting/tools/BUILD.gn @@ -0,0 +1,39 @@ +# Copyright 2016 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("//remoting/build/config/remoting_build.gni") + +group("all_tests") { + testonly = true +} + +group("all") { + testonly = true + + deps = [] + + if (is_win) { + deps += [ ":remoting_breakpad_tester" ] + } + + if (enable_nacl) { + deps += [ "//remoting/tools/javascript_key_tester" ] + } +} + +if (is_win) { + executable("remoting_breakpad_tester") { + deps = [ + "//base", + "//build/win:default_exe_manifest", + "//remoting/host", + ] + + configs += [ "//build/config/compiler:wexit_time_destructors" ] + + sources = [ + "breakpad_tester_win.cc", + ] + } +}