cpp.js 1.0.0-beta.32 → 1.0.0-beta.33
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/CHANGELOG.md +7 -0
- package/README.md +1 -1
- package/package.json +1 -1
- package/src/actions/run.js +20 -6
- package/src/state/index.js +2 -2
- package/src/state/loadConfig.js +1 -0
package/CHANGELOG.md
ADDED
package/README.md
CHANGED
package/package.json
CHANGED
package/src/actions/run.js
CHANGED
|
@@ -5,7 +5,8 @@ import getOsUserAndGroupId from '../utils/getOsUserAndGroupId.js';
|
|
|
5
5
|
import { getContentHash } from '../utils/hash.js';
|
|
6
6
|
import state from '../state/index.js';
|
|
7
7
|
|
|
8
|
-
const
|
|
8
|
+
const CROSSCOMPILER_ARM64 = 'aarch64-linux-android33';
|
|
9
|
+
const CROSSCOMPILER_x86_64 = 'x86_64-linux-android33';
|
|
9
10
|
const ANDROID_NDK = '/opt/android-sdk/ndk/25.2.9519653';
|
|
10
11
|
const t = `${ANDROID_NDK}/toolchains/llvm/prebuilt/linux-x86_64/bin`;
|
|
11
12
|
const t2 = `${ANDROID_NDK}/toolchains/llvm/prebuilt/linux-x86_64`;
|
|
@@ -15,11 +16,23 @@ const iosBinPath = `${iOSDevPath}/Toolchains/XcodeDefault.xctoolchain/usr/bin`;
|
|
|
15
16
|
const iosSdkPath = `${iOSDevPath}/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk`;
|
|
16
17
|
const iosSimSdkPath = `${iOSDevPath}/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk`;
|
|
17
18
|
|
|
18
|
-
const
|
|
19
|
+
const androidParamsArm64 = [
|
|
19
20
|
'-e', `AR=${t}/llvm-ar`,
|
|
20
21
|
'-e', `AS=${t}/llvm-as`,
|
|
21
|
-
'-e', `CC=${t}/${
|
|
22
|
-
'-e', `CXX=${t}/${
|
|
22
|
+
'-e', `CC=${t}/${CROSSCOMPILER_ARM64}-clang`,
|
|
23
|
+
'-e', `CXX=${t}/${CROSSCOMPILER_ARM64}-clang++`,
|
|
24
|
+
'-e', `LD=${t}/ld`,
|
|
25
|
+
'-e', `RANLIB=${t}/llvm-ranlib`,
|
|
26
|
+
'-e', `STRIP=${t}/llvm-strip`,
|
|
27
|
+
'-e', `NM=${t}/nm`,
|
|
28
|
+
'-e', `CFLAGS=--sysroot=${t2}/sysroot`,
|
|
29
|
+
];
|
|
30
|
+
|
|
31
|
+
const androidParamsX86_64 = [
|
|
32
|
+
'-e', `AR=${t}/llvm-ar`,
|
|
33
|
+
'-e', `AS=${t}/llvm-as`,
|
|
34
|
+
'-e', `CC=${t}/${CROSSCOMPILER_x86_64}-clang`,
|
|
35
|
+
'-e', `CXX=${t}/${CROSSCOMPILER_x86_64}-clang++`,
|
|
23
36
|
'-e', `LD=${t}/ld`,
|
|
24
37
|
'-e', `RANLIB=${t}/llvm-ranlib`,
|
|
25
38
|
'-e', `STRIP=${t}/llvm-strip`,
|
|
@@ -91,11 +104,12 @@ export default function run(program, params = [], platformPrefix = null, platfor
|
|
|
91
104
|
break;
|
|
92
105
|
case 'Android':
|
|
93
106
|
[dProgram, ...dParams] = params;
|
|
94
|
-
platformParams =
|
|
107
|
+
platformParams = arch[0] === 'x86_64' ? androidParamsX86_64 : androidParamsArm64;
|
|
95
108
|
if (dProgram === 'cmake') {
|
|
96
109
|
dParams = [
|
|
97
110
|
...dParams,
|
|
98
|
-
'-DCMAKE_SYSTEM_NAME=Android', '-DCMAKE_SYSTEM_VERSION=33',
|
|
111
|
+
'-DCMAKE_SYSTEM_NAME=Android', '-DCMAKE_SYSTEM_VERSION=33',
|
|
112
|
+
`-DCMAKE_ANDROID_ARCH_ABI=${arch[0] === 'x86_64' ? 'x86_64' : 'arm64-v8a'}`,
|
|
99
113
|
`-DCMAKE_ANDROID_NDK=${ANDROID_NDK}`,
|
|
100
114
|
];
|
|
101
115
|
}
|
package/src/state/index.js
CHANGED
|
@@ -6,9 +6,9 @@ const cacheDir = `${process.cwd()}/.cppjs`;
|
|
|
6
6
|
|
|
7
7
|
const state = {
|
|
8
8
|
platforms: {
|
|
9
|
-
All: ['Emscripten-x86_64', 'Android-arm64-v8a', 'iOS-iphoneos', 'iOS-iphonesimulator'],
|
|
9
|
+
All: ['Emscripten-x86_64', 'Android-arm64-v8a', 'Android-x86_64', 'iOS-iphoneos', 'iOS-iphonesimulator'],
|
|
10
10
|
WebAssembly: ['Emscripten-x86_64'],
|
|
11
|
-
Android: ['Android-arm64-v8a'],
|
|
11
|
+
Android: ['Android-arm64-v8a', 'Android-x86_64'],
|
|
12
12
|
iOS: ['iOS-iphoneos', 'iOS-iphonesimulator'],
|
|
13
13
|
},
|
|
14
14
|
config: null,
|
package/src/state/loadConfig.js
CHANGED
|
@@ -85,6 +85,7 @@ function getFilledConfig(config, options = { isDepend: false }) {
|
|
|
85
85
|
newConfig.platform['Emscripten-x86_64-browser'] = newConfig.platform['Emscripten-x86_64-browser'] || {};
|
|
86
86
|
newConfig.platform['Emscripten-x86_64-node'] = newConfig.platform['Emscripten-x86_64-node'] || {};
|
|
87
87
|
newConfig.platform['Android-arm64-v8a'] = newConfig.platform['Android-arm64-v8a'] || {};
|
|
88
|
+
newConfig.platform['Android-x86_64'] = newConfig.platform['Android-x86_64'] || {};
|
|
88
89
|
newConfig.platform['iOS-iphoneos'] = newConfig.platform['iOS-iphoneos'] || {};
|
|
89
90
|
newConfig.platform['iOS-iphonesimulator'] = newConfig.platform['iOS-iphonesimulator'] || {};
|
|
90
91
|
|