Boost logo

Boost-Build :

Subject: Re: [Boost-build] [CMake] FindBoost: find both win32 and x64 static libs
From: Michael Jackson (mike.jackson_at_[hidden])
Date: 2010-12-20 09:50:58


On 12/19/10 6:16 PM, in article m2bp4hl5eg.wl%dave_at_[hidden], "Dave
Abrahams" wrote:

> At Tue, 7 Dec 2010 21:35:47 -0500,
> Michael Jackson wrote:
>>
>> I would see what the actual boost project has to say about
>> this. BoostPro used to have precompiled binaries that got installed
>> on windows.
>
> We still do: http://boostpro.com/download
>
>> Where were those installed in the filesystem?
>
> I could give you an answer from memory, but there's always a risk I'd
> be wrong. Why don't you try it and find out?
>
>> Basically Windows is a crap-shoot. Nobody installs boost in the
>> same location on windows and like Phillip said, Windows does not
>> have anything like Linux Standard so your guess is as good as
>> anyone else's. The best you can do is look for "BOOST_ROOT"
>
> That has no real status as a variable setting. It's mostly just a
> shorthand for "the top of the Boost tree."
>
> http://boost.org/doc/libs/1_45_0/more/getting_started/windows.html#boost-root-
> directory

I guess one could consider BOOST_ROOT as more of a hint to CMake on where to
find Boost. See below...

>
>> and go from there. This is what the Boost project seems to advocate
>> and it would be best if CMake could honor that as much as possible.
>
> We don't advocate that. The closest thing we have to a philosophy is
> that it should be possible to build and use Boost without cluttering
> your environment with boost-specific variable settings.

Is there a registry setting? Some executable that always gets installed? Qt
has qmake which CMake keys off of to find everything. The cmake user just
sets the path to the qmake executable and then cmake can find everything
from there. What would be the equivalent for boost? Any suggestions are good
at this point.

>
>> Just to add to the "Here is my setup" bandwagon this is how I set
>> things up on my windows X64 system:
>>
>> I have the following directories: C:\Developer\i386\Boost and
>> C:\Developer\x64\Boost. I then have a pair of .bat files that get called each
>> from a matching Command Prompt Shortcut. Each .bat file sets up the visual
>> studio environment for either i386 or x64 and also sets the proper
>> environment variables such as BOOST_ROOT. So when I configure a CMake project
>> for use with Visual Studio for the first time I simply launch the proper
>> Command Prompt (either i386 or x64) and run CMake from there. That way the
>> proper environment is picked up. For completeness here is one of the .bat
>> files:
>>
>> @rem This is the vcvarsamd64.bat file. It is invoked using the argument
>> @rem "x64"
>> @SET VSINSTALLDIR=C:\Program Files (x86)\Microsoft Visual Studio 9.0
>> @SET VCINSTALLDIR=C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC
>> @SET FrameworkDir=C:\Windows\Microsoft.NET\Framework64
>> @SET FrameworkVersion=v2.0.50727
>> @SET Framework35Version=v3.5
>> @if "%VSINSTALLDIR%"=="" goto error_no_VSINSTALLDIR
>> @if "%VCINSTALLDIR%"=="" goto error_no_VCINSTALLDIR
>>
>> @echo Setting environment for using Microsoft Visual Studio 2008 Beta2 x64
>> tools.
>>
>> @call :GetWindowsSdkDir
>>
>> @if not "%WindowsSdkDir%" == "" (
>> set
>> "PATH=%WindowsSdkDir%bin\x64;%WindowsSdkDir%bin\win64\x64;%WindowsSdkDir%bin;
>> %PATH%"
>> set "INCLUDE=%WindowsSdkDir%include;%INCLUDE%"
>> set "LIB=%WindowsSdkDir%lib\x64;%LIB%"
>> )
>>
>> @set
>> PATH=%VCINSTALLDIR%\BIN\amd64;%FrameworkDir%\%Framework35Version%;%FrameworkD
>> ir%\%Framework35Version%\Microsoft .NET Framework 3.5 (Pre-Release
>> Version);%FrameworkDir%\%FrameworkVersion%;%VCINSTALLDIR%\VCPackages;%VSINSTA
>> LLDIR%\Common7\IDE;%VSINSTALLDIR%\Common7\Tools;%VSINSTALLDIR%\Common7\Tools\
>> bin;%PATH%
>> @set INCLUDE=%VCINSTALLDIR%\ATLMFC\INCLUDE;%VCINSTALLDIR%\INCLUDE;%INCLUDE%
>> @set LIB=%VCINSTALLDIR%\ATLMFC\LIB\amd64;%VCINSTALLDIR%\LIB\amd64;%LIB%
>>
>> @set
>> LIBPATH=%FrameworkDir%\%Framework35Version%;%FrameworkDir%\%FrameworkVersion%
>> ;%FrameworkDir%\%Framework35Version%;%FrameworkDir%\%FrameworkVersion%;%VCINS
>> TALLDIR%\ATLMFC\LIB\amd64;%VCINSTALLDIR%\LIB\amd64;%LIBPATH%
>>
>>
>> @set ARCH_TYPE=x64
>> @set BOOST_ROOT=C:\Developer\%ARCH_TYPE%\MXABoost-1.44
>> @set EXPAT_INSTALL=C:\Developer\%ARCH_TYPE%\expat
>> @set HDF5_INSTALL=C:\Developer\%ARCH_TYPE%\hdf5-169
>> @set ITK_DIR=C:\Users\mjackson\Workspace\InsightToolkit-3.14.0\%ARCH_TYPE%
>> @set QTDIR=C:\Developer\%ARCH_TYPE%\Qt-4.6.2
>> @set BJAM_INSTALL=C:\Applications\bjam
>> @set SVN_INSTALL=C:\Applications\svn-1.5.6
>> @set CMAKE_INSTALL=C:\Applications\CMake-2.8.2
>> @set SEVENZIP_INSTALL=C:\Applications\7-Zip
>> @set JOM_INSTALL=C:\Applications\jom
>> @set QWT_INSTALL=C:\Developer\%ARCH_TYPE%\qwt-5.2.2
>>
>> @SET
>> PATH=%PATH%;%CMAKE_INSTALL%\bin;%BJAM_INSTALL%;%SVN_INSTALL%\bin;%QTDIR%\bin;
>> %SEVENZIP_INSTALL%;%JOM_INSTALL%
>>
>> @echo BOOST_ROOT=%BOOST_ROOT%
>> @echo EXPAT_INSTALL=%EXPAT_INSTALL%
>> @echo HDF5_INSTALL=%HDF5_INSTALL%
>> @echo ITK_DIR=%ITK_DIR%
>> @echo MXADATAMODEL_INSTALL=%MXADATAMODEL_INSTALL%
>> @echo QTDIR=%QTDIR%
>> @echo TIFF_INSTALL=%TIFF_INSTALL%
>> @echo BJAM_INSTALL=%BJAM_INSTALL%
>> @echo SVN_INSTALL=%SVN_INSTALL%
>> @echo CMAKE_INSTALL=%CMAKE_INSTALL%
>> @echo SEVENZIP_INSTALL=%SEVENZIP_INSTALL%
>> @echo JOM_INSTALL=%JOM_INSTALL%
>> @echo QWT_INSTALL=%QWT_INSTALL%
>> @echo EMMPM_INSTALL=%EMMPM_INSTALL%
>>
>> @goto end
>>
>> :GetWindowsSdkDir
>> @call :GetWindowsSdkDirHelper HKLM > nul 2>&1
>> @if errorlevel 1 call :GetWindowsSdkDirHelper HKCU > nul 2>&1
>> @if errorlevel 1 echo WindowsSdkDir not found
>> @exit /B 0
>>
>> :GetWindowsSdkDirHelper
>> @SET WindowsSdkDir=
>> @for /F "tokens=1,2*" %%i in ('reg query "%1\SOFTWARE\Microsoft\Microsoft
>> SDKs\Windows" /v "CurrentInstallFolder"') DO (
>> if "%%i"=="CurrentInstallFolder" (
>> SET "WindowsSdkDir=%%k"
>> )
>> )
>> @if "%WindowsSdkDir%"=="" exit /B 1
>> @exit /B 0
>>
>> :error_no_VSINSTALLDIR
>> @echo ERROR: VSINSTALLDIR variable is not set.
>> @goto end
>>
>> :error_no_VCINSTALLDIR
>> @echo ERROR: VCINSTALLDIR variable is not set.
>> @goto end
>>
>> :end
>
> Wow, that's pretty complicated!

Most of that is from the actual .bat files that get executed if one were to
do a "Start->Programs->Visual Studio 2008->Visual Studio Command Prompt" (or
something like that). I added the rest for my own environment. I guess to
cut it down to something more understandable the basics would be:

@rem Everything above this
@set ARCH_TYPE=x64
@set BOOST_ROOT=C:\Developer\%ARCH_TYPE%\MXABoost-1.36
@set BJAM_INSTALL=C:\Applications\bjam

@SET PATH=%PATH%;C:\Applications\CMake-2.8.3\bin;%BJAM_INSTALL%

@echo BOOST_ROOT=%BOOST_ROOT%
@echo BJAM_INSTALL=%BJAM_INSTALL%
@rem Everything below this

Mike Jackson


Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk