Search code examples
fortranstatic-librariesqt-creatorqmake

QMAKE_EXTRA_COMPILER execution order


Is there some way to arbitrarily assign an order on when the make is performed for the QMAKE_EXTRA_COMPILER option? It seems that declaration order seems to affect it, but it doesn't work it seems...

I have a bunch of fortran code that needs to be compiled then archived into a static library (using the ar command) to be used by a DLL I'm building. Iv been streamlining this in my .pro file to make everything happen in one go but am having a little trouble.

Heres the important stuff:

win32 {
    gfortran.commands = gfortran $${FORTRAN_FLAGS} ${QMAKE_FILE_NAME} -c -o ${QMAKE_FILE_OUT}
    gfortran.input = FORTRAN_SOURCE
    gfortran.output = ../../src/SupMods/FireNetworkDLL/${QMAKE_FILE_BASE}.o
    gfortran.CONFIG = target_predeps
    QMAKE_EXTRA_COMPILERS += gfortran
}

win32 {
    archive.commands = ar -qsc ${QMAKE_FILE_OUT} $${FORTRAN_OBJ}
    archive.input = FORTRAN_OBJ
    archive.output = ../../src/SupMods/FireNetworkDLL/libORAN.a
    archive.CONFIG = combine target_predeps
    QMAKE_EXTRA_COMPILERS += archive
}

This only works some of the time...no idea why. Also FORTRAN_SOURCE is just a list of all the fortran files (ex: fire.f95) and $${FORTRAN_OBJ} is a list of all the fortran .o files.

So is there some way I can always have the object files generated from gfortran first and follow that by the ar command? (im guessing it has something to do with dependency_type or depends...)

Also if someone has a better approach I'm all ears, first time messing with qmake really.

**Could this have something to do with the variable FORTRAN_OBJ referencing .o files that aren't actually there before the build start?


Solution

  • Well... ended up just adding all the object files to the final DLL instead of using a static library! Should have done that awhile ago...