Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(84)

Unified Diff: build/config/linux/BUILD.gn

Issue 300973003: Add CC to the GN build, work on GPU more (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « BUILD.gn ('k') | build/config/linux/pkg_config.gni » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/config/linux/BUILD.gn
diff --git a/build/config/linux/BUILD.gn b/build/config/linux/BUILD.gn
index e26e397ec0ed85b84fa4eafaae057490426ea577..18b1da4a6482d0977c57b803e2025cf990964fc3 100644
--- a/build/config/linux/BUILD.gn
+++ b/build/config/linux/BUILD.gn
@@ -82,31 +82,63 @@ pkg_config("gconf") {
defines = [ "USE_GCONF" ]
}
+# name: Name to use for the value of the --name arg.
+# output_h/output_cc: Names for the generated header/cc file with no dir.
+# header: header file to process. Example: "<foo/bar.h>"
+# functions: List of strings for functions to process.
+# config: Label of the config generated by pkgconfig.
+template("generate_library_loader") {
+ output_h = "$root_gen_dir/library_loaders/" + invoker.output_h
+ output_cc = "$root_gen_dir/library_loaders/" + invoker.output_cc
+
+ action_visibility = ":$target_name"
+ action("${target_name}_loader") {
+ visibility = action_visibility
+
+ script = "//tools/generate_library_loader/generate_library_loader.py"
+ if (defined(invoker.visibility)) {
+ visibility = invoker.visibility
+ }
+
+ outputs = [ output_h, output_cc ]
+
+ args = [
+ "--name", invoker.name,
+ "--output-h", rebase_path(output_h),
+ "--output-cc", rebase_path(output_cc),
+ "--header", invoker.header,
+ # Note GYP build exposes a per-target variable to control this, which, if
+ # manually set to true, will disable dlopen(). Its not clear this is
+ # needed, so here we just leave off. If this can be done globally, we
+ # can expose one switch for this value, otherwise we need to add a template
+ # param for this.
+ "--link-directly=0",
+ ] + invoker.functions
+ }
+
+ source_set(target_name) {
+ direct_dependent_configs = [ invoker.config ]
+ sources = [ output_h, output_cc ]
+ deps = [ ":${target_name}_loader" ]
+ }
+}
+
pkg_config("gio_config") {
packages = [ "gio-2.0" ]
defines = [ "USE_GIO" ]
+ ignore_libs = true # Loader generated below.
}
-gio_output_h = "$root_gen_dir/library_loaders/libgio.h"
-gio_output_cc = "$root_gen_dir/library_loaders/libgio_loader.cc"
+# This generates a target named "gio".
+generate_library_loader("gio") {
+ name = "LibGioLoader"
+ output_h = "libgio.h"
+ output_cc = "libgio_loader.cc"
+ # TODO(brettw) convert ti "<gio/gio.h>" once GN doesn't mangle <>.
+ header = "\"gio/gio.h\""
+ config = ":gio_config"
-action("make_gio_headers") {
- visibility = ":gio"
-
- script = "//tools/generate_library_loader/generate_library_loader.py"
-
- outputs = [ gio_output_h, gio_output_cc ]
-
- args = [
- "--name", "LibGioLoader",
- "--output-h", rebase_path(gio_output_h),
- "--output-cc", rebase_path(gio_output_cc),
- # TODO(brettw) convert ti "<gio/gio.h>" once GN doesn't mangle <>.
- "--header", "\"gio/gio.h\"",
- # Note GYP build exposes a variable linux_link_gsettings to control this,
- # which, if manually set to true, will disable dlopen() for this. Its not
- # clear this is needed, so here we just leave off.
- "--link-directly=0",
+ functions = [
"g_settings_new",
"g_settings_get_child",
"g_settings_get_string",
@@ -117,8 +149,29 @@ action("make_gio_headers") {
]
}
-source_set("gio") {
- direct_dependent_configs = [ ":gio_config" ]
- sources = [ gio_output_h, gio_output_cc ]
- deps = [ ":make_gio_headers" ]
+# pkgconfig doesn't return anything interesting for this other than -lpci
+# on suppotred systems, so we hardcode.
+config("libpci_config") {
+ # This is not needed as long as we're setting link_directly=0 for the library
+ # loaders.
+ #libs = [ "pci" ]
+}
+
+# This generates a target named "libpci".
+generate_library_loader("libpci") {
+ name = "LibPciLoader"
+ output_h = "libpci.h"
+ output_cc = "libpci_loader.cc"
+ # TODO(brettw) convert to "<pci/pci.h>" once GN doesn't mangle <>.
+ header = "\"pci/pci.h\""
+ config = ":libpci_config"
+
+ functions = [
+ "pci_alloc",
+ "pci_init",
+ "pci_cleanup",
+ "pci_scan_bus",
+ "pci_fill_info",
+ "pci_lookup_name",
+ ]
}
« no previous file with comments | « BUILD.gn ('k') | build/config/linux/pkg_config.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698