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.

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

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

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

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

     bii find
    

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

     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 sys/sysctl.h, objc/runtime.h and Foundation/Foundation.h are related to iOS development in Objective-C. The file 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.

     bii deps
    

    The following is printed to STDOUT:

     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.

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

    bii cpp:build
    

    A build target (executable) with the name SelfTest is build into the directory <biicode_project_root>/bin. The executable SelfTest can be run via the following command:

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

    The following is printed to STDOUT:

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

    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.