How can I integrate Boost.Build into Visual C++ 2005
(The steps that I detail here are based off instructions I found in in this post http://qemu-forum.ipi.fi/viewtopic.php?t=1871)
Useful Links
- Boost Build Documentation Homepage - http://www.boost.org/tools/build/index.html
This is the authoritative resource for all things related to Boost Build.
Assumptions
- I assume that you already have a working installation of Boost.Build on your system.
- I assume that you already have a working installation of Visual Studio 2005.
Directory Rational
As I like to keep things fairly neat I have separate directories for my src (with jam files) and my Visual Studio Solutions. This has complicated my instructions slightly but for those interested in this without this additional complication it is straight forward to remove this.
You just need to keep two things in mind:
- When creating the solution point it to the location you have the jamroot located at; and
- When adding the command line build instructions remove "&& path_to_jamroot.bat" from the command line.
Setting up Visual Studio
1. Open Visual Studio; Open the "File Menu" and select "New" and then "Project"
2. Expand "Visual C++" and click on "General" project type and then select the "Makefile Project" template.
3. Give the Project a Name (for this example "BB_MSVC_Int"), location ("e:\dev\VS Projects") and fill in the other details.
4. Click "Next"
5. Fill in the "Debug Configuration Settings". For my configuration I use:
- Build Command Line - E:\dev\tools\bjam\bin\bjam_setup.bat && path_to_jamroot.bat && bjam.exe -d0 variant=debug
- Clean Commands - E:\dev\tools\bjam\bin\bjam_setup.bat && path_to_jamroot.bat && bjam.exe --clean variant=debug
- Rebuild Command Line - E:\dev\tools\bjam\bin\bjam_setup.bat && path_to_jamroot.bat && bjam.exe -a -d0 variant=debug
6. Fill in the "Release Configuration Settings". For my configuration I use:
- Build Command Line - E:\dev\tools\bjam\bin\bjam_setup.bat && path_to_jamroot.bat && bjam.exe -d0 variant=release
- Clean Commands - E:\dev\tools\bjam\bin\bjam_setup.bat && path_to_jamroot.bat && bjam.exe --clean variant=release
- Rebuild Command Line - E:\dev\tools\bjam\bin\bjam_setup.bat && path_to_jamroot.bat && bjam.exe -a -d0 variant=release
What are the two batch files (bjam_setup and path_to_jamroot) doing?
The contents of each file is as follows:
bjam_setup.jam
I store this file with the BJAM executable as it is general across projects.
@echo off REM Add the bjam\bin to the path so I can use Boost.Build anywhere. SET PATH=%PATH%;E:\dev\tools\bjam\bin REM Tell BJAM where the boost-build.jam file is SET BOOST_BUILD_PATH=E:\dev\tools\bjam\bin REM Tell BJAM where my user-config.jam file is SET BOOST_BUILD_USER_CONFIG=%HOMEDRIVE%%HOMEPATH%\My Documents\user-config.jam
path_to_jamroot.jam
This file is specific for each Visual C++ project you use. This should be stored in the same directory that the project is located in.
@Echo Off Set drive_letter=E: Set jamroot_path=\dev\src\hello cd %drive_letter% cd %jamroot_path%
7. You should now be able to use Boost.Build within Visual C++ 2005. Lets test it!
Using the Boost Build Examples to test this!
I am going to test this against the libraries example located within the Boost.Build examples directory. My "path_to_jamroot.bat" looks like this:
@Echo Off Set drive_letter=E: Set jamroot_path=\dev\tools\071006-boost-build\example\libraries cd %drive_letter% cd %jamroot_path%
Conclusion
As you can see it was fairly straight forward to set this up. It is also possible to create additional build configurations and have these relate to different Boost.Build vairant's (exe, pdf, html ...).
Attachments (4)
-
001 - New Project.PNG
(25.4 KB
) - added by 15 years ago.
New Project window
-
004 - Libraries Example.PNG
(69.4 KB
) - added by 15 years ago.
Example - Libraries
-
002 - Debug Configuration Settings.PNG
(26.7 KB
) - added by 15 years ago.
Updated file to correct error
-
003 - Release Configuration Settings.PNG
(27.8 KB
) - added by 15 years ago.
Updated file to correct error
Download all attachments as: .zip