Skip to content

Commit 7a8174a

Browse files
authored
Switch to cpu_features to bazelmod (#365)
1 parent c6a22fc commit 7a8174a

File tree

5 files changed

+35
-27
lines changed

5 files changed

+35
-27
lines changed

.bazelrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
# Use sparingly for things common to all compilers and platforms.
44
###############################################################################
55

6+
# Enable Bzlmod for every Bazel command
7+
common --enable_bzlmod
8+
69
# Prevent invalid caching if input files are modified during a build.
710
build --experimental_guard_against_concurrent_changes
811

BUILD.bazel

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ cc_test(
5555
includes = INCLUDES,
5656
deps = [
5757
":bit_utils",
58-
"@com_google_googletest//:gtest_main",
58+
"@googletest//:gtest_main",
5959
],
6060
)
6161

@@ -89,7 +89,7 @@ cc_test(
8989
includes = INCLUDES,
9090
deps = [
9191
":string_view",
92-
"@com_google_googletest//:gtest_main",
92+
"@googletest//:gtest_main",
9393
],
9494
)
9595

@@ -147,7 +147,7 @@ cc_test(
147147
":cpu_features_macros",
148148
":filesystem_for_testing",
149149
":string_view",
150-
"@com_google_googletest//:gtest_main",
150+
"@googletest//:gtest_main",
151151
],
152152
)
153153

@@ -311,7 +311,7 @@ cc_library(
311311
PLATFORM_CPU_ARM: ["include/cpuinfo_arm.h"],
312312
PLATFORM_CPU_ARM64: [
313313
"include/cpuinfo_aarch64.h",
314-
"include/internal/cpuid_aarch64.h"
314+
"include/internal/cpuid_aarch64.h",
315315
],
316316
PLATFORM_CPU_MIPS: ["include/cpuinfo_mips.h"],
317317
PLATFORM_CPU_PPC: ["include/cpuinfo_ppc.h"],
@@ -321,10 +321,10 @@ cc_library(
321321
copts = C99_FLAGS,
322322
defines = selects.with_or({
323323
PLATFORM_CPU_X86_64: ["CPU_FEATURES_MOCK_CPUID_X86"],
324-
PLATFORM_CPU_ARM64: [
325-
"CPU_FEATURES_MOCK_CPUID_AARCH64",
326-
"CPU_FEATURES_MOCK_SYSCTL_AARCH64",
327-
],
324+
PLATFORM_CPU_ARM64: [
325+
"CPU_FEATURES_MOCK_CPUID_AARCH64",
326+
"CPU_FEATURES_MOCK_SYSCTL_AARCH64",
327+
],
328328
"//conditions:default": [],
329329
}) + selects.with_or({
330330
PLATFORM_OS_MACOS: ["HAVE_SYSCTLBYNAME"],
@@ -368,7 +368,7 @@ cc_test(
368368
":filesystem_for_testing",
369369
":hwcaps_for_testing",
370370
":string_view",
371-
"@com_google_googletest//:gtest_main",
371+
"@googletest//:gtest_main",
372372
],
373373
)
374374

MODULE.bazel

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
###############################################################################
2+
# Bazel now uses Bzlmod by default to manage external dependencies.
3+
# Please consider migrating your external dependencies from WORKSPACE to MODULE.bazel.
4+
#
5+
# For more details, please check https://github.com/bazelbuild/bazel/issues/18958
6+
###############################################################################
7+
8+
CPU_FEATURES_VERSION = "0.9.0"
9+
10+
module(
11+
name = "cpu_features",
12+
repo_name = "com_google_cpufeatures",
13+
version = CPU_FEATURES_VERSION,
14+
)
15+
16+
bazel_dep(name = "bazel_skylib", version = "1.7.1")
17+
bazel_dep(name = "googletest", version = "1.15.2")

WORKSPACE

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,4 @@
1-
workspace(name = "com_google_cpufeatures")
2-
3-
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
4-
5-
git_repository(
6-
name = "com_google_googletest",
7-
tag = "release-1.11.0",
8-
remote = "https://github.com/google/googletest.git",
9-
)
1+
# This file marks the root of the Bazel workspace.
2+
# See MODULE.bazel for external dependencies setup.
103

11-
git_repository(
12-
name = "bazel_skylib",
13-
tag = "1.2.0",
14-
remote = "https://github.com/bazelbuild/bazel-skylib.git",
15-
)
16-
17-
load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")
18-
19-
bazel_skylib_workspace()
4+
workspace(name = "com_google_cpufeatures")

scripts/make_release.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ fi
6262
echo -e "${ACTION}Modifying CMakeLists.txt${NOCOLOR}"
6363
sed -i "s/CpuFeatures VERSION ${LATEST_VERSION}/CpuFeatures VERSION ${VERSION}/g" CMakeLists.txt
6464

65+
echo -e "${ACTION}Modifying MODULE.bazel${NOCOLOR}"
66+
sed -i "s/CPU_FEATURES_VERSION = \"${LATEST_VERSION}\"/CPU_FEATURES_VERSION = \"${VERSION}\"/g" MODULE.bazel
67+
6568
echo -e "${ACTION}Commit new revision${NOCOLOR}"
6669
git add CMakeLists.txt
6770
git commit -m"Release ${GIT_TAG}"

0 commit comments

Comments
 (0)