Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
228 lines (136 sloc) 6.26 KB

Getting started

Welcome to biicode.

Biicode manages your project's dependencies so you can use the libs you need (Curl, Catch, Fann, OpenSSL, OpenCV, Poco, Boost, Libuv, GTest ...) as you wish within your project. Biicode uses CMake to configure and build your projects and it is compatible with many IDEs and version control systems.

This guide will help you get your first biicode block off the ground. Let's run a block with a unit test using the Google Test Framework in biicode. There's no need to install GTest, biicode downloads and configures it for you, GTest is already in biicode!

Basics

Make sure :ref:`biicode is installed<first_steps>`. Open the terminal and execute bii setup:cpp to ensure you've got all tools required.

Create your first project

bii init -L a folder to create a new project. The commands below create unit_test/ folder as a biicode project containing a block and a main.cpp file.

~$ bii init unit_test -L
~$ cd unit_test
~/unit_test$ echo "//main.cpp code goes here" >> main.cpp

Place this code into the main.cpp file:

It is just a sum function and a test using Google Test framework.

The #include is composed as #include <biicode_user>/<block_name>/path/to/file. In this case, it #includes the include/gtest/gtest.h header from GTest block and user google.

In the web, you see its latest version is 10 tagged STABLE:

/_static/img/c++/gtest_in_biicode.png

Retrieve the dependency:

~/unit_test$ bii find
...

INFO: Analyzing compatibility for found dependencies...
INFO: All dependencies resolved
Find resolved new dependencies:
  google/gtest: 10
INFO: Saving files from: google/gtest

bii find creates a biicode.conf file and downloads GoogleTest block into your bii/deps folder:

unit_test/
      ├── bii/
      │   ├── deps/
      │   │   └── google/
      │   │       └── gtest/
      ├── biicode.conf
      └── main.cpp

[optional] Keeping #includes short

Keep reading to see how to keep your #includes as usual. You can also :ref:`skip this section.<cpp_run>`

Instead of using long #includes, you can write the specs to retrieve this dependency in your biicode.conf.

  • Split the long #include "google/gtest/include/gtest/gtest.h" in two halfs:
[requirements]
   google/gtest: 10

[includes]
    gtest/gtest.h: google/gtest/include

You can also use patterns:

[includes]
    gtest/*.h: google/gtest/include

Using an IDE

biicode configures your default settings to no IDE and MinGW (Windows) or UNIX Makefiles (MacOS and Linux). You can change these values executing bii configure:

~/unit_test$ bii configure -G "Visual Studio 10"

Here's more about :ref:`configuring your IDE <generators_ide>`.

Build and run

Build and run your Unit Test, check it works:

~/unit_test$ bii build
...
~/unit_test$ bin/user_unit_test_main
[==========] Running 1 test from 1 test case.
...
[----------] Global test environment tear-down
[==========] 1 test from 1 test case ran. (15 ms total)
[  PASSED  ] 1 test.

Linux/Mac users might run as:

~/unit_test$ ./bin/user_unit_test_main

That's it, that output means Google Test was downloaded, configured and built in your project!

Congrats! You have just used GoogleTest within your project. You know that we are available at biicode's forum for any problems. You can also write us for suggestions and feedback.

Publishing

Publish to make your libs available in biicode.

  • Execute $ bii user your_username.
~/unit_test$ bii publish

INFO: *****************************
INFO: ***** Publishing public ****
INFO: *****************************
INFO: Successfully published your_username/unit_test: 0

Go to your profile at www.biicode.com/your_username to check what you've just uploaded.

/_static/img/c++/unit_test_publishing.png

  • Log in to edit the block's web description.
  • Make sure you've got an account to publish. It's free.

Take a look into your block's biicode.conf file (~/unit_test/biicode.conf). [parent] section tells you "who is your parent version", which is the latest published version of your block and looks like this:

[parent]
   your_username/unit_test: 0

Celebrate! You've just published your first block in biicode. You know that we are available at biicode's forum for any issues. You can also write us for suggestions and feedback.