Programming Reference:Build System (obsolete): Difference between revisions
| Line 98: | Line 98: | ||
Now that BCI2000 is open to other compilers - and soon - other platforms, support may not exist for every possible compiler/platform available. Certain compilers do not optimize code as well as others, and this behavior may lead to poor system latencies during BCI2000 experiments. The supported compilers have been rigorously tested and confirmed to be adequate for compiling the BCI2000 sources. If you wish to use a different compiler, | Now that BCI2000 is open to other compilers - and soon - other platforms, support may not exist for every possible compiler/platform available. Certain compilers do not optimize code as well as others, and this behavior may lead to poor system latencies during BCI2000 experiments. The supported compilers have been rigorously tested and confirmed to be adequate for compiling the BCI2000 sources. If you wish to use a different compiler, | ||
be sure to run tools/BCI2000Certification in order to confirm your setup. CMake is a powerful tool, but in the end, ability to compile the sources is completely up to the IDE/compiler choice. If your IDE/compiler choice is not listed above, it is strongly urged that you to consider using one which is supported. If you run into problems using an unsupported IDE/compiler combination, you can try to find help at the BBS - http://www.bci2000.org/phpbb/index.php. BCI2000 should compile as effortlessly as possible on supported platforms. | be sure to run tools/BCI2000Certification in order to confirm your setup. CMake is a powerful tool, but in the end, ability to compile the sources is completely up to the IDE/compiler choice. If your IDE/compiler choice is not listed above, it is strongly urged that you to consider using one which is supported. If you run into problems using an unsupported IDE/compiler combination, you can try to find help at the BBS - http://www.bci2000.org/phpbb/index.php. BCI2000 should compile as effortlessly as possible on supported platforms. | ||
== Platforms tested successfully so far == | == Platforms tested successfully so far == | ||
Revision as of 16:27, 1 December 2010
This documentation only applies to BCI2000 Ver 3.0
Introduction
BCI2000 was originally intended to be built only on the Borland compiler due to the fact that much of its architecture was built on the visual components library (VCL) by Borland. By making BCI2000 compiler independent, we could no longer use VCL, and had to choose an open source and cross platform replacement. Qt was chosen to replace VCL because it is not only compiler independent but is also platform independent, a future goal for BCI2000.
As such, Qt is required for compiling the BCI2000 source on a non-Borland platform. If Borland is still being used as the compiling environment, VCL is still temporary supported and the project will be built using the VCL for it's graphical elements. For Visual Studio or MinGW builds of BCI2000, a stripped-down version of the Qt SDK is provided in the BCI2000 source tree.
To support such a large number of platforms and compilers, BCI2000 has turned to CMake http://www.cmake.org to generate makefiles, project files, and visual studio solutions. Cmake can be thought of as a meta-makefile, in that it examines your build environment, and sets up a Visual Studio project, or a Code::Blocks project which is custom tailored to your environment. It is because of varying build environments, that BCI2000 can not come with a set Visual Studio solution file, or an Eclipse project file without giving the user a lot of headache in setting up the compiler to work correctly. Once remaining dependencies on the Win32 API are removed, the number of platforms BCI2000 supports will only be limited by the number of platforms and compilers that CMake has generators for.
Supported Environments
- Supported Operating Systems
- Windows XP, Windows 2000 (Vista and Windows 7 have poor Audio Video latencies - not recommended for BCI2000)
- Macintosh OSX support coming soon
- Linux support coming soon
- Supported Compilers
- Borland 6, 2007, 2009, 2010
- Visual Studio 9 (2008), download free Express version from here (although some BCI2000 modules require MFC, most modules may be built using the Express version)
- MinGW with gcc 3.x (4.x when building against a recent version of Qt)
- Supported IDEs
- Borland 6, 2007, 2009, 2010 (Note: Use the project files in the src directory for Borland IDE support. This support is being phased out)
- Visual Studio 9 (2008) (via CMake)
- Code::Blocks - MinGW Makefiles (via CMake)
- Other IDEs supported by CMake generators (Eclipse CDT, ...), as long as these use the compilers listed above
How To Build Using CMake
- Ensure that your compiler and IDE are installed on the computer. This means that Visual Studio is installed if you intend to use Visual Studio, or that MinGW and Code::Blocks are installed if you intend to use Code::Blocks as your IDE and MinGW as your compiler.
- Download and install cmake (Version 2.8 or higher!) from http://www.cmake.org/ - Add to path for all users. -- If you experience a problem with a version of cmake newer than 2.8.1, download cmake 2.8.1 from here.
- Go to the BCI2000/build directory and double click the .bat file which best describes your intended platform. (ie. if you plan to use Visual Studio 2008, run the Visual Studio 2008 .bat file)
- Wait while cmake examines your computer, finds qt and your compiler, and generates applicable project files for your system
- Open the generated project/solution in the IDE and build BCI2000, or - if makefiles were generated - run the make command from a command prompt. Refer to the IDE help for IDE specific instructions on how to build an application.
Building against a Qt distribution outside the BCI2000 source tree
BCI2000 may be built against a standard Qt distribution. Depending on your compiler and desired configuration (e.g., when using Visual Studio), you might need to re-build that distribution from source before building BCI2000.
To enable the BCI2000 build system to use the external Qt distribution, open the file BCI2000/build/cmake/FindQt.cmake in a text editor. There, in line 10, replace
SET( USE_STD_QT FALSE )
with
SET( USE_STD_QT TRUE )
Then, go to the directory BCI2000/build and remove the file CMakeCache.txt before re-creating project files using the appropriate batch file in BCI2000/build.
How To Test
It is important - especially if you're using an unsupported compiler/IDE - to test your executables once they've been built to make sure they function properly.
To run testing:
- Ensure that the entire BCI2000 project has built successfully and that executables exist in the BCI2000/prog directory, the BCI2000/tools/cmdline directory, and the BCI2000/build/buildutils/test directory.
- Run test_executables.bat in the BCI2000/build/buildutils/test directory.
The tests will run and report a message after they've finished whether they've failed or not. You may see a message in the beginning of the test stating that a directory does not exist. This is normal behavior and does not reflect whether or not your executables have failed testing or not.
A Note on found differences: depending on how many differences found it may not indicate that you have a broken build. Sometimes different compilers handle the precision of floating point numbers differently than others. These can account for small differences in calculated signal or state values. The default ref files were generated using Borland 2007. If your compiler is different, this may not be a problem.
Known Issues
- MinGW, Borland and other single configuration generators within CMake only generate one configuration at CMake Run-time. By default, this is set to the release configuration. It can be set - along with specific compiler options - in BCI2000/build/cmake/BuildConfigurations.cmake. The Visual Studio generator will ignore settings in this file.
- All Compilers handle non standard characters, such as umlauts and characters with accents or tildes, differently. Because BCI2000 currently has no standardized way of handling non standard characters in a cross-compiler environment, it is strongly recommended that - for the time being - special characters are not used in localizations during the development of BCI2000 Ver 3.0.
Conclusions
Now that BCI2000 is open to other compilers - and soon - other platforms, support may not exist for every possible compiler/platform available. Certain compilers do not optimize code as well as others, and this behavior may lead to poor system latencies during BCI2000 experiments. The supported compilers have been rigorously tested and confirmed to be adequate for compiling the BCI2000 sources. If you wish to use a different compiler, be sure to run tools/BCI2000Certification in order to confirm your setup. CMake is a powerful tool, but in the end, ability to compile the sources is completely up to the IDE/compiler choice. If your IDE/compiler choice is not listed above, it is strongly urged that you to consider using one which is supported. If you run into problems using an unsupported IDE/compiler combination, you can try to find help at the BBS - http://www.bci2000.org/phpbb/index.php. BCI2000 should compile as effortlessly as possible on supported platforms.
Platforms tested successfully so far
| Compiler | OS | Processors | Qt linkage |
|---|---|---|---|
| MSVC2008 | Win XP SP3 | 2 | static |
| MSVC2008 | Win XP SP3 | 1 | static |
| MSVC2008 | Win 7 64bit | 1 | dynamic |
| MinGW > 4 | Win XP SP3 | 1 | static |
| MinGW > 4 | Win XP SP3 | 1 | dynamic |