On Sun, Jun 22, 2014 at 10:22 AM, Liam White <inkscapebrony@...400...> wrote:
There is no standardized way of determining what OS you are compiling for. However, _WIN32 seems more common than WIN32. See, e.g. here:
 http://sourceforge.net/p/predef/wiki/OperatingSystems/
So, we should be able to change all WIN32 to _WIN32 and improve compatibility.
The standard Windows build system (btool/build.xml) explicitly defines WIN32 in config.h.
 
That's correct. Also note that Microsoft's compiler does not define __WIN32__, so we should stop checking for that as well.

About M_PI, <2geom/angle.h> defines it if it is not already defined. If there are many other constants needed (Liam mentioned sqrt(2)), we could add <geom/constants.h> file to collect all those. Regardless, I think you cannot escape modifying the source code, or temporarily adding the missing defines to the gcc cmdline.

Looks like we need, at a bare minimum:
M_PI
M_PI_2
M_SQRT2 (this is the default zoom factor in Inkscape)
 
Although defining others would be great, too.
These are actually defined and if you don't compile with C++11 then you can get away with it. 

My suggestion would be either

#define _USE_MATH_DEFINES
#include <cmath>

right at the top or

or
const double pi = boost::math::constants::pi<double>();
 
Moreover, simply collecting them in geom/constants.h may not cover all since M_PI is used in other places as well such as widgets and tools?

Thanks,
Partha