Jump to content

Programming Howto:Configure BCI2000 for Compilation: Difference between revisions

From BCI2000 Wiki
Nluczak (talk | contribs)
No edit summary
 
(3 intermediate revisions by 2 users not shown)
Line 10: Line 10:
Click "AddEntry" in the CMake window ...
Click "AddEntry" in the CMake window ...
<br />
<br />
* <i>Note that checking off "Advanced" in Cmake is optional and does not impact the compilation</i>
* <i>Note that checking of "Advanced" in Cmake is optional and does not impact the compilation</i>
[[File:use_cmake_2.PNG|center]]
[[File:use_cmake_2.PNG|center]]


Line 28: Line 28:
|}
|}


<i> Note that BCI2000 is most frequently tested using Visual Studio 2019 and Qt 5.15.2</i>
<i> Note that BCI2000 is most frequently tested using Visual Studio 2019 and Qt 5.15.2, and that the table above shows the suggested versions of Visual Studio and Qt to use together.</i>
'''Also note:''' Qt versions built for Visual Studio 2019 are compatible with Visual Studio 2022 as well.
[[File:use_cmake_3.PNG|center]]
[[File:use_cmake_3.PNG|center]]


Line 64: Line 65:


[[File:use_cmake_10.PNG|center]]
[[File:use_cmake_10.PNG|center]]
==Building with Visual Studio 2026==
Visual Studio 2026 needs a recent version of CMake. If you are moving an existing BCI2000 build directory from Visual Studio 2022 or older, follow these steps before you run "Configure.sh.cmd" again.
# <b>Update CMake.</b> The "Visual Studio 18 2026" generator was added in CMake 4.2, so older versions cannot build for Visual Studio 2026. We recommend the latest CMake release; we have tested with CMake 4.5. To check your version, run <code>cmake --version</code> in a command prompt.
# <b>Clear the old CMake cache.</b> CMake remembers the generator a build directory was first configured with. A build directory set up for Visual Studio 2022 will keep generating a Visual Studio 2022 solution, even after Visual Studio 2026 is installed. In the CMake window, choose "File" > "Delete Cache", or close CMake and delete <code>CMakeCache.txt</code> and the <code>CMakeFiles</code> folder from your build directory. Do not delete the build directory itself, since it contains "Configure.sh.cmd".
# <b>Choose the Visual Studio 2026 generator.</b> Click "Configure", select "Visual Studio 18 2026" as the generator, and click "Finish". Then continue with the steps above as usual.
# <b>Open the .slnx solution file.</b> For Visual Studio 2026, CMake writes the solution in the new .slnx format instead of .sln. After clicking "Generate", open the .slnx file in your build directory.
'''Also note:''' If the build directory was used with an older Visual Studio, the old .sln file is still there with an earlier date, because CMake does not remove it. Ignore it or delete it, and open the .slnx file instead.


==Next step==
==Next step==

Latest revision as of 03:33, 20 November 2026

Back

To this howto's overview page.

Run the CMake GUI

Double-click "Configure.sh.cmd" in your BCI2000 build directory.

Tell CMake which Qt installation to use

Click "AddEntry" in the CMake window ...

  • Note that checking of "Advanced" in Cmake is optional and does not impact the compilation

... and enter the path to a Qt directory that is consistent with the compiler you are going to use. Use CMAKE_PREFIX_PATH as the name for the new entry. Be aware that the entry's name is case sensitive. Be sure to download the correct version of Qt for the build version you plan to use, and verify the compatibility of the versions of Qt and Visual Studio used.

Visual Studio and Qt Compatibility
Visual Studio 2017 Qt 5.12.12
Visual Studio 2019 Qt 5.15.2
Visual Studio 2022 Qt 6.2.4

Note that BCI2000 is most frequently tested using Visual Studio 2019 and Qt 5.15.2, and that the table above shows the suggested versions of Visual Studio and Qt to use together. Also note: Qt versions built for Visual Studio 2019 are compatible with Visual Studio 2022 as well.

Perform the configuration step

In the CMake window, click "Configure" ...

... and choose a generator that is consistent with your compiler, and with the Qt directory chosen above. Then click "Finish" to perform the configuration step.

You will see a list of targets scrolling by, and a number of new entries in the variable list at the top of the window, marked in red.

Choose build options

Make sure the "Grouped" checkbox is checked, and configure the build by customizing values in the "BUILD" ...

... "EXTENSIONS" group,

... and "USE" group. Make sure to uncheck USE_APPLICATION_BUNDLES to avoid problems with compiling. Then, click "Generate" to create build files.

When CMake displays its "Generating done" message, ...

... your BCI2000 build directory will now contain a VisualStudio solution file, as well as a number of additional CMake-generated files.

Building with Visual Studio 2026

Visual Studio 2026 needs a recent version of CMake. If you are moving an existing BCI2000 build directory from Visual Studio 2022 or older, follow these steps before you run "Configure.sh.cmd" again.

  1. Update CMake. The "Visual Studio 18 2026" generator was added in CMake 4.2, so older versions cannot build for Visual Studio 2026. We recommend the latest CMake release; we have tested with CMake 4.5. To check your version, run cmake --version in a command prompt.
  2. Clear the old CMake cache. CMake remembers the generator a build directory was first configured with. A build directory set up for Visual Studio 2022 will keep generating a Visual Studio 2022 solution, even after Visual Studio 2026 is installed. In the CMake window, choose "File" > "Delete Cache", or close CMake and delete CMakeCache.txt and the CMakeFiles folder from your build directory. Do not delete the build directory itself, since it contains "Configure.sh.cmd".
  3. Choose the Visual Studio 2026 generator. Click "Configure", select "Visual Studio 18 2026" as the generator, and click "Finish". Then continue with the steps above as usual.
  4. Open the .slnx solution file. For Visual Studio 2026, CMake writes the solution in the new .slnx format instead of .sln. After clicking "Generate", open the .slnx file in your build directory.

Also note: If the build directory was used with an older Visual Studio, the old .sln file is still there with an earlier date, because CMake does not remove it. Ignore it or delete it, and open the .slnx file instead.

Next step

As a next step, learn how to compile BCI2000.

See also

Programming Howto:Building and Customizing BCI2000