Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main'
Browse files Browse the repository at this point in the history
# Conflicts:
#	CMakeLists.txt
  • Loading branch information
lmglmg committed Apr 24, 2024
2 parents 195e8d1 + 3c8b153 commit efd8506
Show file tree
Hide file tree
Showing 263 changed files with 34,943 additions and 32,169 deletions.
1 change: 0 additions & 1 deletion .bazelversion

This file was deleted.

85 changes: 85 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
---
AccessModifierOffset: -1
AlignAfterOpenBracket: AlwaysBreak
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlinesLeft: true
AlignOperands: false
AlignTrailingComments: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Empty
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: true
BinPackArguments: false
BinPackParameters: false
BraceWrapping:
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Attach
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: false
ColumnLimit: 120
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 8
ContinuationIndentWidth: 8
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat: false
ForEachMacros: [ FOR_EACH_RANGE, FOR_EACH, ]
IncludeCategories:
- Regex: '^<.*\.h(pp)?>'
Priority: 1
- Regex: '^<.*'
Priority: 2
- Regex: '.*'
Priority: 3
IndentCaseLabels: true
IndentWidth: 8
IndentWrappedFunctionNames: false
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
PenaltyBreakBeforeFirstCallParameter: 1
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 2000000
PointerAlignment: Left
ReflowComments: true
SortIncludes: true
SpaceAfterCStyleCast: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Cpp11
TabWidth: 8
UseTab: Always
---
24 changes: 23 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ on:
pull_request:
push:
branches:
- master
- main

permissions:
Expand Down Expand Up @@ -94,3 +93,26 @@ jobs:
working-directory: ${{ github.workspace }}
env:
ANDROID_NDK: ${{ steps.setup-ndk.outputs.ndk-path }}
cmake-linux-qemu:
runs-on: ubuntu-22.04
timeout-minutes: 40
strategy:
matrix:
build_props:
- [
"cmake-linux-riscv64",
"riscv64/ubuntu:22.04"
]

name: ${{ matrix.build_props[0] }}
steps:
- uses: actions/checkout@v2
- name: Setup QEMU
uses: docker/[email protected]
- name: Build cpuinfo in ${{ matrix.build_props[1] }}
run: |
docker run -i -v $(pwd):/cpuinfo ${{ matrix.build_props[1] }} /bin/bash -c "
apt update &&
apt install -y cmake git gcc g++ &&
cd /cpuinfo &&
scripts/local-build.sh"
21 changes: 21 additions & 0 deletions .github/workflows/build_bazel.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Build using Bazel
on:
pull_request:
push:
branches:
- main

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
bazel-linux-local:
runs-on: ubuntu-latest
timeout-minutes: 40
steps:
- uses: actions/checkout@v2
- name: Build
run: scripts/local-bazel-build.sh
12 changes: 12 additions & 0 deletions .github/workflows/clang-format-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: clang-format
on: [push, pull_request]
jobs:
formatting-check:
name: Formatting Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Run clang-format style check.
uses: jidicula/[email protected]
with:
exclude-regex: 'deps\/'
54 changes: 52 additions & 2 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ ARM_SRCS = [
"src/arm/uarch.c",
]

RISCV_SRCS = [
"src/riscv/uarch.c",
]

# Platform-specific sources and headers
LINUX_SRCS = [
"src/linux/cpulist.c",
Expand Down Expand Up @@ -81,6 +85,12 @@ LINUX_ARM32_SRCS = LINUX_ARM_SRCS + ["src/arm/linux/aarch32-isa.c"]

LINUX_ARM64_SRCS = LINUX_ARM_SRCS + ["src/arm/linux/aarch64-isa.c"]

LINUX_RISCV_SRCS = [
"src/riscv/linux/init.c",
"src/riscv/linux/riscv-isa.c",
"src/riscv/linux/riscv-hw.c",
]

ANDROID_ARM_SRCS = [
"src/arm/android/properties.c",
]
Expand All @@ -89,6 +99,11 @@ WINDOWS_X86_SRCS = [
"src/x86/windows/init.c",
]

WINDOWS_ARM_SRCS = [
"src/arm/windows/init-by-logical-sys-info.c",
"src/arm/windows/init.c",
]

MACH_X86_SRCS = [
"src/x86/mach/init.c",
]
Expand All @@ -111,15 +126,19 @@ cc_library(
":linux_armeabi": COMMON_SRCS + ARM_SRCS + LINUX_SRCS + LINUX_ARM32_SRCS,
":linux_aarch64": COMMON_SRCS + ARM_SRCS + LINUX_SRCS + LINUX_ARM64_SRCS,
":linux_mips64": COMMON_SRCS + LINUX_SRCS,
":linux_riscv64": COMMON_SRCS + LINUX_SRCS,
":linux_riscv32": COMMON_SRCS + RISCV_SRCS + LINUX_SRCS + LINUX_RISCV_SRCS,
":linux_riscv64": COMMON_SRCS + RISCV_SRCS + LINUX_SRCS + LINUX_RISCV_SRCS,
":linux_s390x": COMMON_SRCS + LINUX_SRCS,
":macos_x86_64": COMMON_SRCS + X86_SRCS + MACH_SRCS + MACH_X86_SRCS,
":macos_x86_64_legacy": COMMON_SRCS + X86_SRCS + MACH_SRCS + MACH_X86_SRCS,
":macos_arm64": COMMON_SRCS + MACH_SRCS + MACH_ARM_SRCS,
":windows_x86_64": COMMON_SRCS + X86_SRCS + WINDOWS_X86_SRCS,
":windows_arm64": COMMON_SRCS + ARM_SRCS + WINDOWS_ARM_SRCS,
":android_armv7": COMMON_SRCS + ARM_SRCS + LINUX_SRCS + LINUX_ARM32_SRCS + ANDROID_ARM_SRCS,
":android_arm64": COMMON_SRCS + ARM_SRCS + LINUX_SRCS + LINUX_ARM64_SRCS + ANDROID_ARM_SRCS,
":android_x86": COMMON_SRCS + X86_SRCS + LINUX_SRCS + LINUX_X86_SRCS,
":android_x86_64": COMMON_SRCS + X86_SRCS + LINUX_SRCS + LINUX_X86_SRCS,
":android_riscv64": COMMON_SRCS + RISCV_SRCS + LINUX_SRCS + LINUX_RISCV_SRCS,
":ios_x86_64": COMMON_SRCS + X86_SRCS + MACH_SRCS + MACH_X86_SRCS,
":ios_x86": COMMON_SRCS + X86_SRCS + MACH_SRCS + MACH_X86_SRCS,
":ios_armv7": COMMON_SRCS + MACH_SRCS + MACH_ARM_SRCS,
Expand All @@ -136,6 +155,7 @@ cc_library(
}),
copts = select({
":windows_x86_64": [],
":windows_arm64": [],
"//conditions:default": C99OPTS,
}) + [
"-Iexternal/cpuinfo/include",
Expand All @@ -149,6 +169,7 @@ cc_library(
linkstatic = select({
# https://github.com/bazelbuild/bazel/issues/11552
":macos_x86_64": False,
":macos_x86_64_legacy": False,
"//conditions:default": True,
}),
# Headers must be in textual_hdrs to allow us to set the standard to C99
Expand All @@ -168,6 +189,8 @@ cc_library(
"src/arm/linux/cp.h",
"src/arm/api.h",
"src/arm/midr.h",
"src/riscv/api.h",
"src/riscv/linux/api.h",
],
)

Expand Down Expand Up @@ -229,6 +252,11 @@ config_setting(
values = {"cpu": "mips64"},
)

config_setting(
name = "linux_riscv32",
values = {"cpu": "riscv32"},
)

config_setting(
name = "linux_riscv64",
values = {"cpu": "riscv64"},
Expand All @@ -240,18 +268,31 @@ config_setting(
)

config_setting(
name = "macos_x86_64",
name = "macos_x86_64_legacy",
values = {
"apple_platform_type": "macos",
"cpu": "darwin",
},
)

config_setting(
name = "macos_x86_64",
values = {
"apple_platform_type": "macos",
"cpu": "darwin_x86_64",
},
)

config_setting(
name = "windows_x86_64",
values = {"cpu": "x64_windows"},
)

config_setting(
name = "windows_arm64",
values = {"cpu": "arm64_windows"},
)

config_setting(
name = "android_armv7",
values = {
Expand All @@ -270,6 +311,15 @@ config_setting(
visibility = ["//visibility:public"],
)

config_setting(
name = "android_riscv64",
values = {
"crosstool_top": "//external:android/crosstool",
"cpu": "riscv64",
},
visibility = ["//visibility:public"],
)

config_setting(
name = "android_x86",
values = {
Expand Down
Loading

0 comments on commit efd8506

Please sign in to comment.