Boost logo

Boost Users :

Subject: Re: [Boost-users] [polygon] Compiling polygon under Windows
From: Simonson, Lucanus J (lucanus.j.simonson_at_[hidden])
Date: 2010-11-29 16:32:27


Lars Viklund wrote:
> On Mon, Nov 29, 2010 at 11:31:03AM -0800, Simonson, Lucanus J wrote:
>> I can fix this for the next release, however, for the second change
>> it should actually use BOOST_POLYGON_MSVC and not _WIN32. It was an
>> oversight on my part that it was using the WIN32 instead of
>> BOOST_POLYGON_MSVC macro. It was a bug fix I added for older
>> versions of the ICC compiler (and EDG frontend in general) which
>> weren't doing SFINAE properly in a way that was mutually exclusive
>> with the way MSVC
>> 7.1, 8 and 9 doesn't do SFINAE properly. Gcc worked either way so I
>> singled out MSVC for the special behavior so that gcc, icc and all
>> compilers that might use old versions of EDG frontend that I don't
>> know about would work by default. Apparently when I made the fix I
>> used the wrong macro name. I doubt you are using Polygon with
>> BOOST_POLYGON_NO_DEPS defined, so it is the second instance of WIN32
>> that was causing you trouble and it was my error in using WIN32
>> instead of BOOST_POLYGON_MSVC that caused you the problem. You
>> should see a commit to trunk soon.
>
> Surely Boost.Config contains Boost-global functionality for platform
> detection?

Indeed it does, and by default BOOST_POLYGON_MSVC is defined if BOOST_MSVC is defined. Only if the user defines BOOST_POLYGON_NO_DEPS does Polygon attempt to compile without any dependency on boost what-so-ever and in that case I set BOOST_POLYGON_MSVC if I detect WIN32 macro is defined.

#ifndef BOOST_POLYGON_NO_DEPS

#include <boost/config.hpp>
#ifdef BOOST_MSVC
#define BOOST_POLYGON_MSVC
#endif
...

#else

#ifdef _WIN32
#define BOOST_POLYGON_MSVC
#endif
...

#endif

...
  template <typename T>
  struct gtl_if {
#ifdef BOOST_POLYGON_MSVC
    typedef gtl_no type;
#endif
  };
  template <>
  struct gtl_if<gtl_yes> { typedef gtl_yes type; };

Above we see the fixed version of the code where I use the _WIN32 in no deps mode and BOOST_POLYGON_MSVC later which is defined only if BOOST_MSVC is defined or both _WIN32 and BOOST_POLYGON_NO_DEPS are defined.

The no dependencies mode of building Boost.Polygon is part of the legacy of developing it in an environment where usage of boost libraries was prohibited, but is still useful for unit testing. I don't have to configure my build environment at all or even have boost installed. I can just define BOOST_POLYGON_NO_DEPS and I'm off to the races debugging and testing my code.

Regards,
Luke


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net