From ed559bd1594477689d0de32f660e0e37d62a5247 Mon Sep 17 00:00:00 2001 From: zijiehe Date: Thu, 10 Mar 2016 09:18:18 -0800 Subject: Move //remoting/remoting_host_win.gypi:* to GN BUG=512899 Review URL: https://codereview.chromium.org/1749053002 Cr-Commit-Position: refs/heads/master@{#380425} --- remoting/BUILD.gn | 11 +- remoting/host/BUILD.gn | 317 +++++++++++++++++++++++++++++++++++- remoting/host/it2me/BUILD.gn | 87 +++++++--- remoting/host/win/chromoting_lib.rc | 5 + remoting/remoting_enable.gni | 6 +- remoting/remoting_host.gni | 11 -- remoting/remoting_host_win.gypi | 12 ++ 7 files changed, 398 insertions(+), 51 deletions(-) create mode 100644 remoting/host/win/chromoting_lib.rc delete mode 100644 remoting/remoting_host.gni (limited to 'remoting') diff --git a/remoting/BUILD.gn b/remoting/BUILD.gn index 9b834d0..6b9fb64 100644 --- a/remoting/BUILD.gn +++ b/remoting/BUILD.gn @@ -34,10 +34,11 @@ group("remoting_all") { if (is_win) { deps += [ - #"//remoting:remoting_breakpad_tester", - #"//remoting:remoting_console", - #"//remoting:remoting_desktop", - #"//remoting:remoting_host_installation", + "//remoting:remoting_breakpad_tester", + "//remoting/host:remoting_console", + "//remoting/host:remoting_desktop", + + # "//remoting:remoting_host_installation", ] } @@ -83,6 +84,8 @@ if (is_win) { "//remoting/host", ] + configs += [ "//build/config/compiler:wexit_time_destructors" ] + sources = [ "tools/breakpad_tester_win.cc", ] diff --git a/remoting/host/BUILD.gn b/remoting/host/BUILD.gn index 8a918fa..40fe83c 100644 --- a/remoting/host/BUILD.gn +++ b/remoting/host/BUILD.gn @@ -5,7 +5,7 @@ import("//build/config/features.gni") import("//build/config/ui.gni") import("//build/util/version.gni") -import("//remoting/remoting_host.gni") +import("//remoting/remoting_enable.gni") import("//remoting/remoting_locales.gni") import("//remoting/remoting_options.gni") import("//remoting/remoting_srcs.gni") @@ -369,6 +369,40 @@ if (is_mac) { # TODO(GYP) Mac build of remoting host. ] } + # GYP version: remoting/remoting_host_win.gypi:remoting_lib_ps + static_library("remoting_lib_ps") { + 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", + ] + + 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", + ] + } + } + # Makes the .mc file from the .mc.jinja file. remoting_localize("messages_localizing") { sources = [ @@ -396,6 +430,237 @@ if (is_mac) { # TODO(GYP) Mac build of remoting host. ] } + # GYP version: remoting/remoting_host_win.gypi:remoting_console + executable("remoting_console") { + configs += [ "//build/config/compiler:wexit_time_destructors" ] + + defines = [ "BINARY=BINARY_HOST_ME2ME" ] + + deps = [ + ":remoting_core", + ":remoting_windows_resources", + ] + + sources = [ + "$root_gen_dir/remoting/version.rc", + "win/entry_point.cc", + ] + + ldflags = [ + "/MANIFEST:EMBED", + "/MANIFESTINPUT:" + + rebase_path("win/dpi_aware.manifest", root_build_dir), + "/ENTRY:HostEntryPoint", + "/NODEFAULTLIB", + ] + } + + # GYP version: //remoting/remoting_host_win.gypi:remoting_core + shared_library("remoting_core") { + configs += [ + "//base/allocator:allocator_shim_define", + "//build/config/compiler:wexit_time_destructors", + ] + + defines = [ + "_ATL_APARTMENT_THREADED", + "_ATL_CSTRING_EXPLICIT_CONSTRUCTORS", + "_ATL_NO_AUTOMATIC_NAMESPACE", + "_ATL_NO_EXCEPTIONS", + "BINARY=BINARY_CORE", + "BINARY_CORE=1", + "BINARY_DESKTOP=2", + "BINARY_HOST_ME2ME=3", + "BINARY_NATIVE_MESSAGING_HOST=4", + "BINARY_REMOTE_ASSISTANCE_HOST=5", + "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 (is_win && remoting_multi_process != 0 && remoting_rdp_session != 0) { + defines += [ "REMOTING_RDP_SESSION" ] + } + + if (remoting_multi_process != 0) { + defines += [ "REMOTING_MULTI_PROCESS" ] + } + + deps = [ + ":remoting_lib_idl", + ":remoting_lib_ps", + ":remoting_me2me_host_static", + ":remoting_windows_resources", + "//base", + "//base:base_static", + "//base/third_party/dynamic_annotations", + "//ipc", + "//net", + "//remoting/base", + "//remoting/base:breakpad", + "//remoting/codec", + "//remoting/host", + "//remoting/host:messages", + "//remoting/host/it2me:common", + "//remoting/host/native_messaging", + "//remoting/host/setup", + "//remoting/protocol", + "//sandbox/win:sandbox", # Should always use Windows version + "//third_party/webrtc/modules/desktop_capture", + ] + + sources = [ + "desktop_process_main.cc", + "host_main.cc", + "host_main.h", + "it2me/it2me_native_messaging_host_main.cc", + "it2me/it2me_native_messaging_host_main.h", + "security_key/remote_security_key_main.cc", + "security_key/remote_security_key_main.h", + "setup/me2me_native_messaging_host_main.cc", + "setup/me2me_native_messaging_host_main.h", + "win/chromoting_lib.rc", + "win/chromoting_module.cc", + "win/chromoting_module.h", + "win/core.cc", + "win/core_resource.h", + "win/host_service.cc", + "win/host_service.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 = [ + "/MANIFEST:EMBED", + "/MANIFESTINPUT:" + + rebase_path("win/common-controls.manifest", root_build_dir), + "comctl32.lib", + "rpcns4.lib", + "rpcrt4.lib", + "uuid.lib", + "wtsapi32.lib", + "/EXPORT:DllGetClassObject=PsDllGetClassObject,PRIVATE", + "/EXPORT:DllCanUnloadNow=PsDllCanUnloadNow,PRIVATE", + "/EXPORT:DllRegisterServer=PsDllRegisterServer,PRIVATE", + "/EXPORT:DllUnregisterServer=PsDllUnregisterServer,PRIVATE", + ] + + if (is_clang) { + cflags += [ "-Wno-header-hygiene" ] + } + } + + # GYP version: //remoting/remoting_host_win.gypi:remoting_desktop + executable("remoting_desktop") { + configs += [ + "//build/config/compiler:wexit_time_destructors", + "//build/config/win:windowed", + ] + + defines = [ "BINARY=BINARY_DESKTOP" ] + + deps = [ + ":remoting_core", + ":remoting_windows_resources", + ] + + sources = [ + "$root_gen_dir/remoting/version.rc", + "win/entry_point.cc", + ] + + ldflags = [ + "/MANIFEST:EMBED", + "/MANIFESTINPUT:" + + rebase_path("win/dpi_aware.manifest", root_build_dir), + "/MANIFESTUAC", + "/ENTRY:HostEntryPoint", + "/NODEFAULTLIB", + ] + + if (is_official_build) { + ldflags += [ + "/MANIFESTUAC:level=2", + "/MANIFESTUAC:uiAccess=true", + ] + } + } + + # GYP version: //remoting/remoting_host_win.gypi:remote_security_key + executable("remote_security_key") { + configs += [ "//build/config/compiler:wexit_time_destructors" ] + + defines = [ "BINARY=BINARY_REMOTE_SECURITY_KEY" ] + + deps = [ + ":remoting_core", + ":remoting_windows_resources", + ] + + sources = [ + "$root_gen_dir/remoting/version.rc", + "security_key/remote_security_key_entry_point.cc", + ] + + ldflags = [ "/NODEFAULTLIB" ] + } + + # GYP version: + # //remoting/remoting_host_win.gypi:remoting_me2me_native_messaging_host + executable("remoting_me2me_native_messaging_host") { + configs += [ "//build/config/compiler:wexit_time_destructors" ] + + deps = [ + ":remoting_core", + ":remoting_windows_resources", + ] + + sources = [ + "$root_gen_dir/remoting/version.rc", + "setup/me2me_native_messaging_host_entry_point.cc", + ] + + ldflags = [ "/NODEFAULTLIB" ] + } + + # GYP version: //remoting/remoting_host_win.gypi:remoting_windows_resources + 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 } @@ -420,8 +685,6 @@ if (is_mac) { # TODO(GYP) Mac build of remoting host. action_foreach("remoting_native_messaging_manifests") { if (is_mac) { assert(false, "not implemented on mac yet") - } else if (is_win) { - assert(false, "not implemented on win yet") } else { me2me_host_path = "/opt/google/chrome-remote-desktop/native-messaging-host" @@ -505,15 +768,57 @@ if (is_mac) { # TODO(GYP) Mac build of remoting host. 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) { + if (is_win) { + # GYP version: //remoting/remoting_host_win.gypi:remoting_me2me_host + executable("remoting_me2me_host") { + configs += [ + "//build/config/compiler:wexit_time_destructors", + "//build/config/win:windowed", + ] + + defines = [ "BINARY=BINARY_HOST_ME2ME" ] + + deps = [ + ":remoting_core", + ":remoting_windows_resources", + ] + + sources = [ + "$root_gen_dir/remoting/version.rc", + "win/entry_point.cc", + ] + + output_name = "remoting_host" + + ldflags = [ + "/MANIFEST:EMBED", + "/MANIFESTINPUT:" + + rebase_path("win/dpi_aware.manifest", root_build_dir), + "/ENTRY:HostEntryPoint", + "/NODEFAULTLIB", + ] + } + } else { executable("remoting_me2me_host") { sources = [ "host_main.cc", "host_main.h", ] + if (is_mac && is_chrome_branded && is_official_build) { + defines = [ "REMOTING_ENABLE_BREAKPAD" ] + } + deps = [ ":credits", ":remoting_me2me_host_static", @@ -546,8 +851,8 @@ if (is_mac) { # TODO(GYP) Mac build of remoting host. "$remoting_version_patch" + "." + "$chrome_version_build" + "." + "$chrome_version_patch" ] - if (is_mac || is_win) { - assert(false, "not implemented on mac or win yet") + if (is_mac) { + assert(false, "not implemented on mac yet") } } } diff --git a/remoting/host/it2me/BUILD.gn b/remoting/host/it2me/BUILD.gn index a584c72..6909a35 100644 --- a/remoting/host/it2me/BUILD.gn +++ b/remoting/host/it2me/BUILD.gn @@ -3,7 +3,7 @@ # found in the LICENSE file. import("//build/config/features.gni") -import("//remoting/remoting_host.gni") +import("//remoting/remoting_enable.gni") import("//remoting/remoting_srcs.gni") source_set("common") { @@ -27,34 +27,67 @@ source_set("common") { ] } -if (!is_win && !is_chromeos && enable_remoting_host) { - executable("remote_assistance_host") { - sources = [ - "it2me_native_messaging_host_entry_point.cc", - "it2me_native_messaging_host_main.cc", - "it2me_native_messaging_host_main.h", - ] - - configs += [ - "//build/config/compiler:wexit_time_destructors", - "//remoting:version", - ] - - deps = [ - ":common", - "//build/config/sanitizers:deps", - "//remoting/host", - "//remoting/host/native_messaging", - "//remoting/proto", - "//ui/gfx", - ] - - if (enable_webrtc) { - deps += [ "//third_party/libjingle:libjingle_webrtc" ] +if (!is_chromeos && enable_remoting_host) { + if (is_win) { + # GYP version: + # //remoting/remoting_host_win.gypi:remoting_it2me_native_messaging_host + executable("remote_assistance_host") { + configs += [ "//build/config/compiler:wexit_time_destructors" ] + + deps = [ + "//base/allocator", + "//remoting/host:remoting_core", + "//remoting/host:remoting_windows_resources", + ] + + sources = [ + "$root_gen_dir/remoting/version.rc", + "it2me_native_messaging_host_entry_point.cc", + ] + + defines = [ "BINARY=BINARY_REMOTE_ASSISTANCE_HOST" ] + + ldflags = [ + "/MANIFEST:EMBED", + "/MANIFESTINPUT:" + + rebase_path("../win/common-controls.manifest", root_build_dir), + "/MANIFESTINPUT:" + + rebase_path("../win/dpi_aware.manifest", root_build_dir), + + # "/NODEFAULTLIB", TODO(zijiehe): Why IgnoreAllDefaultLibraries: true in + # GYP does not take effect? + "comctl32.lib", + ] } + } else { + executable("remote_assistance_host") { + sources = [ + "it2me_native_messaging_host_entry_point.cc", + "it2me_native_messaging_host_main.cc", + "it2me_native_messaging_host_main.h", + ] + + configs += [ + "//build/config/compiler:wexit_time_destructors", + "//remoting:version", + ] + + deps = [ + ":common", + "//build/config/sanitizers:deps", + "//remoting/host", + "//remoting/host/native_messaging", + "//remoting/proto", + "//ui/gfx", + ] + + if (enable_webrtc) { + deps += [ "//third_party/libjingle:libjingle_webrtc" ] + } - if (is_desktop_linux) { - deps += [ "//build/config/linux/gtk2" ] + if (is_desktop_linux) { + deps += [ "//build/config/linux/gtk2" ] + } } } } diff --git a/remoting/host/win/chromoting_lib.rc b/remoting/host/win/chromoting_lib.rc new file mode 100644 index 0000000..d5c0b2b --- /dev/null +++ b/remoting/host/win/chromoting_lib.rc @@ -0,0 +1,5 @@ +// 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. + +1 typelib "remoting/host/chromoting_lib.tlb" diff --git a/remoting/remoting_enable.gni b/remoting/remoting_enable.gni index f8c1b20..b213f67 100644 --- a/remoting/remoting_enable.gni +++ b/remoting/remoting_enable.gni @@ -9,13 +9,13 @@ import("//build/config/ui.gni") enable_remoting_host = false enable_me2me_host = false -# TODO(GYP) Make remoting hosts work on Windows and Mac. -#if (is_win || is_mac) { +# TODO(GYP) Make remoting hosts work on Mac. +#if (is_mac) { # enable_remoting_host = true # enable_me2me_host = true #} -if (is_linux && !is_chromeos && use_x11) { +if (is_win || (is_linux && !is_chromeos && use_x11)) { enable_remoting_host = true enable_me2me_host = true } diff --git a/remoting/remoting_host.gni b/remoting/remoting_host.gni deleted file mode 100644 index d7d38d9..0000000 --- a/remoting/remoting_host.gni +++ /dev/null @@ -1,11 +0,0 @@ -# Copyright 2015 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("//build/config/ui.gni") - -# TODO(GYP): make remoting hosts work on win and mac -# enable_remoting_host = is_win || is_mac || is_chromeos || use_x11 -# enable_me2me_host = is_win || is_mac || (use_x11 && !is_chromeos) -enable_remoting_host = is_chromeos || use_x11 -enable_me2me_host = use_x11 && !is_chromeos diff --git a/remoting/remoting_host_win.gypi b/remoting/remoting_host_win.gypi index c39f5cb..d8a3c5c 100644 --- a/remoting/remoting_host_win.gypi +++ b/remoting/remoting_host_win.gypi @@ -15,6 +15,7 @@ 'targets': [ { + # GN version: //remoting:remoting_breakpad_tester 'target_name': 'remoting_breakpad_tester', 'type': 'executable', 'variables': { 'enable_wexit_time_destructors': 1, }, @@ -79,6 +80,7 @@ # remoting_lib_ps builds the proxy/stub code generated by MIDL (see # remoting_lib_idl). { + # GN version: //remoting/host:remoting_lib_ps 'target_name': 'remoting_lib_ps', 'type': 'static_library', 'defines': [ @@ -117,6 +119,8 @@ # are rebuilt every time the type library is updated. GYP alone is # not smart enough to figure out this dependency on its own. { + # We do not need remoting_lib_rc target anymore in GN, generate_idl and + # remoting_lib_idl take care of chromoting_lib_idl.templ change. 'target_name': 'remoting_lib_rc', 'type': 'none', 'sources': [ @@ -146,6 +150,7 @@ # |remoting_host.exe| is that the former is a console application. # |remoting_console.exe| is used for debugging purposes. { + # GN version: //remoting/host:remoting_console 'target_name': 'remoting_console', 'type': 'executable', 'variables': { 'enable_wexit_time_destructors': 1, }, @@ -174,6 +179,7 @@ }, }, # end of target 'remoting_console' { + # GN version: //remoting/host:remoting_core 'target_name': 'remoting_core', 'type': 'shared_library', 'variables': { 'enable_wexit_time_destructors': 1, }, @@ -278,6 +284,7 @@ }, }, # end of target 'remoting_core' { + # GN version: //remoting/host:remoting_desktop 'target_name': 'remoting_desktop', 'type': 'executable', 'variables': { 'enable_wexit_time_destructors': 1, }, @@ -316,6 +323,7 @@ }, }, # end of target 'remoting_desktop' { + # GN version: //remoting/host:remoting_me2me_host 'target_name': 'remoting_me2me_host', 'product_name': 'remoting_host', 'type': 'executable', @@ -346,6 +354,7 @@ }, }, # end of target 'remoting_me2me_host' { + # GN version: //remoting/host:remote_security_key 'target_name': 'remote_security_key', 'type': 'executable', 'product_name': 'remote_security_key', @@ -369,6 +378,7 @@ }, }, # end of target 'remote_security_key' { + # GN version: //remoting/host:remoting_me2me_native_messaging_host 'target_name': 'remoting_me2me_native_messaging_host', 'type': 'executable', 'product_name': 'remoting_native_messaging_host', @@ -392,6 +402,7 @@ }, }, # end of target 'remoting_me2me_native_messaging_host' { + # GN version: //remoting/host/it2me:remoting_assistance_host 'target_name': 'remoting_it2me_native_messaging_host', 'type': 'executable', 'product_name': 'remote_assistance_host', @@ -470,6 +481,7 @@ # for chrome/VERSION). # - translated webapp strings { + # GN version: //remoting/host:remoting_windows_resources 'target_name': 'remoting_windows_resources', 'type': 'none', 'dependencies': [ -- cgit v1.1