The modifications of the build.bat file described in the previous post give us better VC 11 compatibility, but there are still a few shortcomings that we need to deal with, particularly if we want to get auto-linking working. With the changes described so far, Visual Studio will attempt to link to libraries from the previous version of visual studio (2010), resulting in complaints about missing libraries.
The remaining VC 11 issues are spread over two files.
The changes, as before, are mostly trivial and it's mostly a case of keeping track of those few places that need VC 11 cases. No doubt a later boost version will have more significant changes to these files to more accurately track the changed capabilities of the compiler and standard library.
Compiler Capabilities (visualc.hpp)
First config/compiler/visualc.hpp
There are a number of issues with the file, but none serious and none dealing with auto-linking issues.
The purpose of the file is to specify for boost which C++ features are available or not available, given the current version of VC. Of course, the version checking tops out at 2010.
We probably want to remove the warning that we're using an unknown compiler, a check performed at the very end. We just need to bump the version up to 1700, as below:
// last known and checked version is now 1700 (VC 11):
#if (_MSC_VER > 1700)
# if defined(BOOST_ASSERT_CONFIG)
# error "Unknown compiler version - please run the configure tests and report the results"
# else
# pragma message("Unknown compiler version - please run the configure tests and report the results")
# endif
#endif
Shortly above that the compiler version is defined, again topping out at VC2010. We just need to modify that section to include a VC 11 case:
# elif _MSC_VER == 1600
# define BOOST_COMPILER_VERSION 10.0
# elif _MSC_VER == 1700
# define BOOST_COMPILER_VERSION 11.0
Finally, above this we have a set of defines for all versions of the compiler, specifying those features that are not supported in any VC release. Doesn't look like this really changes for VC 11, but they're under the following banner in case you're curious:
// C++0x features not supported by any versions
Autolinking (auto_link.hpp)
We need boost to define the library toolset for us, and config/auto_link.hpp tops out at VC2010. Once again a simple extra case for VC 11 (and modification of the previous case to stop it matching) is all we need. Check that BOOST_MSVC is 1700 or greater for VC 11 before moving on to CBuilder 6 and auto link will once again try searching for the correct libs when required. Trivial, as below:
#elif defined(BOOST_MSVC) && (BOOST_MSVC == 1600)
// vc10:
# define BOOST_LIB_TOOLSET "vc100"
#elif defined(BOOST_MSVC) && (BOOST_MSVC >= 1700)
// vc11:
# define BOOST_LIB_TOOLSET "vc110"
#elif defined(__BORLANDC__)
Conclusion
That pretty much concludes all the changes you should need to make to the boost build system to get it playing nice with VC 11.
Latest version of Boost (1.48)
http://www.boost.org/
Hi there, thanks for the descriptions. I've been trying to get this to work lately but have only partially been successfull. What you describe here in the 2nd part seems to be already done in boost 1.49 only the changes in part 1 still have to be made. The build process runs through without errors or warnings.
ReplyDeleteHowever if I try to build a project that includes the thread.hpp VS2012 tries to access "libboost_thread-vc110-mt-gd-1_49.lib" where the build process only creates "libboost_thread-vc-mt-gd-1_49.lib". Any ideas how to fix that?
did you add toolset=msvc-11.0 to bjam build command?
ReplyDelete