Re: [QBS] (no subject)

2013-05-16 Thread Joerg Bornemann
On 15/05/2013 18:28, Kakadu wrote:

 Now qbs take source file and generates result in  build folder. I have 
 compiler which takes source files and places result always in the same 
 folder. Is it possible to hack qbs to copy source file to build directory and 
 built it there? How difficult is it?

You'd have to add a copy command before the actual compiler call. 
Something like this:

---snip---
Rule {
 ...
 prepare: {
 ...
 var commands = [];
 // copy source file
 var cmd = new Command(cp, [input.fileName, 
FileInfo.path(output.fileName));
 commands.push(cmd);
 // now the actual compiler call
 cmd = new Command(g++, args);
 commands.push(cmd);
 return commands;
 }
}
---snap---

Instead of calling cp you can use a JavaScript command and copy the file 
via File.copy in a platform-independent way, if you want.


BR,

Joerg

___
QBS mailing list
QBS@qt-project.org
http://lists.qt-project.org/mailman/listinfo/qbs


Re: [QBS] (no subject)

2013-05-16 Thread Kakadu
Oh, I didn't expect that prepare can return many commands. thanks.

-- 
Best wishes,
Kakadu

16.05.2013, 12:14, Joerg Bornemann joerg.bornem...@digia.com:
 On 15/05/2013 18:28, Kakadu wrote:

  Now qbs take source file and generates result in  build folder. I have 
 compiler which takes source files and places result always in the same 
 folder. Is it possible to hack qbs to copy source file to build directory 
 and built it there? How difficult is it?

 You'd have to add a copy command before the actual compiler call.
 Something like this:

 ---snip---
 Rule {
  ...
  prepare: {
  ...
  var commands = [];
  // copy source file
  var cmd = new Command(cp, [input.fileName,
 FileInfo.path(output.fileName));
  commands.push(cmd);
  // now the actual compiler call
  cmd = new Command(g++, args);
  commands.push(cmd);
  return commands;
  }
 }
 ---snap---

 Instead of calling cp you can use a JavaScript command and copy the file
 via File.copy in a platform-independent way, if you want.

 BR,

 Joerg

 ___
 QBS mailing list
 QBS@qt-project.org
 http://lists.qt-project.org/mailman/listinfo/qbs
___
QBS mailing list
QBS@qt-project.org
http://lists.qt-project.org/mailman/listinfo/qbs