Separates "bin" and "build" at compile with Shadow Build



  • Hello everyone!

    I work on a "big" project, with a lot of SubProjects, so I tried to keeping a clear files organization:

    @
    [Project Root]
    ├ 3rdparty
    ├ bin (Final executableS fileS, including DLL on Windows)
    │ ├ linux
    │ │ └ ...
    │ ├ win32
    │ │ ├ release
    │ │ │ ├ SomeApp.exe
    │ │ │ ├ AnotherApp.exe
    │ │ │ ├ SomeDynamicLib.dll
    │ │ │ └ ...
    │ │ ├ debug
    │ │ │ └ ...
    │ │ └ tests
    │ │ └ ...
    │ └ ...
    ├ build (all object files, removed on a clean)
    │ └ (same structure as "bin")
    ├ doc
    ├ include (project specific headers)
    ├ lib (lib*.a, lib*d.a)
    ├ src (Sources of apps and libs, including *.h)
    │ ├ SomeApp
    │ ├ AnotherApp
    │ ├ SomeDynamicLib
    │ └ ...
    └ resource@

    I want to have the objects files out from sources' directory, so I use Shadow Build and I sets BuildDir pointing to "/Project's Root/build/".
    The problem is that binary files (final apps and libs) are builds in this directory too.
    Also, if I add "DESTDIR=/ProjectRoot/bin/" (so, out of the BuildDir path) in the .pro file , i get this error at compile.

    "Makefile.Debug:74: error : multiple target patterns. Stop."

    If I set BuildDir directly to the Project's Root, i can place binaries to /bin/, but when I compile, Qt creates (unwanted) directories that corresponds to sub projects at this place (then directly in the "Project's Root").

    Does it exists a way to make what I want?

    • Compiled binaries in bin/ (per exemple *.exe and *.dll on Windows)
    • Objects files and makefiles in build/ (with the pre-quoted organization)

    Thanks in advance


  • Moderators

    Stop using shadow building and it will work well:
    @

    .pro

    DESTDIR=bin

    BUILDDIR=build
    OBJECTS_DIR = $${BUILDDIR}
    MOC_DIR = $${BUILDDIR}
    RCC_DIR = $${BUILDDIR}
    UI_DIR = $${BUILDDIR}
    @

    Or use a more advanced example from one of my projects: "link":https://github.com/sierdzio/spdr/blob/master/definitions.pri.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.