• Martin Kampas's avatar
    Refactorize project files · 16fe343d
    Martin Kampas authored
    Every subproject "mysubproject" of type app or lib now contains three qmake
    files:
    
      mysubproject.pro
      mysubproject.pri
      mysubproject_dependencies.pri
    
    Dependency between two projects is satisfied by calling
    include(../path/to/dependee/dependee.pri) inside dependent_dependencies.pri.
    mysubproject.pri always includes mysubproject_dependencies.pri - this way
    dependencies are gathered transitively.
    
    Every mysubproject.pro starts with defining TARGET and including one of the
    templates:
    
      ssuapplication.pri
      ssulibrary.pri
    
    Settings common to both app and lib type of projects comes from
    
      ssu_common.pri
    
    For tests, there are derived templates inside tests directory
    
      tests/testapplication.pri
      tests/testlibrary.pri
    
    Common settings similarly comes from
    
      tests/tests_common.pri
    
    Source code root is added to INCLUDEPATH and DEPENDPATH so it is possible to
    include any header file specifying ints path relatively to source code root.
    Since all the libs and apps are part of single source tree, I recommend to
    express this fact by #including ssu own headers with "" instead of <>.
    
      #include "libssu/ssu.h"
    
    Projects outside of ssu source tree will still use #include <ssu.h>
    
    For tests, the "tests" dir is also added to INCLUDEPATH and DEPENDPATH so the
    "tests/" path component can/should be omitted inside tests code:
    
      #include "testutils/process.h"
    
    Building:
    
    I have removed the hardcoded build paths (buildpath.pri). It is still possible
    to keep source tree clean of build artefacts -- with shadow build:
    
    mkdir build && cd build && qmake ../ssu.pro -r && make
    
    Note that the output directories for app and lib binaries is still hardcoded
    as build/{bin,lib}.
    
    When gcov is to be used, simply build without the shadow build and object
    files will be placed next to source files.
    
    Other notes:
    
    I found some CONFIG settings having no effect and removed these. Namely
    
    CONFIG += dll - shared libs are build by default
    CONFIG -= app_bundle - Mac OS X specific
    CONFIG += console - Windows specific
    CONFIG += qtestlib - QT+=testlib should be the prefered way
    
    -maybe I am wrong?
    
    The 'unix' conditional was not used consistently. Similar issue with
    $${PREFIX}. As it is not much useful at the moment, I rather removed it.
    16fe343d
ssulibrary.pri 246 Bytes