biicode knows how source code files connect to each other. With this information, it creates a boilerplate CMake layout to build your project automatically. biicode then detects how sources connect and builds a dependency graph following #includes and implementations generating, for each block, a CMakeLists.txt defining variables to the dependency graph detected.
This translates into a CMakeLists.txt file with just one line by default:
Even though the boilerplate might be enough for some projects, here’s a guide to fully control the building process.
Today, we explain the different options available in biicode once you’ve got your CMakeLists.txt ready.
Compiling with biicode
bii configure or bii build commands generate a CMakeLists.txt file in each block. Both commands accept CMake directives. For example, you can switch between building with gcc or clang just by running:
bii configure -DCMAKE_CXX_COMPILER=g++
bii configure -DCMAKE_CXX_COMPILER=$(which clang++)
You can also choose the build type:
bii configure -DCMAKE_BUILD_TYPE=DEBUG
Possible values are: DEBUG, RELEASE, RELWITHDEBINFO and MINSIZEREL.
You can build your projects with the parameters CMake offers depending on your OS.
By default, biicode configures projects with no IDE. Using MinGW in Windows UNIX Makefiles in MacOS and Linux. But you can use CMake generators to create biicode projects for different IDEs and platforms.
A CMake Generator is responsible for writing the input files for a native build system. Exactly one of the CMake Generators must be selected for a build tree to determine what native build system is to be used. CMake Generators are platform-specific so each may be available only on certain platforms.
cmake --help to see the full list of CMake generators available in your system:
Let’s get into specifics using generators available for common IDEs:
Linux/Mac OSX users:
bii configure -G "Eclipse CDT4 - Unix Makefiles"
If you are using Eclipse with Mac OS X, you may need some additional setup to execute your binaries within this IDE. Read this troubleshooting section for more information.
bii configure -G "Eclipse CDT4 - MinGW Makefiles"
And once done, you can import your project into Eclipse:
- Choose: File > import…
- Now, general > Existing Projects into Workspace > next.
- Select the root directory as the root folder of your project.
- You should see a project already selected in the projects box. Click finish.
Generate a Microsoft Visual Studio 12 (2013) project:
bii configure -G "Visual Studio 12"
Open your project with Visual Studio. Just double-click on the .sln file inside the build folder of your project and a VS project opens.
CLion’s compatibility is way easier, just get into your project’s folder and execute:
bii init -L=clion
Configure your project to set the changes:
Open the biicode project with CLion (File -> Open).
And use biicode’s commands from the embedded Terminal in CLion, open it with: Alt+F12 or View -> Tool Windows -> Terminal.
There are many options available, even some we haven’t tried yet, give it a try and tell us how you use biicode, we’re waiting forward to hear from you!
Some biicoders are hacking around already:
Pumped that @biicode now works with KDevelop using the clion layout.
— Zachary Grafton (@zackgrafton) March 14, 2015