blob: a878753846690bc7e2064fbf2fcf383ce5ed1955 [file] [log] [blame]
# Copyright 2024 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/config/chrome_build.gni")
import("//build/toolchain/win/midl.gni")
config("classic_com") {
# This macro is used in <wrl/module.h>. Since only the COM functionality is
# used here (while WinRT isn't being used), define this macro to optimize
# compilation of <wrl/module.h> for COM-only.
defines = [ "__WRL_CLASSIC_COM_STRICT__" ]
}
config("winver") {
# <wrl/module.h> will try to use RuntimeObject.lib symbols when targeting
# Windows 8.1 and up. Target Windows 8.0 to avoid this extra dependency.
# Note that "//build/config/win:winver" must be removed from each target's
# `configs` when adding this; even if this is added to a target's
# `public_configs`.
defines = [
"NTDDI_VERSION=NTDDI_WIN8",
# See //build/config/win/BUILD.gn for why not to use _WIN32_WINNT_WIN8.
"_WIN32_WINNT=0x0602",
"WINVER=0x0602",
]
}
source_set("service_program") {
public = [ "service_program_main.h" ]
sources = [ "service_program_main.cc" ]
deps = [
":delegate",
":lib",
"//base",
"//chrome/install_static:install_static_util",
]
}
source_set("constants") {
public = [ "switches.h" ]
}
source_set("common") {
public = [
"get_calling_process.h",
"scoped_client_impersonation.h",
]
public_deps = [ "//base" ]
sources = [
"get_calling_process.cc",
"scoped_client_impersonation.cc",
]
libs = [ "rpcrt4.lib" ]
}
source_set("crash_integration") {
public = [ "is_running_unattended.h" ]
sources = [ "is_running_unattended.cc" ]
deps = [
":constants",
"//base",
]
}
source_set("lib") {
public = [
"logging_support.h",
"process_wrl_module.h",
"service.h",
]
public_deps = [ "//base" ]
sources = [
"logging_support.cc",
"process_wrl_module.cc",
"service.cc",
]
configs -= [ "//build/config/win:winver" ]
configs += [
":classic_com",
":winver",
]
deps = [
":common",
":constants",
":delegate",
"//chrome/install_static:install_static_util",
]
visibility = [
":service_program",
"//chrome/elevation_service:elevation_service_unittests",
"//chrome/updater:base",
"//chrome/windows_services/elevated_tracing_service:elevated_tracing_service_unittests",
"//chrome/windows_services/service_program/test_support:unit_tests",
]
}
# Implementations of ServiceDelegate will need to include wrl/module.h, so they
# must include `//chrome/windows_services/service_program:classic_com` and
# `//chrome/windows_services/service_program:winver` in their own configs (and,
# as described above, remove `//build/config/win:winver`).
source_set("delegate") {
public = [
"factory_and_clsid.h",
"service_delegate.h",
]
public_deps = [ "//base" ]
sources = [
"factory_and_clsid.cc",
"service_delegate.cc",
]
}
midl("test_service_idl") {
testonly = true
sources = [ "test_service_idl.idl" ]
writes_tlb = true
}
executable("test_service") {
testonly = true
sources = [
"test_service.cc",
"test_service.rc",
]
deps = [
":common",
":crash_integration",
":delegate",
":service_program",
":test_service_idl",
"//base",
"//build/win:default_exe_manifest",
"//chrome/common/win:eventlog_provider",
]
configs -= [
"//build/config/win:console",
"//build/config/win:winver",
]
configs += [
":classic_com",
":winver",
"//build/config/win:windowed",
]
}
source_set("unit_tests") {
testonly = true
sources = [ "service_unittest.cc" ]
deps = [
":test_service_idl",
"//base",
"//base/test:test_support",
"//chrome/common:non_code_constants",
"//chrome/windows_services/service_program/test_support",
"//testing/gtest",
"//third_party/abseil-cpp:absl",
]
data_deps = [ ":test_service" ]
}