Adding biicode support for the library Catch

Published:

Content

Introduction

In this blog post I will demonstrate how-to use an already existing library with the dependency manager biicode.

biicode is described with the following head line:

C / C++ dependency manager with a cloud-based service

The library I want to use with biicode is Catch. Catch is described as follows:

Catch stands for C++ Automated Test Cases in Headers and is a multi-paradigm automated test framework for C++ and Objective-C (and, maybe, C). It is implemented entirely in a set of header files, but is packaged up as a single header for extra convenience.

Steps

  1. [Optional Step] Install necessary C++ third party tools to start using biicode.

    1
    
     bii setup:cpp
    
  2. Create a new biicode project.

    1
    2
    
     bii init catch
     cd catch
    
  3. Create new biicode block folder.

    1
    2
    
     bii new florianwolters/catch
     cd blocks/florianwolters/catch
    
  4. Fork the original Git repository philsquared/Catch on GitHub.
  5. Clone the forked Git repository.

    1
    
     git clone https://github.com/FlorianWolters/Catch.git .
    
  6. Create the biicode configuration file
    1
    
    biicode.conf
    (the content can be seen here).
  7. Create the biicode ignore file
    1
    
    ignore.bii
    (the content can be seen here).
  8. Create a CMake configuration file
    1
    
    CMakeLists.txt
    in the block directory
    1
    
    blocks/florianwolters/catch
    (the content can be seen here).
  9. Retrieve any code dependencies from biicode’s servers.

    1
    
     bii find
    

    The following is printed to the standard output (STDOUT):

    1
    2
    3
    
     WARN: There are local unresolved dependencies
     They will not be searched in the server
     Unresolved: sys/sysctl.h, objc/runtime.h, Foundation/Foundation.h, AfxWin.h
    

    The three files

    1
    
    sys/sysctl.h
    ,
    1
    
    objc/runtime.h
    and
    1
    
    Foundation/Foundation.h
    are related to iOS development in Objective-C. The file
    1
    
    AfxWin.h
    is part of the C++ library Microsoft Foundation Classes (MFC) from Microsoft.

    I don’t know (yet) how to deal with dependencies in biicode that depent on the system environment. Therefore I created this question on Stack Overflow.

  10. Show information about current project dependencies.

    1
    
     bii deps
    

    The following is printed to STDOUT:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    
     florianwolters/catch depends on:
            system:
               algorithm
               assert.h
               cmath
               cstddef
               cstdio
               cstring
               fstream
               iomanip
               iostream
               iterator
               limits
               map
               memory
               ostream
               set
               sstream
               stdbool.h
               stdexcept
               stdint.h
               stdlib.h
               streambuf
               string
               sys/time.h
               sys/types.h
               unistd.h
               vector
               windows.h
            unresolved:
               AfxWin.h
               Foundation/Foundation.h
               objc/runtime.h
               sys/sysctl.h
    
  11. Configure the project.

    1
    
     bii cpp:configure -G"Unix Makefiles"
    
  12. Build the project.

    1
    
    bii cpp:build
    

    A build target (executable) with the name

    1
    
    SelfTest
    is build into the directory
    1
    
    <biicode_project_root>/bin
    . The executable
    1
    
    SelfTest
    can be run via the following command:

    1
    
    ../../../bin/SelfTest
    

    The following is printed to STDOUT:

    1
    2
    
    ===============================================================================
    All tests passed (450 assertions in 77 test cases)
    
  13. Publish the project to biicode’s servers.

    1
    
    bii publish
    

Conclusion

And that’s it. We successfully adopted the library Catch for biicode without changing one single line of existing code.

  • The forked Git repository can be found here.
  • The biicode block can be found here.

After the problems with the header files are resolved, a pull request can be created on GitHub to merge the biicode integration into the main Git repository.

Please let me know, if you have suggestions improving the workflow described.

I will try to add biicode support to some other libraries, because I believe that the biicode approach is pushing C++ into the right direction.