ITK/Compilers: Difference between revisions
(→Linux) |
|||
(10 intermediate revisions by 2 users not shown) | |||
Line 9: | Line 9: | ||
* Always use CMake with ITK. CMake has generators for most major build systems. Attempting to, for example, use Visual Studio directly without CMake will make things much more difficult than they need to be. | * Always use CMake with ITK. CMake has generators for most major build systems. Attempting to, for example, use Visual Studio directly without CMake will make things much more difficult than they need to be. | ||
* ITK does not distribute binaries on purpose. An open source software development system has numerous advantages; one advantage is avoiding problems related building, distributing, and linking binaries. Have your build system build ITK from source on the the same platform and with the same compiler to | * ITK does not distribute binaries on purpose. An open source software development system has numerous advantages; one advantage is avoiding problems related building, distributing, and linking binaries. Have your build system build ITK from source on the the same platform and with the same compiler to avoid these problems. Git submodules and the CMake ExternalProject system can help with this. | ||
* For a list of supported compilers, see the [[ITK_Release_4/Modern_C%2B%2B|supported compilers Wiki page]]. | * For a list of supported compilers, see the [[ITK_Release_4/Modern_C%2B%2B|supported compilers Wiki page]]. The most accurate and informative supported compiler information is the set of compilers reporting to the [http://public.kitware.com/dashboard.php?name=itk nightly dashboard]. To make your favorite compiler better supported, consider [[ITK/Policy_and_Procedure_for_Adding_Dashboards|setting up a nightly dashboard submission]]. | ||
== Linux == | == Linux == | ||
* ITK | * ITK supports the latest GCC very well. | ||
* LLVM support is good. | * LLVM support is good. | ||
* The "Unix Makefile" CMake generator support is very good. Recent CMake generator support for the [http://martine.github.com/ninja/ Ninja build system] is experimental, but most experiments have been successful. | * The "Unix Makefile" CMake generator support is very good. Recent CMake generator support for the [http://martine.github.com/ninja/ Ninja build system] is experimental, but most experiments have been successful. | ||
== Mac == | == Mac == | ||
* Use the latest version of Xcode or build LLVM from source for best results. | |||
== Windows == | == Windows == | ||
Please avoid attempting to use ancient Visual Studio compilers, such as VS6, which has been [[ITK/10th_Anniversary_Activities/Compilers_Farewell_ITKv4|put to rest]]. | === Avoid old versions of Visual Studio === | ||
Please avoid attempting to use ancient Visual Studio compilers, such as VS6, which has been [[ITK/10th_Anniversary_Activities/Compilers_Farewell_ITKv4|put to rest]]. There are a number of preferable alternatives to an old version of Visual Studio. | |||
* The free-to-use [http://www.microsoft.com/express Visual Studio Express versions]. | |||
* [http://www.mingw.org/ MinGW] | |||
=== Make based build systems === | |||
The Visual Studio GUI may be very slow when it tries to handle a large project like ITK. These problems can be avoided with a make based build system. | |||
==== Visual Studio CL compiler ==== | |||
The Visual Studio cl.exe compiler can be called directly with make based build systems. There are a few options. | |||
* nmake | |||
* jom | |||
To use either of these systems, you must set the appropriate environment variables as [http://www.cmake.org/Wiki/CMake_Generator_Specific_Information specified here]. Then, specify the appropriate build system generator with CMake. NMake comes with Visual Studio, but does not perform parallel builds. JOM is similar to NMake, but it can perform parallel builds, so it is preferred. | |||
==== MinGW compiler ==== | |||
CMake can generate Makefiles for the '''make''' executable to be executed in the MSYS shell. Make based build systems are also the backend for GUI tools like the [http://www.codeblocks.org/ CodeBlocks IDE] or the [http://qt.nokia.com/products/developer-tools/ QtCreator IDE], which conveniently come packaged with the MinGW compiler. |
Latest revision as of 05:18, 14 August 2012
Compilers
This page contains information and tips on using compilers and build systems with ITK.
General Tips
Build systems
- Always use CMake with ITK. CMake has generators for most major build systems. Attempting to, for example, use Visual Studio directly without CMake will make things much more difficult than they need to be.
- ITK does not distribute binaries on purpose. An open source software development system has numerous advantages; one advantage is avoiding problems related building, distributing, and linking binaries. Have your build system build ITK from source on the the same platform and with the same compiler to avoid these problems. Git submodules and the CMake ExternalProject system can help with this.
- For a list of supported compilers, see the supported compilers Wiki page. The most accurate and informative supported compiler information is the set of compilers reporting to the nightly dashboard. To make your favorite compiler better supported, consider setting up a nightly dashboard submission.
Linux
- ITK supports the latest GCC very well.
- LLVM support is good.
- The "Unix Makefile" CMake generator support is very good. Recent CMake generator support for the Ninja build system is experimental, but most experiments have been successful.
Mac
- Use the latest version of Xcode or build LLVM from source for best results.
Windows
Avoid old versions of Visual Studio
Please avoid attempting to use ancient Visual Studio compilers, such as VS6, which has been put to rest. There are a number of preferable alternatives to an old version of Visual Studio.
- The free-to-use Visual Studio Express versions.
- MinGW
Make based build systems
The Visual Studio GUI may be very slow when it tries to handle a large project like ITK. These problems can be avoided with a make based build system.
Visual Studio CL compiler
The Visual Studio cl.exe compiler can be called directly with make based build systems. There are a few options.
- nmake
- jom
To use either of these systems, you must set the appropriate environment variables as specified here. Then, specify the appropriate build system generator with CMake. NMake comes with Visual Studio, but does not perform parallel builds. JOM is similar to NMake, but it can perform parallel builds, so it is preferred.
MinGW compiler
CMake can generate Makefiles for the make executable to be executed in the MSYS shell. Make based build systems are also the backend for GUI tools like the CodeBlocks IDE or the QtCreator IDE, which conveniently come packaged with the MinGW compiler.