cmakebiicode

Exclude Cmake dependecies in biicode block


I wanted to port my library project to biicode, however my example uses binaries that are too big for a biicode block (there is a 12MB limit), so I added the example folder to the ignore.bii file. The problem is that it now looks for example/CMakeLists.txt because I'm using the old CMakeLists.txt wrapped in

IF(BIICODE)
   INIT_BIICODE_BLOCK()
   ADD_BIICODE_TARGETS()
ELSE()
#MY OLD CMAKELIST HERE
ENDIF()

It actually builds fine but bii deps still tries to resolve the dependency

What should I do ? I don't really want to remove nor change too many things to support biicode as the project is already on github.

Edit: Here is the link to the project : https://github.com/Lectem/libmpo I tried something in the biicode.conf along the lines of

[dependencies]
    CMakeLists.txt - example/CMakeLists.txt
    include/libmpo/mpo.h - jpeglib.h

but I get this :

WARN: Lectem/libmpo/biicode.conf, [dependencies] CMakeLists.txt - example/CMakeLists.txt
        There are no files matching pattern example/CMakeLists.txt
WARN: Lectem/libmpo/biicode.conf, [dependencies] include/libmpo/mpo.h - jpeglib.h
        There are no files matching pattern jpeglib.h
Lectem/libmpo depends on:
       Lectem/libmpo (self)
          include/libmpo/cmpo.h
                src/cmpo.c (E)
          include/libmpo/mpo.h
                src/cmpo.c (E)
                src/dmpo.c (E)
                src/mpo.c (E)
          src/cmpo.c
                include/libmpo/cmpo.h (I)
          src/dmpo.c
                include/libmpo/mpo.h (I)
          src/mpo.c
                include/libmpo/mpo.h (I)
       jpeg/jpeg: 0
          jpeglib.h
                include/libmpo/mpo.h (E)
       system:
          assert.h
                src/cmpo.c
                src/mpo.c
          stdint.h
                include/libmpo/mpo.h
          stdio.h
                include/libmpo/mpo.h
          stdlib.h
                include/libmpo/mpo.h
       unresolved:
          example/CMakeLists.txt
                CMakeLists.txt
          jpeglib.h
                include/libmpo/mpo.h

I'm also trying to remove the jpeglib.h dependency as I put the following macro :

#ifdef BII
#include <jpeg/jpeg/jpeglib.h>
#else
#include <jpeglib.h>
#endif

Solution

  • It is not necessary to modify your source code, and if you want to do such a check it would be #ifdef BIICODE.

    So leave the code as is, and use the [includes] section in biicode.conf:

    [requirements]
         jpeg/jpeg: 1
    
    [paths]
        include
    
    [includes]
         jpeglib.h: jpeg/jpeg
    

    It is true that there is a limit now of 12 mb, but you can workaround it with your current size adding a ignore.bii file with:

    example/*.mpo
    *.pdf
    

    Then it should be enough to add the ADD_BIICODE_TARGETS macro to your cmake, which will manage everything, so just add at the beginning of your CMakeLists.txt

    IF(BIICODE)
      ADD_BIICODE_TARGETS()
      return()
    ENDIF()
    

    It is true that it seemed that jpeg lib version in biicode had a problem, but it is fixed and updgraded to jpeg9 in biicode version jpeg/jpeg: 1, which is the one in the biicode.conf.

    Adding this to your repo, you should be able to just "bii build" and run the generated example inside bin folder. I have tested it with MinGW 4.8 and worked.