|
Boost Users : |
Subject: [Boost-users] Using Boost.Geometry with Clang/LLVM & VC14
From: degski (degski_at_[hidden])
Date: 2016-03-14 03:50:55
GGL does not compile with the combo of Clang/LLVM (http://llvm.org/builds/)
and VC14 out of the box. There seem to be comflicts in the resolution of
old MSVC bugs and Clang. On windows __clang__ is defined at the same time
as _MSVC_VER.
Undefining the macro _MSVC_VER before #include
<boost/geometry/geometry.hpp> does however solve the problem (in my use
case):
file: boost/geometry.hpp
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2007-2011 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2011 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2011 Mateusz Loskot, London, UK.
// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
// Use, modification and distribution is subject to the Boost Software
License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_GEOMETRY_HPP
#define BOOST_GEOMETRY_HPP
#if defined(__clang__) && defined(_MSC_VER)
#define __BOOST_GEOMETRY_MSVC_CLANG_WORKAROUND__ _MSC_VER
#undef _MSC_VER
#endif
#include <boost/geometry/geometry.hpp>
#if defined(__clang__) && defined(__BOOST_GEOMETRY_MSVC_CLANG_WORKAROUND__)
#define _MSC_VER __BOOST_GEOMETRY_MSVC_CLANG_WORKAROUND__
#undef __BOOST_GEOMETRY_MSVC_CLANG_WORKAROUND__
#endif
#endif // BOOST_GEOMETRY_HPP
I've run into similar problems before (cannot remember where) with other
boost libraries (which I hacked in other ways).
Clang/LLVM with MSVC (and the IDE) works extremely well for a while now.
The advantages of Clang/LLVM are well known, no need to spell them out It
produces far faster code (almost twice as fast on simple matrix
multiplication f.e.. It also gives the best of two worlds as it supports
Clang and GCC extensions on Windows (calculated goto), while maintaining
(although with a suppressable warning) M$ extensions as well, f.e. in-class
template specialization.
Clang/LLVM (3.9.0 as it stands) is much faster than Clang/CL2 (CodeGen)
(3.7.0).
I would herewith like to request the development team to integrate
Clang/LLVM on Windows as another supported platform.
Have good day to you all,
degski
-- (\___/) (+'.'+) (")_(") This is Bunny. Copy and paste Bunny into your signature to help him gain world domination!
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