Special build requirements for a project
-
Sorry for the newbie question, I am building a Qt app that needs to interface with an Oracle database. This interface is implemented using Oracle's procC, where SQL statements can be embedded directly into the C/C++. At the moment the system works but the build process has two stages; one to compile the proc files and then the normal build process for a qt app. Could someone point me in the right direction so that I could incorporate the pro*c build commands into the .pro file? Obviously if I put these statements into the makefile then they can get removed if the makefile is rebuilt.
Thanks in advance.
John T,
-
You need to look into qmake variables reference. There are quite a few to choose from, that would help you with your task, depending on the exact circumstances. Here's a "link":http://developer.qt.nokia.com/doc/qt-4.8/qmake-variable-reference.html to reference, and a few example vars that might come in handy:
- "QMAKE_PRE_LINK":http://developer.qt.nokia.com/doc/qt-4.8/qmake-variable-reference.html#qmake-pre-link
- "QMAKE_POST_LINK":http://developer.qt.nokia.com/doc/qt-4.8/qmake-variable-reference.html#qmake-post-link
OF course, I assume here that you do use qmake and not other tools like scons, cmake etc.
-
Thanks for the quick response. I am half way to the solution by doing the following.
adding the QMAKE_PRE_LINK :
QMAKE_PRE_LINK=proc iname=myprocfile.pc;
gcc -c myprocfile.cand then:
adding myprocfile.o to the LIBS list.This does make the system build with one 'make' command however the dependencies do not work; if I update the myprocfile.pc file then the make command thinks there is nothing to do and I have to delete the executable file for a successful build. This is because what I really need is a PRE_BUILD var rather than a PRE_LINK; the proc command takes a .pc file, that contains a mixture of standard C/C++ and SQL and compiles this file into a .c file that gcc can compile.
Thanks
John T.
-
That's what I suspected. I'm not an expert on qmake, though. Any possibility of switching to cmake or scons? Or maybe, creating a shell script that would fire the "SQL" build first, and then proceed with qmake one?
-
[quote author="sierdzio" date="1327582767"]Or maybe, creating a shell script that would fire the "SQL" build first, and then proceed with qmake one?[/quote]
That is of course the obvious answer but I was not going to give in so quickly ;-)
John T.
-
QMake would overwrite it.
-
I have done this for the moment:
As suggested I have a simple make file that builds the .c file from the oracle pro*c .pc file (oracle.mak). I have then added a new bash function called rmake which looks like this:
function rmake() { /usr/bin/make -f oracle.mak $@;/usr/bin/make $@;}
This way the dependencies are preserved and also the make clean works as well.
I chose the command 'rmake' as the software I am working on is modelling a radio system.
Thanks for your time Professor Sierdzio, it is very much appreciated.
John T
PS I should also add that I have removed the QMAKE_PRE_LINK stuff from my .pro file.