Here are some modifications to be able to build with Visual Studio or for better compatibility with MinGW (see also automated builds of multiple compiler versions on temporary Travis on https://travis-ci.org/github/lebarsfa/Test/builds/697284188) :
There are some MinGW compiler options inconsistent between what Ibex sets and what Tubex sets, some of them cause an error message related to the -pg option set by Ibex or Tubex when building Tubex in Debug while Ibex was built in Release. A way to solve that is to force CMAKE_BUILD_TYPE to Release when calling cmake for Tubex, but it would be probably better that Tubex chooses Release by default to be consistent with what Ibex does. Tubex should also probably ensure -pg option is set when Tubex is built in Debug, to check…
In the same idea (although it does not seem to cause errors at the moment), it might be better to remove -std=c++11 (while Ibex sets -std=gnu++11), __STRICT_ANSI__ lines in Tubex since Ibex already handles that, possibly remove also -O3 line since it should depend onCMAKE_BUILD_TYPE, also those flags are not valid for Visual Studio.
In the documentation, maybe replace make command with cmake --build ., sudo make install with sudo cmake --build . --target install to be more compiler independent (e.g. when using Visual Studio, msbuild might be used instead of make, or for MinGW it could be mingw32-make...).
Here are some modifications to be able to build with Visual Studio or for better compatibility with MinGW (see also automated builds of multiple compiler versions on temporary Travis on https://travis-ci.org/github/lebarsfa/Test/builds/697284188) :
#ifdef _MSC_VER
is used to propose a workaround but later only the workaround should be probably kept to simplify the code while being portable.-pg
option set by Ibex or Tubex when building Tubex in Debug while Ibex was built in Release. A way to solve that is to forceCMAKE_BUILD_TYPE
to Release when calling cmake for Tubex, but it would be probably better that Tubex chooses Release by default to be consistent with what Ibex does. Tubex should also probably ensure-pg
option is set when Tubex is built in Debug, to check…-std=c++11
(while Ibex sets-std=gnu++11
),__STRICT_ANSI__
lines in Tubex since Ibex already handles that, possibly remove also-O3
line since it should depend onCMAKE_BUILD_TYPE
, also those flags are not valid for Visual Studio.M_PI
is only available with_USE_MATH_DEFINES
in Visual Studio.Other suggestions not in this pull request :
TUBEX_LIBRARIES
is twice in e.g. https://github.com/SimonRohou/tubex-lib/blob/193bc95f2925d2a2e891e8503c1cfdb2cc67815e/examples/basics/ex_01_arithmetic/CMakeLists.txt#L32? Removing the last one seems to work fine.make
command withcmake --build .
,sudo make install
withsudo cmake --build . --target install
to be more compiler independent (e.g. when using Visual Studio,msbuild
might be used instead ofmake
, or for MinGW it could bemingw32-make
...).