@xulongzhe/clawbench-desktop-linux-x64-payload 0.102.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +10 -0
- package/payload.json +4 -0
- package/resources/app.asar +0 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/.eslintrc.js +5 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/LICENSE +19 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/build/Release/cpufeatures.node +0 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/build/deps/cpu_features/cpu_features.Makefile +6 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/buildcheck.gypi +19 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/buildcheck.js +32 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/.clang-format +4 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/.dockerignore +31 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/.grenrc.yml +21 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/BUILD.bazel +329 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/CMakeLists.txt +261 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/CONTRIBUTING.md +23 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/LICENSE +230 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/README.md +272 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/WORKSPACE +19 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/bazel/ci/README.md +5 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/bazel/platforms.bzl +11 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/cmake/CpuFeaturesConfig.cmake.in +3 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/cmake/CpuFeaturesNdkCompatConfig.cmake.in +3 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/cmake/README.md +30 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/cmake/ci/Makefile +252 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/cmake/ci/README.md +40 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/cmake/ci/doc/docker.dot +64 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/cmake/ci/doc/docker.svg +312 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/cmake/ci/doc/generate_image.sh +7 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/cmake/ci/docker/amd64/Dockerfile +48 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/cmake/ci/docker/toolchain/Dockerfile +34 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/cmake/ci/sample/CMakeLists.txt +22 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/cmake/ci/sample/main.cpp +11 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/cmake/ci/vagrant/freebsd/Vagrantfile +107 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/cmake/googletest.CMakeLists.txt.in +15 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/cpu_features.gyp +105 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/include/cpu_features_cache_info.h +54 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/include/cpu_features_macros.h +384 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/include/cpuinfo_aarch64.h +259 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/include/cpuinfo_arm.h +121 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/include/cpuinfo_mips.h +74 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/include/cpuinfo_ppc.h +149 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/include/cpuinfo_riscv.h +72 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/include/cpuinfo_s390x.h +108 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/include/cpuinfo_x86.h +288 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/include/internal/bit_utils.h +40 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/include/internal/cpuid_x86.h +37 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/include/internal/filesystem.h +39 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/include/internal/hwcaps.h +240 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/include/internal/stack_line_reader.h +49 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/include/internal/string_view.h +110 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/include/internal/windows_utils.h +70 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/ndk_compat/CMakeLists.txt +60 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/ndk_compat/README.md +4 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/ndk_compat/cpu-features.c +205 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/ndk_compat/cpu-features.h +320 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/ndk_compat/ndk-compat-test.c +12 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/patches/0001-Add-Apple-Silicon-Support.patch +456 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/scripts/generate_badges.d +165 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/scripts/make_release.sh +75 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/scripts/run_integration.sh +490 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/scripts/test_integration.sh +79 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/src/copy.inl +19 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/src/define_introspection.inl +86 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/src/define_introspection_and_hwcaps.inl +26 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/src/equals.inl +22 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/src/filesystem.c +62 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/src/hwcaps.c +169 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/src/impl_aarch64__base_implementation.inl +88 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/src/impl_aarch64_linux_or_android.c +79 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/src/impl_aarch64_macos_or_iphone.c +82 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/src/impl_aarch64_windows.c +138 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/src/impl_arm_linux_or_android.c +212 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/src/impl_mips_linux_or_android.c +93 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/src/impl_ppc_linux.c +163 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/src/impl_riscv_linux.c +111 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/src/impl_s390x_linux.c +120 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/src/impl_x86__base_implementation.inl +2055 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/src/impl_x86_freebsd.c +68 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/src/impl_x86_linux_or_android.c +58 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/src/impl_x86_macos.c +57 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/src/impl_x86_windows.c +58 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/src/stack_line_reader.c +132 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/src/string_view.c +192 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/src/utils/list_cpu_features.c +461 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/test/CMakeLists.txt +114 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/test/filesystem_for_testing.h +61 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/test/hwcaps_for_testing.h +31 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/lib/index.js +5 -0
- package/resources/app.asar.unpacked/node_modules/cpu-features/package.json +28 -0
- package/resources/app.asar.unpacked/node_modules/ssh2/.eslintignore +4 -0
- package/resources/app.asar.unpacked/node_modules/ssh2/.eslintrc.js +5 -0
- package/resources/app.asar.unpacked/node_modules/ssh2/LICENSE +19 -0
- package/resources/app.asar.unpacked/node_modules/ssh2/SFTP.md +413 -0
- package/resources/app.asar.unpacked/node_modules/ssh2/install.js +27 -0
- package/resources/app.asar.unpacked/node_modules/ssh2/lib/Channel.js +295 -0
- package/resources/app.asar.unpacked/node_modules/ssh2/lib/agent.js +1123 -0
- package/resources/app.asar.unpacked/node_modules/ssh2/lib/client.js +2176 -0
- package/resources/app.asar.unpacked/node_modules/ssh2/lib/http-agents.js +84 -0
- package/resources/app.asar.unpacked/node_modules/ssh2/lib/index.js +44 -0
- package/resources/app.asar.unpacked/node_modules/ssh2/lib/keygen.js +582 -0
- package/resources/app.asar.unpacked/node_modules/ssh2/lib/protocol/Protocol.js +2136 -0
- package/resources/app.asar.unpacked/node_modules/ssh2/lib/protocol/SFTP.js +4052 -0
- package/resources/app.asar.unpacked/node_modules/ssh2/lib/protocol/constants.js +356 -0
- package/resources/app.asar.unpacked/node_modules/ssh2/lib/protocol/crypto/build/Release/sshcrypto.node +0 -0
- package/resources/app.asar.unpacked/node_modules/ssh2/lib/protocol/crypto/poly1305.js +43 -0
- package/resources/app.asar.unpacked/node_modules/ssh2/lib/protocol/crypto.js +1602 -0
- package/resources/app.asar.unpacked/node_modules/ssh2/lib/protocol/handlers.js +16 -0
- package/resources/app.asar.unpacked/node_modules/ssh2/lib/protocol/handlers.misc.js +1285 -0
- package/resources/app.asar.unpacked/node_modules/ssh2/lib/protocol/kex.js +1908 -0
- package/resources/app.asar.unpacked/node_modules/ssh2/lib/protocol/keyParser.js +1484 -0
- package/resources/app.asar.unpacked/node_modules/ssh2/lib/protocol/node-fs-compat.js +115 -0
- package/resources/app.asar.unpacked/node_modules/ssh2/lib/protocol/utils.js +356 -0
- package/resources/app.asar.unpacked/node_modules/ssh2/lib/protocol/zlib.js +255 -0
- package/resources/app.asar.unpacked/node_modules/ssh2/lib/server.js +1380 -0
- package/resources/app.asar.unpacked/node_modules/ssh2/lib/utils.js +336 -0
- package/resources/app.asar.unpacked/node_modules/ssh2/package.json +32 -0
- package/resources/app.asar.unpacked/node_modules/ssh2/util/build_pagent.bat +2 -0
- package/resources/app.asar.unpacked/node_modules/ssh2/util/pagent.c +88 -0
- package/resources/login.html +1777 -0
- package/resources/logo.png +0 -0
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
# cpu_features
|
|
2
|
+
|
|
3
|
+
A cross-platform C library to retrieve CPU features (such as available
|
|
4
|
+
instructions) at runtime.
|
|
5
|
+
|
|
6
|
+
# GitHub-CI Status
|
|
7
|
+
|
|
8
|
+
[comment]: <> (The following lines are generated by "scripts/generate_badges.d" that you can run online https://run.dlang.io/)
|
|
9
|
+
|
|
10
|
+
| Os | amd64 | AArch64 | ARM | MIPS | POWER | RISCV | s390x |
|
|
11
|
+
| :-- | --: | --: | --: | --: | --: | --: | --: |
|
|
12
|
+
| Linux | [![][i1a0]][l1a0]<br/>[![][i1a1]][l1a1] | [![][i1b0]][l1b0]<br/>![][d1] | [![][i1c0]][l1c0]<br/>![][d1] | [![][i1d0]][l1d0]<br/>![][d1] | [![][i1e0]][l1e0]<br/>![][d1] | [![][i1f0]][l1f0]<br/>![][d1] | [![][i1g0]][l1g0]<br/>![][d1] |
|
|
13
|
+
| FreeBSD | [![][i2a0]][l2a0]<br/>![][d1] | ![][d0]<br/>![][d1] | ![][d0]<br/>![][d1] | ![][d0]<br/>![][d1] | ![][d0]<br/>![][d1] | ![][d0]<br/>![][d1] | ![][d0]<br/>![][d1] |
|
|
14
|
+
| MacOS | [![][i3a0]][l3a0]<br/>![][d1] | ![][d0]<br/>![][d1] | ![][d0]<br/>![][d1] | ![][d0]<br/>![][d1] | ![][d0]<br/>![][d1] | ![][d0]<br/>![][d1] | ![][d0]<br/>![][d1] |
|
|
15
|
+
| Windows | [![][i4a0]][l4a0]<br/>![][d1] | ![][d0]<br/>![][d1] | ![][d0]<br/>![][d1] | ![][d0]<br/>![][d1] | ![][d0]<br/>![][d1] | ![][d0]<br/>![][d1] | ![][d0]<br/>![][d1] |
|
|
16
|
+
|
|
17
|
+
[d0]: https://img.shields.io/badge/CMake-N%2FA-lightgrey
|
|
18
|
+
[d1]: https://img.shields.io/badge/Bazel-N%2FA-lightgrey
|
|
19
|
+
[i1a0]: https://img.shields.io/github/actions/workflow/status/google/cpu_features/amd64_linux_cmake.yml?branch=main&label=CMake
|
|
20
|
+
[i1a1]: https://img.shields.io/github/actions/workflow/status/google/cpu_features/amd64_linux_bazel.yml?branch=main&label=Bazel
|
|
21
|
+
[i1b0]: https://img.shields.io/github/actions/workflow/status/google/cpu_features/aarch64_linux_cmake.yml?branch=main&label=CMake
|
|
22
|
+
[i1c0]: https://img.shields.io/github/actions/workflow/status/google/cpu_features/arm_linux_cmake.yml?branch=main&label=CMake
|
|
23
|
+
[i1d0]: https://img.shields.io/github/actions/workflow/status/google/cpu_features/mips_linux_cmake.yml?branch=main&label=CMake
|
|
24
|
+
[i1e0]: https://img.shields.io/github/actions/workflow/status/google/cpu_features/power_linux_cmake.yml?branch=main&label=CMake
|
|
25
|
+
[i1f0]: https://img.shields.io/github/actions/workflow/status/google/cpu_features/riscv_linux_cmake.yml?branch=main&label=CMake
|
|
26
|
+
[i1g0]: https://img.shields.io/github/actions/workflow/status/google/cpu_features/s390x_linux_cmake.yml?branch=main&label=CMake
|
|
27
|
+
[i2a0]: https://img.shields.io/github/actions/workflow/status/google/cpu_features/amd64_freebsd_cmake.yml?branch=main&label=CMake
|
|
28
|
+
[i3a0]: https://img.shields.io/github/actions/workflow/status/google/cpu_features/amd64_macos_cmake.yml?branch=main&label=CMake
|
|
29
|
+
[i4a0]: https://img.shields.io/github/actions/workflow/status/google/cpu_features/amd64_windows_cmake.yml?branch=main&label=CMake
|
|
30
|
+
[l1a0]: https://github.com/google/cpu_features/actions/workflows/amd64_linux_cmake.yml
|
|
31
|
+
[l1a1]: https://github.com/google/cpu_features/actions/workflows/amd64_linux_bazel.yml
|
|
32
|
+
[l1b0]: https://github.com/google/cpu_features/actions/workflows/aarch64_linux_cmake.yml
|
|
33
|
+
[l1c0]: https://github.com/google/cpu_features/actions/workflows/arm_linux_cmake.yml
|
|
34
|
+
[l1d0]: https://github.com/google/cpu_features/actions/workflows/mips_linux_cmake.yml
|
|
35
|
+
[l1e0]: https://github.com/google/cpu_features/actions/workflows/power_linux_cmake.yml
|
|
36
|
+
[l1f0]: https://github.com/google/cpu_features/actions/workflows/riscv_linux_cmake.yml
|
|
37
|
+
[l1g0]: https://github.com/google/cpu_features/actions/workflows/s390x_linux_cmake.yml
|
|
38
|
+
[l2a0]: https://github.com/google/cpu_features/actions/workflows/amd64_freebsd_cmake.yml
|
|
39
|
+
[l3a0]: https://github.com/google/cpu_features/actions/workflows/amd64_macos_cmake.yml
|
|
40
|
+
[l4a0]: https://github.com/google/cpu_features/actions/workflows/amd64_windows_cmake.yml
|
|
41
|
+
|
|
42
|
+
## Table of Contents
|
|
43
|
+
|
|
44
|
+
- [Design Rationale](#rationale)
|
|
45
|
+
- [Code samples](#codesample)
|
|
46
|
+
- [Running sample code](#usagesample)
|
|
47
|
+
- [What's supported](#support)
|
|
48
|
+
- [Android NDK's drop in replacement](#ndk)
|
|
49
|
+
- [License](#license)
|
|
50
|
+
- [Build with cmake](#cmake)
|
|
51
|
+
- [Community Bindings](#bindings)
|
|
52
|
+
|
|
53
|
+
<a name="rationale"></a>
|
|
54
|
+
## Design Rationale
|
|
55
|
+
|
|
56
|
+
- **Simple to use.** See the snippets below for examples.
|
|
57
|
+
- **Extensible.** Easy to add missing features or architectures.
|
|
58
|
+
- **Compatible with old compilers** and available on many architectures so it
|
|
59
|
+
can be used widely. To ensure that cpu_features works on as many platforms
|
|
60
|
+
as possible, we implemented it in a highly portable version of C: C99.
|
|
61
|
+
- **Sandbox-compatible.** The library uses a variety of strategies to cope
|
|
62
|
+
with sandboxed environments or when `cpuid` is unavailable. This is useful
|
|
63
|
+
when running integration tests in hermetic environments.
|
|
64
|
+
- **Thread safe, no memory allocation, and raises no exceptions.**
|
|
65
|
+
cpu_features is suitable for implementing fundamental libc functions like
|
|
66
|
+
`malloc`, `memcpy`, and `memcmp`.
|
|
67
|
+
- **Unit tested.**
|
|
68
|
+
|
|
69
|
+
<a name="codesample"></a>
|
|
70
|
+
## Code samples
|
|
71
|
+
|
|
72
|
+
**Note:** For C++ code, the library functions are defined in the `cpu_features` namespace.
|
|
73
|
+
|
|
74
|
+
### Checking features at runtime
|
|
75
|
+
|
|
76
|
+
Here's a simple example that executes a codepath if the CPU supports both the
|
|
77
|
+
AES and the SSE4.2 instruction sets:
|
|
78
|
+
|
|
79
|
+
```c
|
|
80
|
+
#include "cpuinfo_x86.h"
|
|
81
|
+
|
|
82
|
+
// For C++, add `using namespace cpu_features;`
|
|
83
|
+
static const X86Features features = GetX86Info().features;
|
|
84
|
+
|
|
85
|
+
void Compute(void) {
|
|
86
|
+
if (features.aes && features.sse4_2) {
|
|
87
|
+
// Run optimized code.
|
|
88
|
+
} else {
|
|
89
|
+
// Run standard code.
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Caching for faster evaluation of complex checks
|
|
95
|
+
|
|
96
|
+
If you wish, you can read all the features at once into a global variable, and
|
|
97
|
+
then query for the specific features you care about. Below, we store all the ARM
|
|
98
|
+
features and then check whether AES and NEON are supported.
|
|
99
|
+
|
|
100
|
+
```c
|
|
101
|
+
#include <stdbool.h>
|
|
102
|
+
#include "cpuinfo_arm.h"
|
|
103
|
+
|
|
104
|
+
// For C++, add `using namespace cpu_features;`
|
|
105
|
+
static const ArmFeatures features = GetArmInfo().features;
|
|
106
|
+
static const bool has_aes_and_neon = features.aes && features.neon;
|
|
107
|
+
|
|
108
|
+
// use has_aes_and_neon.
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
This is a good approach to take if you're checking for combinations of features
|
|
112
|
+
when using a compiler that is slow to extract individual bits from bit-packed
|
|
113
|
+
structures.
|
|
114
|
+
|
|
115
|
+
### Checking compile time flags
|
|
116
|
+
|
|
117
|
+
The following code determines whether the compiler was told to use the AVX
|
|
118
|
+
instruction set (e.g., `g++ -mavx`) and sets `has_avx` accordingly.
|
|
119
|
+
|
|
120
|
+
```c
|
|
121
|
+
#include <stdbool.h>
|
|
122
|
+
#include "cpuinfo_x86.h"
|
|
123
|
+
|
|
124
|
+
// For C++, add `using namespace cpu_features;`
|
|
125
|
+
static const X86Features features = GetX86Info().features;
|
|
126
|
+
static const bool has_avx = CPU_FEATURES_COMPILED_X86_AVX || features.avx;
|
|
127
|
+
|
|
128
|
+
// use has_avx.
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
`CPU_FEATURES_COMPILED_X86_AVX` is set to 1 if the compiler was instructed to
|
|
132
|
+
use AVX and 0 otherwise, combining compile time and runtime knowledge.
|
|
133
|
+
|
|
134
|
+
### Rejecting poor hardware implementations based on microarchitecture
|
|
135
|
+
|
|
136
|
+
On x86, the first incarnation of a feature in a microarchitecture might not be
|
|
137
|
+
the most efficient (e.g. AVX on Sandy Bridge). We provide a function to retrieve
|
|
138
|
+
the underlying microarchitecture so you can decide whether to use it.
|
|
139
|
+
|
|
140
|
+
Below, `has_fast_avx` is set to 1 if the CPU supports the AVX instruction
|
|
141
|
+
set—but only if it's not Sandy Bridge.
|
|
142
|
+
|
|
143
|
+
```c
|
|
144
|
+
#include <stdbool.h>
|
|
145
|
+
#include "cpuinfo_x86.h"
|
|
146
|
+
|
|
147
|
+
// For C++, add `using namespace cpu_features;`
|
|
148
|
+
static const X86Info info = GetX86Info();
|
|
149
|
+
static const X86Microarchitecture uarch = GetX86Microarchitecture(&info);
|
|
150
|
+
static const bool has_fast_avx = info.features.avx && uarch != INTEL_SNB;
|
|
151
|
+
|
|
152
|
+
// use has_fast_avx.
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
This feature is currently available only for x86 microarchitectures.
|
|
156
|
+
|
|
157
|
+
<a name="usagesample"></a>
|
|
158
|
+
### Running sample code
|
|
159
|
+
|
|
160
|
+
Building `cpu_features` (check [quickstart](#quickstart) below) brings a small executable to test the library.
|
|
161
|
+
|
|
162
|
+
```shell
|
|
163
|
+
% ./build/list_cpu_features
|
|
164
|
+
arch : x86
|
|
165
|
+
brand : Intel(R) Xeon(R) CPU E5-1650 0 @ 3.20GHz
|
|
166
|
+
family : 6 (0x06)
|
|
167
|
+
model : 45 (0x2D)
|
|
168
|
+
stepping : 7 (0x07)
|
|
169
|
+
uarch : INTEL_SNB
|
|
170
|
+
flags : aes,avx,cx16,smx,sse4_1,sse4_2,ssse3
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
```shell
|
|
174
|
+
% ./build/list_cpu_features --json
|
|
175
|
+
{"arch":"x86","brand":" Intel(R) Xeon(R) CPU E5-1650 0 @ 3.20GHz","family":6,"model":45,"stepping":7,"uarch":"INTEL_SNB","flags":["aes","avx","cx16","smx","sse4_1","sse4_2","ssse3"]}
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
<a name="support"></a>
|
|
179
|
+
## What's supported
|
|
180
|
+
|
|
181
|
+
| | x86³ | AArch64 | ARM | MIPS⁴ | POWER | RISCV | s390x |
|
|
182
|
+
|---------|:----:|:-------:|:-------:|:-------:|:-------:|:-------:|:-------:|
|
|
183
|
+
| Linux | yes² | yes¹ | yes¹ | yes¹ | yes¹ | yes¹ | yes¹ |
|
|
184
|
+
| FreeBSD | yes² | not yet | not yet | not yet | not yet | N/A | not yet |
|
|
185
|
+
| MacOs | yes² | not yet | N/A | N/A | no | N/A | no |
|
|
186
|
+
| Windows | yes² | not yet | not yet | N/A | N/A | N/A | N/A |
|
|
187
|
+
| Android | yes² | yes¹ | yes¹ | yes¹ | N/A | N/A | N/A |
|
|
188
|
+
| iOS | N/A | not yet | not yet | N/A | N/A | N/A | N/A |
|
|
189
|
+
|
|
190
|
+
1. **Features revealed from Linux.** We gather data from several sources
|
|
191
|
+
depending on availability:
|
|
192
|
+
+ from glibc's
|
|
193
|
+
[getauxval](https://www.gnu.org/software/libc/manual/html_node/Auxiliary-Vector.html)
|
|
194
|
+
+ by parsing `/proc/self/auxv`
|
|
195
|
+
+ by parsing `/proc/cpuinfo`
|
|
196
|
+
2. **Features revealed from CPU.** features are retrieved by using the `cpuid`
|
|
197
|
+
instruction.
|
|
198
|
+
3. **Microarchitecture detection.** On x86 some features are not always
|
|
199
|
+
implemented efficiently in hardware (e.g. AVX on Sandybridge). Exposing the
|
|
200
|
+
microarchitecture allows the client to reject particular microarchitectures.
|
|
201
|
+
4. All flavors of Mips are supported, little and big endian as well as 32/64
|
|
202
|
+
bits.
|
|
203
|
+
|
|
204
|
+
<a name="ndk"></a>
|
|
205
|
+
## Android NDK's drop in replacement
|
|
206
|
+
|
|
207
|
+
[cpu_features](https://github.com/google/cpu_features) is now officially
|
|
208
|
+
supporting Android and offers a drop in replacement of for the NDK's [cpu-features.h](https://android.googlesource.com/platform/ndk/+/main/sources/android/cpufeatures/cpu-features.h)
|
|
209
|
+
, see [ndk_compat](ndk_compat) folder for details.
|
|
210
|
+
|
|
211
|
+
<a name="license"></a>
|
|
212
|
+
## License
|
|
213
|
+
|
|
214
|
+
The cpu_features library is licensed under the terms of the Apache license.
|
|
215
|
+
See [LICENSE](LICENSE) for more information.
|
|
216
|
+
|
|
217
|
+
<a name="cmake"></a>
|
|
218
|
+
## Build with CMake
|
|
219
|
+
|
|
220
|
+
Please check the [CMake build instructions](cmake/README.md).
|
|
221
|
+
|
|
222
|
+
<a name="quickstart"></a>
|
|
223
|
+
### Quickstart
|
|
224
|
+
|
|
225
|
+
- Run `list_cpu_features`
|
|
226
|
+
```sh
|
|
227
|
+
cmake -S. -Bbuild -DBUILD_TESTING=OFF -DCMAKE_BUILD_TYPE=Release
|
|
228
|
+
cmake --build build --config Release -j
|
|
229
|
+
./build/list_cpu_features --json
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
_Note_: Use `--target ALL_BUILD` on the second line for `Visual Studio` and `XCode`.
|
|
233
|
+
|
|
234
|
+
- run tests
|
|
235
|
+
```sh
|
|
236
|
+
cmake -S. -Bbuild -DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Debug
|
|
237
|
+
cmake --build build --config Debug -j
|
|
238
|
+
cmake --build build --config Debug --target test
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
_Note_: Use `--target RUN_TESTS` on the last line for `Visual Studio` and `--target RUN_TEST` for `XCode`.
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
- install `cpu_features`
|
|
245
|
+
```sh
|
|
246
|
+
cmake --build build --config Release --target install -v
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
_Note_: Use `--target INSTALL` for `Visual Studio`.
|
|
250
|
+
|
|
251
|
+
_Note_: When using `Makefile` or `XCode` generator, you can use
|
|
252
|
+
[`DESTDIR`](https://www.gnu.org/software/make/manual/html_node/DESTDIR.html)
|
|
253
|
+
to install on a local repository.<br>
|
|
254
|
+
e.g.
|
|
255
|
+
```sh
|
|
256
|
+
cmake --build build --config Release --target install -v -- DESTDIR=install
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
<a name="bindings"></a>
|
|
260
|
+
## Community bindings
|
|
261
|
+
|
|
262
|
+
Links provided here are not affiliated with Google but are kindly provided by the OSS Community.
|
|
263
|
+
|
|
264
|
+
- .Net
|
|
265
|
+
- https://github.com/toor1245/cpu_features.NET
|
|
266
|
+
- Python
|
|
267
|
+
- https://github.com/Narasimha1997/py_cpu
|
|
268
|
+
- Java
|
|
269
|
+
- https://github.com/aecsocket/cpu-features-java
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
_Send PR to showcase your wrapper here_
|
|
@@ -0,0 +1,19 @@
|
|
|
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
|
+
)
|
|
10
|
+
|
|
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()
|
package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/bazel/platforms.bzl
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"""Defines global variables that lists target cpus"""
|
|
2
|
+
|
|
3
|
+
PLATFORM_CPU_X86_64 = ("@platforms//cpu:x86_64")
|
|
4
|
+
|
|
5
|
+
PLATFORM_CPU_ARM = ("@platforms//cpu:arm")
|
|
6
|
+
|
|
7
|
+
PLATFORM_CPU_ARM64 = ("@platforms//cpu:arm64")
|
|
8
|
+
|
|
9
|
+
PLATFORM_CPU_MIPS = ("@platforms//cpu:mips64")
|
|
10
|
+
|
|
11
|
+
PLATFORM_CPU_PPC = ("@platforms//cpu:ppc")
|
package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/cmake/README.md
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# CMake build instructions
|
|
2
|
+
|
|
3
|
+
## Recommended usage : Incorporating cpu_features into a CMake project
|
|
4
|
+
|
|
5
|
+
For API / ABI compatibility reasons, it is recommended to build and use
|
|
6
|
+
cpu_features in a subdirectory of your project or as an embedded dependency.
|
|
7
|
+
|
|
8
|
+
This is similar to the recommended usage of the googletest framework
|
|
9
|
+
( https://github.com/google/googletest/blob/main/googletest/README.md )
|
|
10
|
+
|
|
11
|
+
Build and use step-by-step
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
1- Download cpu_features and copy it in a sub-directory in your project.
|
|
15
|
+
or add cpu_features as a git-submodule in your project
|
|
16
|
+
|
|
17
|
+
2- You can then use the cmake command `add_subdirectory()` to include
|
|
18
|
+
cpu_features directly and use the `cpu_features` target in your project.
|
|
19
|
+
|
|
20
|
+
3- Add the `CpuFeature::cpu_features` target to the `target_link_libraries()` section of
|
|
21
|
+
your executable or of your library.
|
|
22
|
+
|
|
23
|
+
## Disabling tests
|
|
24
|
+
|
|
25
|
+
CMake default options for cpu_features is `Release` built type with tests
|
|
26
|
+
enabled. To disable testing set cmake `BUILD_TESTING` variable to `OFF`.
|
|
27
|
+
e.g.
|
|
28
|
+
```sh
|
|
29
|
+
cmake -S. -Bbuild -DBUILD_TESTING=OFF
|
|
30
|
+
```
|
package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/cmake/ci/Makefile
ADDED
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
PROJECT := cpu_features
|
|
2
|
+
BRANCH := $(shell git rev-parse --abbrev-ref HEAD)
|
|
3
|
+
SHA1 := $(shell git rev-parse --verify HEAD)
|
|
4
|
+
|
|
5
|
+
# General commands
|
|
6
|
+
.PHONY: help
|
|
7
|
+
BOLD=\e[1m
|
|
8
|
+
RESET=\e[0m
|
|
9
|
+
|
|
10
|
+
help:
|
|
11
|
+
@echo -e "${BOLD}SYNOPSIS${RESET}"
|
|
12
|
+
@echo -e "\tmake <target> [NOCACHE=1]"
|
|
13
|
+
@echo
|
|
14
|
+
@echo -e "${BOLD}DESCRIPTION${RESET}"
|
|
15
|
+
@echo -e "\ttest build inside docker container to have a reproductible build."
|
|
16
|
+
@echo
|
|
17
|
+
@echo -e "${BOLD}MAKE TARGETS${RESET}"
|
|
18
|
+
@echo -e "\t${BOLD}help${RESET}: display this help and exit."
|
|
19
|
+
@echo
|
|
20
|
+
@echo -e "\t${BOLD}amd64_<stage>${RESET}: build <stage> docker image using an Ubuntu:latest x86_64 base image."
|
|
21
|
+
@echo -e "\t${BOLD}save_amd64_<stage>${RESET}: Save the <stage> docker image."
|
|
22
|
+
@echo -e "\t${BOLD}sh_amd64_<stage>${RESET}: run a container using the <stage> docker image (debug purpose)."
|
|
23
|
+
@echo -e "\t${BOLD}clean_amd64_<stage>${RESET}: Remove cache and docker image."
|
|
24
|
+
@echo
|
|
25
|
+
@echo -e "\tWith ${BOLD}<stage>${RESET}:"
|
|
26
|
+
@echo -e "\t\t${BOLD}env${RESET}"
|
|
27
|
+
@echo -e "\t\t${BOLD}devel${RESET}"
|
|
28
|
+
@echo -e "\t\t${BOLD}build${RESET}"
|
|
29
|
+
@echo -e "\t\t${BOLD}test${RESET}"
|
|
30
|
+
@echo -e "\t\t${BOLD}install_env${RESET}"
|
|
31
|
+
@echo -e "\t\t${BOLD}install_devel${RESET}"
|
|
32
|
+
@echo -e "\t\t${BOLD}install_build${RESET}"
|
|
33
|
+
@echo -e "\t\t${BOLD}install_test${RESET}"
|
|
34
|
+
@echo -e "\te.g. 'make amd64_build'"
|
|
35
|
+
@echo
|
|
36
|
+
@echo -e "\t${BOLD}<target>_<toolchain_stage>${RESET}: build <stage> docker image for a specific toolchain target."
|
|
37
|
+
@echo -e "\t${BOLD}save_<target>_<toolchain_stage>${RESET}: Save the <stage> docker image for a specific platform."
|
|
38
|
+
@echo -e "\t${BOLD}sh_<target>_<toolchain_stage>${RESET}: run a container using the <stage> docker image specified (debug purpose)."
|
|
39
|
+
@echo -e "\t${BOLD}clean_<target>_<toolchain_stage>${RESET}: Remove cache and docker image."
|
|
40
|
+
@echo
|
|
41
|
+
@echo -e "\tWith ${BOLD}<target>${RESET}:"
|
|
42
|
+
@echo -e "\t\t${BOLD}arm-linux-gnueabihf${RESET} (linaro toolchain)"
|
|
43
|
+
@echo -e "\t\t${BOLD}armv8l-linux-gnueabihf${RESET} (linaro toolchain)"
|
|
44
|
+
@echo -e "\t\t${BOLD}arm-linux-gnueabi${RESET} (linaro toolchain)"
|
|
45
|
+
@echo -e "\t\t${BOLD}armeb-linux-gnueabihf${RESET} (linaro toolchain)"
|
|
46
|
+
@echo -e "\t\t${BOLD}armeb-linux-gnueabi${RESET} (linaro toolchain)"
|
|
47
|
+
@echo -e "\t\t${BOLD}aarch64-linux-gnu${RESET} (linaro toolchain)"
|
|
48
|
+
@echo -e "\t\t${BOLD}aarch64${RESET} (bootlin toolchain)"
|
|
49
|
+
@echo -e "\t\t${BOLD}aarch64_be-linux-gnu${RESET} (linaro toolchain)"
|
|
50
|
+
@echo -e "\t\t${BOLD}aarch64be${RESET} (bootlin toolchain)"
|
|
51
|
+
@echo -e "\t\t${BOLD}mips32${RESET} (codespace toolchain)"
|
|
52
|
+
@echo -e "\t\t${BOLD}mips64${RESET} (codespace toolchain)"
|
|
53
|
+
@echo -e "\t\t${BOLD}mips32el${RESET} (codespace toolchain)"
|
|
54
|
+
@echo -e "\t\t${BOLD}mips64el${RESET} (codespace toolchain)"
|
|
55
|
+
@echo -e "\t\t${BOLD}ppc${RESET} (bootlin toolchain)"
|
|
56
|
+
@echo -e "\t\t${BOLD}ppc64${RESET} (bootlin toolchain)"
|
|
57
|
+
@echo -e "\t\t${BOLD}ppc64le${RESET} (bootlin toolchain)"
|
|
58
|
+
@echo -e "\t\t${BOLD}riscv32${RESET} (bootlin toolchain)"
|
|
59
|
+
@echo -e "\t\t${BOLD}riscv64${RESET} (bootlin toolchain)"
|
|
60
|
+
@echo -e "\t\t${BOLD}s390x${RESET} (bootlin toolchain)"
|
|
61
|
+
@echo
|
|
62
|
+
@echo -e "\tWith ${BOLD}<toolchain_stage>${RESET}:"
|
|
63
|
+
@echo -e "\t\t${BOLD}env${RESET}"
|
|
64
|
+
@echo -e "\t\t${BOLD}devel${RESET}"
|
|
65
|
+
@echo -e "\t\t${BOLD}build${RESET}"
|
|
66
|
+
@echo -e "\t\t${BOLD}test${RESET}"
|
|
67
|
+
@echo -e "\te.g. 'make aarch64_test'"
|
|
68
|
+
@echo
|
|
69
|
+
@echo -e "\t${BOLD}<VM>${RESET}: build the vagrant <VM> virtual machine."
|
|
70
|
+
@echo -e "\t${BOLD}clean_<VM>${RESET}: Remove virtual machine for the specified vm."
|
|
71
|
+
@echo
|
|
72
|
+
@echo -e "\t${BOLD}<VM>${RESET}:"
|
|
73
|
+
@echo -e "\t\t${BOLD}freebsd${RESET} (FreeBSD)"
|
|
74
|
+
@echo
|
|
75
|
+
@echo -e "\t${BOLD}clean${RESET}: Remove cache and ALL docker images."
|
|
76
|
+
@echo
|
|
77
|
+
@echo -e "\t${BOLD}NOCACHE=1${RESET}: use 'docker build --no-cache' when building container (default use cache)."
|
|
78
|
+
@echo
|
|
79
|
+
@echo -e "branch: $(BRANCH)"
|
|
80
|
+
@echo -e "sha1: $(SHA1)"
|
|
81
|
+
|
|
82
|
+
# Need to add cmd_platform to PHONY otherwise target are ignored since they do not
|
|
83
|
+
# contain recipe (using FORCE do not work here)
|
|
84
|
+
.PHONY: all
|
|
85
|
+
all: build
|
|
86
|
+
|
|
87
|
+
# Delete all implicit rules to speed up makefile
|
|
88
|
+
MAKEFLAGS += --no-builtin-rules
|
|
89
|
+
.SUFFIXES:
|
|
90
|
+
# Remove some rules from gmake that .SUFFIXES does not remove.
|
|
91
|
+
SUFFIXES =
|
|
92
|
+
# Keep all intermediate files
|
|
93
|
+
# ToDo: try to remove it later
|
|
94
|
+
.SECONDARY:
|
|
95
|
+
|
|
96
|
+
# Docker image name prefix.
|
|
97
|
+
IMAGE := ${PROJECT}
|
|
98
|
+
|
|
99
|
+
ifdef NOCACHE
|
|
100
|
+
DOCKER_BUILD_CMD := docker build --no-cache
|
|
101
|
+
else
|
|
102
|
+
DOCKER_BUILD_CMD := docker build
|
|
103
|
+
endif
|
|
104
|
+
|
|
105
|
+
DOCKER_RUN_CMD := docker run --rm --init --net=host
|
|
106
|
+
|
|
107
|
+
# $* stem
|
|
108
|
+
# $< first prerequist
|
|
109
|
+
# $@ target name
|
|
110
|
+
|
|
111
|
+
############
|
|
112
|
+
## NATIVE ##
|
|
113
|
+
############
|
|
114
|
+
STAGES = env devel build test install_env install_devel install_build install_test
|
|
115
|
+
|
|
116
|
+
targets_amd64 = $(addprefix amd64_, $(STAGES))
|
|
117
|
+
.PHONY: $(targets_amd64)
|
|
118
|
+
$(targets_amd64): amd64_%: docker/amd64/Dockerfile
|
|
119
|
+
#@docker image rm -f ${IMAGE}:amd64_$* 2>/dev/null
|
|
120
|
+
${DOCKER_BUILD_CMD} \
|
|
121
|
+
--tag ${IMAGE}:amd64_$* \
|
|
122
|
+
--target=$* \
|
|
123
|
+
-f $< \
|
|
124
|
+
../..
|
|
125
|
+
|
|
126
|
+
#$(info Create targets: save_amd64 $(addprefix save_amd64_, $(STAGES)) (debug).)
|
|
127
|
+
save_targets_amd64 = $(addprefix save_amd64_, $(STAGES))
|
|
128
|
+
.PHONY: $(save_targets_amd64)
|
|
129
|
+
$(save_targets_amd64): save_amd64_%: cache/amd64/docker_%.tar
|
|
130
|
+
cache/amd64/docker_%.tar: amd64_%
|
|
131
|
+
@rm -f $@
|
|
132
|
+
mkdir -p cache/amd64
|
|
133
|
+
docker save ${IMAGE}:amd64_$* -o $@
|
|
134
|
+
|
|
135
|
+
#$(info Create targets: $(addprefix sh_amd64_, $(STAGES)) (debug).)
|
|
136
|
+
sh_targets_amd64 = $(addprefix sh_amd64_, $(STAGES))
|
|
137
|
+
.PHONY: $(sh_targets_amd64)
|
|
138
|
+
$(sh_targets_amd64): sh_amd64_%: amd64_%
|
|
139
|
+
${DOCKER_RUN_CMD} -it --name ${IMAGE}_amd64_$* ${IMAGE}:amd64_$*
|
|
140
|
+
|
|
141
|
+
#$(info Create targets: $(addprefix clean_amd64_, $(STAGES)).)
|
|
142
|
+
clean_targets_amd64 = $(addprefix clean_amd64_, $(STAGES))
|
|
143
|
+
.PHONY: clean_amd64 $(clean_targets_amd64)
|
|
144
|
+
clean_amd64: $(clean_targets_amd64)
|
|
145
|
+
$(clean_targets_amd64): clean_amd64_%:
|
|
146
|
+
docker image rm -f ${IMAGE}:amd64_$* 2>/dev/null
|
|
147
|
+
rm -f cache/amd64/docker_$*.tar
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
###############
|
|
151
|
+
## TOOLCHAIN ##
|
|
152
|
+
###############
|
|
153
|
+
TOOLCHAIN_TARGETS = \
|
|
154
|
+
aarch64 aarch64be \
|
|
155
|
+
arm-linux-gnueabihf armv8l-linux-gnueabihf arm-linux-gnueabi armeb-linux-gnueabihf armeb-linux-gnueabi \
|
|
156
|
+
aarch64-linux-gnu aarch64_be-linux-gnu \
|
|
157
|
+
mips32 mips32el mips64 mips64el \
|
|
158
|
+
ppc ppc64 ppc64le \
|
|
159
|
+
riscv32 riscv64 \
|
|
160
|
+
s390x
|
|
161
|
+
TOOLCHAIN_STAGES = env devel build test
|
|
162
|
+
define toolchain-stage-target =
|
|
163
|
+
#$$(info STAGE: $1)
|
|
164
|
+
#$$(info Create targets: toolchain_$1 $(addsuffix _$1, $(TOOLCHAIN_TARGETS)).)
|
|
165
|
+
targets_toolchain_$1 = $(addsuffix _$1, $(TOOLCHAIN_TARGETS))
|
|
166
|
+
.PHONY: toolchain_$1 $$(targets_toolchain_$1)
|
|
167
|
+
toolchain_$1: $$(targets_toolchain_$1)
|
|
168
|
+
$$(targets_toolchain_$1): %_$1: docker/toolchain/Dockerfile
|
|
169
|
+
#@docker image rm -f ${IMAGE}:$$*_$1 2>/dev/null
|
|
170
|
+
${DOCKER_BUILD_CMD} \
|
|
171
|
+
--tag ${IMAGE}:$$*_$1 \
|
|
172
|
+
--build-arg TARGET=$$* \
|
|
173
|
+
--target=$1 \
|
|
174
|
+
-f $$< \
|
|
175
|
+
../..
|
|
176
|
+
|
|
177
|
+
#$$(info Create targets: save_toolchain_$1 $(addprefix save_, $(addsuffix _$1, $(TOOLCHAIN_TARGETS))) (debug).)
|
|
178
|
+
save_targets_toolchain_$1 = $(addprefix save_, $(addsuffix _$1, $(TOOLCHAIN_TARGETS)))
|
|
179
|
+
.PHONY: save_toolchain_$1 $$(save_targets_toolchain_$1)
|
|
180
|
+
save_toolchain_$1: $$(save_targets_toolchain_$1)
|
|
181
|
+
$$(save_targets_toolchain_$1): save_%_$1: cache/%/docker_$1.tar
|
|
182
|
+
cache/%/docker_$1.tar: %_$1
|
|
183
|
+
@rm -f $$@
|
|
184
|
+
mkdir -p cache/$$*
|
|
185
|
+
docker save ${IMAGE}:$$*_$1 -o $$@
|
|
186
|
+
|
|
187
|
+
#$$(info Create targets: $(addprefix sh_, $(addsuffix _$1, $(TOOLCHAIN_TARGETS))) (debug).)
|
|
188
|
+
sh_targets_toolchain_$1 = $(addprefix sh_, $(addsuffix _$1, $(TOOLCHAIN_TARGETS)))
|
|
189
|
+
.PHONY: $$(sh_targets_toolchain_$1)
|
|
190
|
+
$$(sh_targets_toolchain_$1): sh_%_$1: %_$1
|
|
191
|
+
${DOCKER_RUN_CMD} -it --name ${IMAGE}_$$*_$1 ${IMAGE}:$$*_$1
|
|
192
|
+
|
|
193
|
+
#$$(info Create targets: clean_toolchain_$1 $(addprefix clean_, $(addsuffix _$1, $(TOOLCHAIN_TARGETS))).)
|
|
194
|
+
clean_targets_toolchain_$1 = $(addprefix clean_, $(addsuffix _$1, $(TOOLCHAIN_TARGETS)))
|
|
195
|
+
.PHONY: clean_toolchain_$1 $$(clean_targets_toolchain_$1)
|
|
196
|
+
clean_toolchain_$1: $$(clean_targets_toolchain_$1)
|
|
197
|
+
$$(clean_targets_toolchain_$1): clean_%_$1:
|
|
198
|
+
docker image rm -f ${IMAGE}:$$*_$1 2>/dev/null
|
|
199
|
+
rm -f cache/$$*/docker_$1.tar
|
|
200
|
+
endef
|
|
201
|
+
|
|
202
|
+
$(foreach stage,$(TOOLCHAIN_STAGES),$(eval $(call toolchain-stage-target,$(stage))))
|
|
203
|
+
|
|
204
|
+
## MERGE ##
|
|
205
|
+
.PHONY: clean_toolchain
|
|
206
|
+
clean_toolchain: $(addprefix clean_toolchain_, $(TOOLCHAIN_STAGES))
|
|
207
|
+
-rmdir $(addprefix cache/, $(TOOLCHAIN_TARGETS))
|
|
208
|
+
|
|
209
|
+
.PHONY: env devel build test
|
|
210
|
+
env: amd64_env toolchain_env
|
|
211
|
+
devel: amd64_devel toolchain_devel
|
|
212
|
+
build: amd64_build toolchain_build
|
|
213
|
+
test: amd64_test toolchain_test
|
|
214
|
+
|
|
215
|
+
.PHONY: install_env install_devel install_build install_test
|
|
216
|
+
install_env: amd64_install_env
|
|
217
|
+
install_devel: amd64_install_devel
|
|
218
|
+
install_build: amd64_install_build
|
|
219
|
+
install_test: amd64_install_test
|
|
220
|
+
|
|
221
|
+
#############
|
|
222
|
+
## VAGRANT ##
|
|
223
|
+
#############
|
|
224
|
+
VMS = freebsd
|
|
225
|
+
|
|
226
|
+
vms_targets = $(addsuffix _build, $(VMS))
|
|
227
|
+
.PHONY: $(vms_targets)
|
|
228
|
+
$(vms_targets): %_build: vagrant/%/Vagrantfile
|
|
229
|
+
@cd vagrant/$* && vagrant destroy -f
|
|
230
|
+
cd vagrant/$* && vagrant up
|
|
231
|
+
|
|
232
|
+
clean_vms_targets = $(addprefix clean_, $(VMS))
|
|
233
|
+
.PHONY: clean_vms $(clean_vms_targets)
|
|
234
|
+
clean_vms: $(clean_vms_targets)
|
|
235
|
+
$(clean_vms_targets): clean_%:
|
|
236
|
+
cd vagrant/$* && vagrant destroy -f
|
|
237
|
+
-rm -rf vagrant/$*/.vagrant
|
|
238
|
+
|
|
239
|
+
###########
|
|
240
|
+
## CLEAN ##
|
|
241
|
+
###########
|
|
242
|
+
.PHONY: clean
|
|
243
|
+
clean: clean_amd64 clean_toolchain clean_vms
|
|
244
|
+
docker container prune -f
|
|
245
|
+
docker image prune -f
|
|
246
|
+
-rmdir cache
|
|
247
|
+
|
|
248
|
+
.PHONY: distclean
|
|
249
|
+
distclean: clean
|
|
250
|
+
-docker container rm -f $$(docker container ls -aq)
|
|
251
|
+
-docker image rm -f $$(docker image ls -aq)
|
|
252
|
+
-vagrant box remove -f generic/freebsd12
|
package/resources/app.asar.unpacked/node_modules/cpu-features/deps/cpu_features/cmake/ci/README.md
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
## Makefile/Docker testing
|
|
2
|
+
To test the build on various distro, we are using docker containers and a Makefile for orchestration.
|
|
3
|
+
|
|
4
|
+
pros:
|
|
5
|
+
* You are independent of third party CI runner config
|
|
6
|
+
(e.g. [github action virtual-environnments](https://github.com/actions/virtual-environments)).
|
|
7
|
+
* You can run it locally on your linux system.
|
|
8
|
+
* Most CI provide runners with docker and Makefile installed.
|
|
9
|
+
|
|
10
|
+
cons:
|
|
11
|
+
* Only GNU/Linux distro supported.
|
|
12
|
+
|
|
13
|
+
### Usage
|
|
14
|
+
To get the help simply type:
|
|
15
|
+
```sh
|
|
16
|
+
make
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
note: you can also use from top directory
|
|
20
|
+
```sh
|
|
21
|
+
make --directory=cmake/ci
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### Example
|
|
25
|
+
For example to test mips32 inside an container:
|
|
26
|
+
```sh
|
|
27
|
+
make mips32_test
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### Docker layers
|
|
31
|
+
Dockerfile is splitted in several stages.
|
|
32
|
+
|
|
33
|
+

|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
## Makefile/Vagrant testing
|
|
37
|
+
To test build for FreeBSD we are using Vagrant and VirtualBox box.
|
|
38
|
+
|
|
39
|
+
This is similar to the docker stuff but use `vagrant` as `docker` cli and
|
|
40
|
+
VirtuaBox to replace the docker engine daemon.
|