1
0
mirror of https://github.com/google/cpu_features.git synced 2025-04-26 22:52:30 +02:00

Switch to cpu_features to bazelmod (#365)

This commit is contained in:
Guillaume Chatelet 2024-09-13 14:31:12 +02:00 committed by GitHub
parent c6a22fc617
commit 7a8174a371
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 35 additions and 27 deletions

View File

@ -3,6 +3,9 @@
# Use sparingly for things common to all compilers and platforms.
###############################################################################
# Enable Bzlmod for every Bazel command
common --enable_bzlmod
# Prevent invalid caching if input files are modified during a build.
build --experimental_guard_against_concurrent_changes

View File

@ -55,7 +55,7 @@ cc_test(
includes = INCLUDES,
deps = [
":bit_utils",
"@com_google_googletest//:gtest_main",
"@googletest//:gtest_main",
],
)
@ -89,7 +89,7 @@ cc_test(
includes = INCLUDES,
deps = [
":string_view",
"@com_google_googletest//:gtest_main",
"@googletest//:gtest_main",
],
)
@ -147,7 +147,7 @@ cc_test(
":cpu_features_macros",
":filesystem_for_testing",
":string_view",
"@com_google_googletest//:gtest_main",
"@googletest//:gtest_main",
],
)
@ -311,7 +311,7 @@ cc_library(
PLATFORM_CPU_ARM: ["include/cpuinfo_arm.h"],
PLATFORM_CPU_ARM64: [
"include/cpuinfo_aarch64.h",
"include/internal/cpuid_aarch64.h"
"include/internal/cpuid_aarch64.h",
],
PLATFORM_CPU_MIPS: ["include/cpuinfo_mips.h"],
PLATFORM_CPU_PPC: ["include/cpuinfo_ppc.h"],
@ -321,10 +321,10 @@ cc_library(
copts = C99_FLAGS,
defines = selects.with_or({
PLATFORM_CPU_X86_64: ["CPU_FEATURES_MOCK_CPUID_X86"],
PLATFORM_CPU_ARM64: [
"CPU_FEATURES_MOCK_CPUID_AARCH64",
"CPU_FEATURES_MOCK_SYSCTL_AARCH64",
],
PLATFORM_CPU_ARM64: [
"CPU_FEATURES_MOCK_CPUID_AARCH64",
"CPU_FEATURES_MOCK_SYSCTL_AARCH64",
],
"//conditions:default": [],
}) + selects.with_or({
PLATFORM_OS_MACOS: ["HAVE_SYSCTLBYNAME"],
@ -368,7 +368,7 @@ cc_test(
":filesystem_for_testing",
":hwcaps_for_testing",
":string_view",
"@com_google_googletest//:gtest_main",
"@googletest//:gtest_main",
],
)

17
MODULE.bazel Normal file
View File

@ -0,0 +1,17 @@
###############################################################################
# Bazel now uses Bzlmod by default to manage external dependencies.
# Please consider migrating your external dependencies from WORKSPACE to MODULE.bazel.
#
# For more details, please check https://github.com/bazelbuild/bazel/issues/18958
###############################################################################
CPU_FEATURES_VERSION = "0.9.0"
module(
name = "cpu_features",
repo_name = "com_google_cpufeatures",
version = CPU_FEATURES_VERSION,
)
bazel_dep(name = "bazel_skylib", version = "1.7.1")
bazel_dep(name = "googletest", version = "1.15.2")

View File

@ -1,19 +1,4 @@
# This file marks the root of the Bazel workspace.
# See MODULE.bazel for external dependencies setup.
workspace(name = "com_google_cpufeatures")
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
git_repository(
name = "com_google_googletest",
tag = "release-1.11.0",
remote = "https://github.com/google/googletest.git",
)
git_repository(
name = "bazel_skylib",
tag = "1.2.0",
remote = "https://github.com/bazelbuild/bazel-skylib.git",
)
load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")
bazel_skylib_workspace()

View File

@ -62,6 +62,9 @@ fi
echo -e "${ACTION}Modifying CMakeLists.txt${NOCOLOR}"
sed -i "s/CpuFeatures VERSION ${LATEST_VERSION}/CpuFeatures VERSION ${VERSION}/g" CMakeLists.txt
echo -e "${ACTION}Modifying MODULE.bazel${NOCOLOR}"
sed -i "s/CPU_FEATURES_VERSION = \"${LATEST_VERSION}\"/CPU_FEATURES_VERSION = \"${VERSION}\"/g" MODULE.bazel
echo -e "${ACTION}Commit new revision${NOCOLOR}"
git add CMakeLists.txt
git commit -m"Release ${GIT_TAG}"