| # Copyright 2023 The ChromiumOS Authors |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| import("//common-mk/pkg_config.gni") |
| |
| group("all") { |
| deps = [ |
| ":libnet-base", |
| ":libnet-base_pc", |
| ] |
| if (use.test) { |
| deps += [ ":libnet-base-testrunner" ] |
| } |
| } |
| |
| pkg_config("target_defaults") { |
| cflags = [ |
| "-Wconversion", |
| "-Wextra", |
| "-Werror", |
| "-Wno-unused-parameter", # needed for libchrome |
| ] |
| pkg_deps = [ "libchrome" ] |
| } |
| |
| shared_library("libnet-base") { |
| sources = [ |
| "byte_utils.cc", |
| "ip_address.cc", |
| "ip_address_utils.cc", |
| "ipv4_address.cc", |
| "ipv6_address.cc", |
| "mac_address.cc", |
| ] |
| configs += [ ":target_defaults" ] |
| install_path = "lib" |
| } |
| |
| generate_pkg_config("libnet-base_pc") { |
| name = "libnet-base" |
| description = "Network primitive library" |
| version = getenv("PV") |
| requires = [ "libchrome" ] |
| libs = [ "-lnet-base" ] |
| install = true |
| } |
| |
| if (use.test) { |
| executable("libnet-base-testrunner") { |
| run_test = true |
| sources = [ |
| "byte_utils_test.cc", |
| "ip_address_test.cc", |
| "ipv4_address_test.cc", |
| "ipv6_address_test.cc", |
| "mac_address_test.cc", |
| ] |
| configs += [ |
| "//common-mk:test", |
| ":target_defaults", |
| ] |
| deps = [ |
| ":libnet-base", |
| "//common-mk/testrunner", |
| ] |
| pkg_deps = [ "libchrome-test" ] |
| } |
| } |