From 1ecd37622e2c4e65fc99946cc5dcfdd4c617d82f Mon Sep 17 00:00:00 2001 From: Atul R Date: Fri, 6 Sep 2019 00:35:46 +0200 Subject: [PATCH] now automoc runs with qode qt env --- scripts/automoc.js | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/scripts/automoc.js b/scripts/automoc.js index 432c5b483..1805095af 100644 --- a/scripts/automoc.js +++ b/scripts/automoc.js @@ -1,6 +1,7 @@ const path = require("path"); const fs = require("fs"); const childProcess = require("child_process"); +const { qtHome } = require("@nodegui/qode"); const ROOT_DIR = path.resolve(__dirname, "../"); const MOC_AUTOGEN_DIR = path.resolve(ROOT_DIR, "src/cpp/autogen"); @@ -50,13 +51,22 @@ const main = () => { eachHeaderPath, includeFilePath ); - console.log(command); - childProcess.exec(command, {}, error => { - if (error) { - console.error(`exec error: ${error}`); - return; + const mocPath = path.resolve(process.env.QT_INSTALL_DIR || qtHome, "bin"); + childProcess.exec( + command, + { + env: { + ...process.env, + PATH: `${mocPath}${path.delimiter}${process.env.PATH}` + } + }, + error => { + if (error) { + console.error(`exec error: ${error}`); + return; + } } - }); + ); return outfilePath; }); generateMocGypiFile(outFiles);