Adds miniqt installation

This commit is contained in:
Atul R 2020-02-22 23:50:16 +01:00
parent 9daefcb662
commit 9ed075df68
8 changed files with 57 additions and 23 deletions

View File

@ -6,18 +6,14 @@ set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
set(QTCONFIG_FILE ${CMAKE_CURRENT_LIST_DIR}/../scripts/qtConfig.js)
macro(AddQtSupport addonName)
execute_process(COMMAND node -p "require('./scripts/config.js').qtCmakeDir"
execute_process(COMMAND node -p "require('${QTCONFIG_FILE}').qtCmakeDir"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE QT_CMAKE_HOME_DIR
)
# if(DEFINED ENV{QT_INSTALL_DIR})
# # Allows to use custom Qt installation via QT_INSTALL_DIR env variable
# message(STATUS "Using Custom QT installation for ${addonName} QT_INSTALL_DIR:$ENV{QT_INSTALL_DIR}")
# set(QT_HOME_DIR "$ENV{QT_INSTALL_DIR}")
# endif()
string(REPLACE "\n" "" QT_CMAKE_HOME_DIR "${QT_CMAKE_HOME_DIR}")
string(REPLACE "\"" "" QT_CMAKE_HOME_DIR "${QT_CMAKE_HOME_DIR}")

View File

@ -11,6 +11,6 @@ module.exports = {
transform: {
'^.+\\.tsx?$': 'ts-jest',
},
globalSetup: './config/tests/setup.js',
globalTeardown: './config/tests/teardown.js',
globalSetup: './scripts/tests/setup.js',
globalTeardown: './scripts/tests/teardown.js',
};

35
package-lock.json generated
View File

@ -4,6 +4,19 @@
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"7zip-bin": {
"version": "5.0.3",
"resolved": "https://registry.npmjs.org/7zip-bin/-/7zip-bin-5.0.3.tgz",
"integrity": "sha512-GLyWIFBbGvpKPGo55JyRZAo4lVbnBiD52cKlw/0Vt+wnmKvWJkpZvsjVoaIolyBXDeAQKSicRtqFNPem9w0WYA=="
},
"7zip-min": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/7zip-min/-/7zip-min-1.1.1.tgz",
"integrity": "sha512-GPTk3xycxB0NjRM1SKAUL7TWXjgFAyzwXkamkk5YgSLd6OneeWBw+fxULctrVr4XqPBBh+LyqpHlyj9ryfpqoQ==",
"requires": {
"7zip-bin": "^5.0.3"
}
},
"@babel/code-frame": {
"version": "7.5.5",
"resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.5.5.tgz",
@ -1107,6 +1120,19 @@
}
}
},
"@nodegui/artifact-installer": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/@nodegui/artifact-installer/-/artifact-installer-1.0.0.tgz",
"integrity": "sha512-qKtlsXgO/fNppgVfkuTkHmgALZQgppjvJ5XJg3+J90SeIQBri1KRk8H/3CgKL/MmXsDJkvWftQrX9BmZ9uKv+Q==",
"requires": {
"7zip-min": "^1.1.1",
"empty-dir": "^2.0.0",
"env-paths": "^2.2.0",
"make-dir": "^3.0.0",
"node-fetch": "^2.6.0",
"progress": "^2.0.3"
}
},
"@nodegui/qode": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/@nodegui/qode/-/qode-2.0.3.tgz",
@ -2620,6 +2646,11 @@
"integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
"dev": true
},
"empty-dir": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/empty-dir/-/empty-dir-2.0.0.tgz",
"integrity": "sha512-XAedXlNAQZxMmbllXY9cxuESlNVjZ8xd67bSIUZwbS7VoLyhlNehVN3Iy35yDTGFHKR1opBRgORkp3am0so+WQ=="
},
"end-of-stream": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.1.tgz",
@ -6965,7 +6996,6 @@
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.0.0.tgz",
"integrity": "sha512-grNJDhb8b1Jm1qeqW5R/O63wUo4UXo2v2HMic6YT9i/HBlF93S8jkMgH7yugvY9ABDShH4VZMn8I+U8+fCNegw==",
"dev": true,
"requires": {
"semver": "^6.0.0"
},
@ -6973,8 +7003,7 @@
"semver": {
"version": "6.3.0",
"resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
"integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==",
"dev": true
"integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw=="
}
}
},

View File

@ -9,6 +9,7 @@
"private": false,
"scripts": {
"dev": "cross-env npm run build && qode dist/demo.js",
"preinstall": "node ./scripts/preinstall.js",
"build": "cross-env tsc && npm run build:addon",
"postinstall": "cross-env node ./scripts/skip.js || npm run prebuild:install || npm run build:addon",
"build:addon": "cross-env CMAKE_BUILD_PARALLEL_LEVEL=8 cmake-js build",
@ -19,6 +20,7 @@
"docs": "cross-env typedoc && node ./website/docs/scripts/fixdocs.js"
},
"dependencies": {
"@nodegui/artifact-installer": "^1.0.0",
"@nodegui/qode": "^2.0.1",
"cmake-js": "^6.0.0",
"cross-env": "^7.0.0",

View File

@ -1,14 +1,20 @@
#!/usr/bin/env node
const { setupArtifact } = require('@nodegui/artifact-installer');
const { miniQt } = require('./config');
const { miniQt, useCustomQt, qtHome } = require('./qtConfig');
setupArtifact({
outDir: miniQt.setupDir,
id: 'nodegui-mini-qt',
displayName: `Minimal Qt ${miniQt.version} installation`,
downloadLink: miniQt.downloadLink,
}).catch(err => {
console.error(err);
process.exit(1);
});
if (!useCustomQt) {
console.log(`Minimal Qt ${miniQt.version} setup:`);
setupArtifact({
outDir: miniQt.setupDir,
id: 'nodegui-mini-qt',
displayName: `Minimal Qt ${miniQt.version} installation`,
downloadLink: miniQt.downloadLink,
}).catch(err => {
console.error(err);
process.exit(1);
});
} else {
console.log(`CustomQt detected at ${qtHome} . Hence, skipping Mini Qt installation...`);
}

View File

@ -28,10 +28,11 @@ switch (os.platform()) {
}
}
const qtHome = process.env.CUSTOM_QT_DIR ? process.env.CUSTOM_QT_DIR : miniQt.qtHome;
const qtHome = process.env.QT_INSTALL_DIR ? process.env.QT_INSTALL_DIR : miniQt.qtHome;
module.exports = {
qtHome,
qtCmakeDir: path.resolve(qtHome, 'lib', 'cmake', 'Qt5'),
miniQt,
useCustomQt: Boolean(process.env.QT_INSTALL_DIR),
};