You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
This issue is to address problems with compiling the Cxx examples on Linux.
I opened a PR #245
Background:
As a Developer I want to contribute to this project.
When following the instructions here: https://lorensen.github.io/VTKExamples/site/Instructions/ForDevelopers/
I found that building all the examples does not succeed, using the default CMake configuration, to varying degrees depending on what version of VTK you are using.
How to reproduce:
Install Ubuntu 16.04
Use VTK 6.2 from Ubuntu repo, or compile VTK 6.2 to 8.1.0 from source
Use default CMake config, including without C++11
Complete all steps to "7. Build the VTKExamples", which is to runmake
The compilation will not finish
.
Issues:
I found that many of the Cxx examples would not compile "out of the box" for me, due to:
Missing a header include
Need a specific version of VTK
Need C++11
.
Fixes made in this PR:
1. Missing headers
These were added.
2. Need specific version of VTK
For these examples, the missing guard was added so the example only compiles if you have the minimum version.
Either using the macro:
Most of the examples do not require C++11, but a few do, which breaks the build.
Therefore, where possible, example code was changed to follow the older standard.
e.g. by removing auto
If the change was not easy, because a new feature is used or affects too many lines, a guard was added so the example will only compile if the user has enabled C++11.
Using either a new macro:
Requires_CxxVersion()
or
if (USING_CPP11)
endif()
I added a script CheckCxxStandard.cmake that attempts to handle that users can do either:
Set the "-std=c++11" flag, possibly via some IDE
OR use the newer CMake command : set(CMAKE_CXX_STANDARD 11)
The script can detect the flags "std=c++11" or "std=gnu++11"
and is compatible if the user enables set(CMAKE_CXX_STANDARD 11) or set(CMAKE_CXX_STANDARD 14)
.
Tests:
These changes were tested with multiple versions of VTK using:
Ubuntu 16.04
CXX compiler GNU 5.4.0
the default CMake options for VTK, except for enabling Qt5 starting from VTK 7.1.0
Hi,
This issue is to address problems with compiling the Cxx examples on Linux.
I opened a PR #245
Background:
As a Developer I want to contribute to this project.
When following the instructions here:
https://lorensen.github.io/VTKExamples/site/Instructions/ForDevelopers/
I found that building all the examples does not succeed, using the default CMake configuration, to varying degrees depending on what version of VTK you are using.
How to reproduce:
make
.
Issues:
I found that many of the Cxx examples would not compile "out of the box" for me, due to:
.
Fixes made in this PR:
1. Missing headers
These were added.
2. Need specific version of VTK
For these examples, the missing guard was added so the example only compiles if you have the minimum version.
Either using the macro:
or
3. Need C++ 11
Whilst we could debate this, the VTK documentation says that the C++03 standard is used: https://www.vtk.org/Wiki/VTK/Wrapping_C%2B%2B11_Code
Most of the examples do not require C++11, but a few do, which breaks the build.
Therefore, where possible, example code was changed to follow the older standard.
e.g. by removing
auto
If the change was not easy, because a new feature is used or affects too many lines, a guard was added so the example will only compile if the user has enabled C++11.
Using either a new macro:
or
I added a script
CheckCxxStandard.cmake
that attempts to handle that users can do either:Set the
"-std=c++11"
flag, possibly via some IDEOR use the newer CMake command :
set(CMAKE_CXX_STANDARD 11)
The script can detect the flags
"std=c++11"
or"std=gnu++11"
and is compatible if the user enables
set(CMAKE_CXX_STANDARD 11)
orset(CMAKE_CXX_STANDARD 14)
.
Tests:
These changes were tested with multiple versions of VTK using:
Qt4
VTK 6.2.0
VTK 6.2.0 C++11
VTK 7.0.0
VTK 7.0.0 C++11
VTK 7.1.0
Qt5
VTK 7.1.0 C++11
VTK 8.0.0
VTK 8.0.0
VTK 8.1.0
VTK 8.1.0 C++11
.
Hopefully this work will help other users. Your feedback is welcome.
.
The text was updated successfully, but these errors were encountered: