Changes between Initial Version and Version 1 of Boost_Build_Visual_Studio_Integration


Ignore:
Timestamp:
Oct 6, 2007, 3:49:49 AM (15 years ago)
Author:
Peter Foley
Comment:

Added content to show how to integrate Boost.Build into Visual Studio.

Legend:

Unmodified
Added
Removed
Modified
  • Boost_Build_Visual_Studio_Integration

    v1 v1  
     1= How can I integrate Boost.Build into Visual C++ 2005 =
     2
     3(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)
     4
     5== Useful Links ==
     6 * Boost Build Documentation Homepage - http://www.boost.org/tools/build/index.html [[BR]]
     7   This is the authoritative resource for all things related to Boost Build.
     8
     9== Assumptions ==
     10
     11 * I assume that you already have a working installation of Boost.Build on your system.
     12 * I assume that you already have a working installation of Visual Studio 2005.
     13
     14== Directory Rational ==
     15
     16As 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.
     17
     18You just need to keep two things in mind:
     19 1. When creating the solution point it to the location you have the jamroot located at; and
     20 2. When adding the command line build instructions remove "&& path_to_jamroot.bat" from the command line.
     21
     22== Setting up Visual Studio ==
     23
     24'''1.''' Open Visual Studio; Open the "File Menu" and select "New" and then "Project"
     25
     26'''2.''' Expand "Visual C++" and click on "General" project type and then select the "Makefile Project" template.
     27
     28'''3.''' Give the Project a Name (for this example "BB_MSVC_Int"), location ("e:\dev\VS Projects") and fill in the other details.
     29
     30[[Image(001 - New Project.PNG)]]
     31
     32'''4.''' Click "Next"
     33
     34'''5.''' Fill in the "Debug Configuration Settings".  For my configuration I use:
     35 * Build Command Line - E:\dev\tools\bjam\bin\bjam_setup.bat && path_to_jamroot.bat && bjam.exe -d0 variant=debug
     36 * Clean Commands - E:\dev\tools\bjam\bin\bjam_setup.bat && path_to_jamroot.bat && bjam.exe --clean variant=debug
     37 * Rebuild Command Line - E:\dev\tools\bjam\bin\bjam_setup.bat && path_to_jamroot.bat && bjam.exe -a -d0 variant=debug
     38
     39[[Image(002 - Debug Configuration Settings.PNG)]]
     40
     41'''6.''' Fill in the "Release Configuration Settings".  For my configuration I use:
     42 * Build Command Line - E:\dev\tools\bjam\bin\bjam_setup.bat && path_to_jamroot.bat && bjam.exe -d0 variant=release
     43 * Clean Commands - E:\dev\tools\bjam\bin\bjam_setup.bat && path_to_jamroot.bat && bjam.exe --clean variant=release
     44 * Rebuild Command Line - E:\dev\tools\bjam\bin\bjam_setup.bat && path_to_jamroot.bat && bjam.exe -a -d0 variant=release
     45
     46[[Image(003 - Release Configuration Settings.PNG)]]
     47
     48=== What are the two batch files (bjam_setup and path_to_jamroot) doing? ===
     49
     50The contents of each file is as follows:
     51
     52==== bjam_setup.jam ====
     53
     54I store this file with the BJAM executable as it is general across projects.
     55
     56{{{
     57@echo off
     58
     59REM Add the bjam\bin to the path so I can use Boost.Build anywhere.
     60
     61SET PATH=%PATH%;E:\dev\tools\bjam\bin
     62
     63REM Tell BJAM where the boost-build.jam file is
     64
     65SET BOOST_BUILD_PATH=E:\dev\tools\bjam\bin
     66
     67REM Tell BJAM where my user-config.jam file is
     68
     69SET BOOST_BUILD_USER_CONFIG=%HOMEDRIVE%%HOMEPATH%\My Documents\user-config.jam
     70}}}
     71
     72==== path_to_jamroot.jam ====
     73
     74This file is specific for each Visual C++ project you use.  This should be stored in the same directory that the project is located in.
     75
     76{{{
     77@Echo Off
     78
     79Set drive_letter=E:
     80Set jamroot_path=\dev\src\hello
     81
     82cd %drive_letter%
     83cd %jamroot_path%
     84}}}
     85
     86'''7.''' You should now be able to use Boost.Build within Visual C++ 2005.  Lets test it!
     87
     88== Using the Boost Build Examples to test this! ==
     89
     90I am going to test this against the libraries example located within the Boost.Build examples directory.  My "path_to_jamroot.bat" looks like this:
     91{{{
     92@Echo Off
     93
     94Set drive_letter=E:
     95Set jamroot_path=\dev\tools\071006-boost-build\example\libraries
     96
     97cd %drive_letter%
     98cd %jamroot_path%
     99}}}
     100
     101[[Image(004 - Libraries Example.PNG)]]
     102
     103== Conclusion ==
     104
     105As 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 ...).