mirror of
https://github.com/google/cpu_features.git
synced 2025-04-28 07:23:37 +02:00
Fix include paths in BUILD (#226)
Include paths should be specified through includes rather than copts, so that they are handled correctly when cpu_features is included in another project as an external repository.
This commit is contained in:
parent
1d02169588
commit
5649bdff4e
30
BUILD.bazel
30
BUILD.bazel
@ -10,11 +10,9 @@ package(
|
|||||||
|
|
||||||
exports_files(["LICENSE"])
|
exports_files(["LICENSE"])
|
||||||
|
|
||||||
CC_FLAGS = [
|
INCLUDES = ["include"]
|
||||||
"-Iinclude",
|
|
||||||
]
|
|
||||||
|
|
||||||
C99_FLAGS = CC_FLAGS + [
|
C99_FLAGS = [
|
||||||
"-std=c99",
|
"-std=c99",
|
||||||
"-Wall",
|
"-Wall",
|
||||||
"-Wextra",
|
"-Wextra",
|
||||||
@ -32,12 +30,14 @@ cc_library(
|
|||||||
name = "cpu_features_macros",
|
name = "cpu_features_macros",
|
||||||
hdrs = ["include/cpu_features_macros.h"],
|
hdrs = ["include/cpu_features_macros.h"],
|
||||||
copts = C99_FLAGS,
|
copts = C99_FLAGS,
|
||||||
|
includes = INCLUDES,
|
||||||
)
|
)
|
||||||
|
|
||||||
cc_library(
|
cc_library(
|
||||||
name = "cpu_features_cache_info",
|
name = "cpu_features_cache_info",
|
||||||
hdrs = ["include/cpu_features_cache_info.h"],
|
hdrs = ["include/cpu_features_cache_info.h"],
|
||||||
copts = C99_FLAGS,
|
copts = C99_FLAGS,
|
||||||
|
includes = INCLUDES,
|
||||||
deps = [":cpu_features_macros"],
|
deps = [":cpu_features_macros"],
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -45,13 +45,14 @@ cc_library(
|
|||||||
name = "bit_utils",
|
name = "bit_utils",
|
||||||
hdrs = ["include/internal/bit_utils.h"],
|
hdrs = ["include/internal/bit_utils.h"],
|
||||||
copts = C99_FLAGS,
|
copts = C99_FLAGS,
|
||||||
|
includes = INCLUDES,
|
||||||
deps = [":cpu_features_macros"],
|
deps = [":cpu_features_macros"],
|
||||||
)
|
)
|
||||||
|
|
||||||
cc_test(
|
cc_test(
|
||||||
name = "bit_utils_test",
|
name = "bit_utils_test",
|
||||||
srcs = ["test/bit_utils_test.cc"],
|
srcs = ["test/bit_utils_test.cc"],
|
||||||
copts = CC_FLAGS,
|
includes = INCLUDES,
|
||||||
deps = [
|
deps = [
|
||||||
":bit_utils",
|
":bit_utils",
|
||||||
"@com_google_googletest//:gtest_main",
|
"@com_google_googletest//:gtest_main",
|
||||||
@ -61,6 +62,7 @@ cc_test(
|
|||||||
cc_library(
|
cc_library(
|
||||||
name = "memory_utils",
|
name = "memory_utils",
|
||||||
copts = C99_FLAGS,
|
copts = C99_FLAGS,
|
||||||
|
includes = INCLUDES,
|
||||||
textual_hdrs = [
|
textual_hdrs = [
|
||||||
"src/copy.inl",
|
"src/copy.inl",
|
||||||
"src/equals.inl",
|
"src/equals.inl",
|
||||||
@ -74,6 +76,7 @@ cc_library(
|
|||||||
],
|
],
|
||||||
hdrs = ["include/internal/string_view.h"],
|
hdrs = ["include/internal/string_view.h"],
|
||||||
copts = C99_FLAGS,
|
copts = C99_FLAGS,
|
||||||
|
includes = INCLUDES,
|
||||||
deps = [
|
deps = [
|
||||||
":cpu_features_macros",
|
":cpu_features_macros",
|
||||||
":memory_utils",
|
":memory_utils",
|
||||||
@ -83,7 +86,7 @@ cc_library(
|
|||||||
cc_test(
|
cc_test(
|
||||||
name = "string_view_test",
|
name = "string_view_test",
|
||||||
srcs = ["test/string_view_test.cc"],
|
srcs = ["test/string_view_test.cc"],
|
||||||
copts = CC_FLAGS,
|
includes = INCLUDES,
|
||||||
deps = [
|
deps = [
|
||||||
":string_view",
|
":string_view",
|
||||||
"@com_google_googletest//:gtest_main",
|
"@com_google_googletest//:gtest_main",
|
||||||
@ -95,6 +98,7 @@ cc_library(
|
|||||||
srcs = ["src/filesystem.c"],
|
srcs = ["src/filesystem.c"],
|
||||||
hdrs = ["include/internal/filesystem.h"],
|
hdrs = ["include/internal/filesystem.h"],
|
||||||
copts = C99_FLAGS,
|
copts = C99_FLAGS,
|
||||||
|
includes = INCLUDES,
|
||||||
deps = [":cpu_features_macros"],
|
deps = [":cpu_features_macros"],
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -109,7 +113,7 @@ cc_library(
|
|||||||
"include/internal/filesystem.h",
|
"include/internal/filesystem.h",
|
||||||
"test/filesystem_for_testing.h",
|
"test/filesystem_for_testing.h",
|
||||||
],
|
],
|
||||||
copts = CC_FLAGS,
|
includes = INCLUDES,
|
||||||
defines = ["CPU_FEATURES_MOCK_FILESYSTEM"],
|
defines = ["CPU_FEATURES_MOCK_FILESYSTEM"],
|
||||||
deps = [
|
deps = [
|
||||||
":cpu_features_macros",
|
":cpu_features_macros",
|
||||||
@ -121,6 +125,7 @@ cc_library(
|
|||||||
srcs = ["src/stack_line_reader.c"],
|
srcs = ["src/stack_line_reader.c"],
|
||||||
hdrs = ["include/internal/stack_line_reader.h"],
|
hdrs = ["include/internal/stack_line_reader.h"],
|
||||||
copts = C99_FLAGS,
|
copts = C99_FLAGS,
|
||||||
|
includes = INCLUDES,
|
||||||
defines = ["STACK_LINE_READER_BUFFER_SIZE=1024"],
|
defines = ["STACK_LINE_READER_BUFFER_SIZE=1024"],
|
||||||
deps = [
|
deps = [
|
||||||
":cpu_features_macros",
|
":cpu_features_macros",
|
||||||
@ -136,7 +141,7 @@ cc_test(
|
|||||||
"src/stack_line_reader.c",
|
"src/stack_line_reader.c",
|
||||||
"test/stack_line_reader_test.cc",
|
"test/stack_line_reader_test.cc",
|
||||||
],
|
],
|
||||||
copts = CC_FLAGS,
|
includes = INCLUDES,
|
||||||
defines = ["STACK_LINE_READER_BUFFER_SIZE=16"],
|
defines = ["STACK_LINE_READER_BUFFER_SIZE=16"],
|
||||||
deps = [
|
deps = [
|
||||||
":cpu_features_macros",
|
":cpu_features_macros",
|
||||||
@ -152,6 +157,7 @@ cc_library(
|
|||||||
srcs = ["src/stack_line_reader.c"],
|
srcs = ["src/stack_line_reader.c"],
|
||||||
hdrs = ["include/internal/stack_line_reader.h"],
|
hdrs = ["include/internal/stack_line_reader.h"],
|
||||||
copts = C99_FLAGS,
|
copts = C99_FLAGS,
|
||||||
|
includes = INCLUDES,
|
||||||
defines = ["STACK_LINE_READER_BUFFER_SIZE=1024"],
|
defines = ["STACK_LINE_READER_BUFFER_SIZE=1024"],
|
||||||
deps = [
|
deps = [
|
||||||
":cpu_features_macros",
|
":cpu_features_macros",
|
||||||
@ -165,6 +171,7 @@ cc_library(
|
|||||||
srcs = ["src/hwcaps.c"],
|
srcs = ["src/hwcaps.c"],
|
||||||
hdrs = ["include/internal/hwcaps.h"],
|
hdrs = ["include/internal/hwcaps.h"],
|
||||||
copts = C99_FLAGS,
|
copts = C99_FLAGS,
|
||||||
|
includes = INCLUDES,
|
||||||
defines = ["HAVE_STRONG_GETAUXVAL"],
|
defines = ["HAVE_STRONG_GETAUXVAL"],
|
||||||
deps = [
|
deps = [
|
||||||
":cpu_features_macros",
|
":cpu_features_macros",
|
||||||
@ -184,7 +191,7 @@ cc_library(
|
|||||||
"include/internal/hwcaps.h",
|
"include/internal/hwcaps.h",
|
||||||
"test/hwcaps_for_testing.h",
|
"test/hwcaps_for_testing.h",
|
||||||
],
|
],
|
||||||
copts = CC_FLAGS,
|
includes = INCLUDES,
|
||||||
defines = [
|
defines = [
|
||||||
"CPU_FEATURES_MOCK_GET_ELF_HWCAP_FROM_GETAUXVAL",
|
"CPU_FEATURES_MOCK_GET_ELF_HWCAP_FROM_GETAUXVAL",
|
||||||
"CPU_FEATURES_TEST",
|
"CPU_FEATURES_TEST",
|
||||||
@ -221,6 +228,7 @@ cc_library(
|
|||||||
PLATFORM_CPU_PPC: ["include/cpuinfo_ppc.h"],
|
PLATFORM_CPU_PPC: ["include/cpuinfo_ppc.h"],
|
||||||
}),
|
}),
|
||||||
copts = C99_FLAGS,
|
copts = C99_FLAGS,
|
||||||
|
includes = INCLUDES,
|
||||||
textual_hdrs = selects.with_or({
|
textual_hdrs = selects.with_or({
|
||||||
PLATFORM_CPU_X86_64: ["src/impl_x86__base_implementation.inl"],
|
PLATFORM_CPU_X86_64: ["src/impl_x86__base_implementation.inl"],
|
||||||
"//conditions:default": [],
|
"//conditions:default": [],
|
||||||
@ -266,6 +274,7 @@ cc_library(
|
|||||||
PLATFORM_CPU_PPC: ["include/cpuinfo_ppc.h"],
|
PLATFORM_CPU_PPC: ["include/cpuinfo_ppc.h"],
|
||||||
}),
|
}),
|
||||||
copts = C99_FLAGS,
|
copts = C99_FLAGS,
|
||||||
|
includes = INCLUDES,
|
||||||
defines = selects.with_or({
|
defines = selects.with_or({
|
||||||
PLATFORM_CPU_X86_64: ["CPU_FEATURES_MOCK_CPUID_X86"],
|
PLATFORM_CPU_X86_64: ["CPU_FEATURES_MOCK_CPUID_X86"],
|
||||||
"//conditions:default": [],
|
"//conditions:default": [],
|
||||||
@ -298,7 +307,7 @@ cc_test(
|
|||||||
PLATFORM_CPU_PPC: ["test/cpuinfo_ppc_test.cc"],
|
PLATFORM_CPU_PPC: ["test/cpuinfo_ppc_test.cc"],
|
||||||
PLATFORM_CPU_X86_64: ["test/cpuinfo_x86_test.cc"],
|
PLATFORM_CPU_X86_64: ["test/cpuinfo_x86_test.cc"],
|
||||||
}),
|
}),
|
||||||
copts = CC_FLAGS,
|
includes = INCLUDES,
|
||||||
deps = [
|
deps = [
|
||||||
":cpuinfo_for_testing",
|
":cpuinfo_for_testing",
|
||||||
":filesystem_for_testing",
|
":filesystem_for_testing",
|
||||||
@ -312,6 +321,7 @@ cc_binary(
|
|||||||
name = "list_cpu_features",
|
name = "list_cpu_features",
|
||||||
srcs = ["src/utils/list_cpu_features.c"],
|
srcs = ["src/utils/list_cpu_features.c"],
|
||||||
copts = C99_FLAGS,
|
copts = C99_FLAGS,
|
||||||
|
includes = INCLUDES,
|
||||||
deps = [
|
deps = [
|
||||||
":bit_utils",
|
":bit_utils",
|
||||||
":cpu_features_macros",
|
":cpu_features_macros",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user