Difference between revisions of "Programming Howto:Building BCI2000"

From BCI2000 Wiki
Jump to: navigation, search
Line 1: Line 1:
#REDIRECT [[Programming Reference:Build System]]
 
 
 
This document describes how to build BCI2000, i.e. how to create the BCI2000 executables from their source code.
 
This document describes how to build BCI2000, i.e. how to create the BCI2000 executables from their source code.
  
== Why to build ==
+
==Prerequisites==
Typically, you will install BCI2000 from its [[BCI2000 Binaries|binary distribution]], and do not need to build BCI2000, unless
+
#A C++ compiler. Currently, MSVC 2012 through 2017 are supported.
*you want to always use its most current SVN version,
+
#To build GUI-related parts of BCI2000, a recent version of Qt5 is required. Use Qt's maintenance tool to select and install a version of Qt that matches your C++ compiler.
*you create your own module by modifying an existing one,
+
#CMake 3.11 or newer. Choose "add to path for all users" when prompted by the installer.
*you create a new module from scratch.
 
 
 
== Tools required ==
 
As of BCI2000 version 2.0, building all parts of BCI2000 requires Borland's C++ Builder 6, or a more recent version.
 
The operator GUI and Application modules currently require the Borland VCL library.
 
The following non-GUI related parts of BCI2000 can be built using the freely available Borland C++ compiler:
 
*[[User Reference:Command Line Processing|Command line tools]]
 
*[[User Reference:Matlab MEX Files|Matlab MEX files]]
 
  
 
==How to build==
 
==How to build==
===Building BCI2000 from the command line===
+
===1. Start CMake===
Command-line builds require a working installation of Borland C++ Builder 6.
+
In the BCI2000 build directory, double-click '''Configure.sh.bat'''.
# Open a Windows cmd shell, e.g. by choosing "Run..." from the Start Menu and entering "cmd".
+
===2. If using Qt on Windows, point CMake to it===
# Change to the BCI2000 "src" directory.
+
#In the CMake GUI, click "Add Entry".
# Execute "make" from the command prompt.
+
#Under Name, enter "Qt5_DIR" (case matters), and set "Type" to "PATH".
# If you updated or edited any of the source files, and experience linker errors or other unexpected behavior, execute "make clean && make all".
+
#Under Value, enter the path to your Qt distribution's "lib/cmake/Qt5" directory.
# For build versioning, execute "make build" rather than "make" or "make all". This will update the build information visible in the BCI2000 "Version" parameters, and in the "About" boxes of BCI2000 GUI applications.
+
E.g., if your Qt distribution for MSVC 2015, 64 bit, is located under <tt>D:/Qt/5.10.1/msvc2015_64</tt>, the "Qt5_DIR" CMake variable should point to <tt>D:/Qt/5.10.1/msvc2015_64/lib/cmake/Qt5</tt>.
 
+
===3. Click "Configure"===
===Building BCI2000 using the Borland C++ Builder 6 IDE===
+
From the list of compilers, choose the compiler that matches the Qt distribution chosen above.
# Open the file "BCI2000.bpg" with the IDE by double-clicking it.
+
===4. Choose build options===
# Make sure the "ProjectManager" view is visible to the left (choose "Project Manager" from the "View" menu to display it).
+
#Make sure that "Grouped" is checked in the GUI, and "Advanced" is unchecked.
# Right-click the topmost project (located immediately below the line reading "BCI2000"), and choose "Make all from here".
+
#Under the "BUILD" section, you may choose which parts of BCI2000 to build. Typically, you will want to have "BUILD_CONTRIB" checked.
# To get rid of possible inconsistencies from earlier builds, choose "Build all from here" rather than "Make all from here".
+
#Under "EXTENSIONS", choose which extensions to include into the build.
 
+
===5. Click "Generate"===
===Starting up BCI2000===
+
A project/solution file will be created inside the BCI2000 build directory. Double-click it to open it in the IDE.
# After compilation, a desired configuration of BCI2000 may be started by executing an appropriate batch file from the top level "batch" directory. Once a particular configuration of BCI2000 is started, simply load a parameter file with the same name as the batch file from the "parms" directory.
+
===6. Build BCI2000 in full, or partially===
# If you need a configuration for which no batch file exists, just modify a copy of a batch file that is close to your needs.
+
In the IDE, choose which projects to build. You may right-click individual projects, or groups of projects, and choose "build" from the context menu.
 
 
===Compiling BCI2000 with Borland C++ Builder (BCB) 2006/2007/2009===
 
When using BCB 2006, please make sure to install all available updates from the [http://cc.codegear.com/reg/bds Borland Download Site]. The originally shipped version of BCB 2006 is defective and will not work without updating. We recommend updating to BCB 2009.
 
# Open the file "BCI2000.bpg" from within Borland Developer Studio. This will import all existing projects into BDS project files.
 
# In the project manager (at the top right), right-click the topmost project and choose "Make all from here".
 
# To get rid of possible inconsistencies from earlier builds, choose "Build all from here" rather than "Make all from here".
 
# Command-line builds cannot be done with Borland C++ Builder 2007/2009 because it lacks the bpr2mak project-to-makefile conversion utility. Still, [[User Reference:Command Line Processing|Command line tools]] and [[User Reference:Matlab MEX Files|Matlab MEX files]] may be compiled from the command line as described in their documentation.
 
# When using BCB 2006, you may experience "invalid property" runtime errors when running BCI2000. This may be due to imperfect import of *.dfm files. Make sure to install all available updates, then import a clean version of the BCI2000 source tree. If this doesn't help, consider updating to BCB2009.
 
 
 
===Building Contributions===
 
====From the command line====
 
After building BCI2000 from the command line, the <tt>makefiles</tt> file in the <tt>src</tt> directory contains a full list of subprojects.
 
Those from the contribution section are commented out with a # character in front. When you remove the # character in front of a project, and do a "make all" or "make build", the additional project will be included in the build.
 
Likewise, you may speed up builds by commenting out parts of the core distribution that you don't need.
 
 
 
====From the IDE====
 
Open the contrib project group in the <tt>src/contrib</tt> directory, and build the contributions you want.
 
  
 
[[Category:Howto]][[Category:Development]]
 
[[Category:Howto]][[Category:Development]]

Revision as of 15:10, 28 May 2018

This document describes how to build BCI2000, i.e. how to create the BCI2000 executables from their source code.

Prerequisites

  1. A C++ compiler. Currently, MSVC 2012 through 2017 are supported.
  2. To build GUI-related parts of BCI2000, a recent version of Qt5 is required. Use Qt's maintenance tool to select and install a version of Qt that matches your C++ compiler.
  3. CMake 3.11 or newer. Choose "add to path for all users" when prompted by the installer.

How to build

1. Start CMake

In the BCI2000 build directory, double-click Configure.sh.bat.

2. If using Qt on Windows, point CMake to it

  1. In the CMake GUI, click "Add Entry".
  2. Under Name, enter "Qt5_DIR" (case matters), and set "Type" to "PATH".
  3. Under Value, enter the path to your Qt distribution's "lib/cmake/Qt5" directory.

E.g., if your Qt distribution for MSVC 2015, 64 bit, is located under D:/Qt/5.10.1/msvc2015_64, the "Qt5_DIR" CMake variable should point to D:/Qt/5.10.1/msvc2015_64/lib/cmake/Qt5.

3. Click "Configure"

From the list of compilers, choose the compiler that matches the Qt distribution chosen above.

4. Choose build options

  1. Make sure that "Grouped" is checked in the GUI, and "Advanced" is unchecked.
  2. Under the "BUILD" section, you may choose which parts of BCI2000 to build. Typically, you will want to have "BUILD_CONTRIB" checked.
  3. Under "EXTENSIONS", choose which extensions to include into the build.

5. Click "Generate"

A project/solution file will be created inside the BCI2000 build directory. Double-click it to open it in the IDE.

6. Build BCI2000 in full, or partially

In the IDE, choose which projects to build. You may right-click individual projects, or groups of projects, and choose "build" from the context menu.