dsh-remote 0.8.50 → 0.8.52

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.
Files changed (136) hide show
  1. package/README.en.md +8 -0
  2. package/README.md +22 -0
  3. package/lib/client.js +15 -3
  4. package/lib/index.js +269 -8
  5. package/lib/instructions.js +288 -0
  6. package/lib/openssh.js +10 -1
  7. package/lib/pool.js +29 -1
  8. package/lib/remote-fs.js +26 -1
  9. package/lib/sftp-surface.js +46 -3
  10. package/lib/sshconfig.js +13 -3
  11. package/node_modules/buildcheck/.eslintrc.js +5 -0
  12. package/node_modules/buildcheck/.github/workflows/ci.yml +88 -0
  13. package/node_modules/buildcheck/.github/workflows/lint.yml +27 -0
  14. package/node_modules/buildcheck/.npmignore +3 -0
  15. package/node_modules/buildcheck/LICENSE +19 -0
  16. package/node_modules/buildcheck/README.md +106 -0
  17. package/node_modules/buildcheck/deps/Find-VisualStudio.cs +250 -0
  18. package/node_modules/buildcheck/lib/findvs.js +361 -0
  19. package/node_modules/buildcheck/lib/index.js +738 -0
  20. package/node_modules/buildcheck/package.json +36 -0
  21. package/node_modules/buildcheck/test/test.js +8 -0
  22. package/node_modules/cpu-features/.eslintrc.js +5 -0
  23. package/node_modules/cpu-features/.github/workflows/ci.yml +74 -0
  24. package/node_modules/cpu-features/.github/workflows/lint.yml +27 -0
  25. package/node_modules/cpu-features/LICENSE +19 -0
  26. package/node_modules/cpu-features/README.md +59 -0
  27. package/node_modules/cpu-features/binding.gyp +16 -0
  28. package/node_modules/cpu-features/buildcheck.js +32 -0
  29. package/node_modules/cpu-features/deps/cpu_features/.clang-format +4 -0
  30. package/node_modules/cpu-features/deps/cpu_features/.dockerignore +31 -0
  31. package/node_modules/cpu-features/deps/cpu_features/.github/workflows/Dockerfile +5 -0
  32. package/node_modules/cpu-features/deps/cpu_features/.github/workflows/aarch64_linux_cmake.yml +30 -0
  33. package/node_modules/cpu-features/deps/cpu_features/.github/workflows/amd64_freebsd_cmake.yml +22 -0
  34. package/node_modules/cpu-features/deps/cpu_features/.github/workflows/amd64_linux_bazel.yml +26 -0
  35. package/node_modules/cpu-features/deps/cpu_features/.github/workflows/amd64_linux_cmake.yml +31 -0
  36. package/node_modules/cpu-features/deps/cpu_features/.github/workflows/amd64_macos_cmake.yml +43 -0
  37. package/node_modules/cpu-features/deps/cpu_features/.github/workflows/amd64_windows_cmake.yml +25 -0
  38. package/node_modules/cpu-features/deps/cpu_features/.github/workflows/arm_linux_cmake.yml +31 -0
  39. package/node_modules/cpu-features/deps/cpu_features/.github/workflows/clang_format.yml +24 -0
  40. package/node_modules/cpu-features/deps/cpu_features/.github/workflows/mips_linux_cmake.yml +30 -0
  41. package/node_modules/cpu-features/deps/cpu_features/.github/workflows/power_linux_cmake.yml +29 -0
  42. package/node_modules/cpu-features/deps/cpu_features/.github/workflows/riscv_linux_cmake.yml +28 -0
  43. package/node_modules/cpu-features/deps/cpu_features/.github/workflows/s390x_linux_cmake.yml +27 -0
  44. package/node_modules/cpu-features/deps/cpu_features/.grenrc.yml +21 -0
  45. package/node_modules/cpu-features/deps/cpu_features/BUILD.bazel +329 -0
  46. package/node_modules/cpu-features/deps/cpu_features/CMakeLists.txt +261 -0
  47. package/node_modules/cpu-features/deps/cpu_features/CONTRIBUTING.md +23 -0
  48. package/node_modules/cpu-features/deps/cpu_features/LICENSE +230 -0
  49. package/node_modules/cpu-features/deps/cpu_features/README.md +272 -0
  50. package/node_modules/cpu-features/deps/cpu_features/WORKSPACE +19 -0
  51. package/node_modules/cpu-features/deps/cpu_features/bazel/ci/README.md +5 -0
  52. package/node_modules/cpu-features/deps/cpu_features/bazel/platforms.bzl +11 -0
  53. package/node_modules/cpu-features/deps/cpu_features/cmake/CpuFeaturesConfig.cmake.in +3 -0
  54. package/node_modules/cpu-features/deps/cpu_features/cmake/CpuFeaturesNdkCompatConfig.cmake.in +3 -0
  55. package/node_modules/cpu-features/deps/cpu_features/cmake/README.md +30 -0
  56. package/node_modules/cpu-features/deps/cpu_features/cmake/ci/Makefile +252 -0
  57. package/node_modules/cpu-features/deps/cpu_features/cmake/ci/README.md +40 -0
  58. package/node_modules/cpu-features/deps/cpu_features/cmake/ci/doc/docker.dot +64 -0
  59. package/node_modules/cpu-features/deps/cpu_features/cmake/ci/doc/docker.svg +312 -0
  60. package/node_modules/cpu-features/deps/cpu_features/cmake/ci/doc/generate_image.sh +7 -0
  61. package/node_modules/cpu-features/deps/cpu_features/cmake/ci/docker/amd64/Dockerfile +48 -0
  62. package/node_modules/cpu-features/deps/cpu_features/cmake/ci/docker/toolchain/Dockerfile +34 -0
  63. package/node_modules/cpu-features/deps/cpu_features/cmake/ci/sample/CMakeLists.txt +22 -0
  64. package/node_modules/cpu-features/deps/cpu_features/cmake/ci/sample/main.cpp +11 -0
  65. package/node_modules/cpu-features/deps/cpu_features/cmake/ci/vagrant/freebsd/Vagrantfile +107 -0
  66. package/node_modules/cpu-features/deps/cpu_features/cmake/googletest.CMakeLists.txt.in +15 -0
  67. package/node_modules/cpu-features/deps/cpu_features/cpu_features.gyp +105 -0
  68. package/node_modules/cpu-features/deps/cpu_features/include/cpu_features_cache_info.h +54 -0
  69. package/node_modules/cpu-features/deps/cpu_features/include/cpu_features_macros.h +384 -0
  70. package/node_modules/cpu-features/deps/cpu_features/include/cpuinfo_aarch64.h +259 -0
  71. package/node_modules/cpu-features/deps/cpu_features/include/cpuinfo_arm.h +121 -0
  72. package/node_modules/cpu-features/deps/cpu_features/include/cpuinfo_mips.h +74 -0
  73. package/node_modules/cpu-features/deps/cpu_features/include/cpuinfo_ppc.h +149 -0
  74. package/node_modules/cpu-features/deps/cpu_features/include/cpuinfo_riscv.h +72 -0
  75. package/node_modules/cpu-features/deps/cpu_features/include/cpuinfo_s390x.h +108 -0
  76. package/node_modules/cpu-features/deps/cpu_features/include/cpuinfo_x86.h +288 -0
  77. package/node_modules/cpu-features/deps/cpu_features/include/internal/bit_utils.h +40 -0
  78. package/node_modules/cpu-features/deps/cpu_features/include/internal/cpuid_x86.h +37 -0
  79. package/node_modules/cpu-features/deps/cpu_features/include/internal/filesystem.h +39 -0
  80. package/node_modules/cpu-features/deps/cpu_features/include/internal/hwcaps.h +240 -0
  81. package/node_modules/cpu-features/deps/cpu_features/include/internal/stack_line_reader.h +49 -0
  82. package/node_modules/cpu-features/deps/cpu_features/include/internal/string_view.h +110 -0
  83. package/node_modules/cpu-features/deps/cpu_features/include/internal/windows_utils.h +70 -0
  84. package/node_modules/cpu-features/deps/cpu_features/ndk_compat/CMakeLists.txt +60 -0
  85. package/node_modules/cpu-features/deps/cpu_features/ndk_compat/README.md +4 -0
  86. package/node_modules/cpu-features/deps/cpu_features/ndk_compat/cpu-features.c +205 -0
  87. package/node_modules/cpu-features/deps/cpu_features/ndk_compat/cpu-features.h +320 -0
  88. package/node_modules/cpu-features/deps/cpu_features/ndk_compat/ndk-compat-test.c +12 -0
  89. package/node_modules/cpu-features/deps/cpu_features/patches/0001-Add-Apple-Silicon-Support.patch +456 -0
  90. package/node_modules/cpu-features/deps/cpu_features/scripts/generate_badges.d +165 -0
  91. package/node_modules/cpu-features/deps/cpu_features/scripts/make_release.sh +75 -0
  92. package/node_modules/cpu-features/deps/cpu_features/scripts/run_integration.sh +490 -0
  93. package/node_modules/cpu-features/deps/cpu_features/scripts/test_integration.sh +79 -0
  94. package/node_modules/cpu-features/deps/cpu_features/src/copy.inl +19 -0
  95. package/node_modules/cpu-features/deps/cpu_features/src/define_introspection.inl +86 -0
  96. package/node_modules/cpu-features/deps/cpu_features/src/define_introspection_and_hwcaps.inl +26 -0
  97. package/node_modules/cpu-features/deps/cpu_features/src/equals.inl +22 -0
  98. package/node_modules/cpu-features/deps/cpu_features/src/filesystem.c +62 -0
  99. package/node_modules/cpu-features/deps/cpu_features/src/hwcaps.c +169 -0
  100. package/node_modules/cpu-features/deps/cpu_features/src/impl_aarch64__base_implementation.inl +88 -0
  101. package/node_modules/cpu-features/deps/cpu_features/src/impl_aarch64_linux_or_android.c +79 -0
  102. package/node_modules/cpu-features/deps/cpu_features/src/impl_aarch64_macos_or_iphone.c +82 -0
  103. package/node_modules/cpu-features/deps/cpu_features/src/impl_aarch64_windows.c +138 -0
  104. package/node_modules/cpu-features/deps/cpu_features/src/impl_arm_linux_or_android.c +212 -0
  105. package/node_modules/cpu-features/deps/cpu_features/src/impl_mips_linux_or_android.c +93 -0
  106. package/node_modules/cpu-features/deps/cpu_features/src/impl_ppc_linux.c +163 -0
  107. package/node_modules/cpu-features/deps/cpu_features/src/impl_riscv_linux.c +111 -0
  108. package/node_modules/cpu-features/deps/cpu_features/src/impl_s390x_linux.c +120 -0
  109. package/node_modules/cpu-features/deps/cpu_features/src/impl_x86__base_implementation.inl +2055 -0
  110. package/node_modules/cpu-features/deps/cpu_features/src/impl_x86_freebsd.c +68 -0
  111. package/node_modules/cpu-features/deps/cpu_features/src/impl_x86_linux_or_android.c +58 -0
  112. package/node_modules/cpu-features/deps/cpu_features/src/impl_x86_macos.c +57 -0
  113. package/node_modules/cpu-features/deps/cpu_features/src/impl_x86_windows.c +58 -0
  114. package/node_modules/cpu-features/deps/cpu_features/src/stack_line_reader.c +132 -0
  115. package/node_modules/cpu-features/deps/cpu_features/src/string_view.c +192 -0
  116. package/node_modules/cpu-features/deps/cpu_features/src/utils/list_cpu_features.c +461 -0
  117. package/node_modules/cpu-features/deps/cpu_features/test/CMakeLists.txt +114 -0
  118. package/node_modules/cpu-features/deps/cpu_features/test/bit_utils_test.cc +53 -0
  119. package/node_modules/cpu-features/deps/cpu_features/test/cpuinfo_aarch64_test.cc +396 -0
  120. package/node_modules/cpu-features/deps/cpu_features/test/cpuinfo_arm_test.cc +384 -0
  121. package/node_modules/cpu-features/deps/cpu_features/test/cpuinfo_mips_test.cc +176 -0
  122. package/node_modules/cpu-features/deps/cpu_features/test/cpuinfo_ppc_test.cc +131 -0
  123. package/node_modules/cpu-features/deps/cpu_features/test/cpuinfo_riscv_test.cc +180 -0
  124. package/node_modules/cpu-features/deps/cpu_features/test/cpuinfo_s390x_test.cc +82 -0
  125. package/node_modules/cpu-features/deps/cpu_features/test/cpuinfo_x86_test.cc +1729 -0
  126. package/node_modules/cpu-features/deps/cpu_features/test/filesystem_for_testing.cc +103 -0
  127. package/node_modules/cpu-features/deps/cpu_features/test/filesystem_for_testing.h +61 -0
  128. package/node_modules/cpu-features/deps/cpu_features/test/hwcaps_for_testing.cc +52 -0
  129. package/node_modules/cpu-features/deps/cpu_features/test/hwcaps_for_testing.h +31 -0
  130. package/node_modules/cpu-features/deps/cpu_features/test/stack_line_reader_test.cc +132 -0
  131. package/node_modules/cpu-features/deps/cpu_features/test/string_view_test.cc +202 -0
  132. package/node_modules/cpu-features/lib/index.js +5 -0
  133. package/node_modules/cpu-features/package.json +40 -0
  134. package/node_modules/cpu-features/src/binding.cc +151 -0
  135. package/node_modules/cpu-features/test/test.js +12 -0
  136. package/package.json +1 -1
@@ -0,0 +1,27 @@
1
+ name: s390x Linux CMake
2
+
3
+ on:
4
+ push:
5
+ pull_request:
6
+ schedule:
7
+ # min hours day(month) month day(week)
8
+ - cron: '0 0 7,22 * *'
9
+
10
+ jobs:
11
+ # Building using the github runner environement directly.
12
+ make:
13
+ runs-on: ubuntu-latest
14
+ strategy:
15
+ matrix:
16
+ targets: [
17
+ [s390x],
18
+ ]
19
+ fail-fast: false
20
+ env:
21
+ TARGET: ${{ matrix.targets[0] }}
22
+ steps:
23
+ - uses: actions/checkout@v2
24
+ - name: Build
25
+ run: make --directory=cmake/ci ${TARGET}_build
26
+ - name: Test
27
+ run: make --directory=cmake/ci ${TARGET}_test
@@ -0,0 +1,21 @@
1
+ ---
2
+ dataSource: "prs"
3
+ ignoreLabels:
4
+ - "Apple M1"
5
+ - "duplicate"
6
+ - "help wanted"
7
+ - "invalid"
8
+ - "question"
9
+ - "wontfix"
10
+ onlyMilestones: false
11
+ groupBy:
12
+ "API Change":
13
+ - "API Change"
14
+ "New features / Enhancements":
15
+ - "enhancement"
16
+ - "internal"
17
+ "Bug Fixes":
18
+ - "bug"
19
+ "Misc":
20
+ - "misc"
21
+ changelogFilename: "CHANGELOG.md"
@@ -0,0 +1,329 @@
1
+ # cpu_features, a cross platform C99 library to get cpu features at runtime.
2
+
3
+ load("@bazel_skylib//lib:selects.bzl", "selects")
4
+ load("//:bazel/platforms.bzl", "PLATFORM_CPU_ARM", "PLATFORM_CPU_ARM64", "PLATFORM_CPU_MIPS", "PLATFORM_CPU_PPC", "PLATFORM_CPU_X86_64")
5
+
6
+ package(
7
+ default_visibility = ["//visibility:public"],
8
+ licenses = ["notice"],
9
+ )
10
+
11
+ exports_files(["LICENSE"])
12
+
13
+ INCLUDES = ["include"]
14
+
15
+ C99_FLAGS = [
16
+ "-std=c99",
17
+ "-Wall",
18
+ "-Wextra",
19
+ "-Wmissing-declarations",
20
+ "-Wmissing-prototypes",
21
+ "-Wno-implicit-fallthrough",
22
+ "-Wno-unused-function",
23
+ "-Wold-style-definition",
24
+ "-Wshadow",
25
+ "-Wsign-compare",
26
+ "-Wstrict-prototypes",
27
+ ]
28
+
29
+ cc_library(
30
+ name = "cpu_features_macros",
31
+ copts = C99_FLAGS,
32
+ includes = INCLUDES,
33
+ textual_hdrs = ["include/cpu_features_macros.h"],
34
+ )
35
+
36
+ cc_library(
37
+ name = "cpu_features_cache_info",
38
+ copts = C99_FLAGS,
39
+ includes = INCLUDES,
40
+ textual_hdrs = ["include/cpu_features_cache_info.h"],
41
+ deps = [":cpu_features_macros"],
42
+ )
43
+
44
+ cc_library(
45
+ name = "bit_utils",
46
+ copts = C99_FLAGS,
47
+ includes = INCLUDES,
48
+ textual_hdrs = ["include/internal/bit_utils.h"],
49
+ deps = [":cpu_features_macros"],
50
+ )
51
+
52
+ cc_test(
53
+ name = "bit_utils_test",
54
+ srcs = ["test/bit_utils_test.cc"],
55
+ includes = INCLUDES,
56
+ deps = [
57
+ ":bit_utils",
58
+ "@com_google_googletest//:gtest_main",
59
+ ],
60
+ )
61
+
62
+ cc_library(
63
+ name = "memory_utils",
64
+ copts = C99_FLAGS,
65
+ includes = INCLUDES,
66
+ textual_hdrs = [
67
+ "src/copy.inl",
68
+ "src/equals.inl",
69
+ ],
70
+ )
71
+
72
+ cc_library(
73
+ name = "string_view",
74
+ srcs = [
75
+ "src/string_view.c",
76
+ ],
77
+ copts = C99_FLAGS,
78
+ includes = INCLUDES,
79
+ textual_hdrs = ["include/internal/string_view.h"],
80
+ deps = [
81
+ ":cpu_features_macros",
82
+ ":memory_utils",
83
+ ],
84
+ )
85
+
86
+ cc_test(
87
+ name = "string_view_test",
88
+ srcs = ["test/string_view_test.cc"],
89
+ includes = INCLUDES,
90
+ deps = [
91
+ ":string_view",
92
+ "@com_google_googletest//:gtest_main",
93
+ ],
94
+ )
95
+
96
+ cc_library(
97
+ name = "filesystem",
98
+ srcs = ["src/filesystem.c"],
99
+ copts = C99_FLAGS,
100
+ includes = INCLUDES,
101
+ textual_hdrs = ["include/internal/filesystem.h"],
102
+ deps = [":cpu_features_macros"],
103
+ )
104
+
105
+ cc_library(
106
+ name = "filesystem_for_testing",
107
+ testonly = 1,
108
+ srcs = [
109
+ "src/filesystem.c",
110
+ "test/filesystem_for_testing.cc",
111
+ ],
112
+ hdrs = [
113
+ "include/internal/filesystem.h",
114
+ "test/filesystem_for_testing.h",
115
+ ],
116
+ defines = ["CPU_FEATURES_MOCK_FILESYSTEM"],
117
+ includes = INCLUDES,
118
+ deps = [
119
+ ":cpu_features_macros",
120
+ ],
121
+ )
122
+
123
+ cc_library(
124
+ name = "stack_line_reader",
125
+ srcs = ["src/stack_line_reader.c"],
126
+ copts = C99_FLAGS,
127
+ defines = ["STACK_LINE_READER_BUFFER_SIZE=1024"],
128
+ includes = INCLUDES,
129
+ textual_hdrs = ["include/internal/stack_line_reader.h"],
130
+ deps = [
131
+ ":cpu_features_macros",
132
+ ":filesystem",
133
+ ":string_view",
134
+ ],
135
+ )
136
+
137
+ cc_test(
138
+ name = "stack_line_reader_test",
139
+ srcs = [
140
+ "include/internal/stack_line_reader.h",
141
+ "src/stack_line_reader.c",
142
+ "test/stack_line_reader_test.cc",
143
+ ],
144
+ defines = ["STACK_LINE_READER_BUFFER_SIZE=16"],
145
+ includes = INCLUDES,
146
+ deps = [
147
+ ":cpu_features_macros",
148
+ ":filesystem_for_testing",
149
+ ":string_view",
150
+ "@com_google_googletest//:gtest_main",
151
+ ],
152
+ )
153
+
154
+ cc_library(
155
+ name = "stack_line_reader_to_use_with_filesystem_for_testing",
156
+ testonly = 1,
157
+ srcs = ["src/stack_line_reader.c"],
158
+ hdrs = ["include/internal/stack_line_reader.h"],
159
+ copts = C99_FLAGS,
160
+ defines = ["STACK_LINE_READER_BUFFER_SIZE=1024"],
161
+ includes = INCLUDES,
162
+ deps = [
163
+ ":cpu_features_macros",
164
+ ":filesystem_for_testing",
165
+ ":string_view",
166
+ ],
167
+ )
168
+
169
+ cc_library(
170
+ name = "hwcaps",
171
+ srcs = ["src/hwcaps.c"],
172
+ copts = C99_FLAGS,
173
+ defines = ["HAVE_STRONG_GETAUXVAL"],
174
+ includes = INCLUDES,
175
+ textual_hdrs = ["include/internal/hwcaps.h"],
176
+ deps = [
177
+ ":cpu_features_macros",
178
+ ":filesystem",
179
+ ":string_view",
180
+ ],
181
+ )
182
+
183
+ cc_library(
184
+ name = "hwcaps_for_testing",
185
+ testonly = 1,
186
+ srcs = [
187
+ "src/hwcaps.c",
188
+ "test/hwcaps_for_testing.cc",
189
+ ],
190
+ hdrs = [
191
+ "include/internal/hwcaps.h",
192
+ "test/hwcaps_for_testing.h",
193
+ ],
194
+ defines = [
195
+ "CPU_FEATURES_MOCK_GET_ELF_HWCAP_FROM_GETAUXVAL",
196
+ "CPU_FEATURES_TEST",
197
+ ],
198
+ includes = INCLUDES,
199
+ deps = [
200
+ ":cpu_features_macros",
201
+ ":filesystem_for_testing",
202
+ ":string_view",
203
+ ],
204
+ )
205
+
206
+ cc_library(
207
+ name = "cpuinfo",
208
+ srcs = selects.with_or({
209
+ PLATFORM_CPU_X86_64: [
210
+ "src/impl_x86_freebsd.c",
211
+ "src/impl_x86_linux_or_android.c",
212
+ "src/impl_x86_macos.c",
213
+ "src/impl_x86_windows.c",
214
+ ],
215
+ PLATFORM_CPU_ARM: ["src/impl_arm_linux_or_android.c"],
216
+ PLATFORM_CPU_ARM64: ["src/impl_aarch64_linux_or_android.c"],
217
+ PLATFORM_CPU_MIPS: ["src/impl_mips_linux_or_android.c"],
218
+ PLATFORM_CPU_PPC: ["src/impl_ppc_linux.c"],
219
+ }),
220
+ copts = C99_FLAGS,
221
+ includes = INCLUDES,
222
+ textual_hdrs = selects.with_or({
223
+ PLATFORM_CPU_X86_64: [
224
+ "src/impl_x86__base_implementation.inl",
225
+ "include/cpuinfo_x86.h",
226
+ "include/internal/cpuid_x86.h",
227
+ "include/internal/windows_utils.h",
228
+ ],
229
+ PLATFORM_CPU_ARM: ["include/cpuinfo_arm.h"],
230
+ PLATFORM_CPU_ARM64: ["include/cpuinfo_aarch64.h"],
231
+ PLATFORM_CPU_MIPS: ["include/cpuinfo_mips.h"],
232
+ PLATFORM_CPU_PPC: ["include/cpuinfo_ppc.h"],
233
+ }) + [
234
+ "src/define_introspection.inl",
235
+ "src/define_introspection_and_hwcaps.inl",
236
+ ],
237
+ deps = [
238
+ ":bit_utils",
239
+ ":cpu_features_cache_info",
240
+ ":cpu_features_macros",
241
+ ":filesystem",
242
+ ":hwcaps",
243
+ ":memory_utils",
244
+ ":stack_line_reader",
245
+ ":string_view",
246
+ ],
247
+ )
248
+
249
+ cc_library(
250
+ name = "cpuinfo_for_testing",
251
+ testonly = 1,
252
+ srcs = selects.with_or({
253
+ PLATFORM_CPU_X86_64: [
254
+ "src/impl_x86_freebsd.c",
255
+ "src/impl_x86_linux_or_android.c",
256
+ "src/impl_x86_macos.c",
257
+ "src/impl_x86_windows.c",
258
+ ],
259
+ PLATFORM_CPU_ARM: ["src/impl_arm_linux_or_android.c"],
260
+ PLATFORM_CPU_ARM64: ["src/impl_aarch64_linux_or_android.c"],
261
+ PLATFORM_CPU_MIPS: ["src/impl_mips_linux_or_android.c"],
262
+ PLATFORM_CPU_PPC: ["src/impl_ppc_linux.c"],
263
+ }),
264
+ hdrs = selects.with_or({
265
+ PLATFORM_CPU_X86_64: [
266
+ "include/cpuinfo_x86.h",
267
+ "include/internal/cpuid_x86.h",
268
+ "include/internal/windows_utils.h",
269
+ ],
270
+ PLATFORM_CPU_ARM: ["include/cpuinfo_arm.h"],
271
+ PLATFORM_CPU_ARM64: ["include/cpuinfo_aarch64.h"],
272
+ PLATFORM_CPU_MIPS: ["include/cpuinfo_mips.h"],
273
+ PLATFORM_CPU_PPC: ["include/cpuinfo_ppc.h"],
274
+ }),
275
+ copts = C99_FLAGS,
276
+ defines = selects.with_or({
277
+ PLATFORM_CPU_X86_64: ["CPU_FEATURES_MOCK_CPUID_X86"],
278
+ "//conditions:default": [],
279
+ }),
280
+ includes = INCLUDES,
281
+ textual_hdrs = selects.with_or({
282
+ PLATFORM_CPU_X86_64: ["src/impl_x86__base_implementation.inl"],
283
+ "//conditions:default": [],
284
+ }) + [
285
+ "src/define_introspection.inl",
286
+ "src/define_introspection_and_hwcaps.inl",
287
+ ],
288
+ deps = [
289
+ ":bit_utils",
290
+ ":cpu_features_cache_info",
291
+ ":cpu_features_macros",
292
+ ":filesystem_for_testing",
293
+ ":hwcaps_for_testing",
294
+ ":memory_utils",
295
+ ":stack_line_reader_to_use_with_filesystem_for_testing",
296
+ ":string_view",
297
+ ],
298
+ )
299
+
300
+ cc_test(
301
+ name = "cpuinfo_test",
302
+ srcs = selects.with_or({
303
+ PLATFORM_CPU_ARM64: ["test/cpuinfo_aarch64_test.cc"],
304
+ PLATFORM_CPU_ARM: ["test/cpuinfo_arm_test.cc"],
305
+ PLATFORM_CPU_MIPS: ["test/cpuinfo_mips_test.cc"],
306
+ PLATFORM_CPU_PPC: ["test/cpuinfo_ppc_test.cc"],
307
+ PLATFORM_CPU_X86_64: ["test/cpuinfo_x86_test.cc"],
308
+ }),
309
+ includes = INCLUDES,
310
+ deps = [
311
+ ":cpuinfo_for_testing",
312
+ ":filesystem_for_testing",
313
+ ":hwcaps_for_testing",
314
+ ":string_view",
315
+ "@com_google_googletest//:gtest_main",
316
+ ],
317
+ )
318
+
319
+ cc_binary(
320
+ name = "list_cpu_features",
321
+ srcs = ["src/utils/list_cpu_features.c"],
322
+ copts = C99_FLAGS,
323
+ includes = INCLUDES,
324
+ deps = [
325
+ ":bit_utils",
326
+ ":cpu_features_macros",
327
+ ":cpuinfo",
328
+ ],
329
+ )
@@ -0,0 +1,261 @@
1
+ cmake_minimum_required(VERSION 3.19.2)
2
+
3
+ # option() honors normal variables.
4
+ # see: https://cmake.org/cmake/help/git-stage/policy/CMP0077.html
5
+ if(POLICY CMP0077)
6
+ cmake_policy(SET CMP0077 NEW)
7
+ endif()
8
+
9
+ project(CpuFeatures VERSION 0.8.0 LANGUAGES C)
10
+
11
+ set(CMAKE_C_STANDARD 99)
12
+
13
+ # Default Build Type to be Release
14
+ if(NOT CMAKE_BUILD_TYPE)
15
+ set(CMAKE_BUILD_TYPE "Release" CACHE STRING
16
+ "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel."
17
+ FORCE)
18
+ endif(NOT CMAKE_BUILD_TYPE)
19
+
20
+ # BUILD_SHARED_LIBS is a standard CMake variable, but we declare it here to make
21
+ # it prominent in the GUI.
22
+ # cpu_features uses bit-fields which are - to some extends - implementation-defined (see https://en.cppreference.com/w/c/language/bit_field).
23
+ # As a consequence it is discouraged to use cpu_features as a shared library because different compilers may interpret the code in different ways.
24
+ # Prefer static linking from source whenever possible.
25
+ option(BUILD_SHARED_LIBS "Build library as shared." OFF)
26
+
27
+ # Force PIC on unix when building shared libs
28
+ # see: https://en.wikipedia.org/wiki/Position-independent_code
29
+ if(BUILD_SHARED_LIBS AND UNIX)
30
+ option(CMAKE_POSITION_INDEPENDENT_CODE "Build with Position Independant Code." ON)
31
+ endif()
32
+
33
+ include(CheckIncludeFile)
34
+ include(CheckSymbolExists)
35
+ include(GNUInstallDirs)
36
+
37
+ macro(setup_include_and_definitions TARGET_NAME)
38
+ target_include_directories(${TARGET_NAME}
39
+ PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
40
+ PRIVATE $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include/internal>
41
+ )
42
+ target_compile_definitions(${TARGET_NAME}
43
+ PUBLIC STACK_LINE_READER_BUFFER_SIZE=1024
44
+ )
45
+ endmacro()
46
+
47
+ set(PROCESSOR_IS_MIPS FALSE)
48
+ set(PROCESSOR_IS_ARM FALSE)
49
+ set(PROCESSOR_IS_AARCH64 FALSE)
50
+ set(PROCESSOR_IS_X86 FALSE)
51
+ set(PROCESSOR_IS_POWER FALSE)
52
+ set(PROCESSOR_IS_S390X FALSE)
53
+ set(PROCESSOR_IS_RISCV FALSE)
54
+
55
+ if(CMAKE_SYSTEM_PROCESSOR MATCHES "^mips")
56
+ set(PROCESSOR_IS_MIPS TRUE)
57
+ elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(aarch64|arm64)")
58
+ set(PROCESSOR_IS_AARCH64 TRUE)
59
+ elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm")
60
+ set(PROCESSOR_IS_ARM TRUE)
61
+ elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "(x86_64)|(AMD64|amd64)|(^i.86$)")
62
+ set(PROCESSOR_IS_X86 TRUE)
63
+ elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)")
64
+ set(PROCESSOR_IS_POWER TRUE)
65
+ elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(s390x)")
66
+ set(PROCESSOR_IS_S390X TRUE)
67
+ elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^riscv")
68
+ set(PROCESSOR_IS_RISCV TRUE)
69
+ endif()
70
+
71
+ macro(add_cpu_features_headers_and_sources HDRS_LIST_NAME SRCS_LIST_NAME)
72
+ list(APPEND ${HDRS_LIST_NAME} ${PROJECT_SOURCE_DIR}/include/cpu_features_macros.h)
73
+ list(APPEND ${HDRS_LIST_NAME} ${PROJECT_SOURCE_DIR}/include/cpu_features_cache_info.h)
74
+ file(GLOB IMPL_SOURCES CONFIGURE_DEPENDS "${PROJECT_SOURCE_DIR}/src/impl_*.c")
75
+ list(APPEND ${SRCS_LIST_NAME} ${IMPL_SOURCES})
76
+ if(PROCESSOR_IS_MIPS)
77
+ list(APPEND ${HDRS_LIST_NAME} ${PROJECT_SOURCE_DIR}/include/cpuinfo_mips.h)
78
+ elseif(PROCESSOR_IS_ARM)
79
+ list(APPEND ${HDRS_LIST_NAME} ${PROJECT_SOURCE_DIR}/include/cpuinfo_arm.h)
80
+ elseif(PROCESSOR_IS_AARCH64)
81
+ list(APPEND ${HDRS_LIST_NAME} ${PROJECT_SOURCE_DIR}/include/cpuinfo_aarch64.h)
82
+ list(APPEND ${SRCS_LIST_NAME} ${PROJECT_SOURCE_DIR}/include/internal/windows_utils.h)
83
+ elseif(PROCESSOR_IS_X86)
84
+ list(APPEND ${HDRS_LIST_NAME} ${PROJECT_SOURCE_DIR}/include/cpuinfo_x86.h)
85
+ list(APPEND ${SRCS_LIST_NAME} ${PROJECT_SOURCE_DIR}/include/internal/cpuid_x86.h)
86
+ list(APPEND ${SRCS_LIST_NAME} ${PROJECT_SOURCE_DIR}/include/internal/windows_utils.h)
87
+ elseif(PROCESSOR_IS_POWER)
88
+ list(APPEND ${HDRS_LIST_NAME} ${PROJECT_SOURCE_DIR}/include/cpuinfo_ppc.h)
89
+ elseif(PROCESSOR_IS_S390X)
90
+ list(APPEND ${HDRS_LIST_NAME} ${PROJECT_SOURCE_DIR}/include/cpuinfo_s390x.h)
91
+ elseif(PROCESSOR_IS_RISCV)
92
+ list(APPEND ${HDRS_LIST_NAME} ${PROJECT_SOURCE_DIR}/include/cpuinfo_riscv.h)
93
+ else()
94
+ message(FATAL_ERROR "Unsupported architectures ${CMAKE_SYSTEM_PROCESSOR}")
95
+ endif()
96
+ endmacro()
97
+
98
+ #
99
+ # library : utils
100
+ #
101
+
102
+ add_library(utils OBJECT
103
+ ${PROJECT_SOURCE_DIR}/include/internal/bit_utils.h
104
+ ${PROJECT_SOURCE_DIR}/include/internal/filesystem.h
105
+ ${PROJECT_SOURCE_DIR}/include/internal/stack_line_reader.h
106
+ ${PROJECT_SOURCE_DIR}/include/internal/string_view.h
107
+ ${PROJECT_SOURCE_DIR}/src/filesystem.c
108
+ ${PROJECT_SOURCE_DIR}/src/stack_line_reader.c
109
+ ${PROJECT_SOURCE_DIR}/src/string_view.c
110
+ )
111
+ setup_include_and_definitions(utils)
112
+
113
+ #
114
+ # library : unix_based_hardware_detection
115
+ #
116
+
117
+ if(UNIX)
118
+ add_library(unix_based_hardware_detection OBJECT
119
+ ${PROJECT_SOURCE_DIR}/include/internal/hwcaps.h
120
+ ${PROJECT_SOURCE_DIR}/src/hwcaps.c
121
+ )
122
+ setup_include_and_definitions(unix_based_hardware_detection)
123
+ check_include_file(dlfcn.h HAVE_DLFCN_H)
124
+ if(HAVE_DLFCN_H)
125
+ target_compile_definitions(unix_based_hardware_detection PRIVATE HAVE_DLFCN_H)
126
+ endif()
127
+ check_symbol_exists(getauxval "sys/auxv.h" HAVE_STRONG_GETAUXVAL)
128
+ if(HAVE_STRONG_GETAUXVAL)
129
+ target_compile_definitions(unix_based_hardware_detection PRIVATE HAVE_STRONG_GETAUXVAL)
130
+ endif()
131
+ endif()
132
+
133
+ #
134
+ # library : cpu_features
135
+ #
136
+ set (CPU_FEATURES_HDRS)
137
+ set (CPU_FEATURES_SRCS)
138
+ add_cpu_features_headers_and_sources(CPU_FEATURES_HDRS CPU_FEATURES_SRCS)
139
+ list(APPEND CPU_FEATURES_SRCS $<TARGET_OBJECTS:utils>)
140
+ if(NOT PROCESSOR_IS_X86 AND UNIX)
141
+ list(APPEND CPU_FEATURES_SRCS $<TARGET_OBJECTS:unix_based_hardware_detection>)
142
+ endif()
143
+ add_library(cpu_features ${CPU_FEATURES_HDRS} ${CPU_FEATURES_SRCS})
144
+ set_target_properties(cpu_features PROPERTIES PUBLIC_HEADER "${CPU_FEATURES_HDRS}")
145
+ setup_include_and_definitions(cpu_features)
146
+ target_link_libraries(cpu_features PUBLIC ${CMAKE_DL_LIBS})
147
+ target_include_directories(cpu_features
148
+ PUBLIC $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/cpu_features>
149
+ )
150
+ if(PROCESSOR_IS_X86 OR PROCESSOR_IS_AARCH64)
151
+ if(APPLE)
152
+ target_compile_definitions(cpu_features PRIVATE HAVE_SYSCTLBYNAME)
153
+ endif()
154
+ endif()
155
+ add_library(CpuFeature::cpu_features ALIAS cpu_features)
156
+
157
+ #
158
+ # program : list_cpu_features
159
+ #
160
+
161
+ add_executable(list_cpu_features ${PROJECT_SOURCE_DIR}/src/utils/list_cpu_features.c)
162
+ target_link_libraries(list_cpu_features PRIVATE cpu_features)
163
+ add_executable(CpuFeature::list_cpu_features ALIAS list_cpu_features)
164
+
165
+ #
166
+ # ndk_compat
167
+ #
168
+
169
+ if(ANDROID)
170
+ add_subdirectory(ndk_compat)
171
+ endif()
172
+
173
+ #
174
+ # tests
175
+ #
176
+
177
+ include(CTest)
178
+ if(BUILD_TESTING)
179
+ # Automatically incorporate googletest into the CMake Project if target not
180
+ # found.
181
+ enable_language(CXX)
182
+
183
+ set(CMAKE_CXX_STANDARD 14)
184
+ set(CMAKE_CXX_STANDARD_REQUIRED ON)
185
+ set(CMAKE_CXX_EXTENSIONS OFF) # prefer use of -std14 instead of -gnustd14
186
+
187
+ if(NOT TARGET gtest OR NOT TARGET gmock_main)
188
+ # Download and unpack googletest at configure time.
189
+ configure_file(
190
+ cmake/googletest.CMakeLists.txt.in
191
+ googletest-download/CMakeLists.txt
192
+ )
193
+
194
+ execute_process(
195
+ COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" .
196
+ RESULT_VARIABLE result
197
+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/googletest-download)
198
+
199
+ if(result)
200
+ message(FATAL_ERROR "CMake step for googletest failed: ${result}")
201
+ endif()
202
+
203
+ execute_process(
204
+ COMMAND ${CMAKE_COMMAND} --build .
205
+ RESULT_VARIABLE result
206
+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/googletest-download)
207
+
208
+ if(result)
209
+ message(FATAL_ERROR "Build step for googletest failed: ${result}")
210
+ endif()
211
+
212
+ # Prevent overriding the parent project's compiler/linker settings on
213
+ # Windows.
214
+ set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
215
+
216
+ # Add googletest directly to our build. This defines the gtest and
217
+ # gtest_main targets.
218
+ add_subdirectory(${CMAKE_BINARY_DIR}/googletest-src
219
+ ${CMAKE_BINARY_DIR}/googletest-build
220
+ EXCLUDE_FROM_ALL)
221
+ endif()
222
+
223
+ add_subdirectory(test)
224
+ endif()
225
+
226
+ #
227
+ # Install cpu_features and list_cpu_features
228
+ #
229
+
230
+ include(GNUInstallDirs)
231
+ install(TARGETS cpu_features list_cpu_features
232
+ EXPORT CpuFeaturesTargets
233
+ PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/cpu_features
234
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
235
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
236
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
237
+ BUNDLE DESTINATION ${CMAKE_INSTALL_BINDIR}
238
+ )
239
+ install(EXPORT CpuFeaturesTargets
240
+ NAMESPACE CpuFeatures::
241
+ DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/CpuFeatures
242
+ COMPONENT Devel
243
+ )
244
+ include(CMakePackageConfigHelpers)
245
+ configure_package_config_file(cmake/CpuFeaturesConfig.cmake.in
246
+ "${PROJECT_BINARY_DIR}/CpuFeaturesConfig.cmake"
247
+ INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/CpuFeatures"
248
+ NO_SET_AND_CHECK_MACRO
249
+ NO_CHECK_REQUIRED_COMPONENTS_MACRO
250
+ )
251
+ write_basic_package_version_file(
252
+ "${PROJECT_BINARY_DIR}/CpuFeaturesConfigVersion.cmake"
253
+ COMPATIBILITY SameMajorVersion
254
+ )
255
+ install(
256
+ FILES
257
+ "${PROJECT_BINARY_DIR}/CpuFeaturesConfig.cmake"
258
+ "${PROJECT_BINARY_DIR}/CpuFeaturesConfigVersion.cmake"
259
+ DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/CpuFeatures"
260
+ COMPONENT Devel
261
+ )
@@ -0,0 +1,23 @@
1
+ # How to Contribute
2
+
3
+ We'd love to accept your patches and contributions to this project. There are
4
+ just a few small guidelines you need to follow.
5
+
6
+ ## Contributor License Agreement
7
+
8
+ Contributions to this project must be accompanied by a Contributor License
9
+ Agreement. You (or your employer) retain the copyright to your contribution;
10
+ this simply gives us permission to use and redistribute your contributions as
11
+ part of the project. Head over to <https://cla.developers.google.com/> to see
12
+ your current agreements on file or to sign a new one.
13
+
14
+ You generally only need to submit a CLA once, so if you've already submitted one
15
+ (even if it was for a different project), you probably don't need to do it
16
+ again.
17
+
18
+ ## Code reviews
19
+
20
+ All submissions, including submissions by project members, require review. We
21
+ use GitHub pull requests for this purpose. Consult
22
+ [GitHub Help](https://help.github.com/articles/about-pull-requests/) for more
23
+ information on using pull requests.