c++includedependenciesdependency-managementbiicode

#include statement mapping in Biicode (biicode.conf)


I want to create a block for the dependency manager Biicode. I don't want to touch existing source code, so I have to map the include paths from existing Bii blocks to the paths used in my source code.

I am using the following includes in my existing code:

#include "gtest/gtest.h"
#include "fw/core/uncopyable_mixin.h"

With the default settings Bii expects the following paths:

#include "google/gtest/include/gtest/gtest.h"
#include "florianwolters/include/fw/core/uncopyable_mixin.h"

If I replace the includes, everything is working as expected. But as I already stated I do not want such ugly include paths, but use common sense (as Boost and other libraries do).

Therefore I do need to map the paths. I've read about biicode.conf and stumbled upon the [includes] section.

I've tried the following:

[requirements]
    google/gtest: 9
    florianwolters/uncopyable-mixin: 0

[parent]
    florianwolters/singleton: -1

[paths]
    include

[dependencies]

[mains]

[hooks]

[includes]
    gtest/gtest.h: google/gtest/include/gtest
    fw/core/uncopyable_mixin.h: florianwolters/uncopyable-mixin/include/fw/core

[data]

But that does not work:

INFO: Processing changes...
WARN: Removing unused reference to "florianwolters/uncopyable-mixin: 0" from florianwolters/singleton "requirements"
WARN: Removing unused reference to "google/gtest: 9" from florianwolters/singleton "requirements"

So my question is: How do I have to configure the mapping to make it work with the existing #include-statements? This has to work, otherwise it is a killer-criterium...


Solution

  • The [includes] section prepends the right part to the left side in case that the left side pattern match the file name. In your case, the last folders are not necessary. Try instead:

    [includes]
        gtest/gtest.h: google/gtest/include
        fw/core/uncopyable_mixin.h: florianwolters/uncopyable-mixin/include
    

    Furthermore, remember that you can use also patterns (ala fnmatch):

    [includes]
        gtest/*.h: google/gtest/include
        fw/core/*.h: florianwolters/uncopyable-mixin/include