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

Custom Layouts

Blocks live in Biicode projects, each biicode project can have in it as many blocks as you want.

A project is a combination of meta-data and folders containing your blocks, dependencies and files like policies.bii to apply when finding or updating your dependencies.

Use bii init -L or bii init --layout command to use a different folder structure.

Simple Layout

Place your repo's code directly in your project's folder. Use bii init -L .

~$ bii init myproject -L

Creates a simple folder structure in which deps/ , build/ and cmake/ folders - all auxiliary folders but bin/ - are inside bii/ folder:

+-- myproject/
|    +-- bii/
|    |    +-- layout.bii
|    |    +-- policies.bii
|    |    +-- settings.bii

in which layout.bii content is:

# Minimal layout, with all auxiliary folders inside "bii" and
# The binary "bin" folder as is, and enabled code edition in the project root
cmake: bii/cmake
lib: bii/lib
build: bii/build

deps: bii/deps
# Setting this to True enables directly editing in the project root
# instead of blocks/youruser/yourblock
# the block will be named as your project folder
auto-root-block: True

For example, this is a project with simple layout :

+-- myproject/
|    +-- bii/
|    |    +-- layout.bii
|    |    +-- policies.bii
|    |    +-- settings.bii
|    |    +-- build/
|    |    +-- cmake/
|    |    +-- deps/
|    +-- bin/
|    +-- src/
|    +-- biicode.conf
|    +-- CMakeLists.txt

A project's layout is fully customizable via layout.bii file, you can place the auxiliary folders wherever you want, just specify the relative routes to the folders you want to use instead.

TMP Layout

Looking for an even cleaner layout? Use bii init -l tmp.

This layout option redirects deps/ , build/ and cmake/ folders to the temporal folder of your system tmp/myproject/ -all aux folders but bin/- and places your repo's code directly in your project's folder.

Creates a folder structure in which deps/,build/ and cmake/ folders (all auxiliary folders but bin/ are inside bii/ folder:

+-- myproject/
|    +-- bii/
|    |    +-- layout.bii
|    |    +-- policies.bii
|    |    +-- settings.bii

in which layout.bii content is:

# Layout that redirect aux folders to your tmp/project folder
cmake: $TMP/cmake
lib: $TMP/lib
build: $TMP/build
deps: $TMP/deps
auto-root-block: True

For example, this is a project with TMP layout :

+-- myproject/
|    +-- bii/
|    |    +-- layout.bii
|    |    +-- policies.bii
|    |    +-- settings.bii
|    +-- bin/
|    +-- src/
|    +-- biicode.conf
|    +-- CMakeLists.txt

Classic Layout

bii init myproject creates a simple folder structure:

+-- myproject/
|    +-- bii/
|    |    +-- policies.bii
|    |    +-- settings.bii

And executing:

~$ cd myproject
~/myproject$ bii new username/blockname --hello=cpp

creates this structure into myproject:

+-- myproject/
|    +-- bii/
|    |    +-- policies.bii
|    |    +-- settings.bii
|    +-- blocks/
|    |    +-- username/
|    |    |    +-- blockname/
|    |    |    |    +-- main.cpp

Each project follows the same standard structure, for example:

+-- myproject/
|    +-- bii/
|    +-- blocks/
|    |    +-- owner1/
|    |    |    +-- blockA/
|    |    |    |    +-- src/
|    |    |    |    +-- include/
|    |    |    |    +-- test/
|    |    |    |    +-- biicode.conf
|    |    |    |    +-- CMakeLists.txt
|    +-- deps/

This structure empowers consistency between the blocks published in biicode, it also enables working with different owner/blocks at the same time:

+-- myproject/
|    +-- bii/
|    |    +-- policies.bii
|    |    +-- settings.bii
|    +-- blocks/
|    |    +-- owner1/
|    |    |    +-- blockA/
|    |    |    |    +-- src/
|    |    |    |    +-- include/
|    |    |    |    +-- test/
|    |    |    |    +-- biicode.conf
|    |    |    |    +-- CMakeLists.txt
|    |    |    +-- blockB/
|    |    |    |    +-- main.cpp
|    |    |    |    +-- biicode.conf
|    |    |    |    +-- CMakeLists.txt
|    |    +-- owner2/
|    |    |    +-- blockC/
|    |    |    |    +-- tool.h
|    |    |    |    +-- tool.cpp
|    |    |    |    +-- biicode.conf
|    |    |    |    +-- CMakeLists.txt
|    +-- deps/

CLion Layout

Use CLion with biicode, just like the regular biicode layout but with a bii/layout.bii to integrate biicode with the C/C++ IDE.

This layout places your repo's code as usual, in your project_name/blocks/owner/blockname directory:

This working project looks like this:

+-- myproject/
|    +-- bii/
|    |    +-- policies.bii
|    |    +-- settings.bii
|    |    +-- layout.bii
|    +-- blocks/
|    |    +-- owner1/
|    |    |    +-- blockA/
|    |    |    |    +-- src/
|    |    |    |    +-- include/
|    |    |    |    +-- test/
|    |    |    |    +-- biicode.conf
|    |    |    |    +-- CMakeLists.txt
|    +-- deps/

in which layout.bii content is:

# Layout for CLion IDE with root CMakeLists at project root
# This layout DOES NOT allow root-block, as it will overwrite the project CMakeLists
cmake: /
Here's more info about :ref:`working with CLion <ide_clion>`.

Check our biicode's forum and/or StackOverflow tag for questions and answers. You can also write us for suggestions and feedback.