Boost logo

Boost-Build :

From: Alexey Pakhunov (alexeypa_at_[hidden])
Date: 2005-07-03 13:54:30


Hi All,

> I volunteer for writing HOWTO describing how to convert existing
Visual Studio project to a .jam file.

Finally, I've finished this document. Currently it is an .rtf file with
three example projects. I put it to Boost Sandbox Files for now:
http://boost-sandbox.sourceforge.net/vault/index.php?action=downloadfile&filename=How%20to%20build%20a%20COM%20server%20using%20BBv2.zip&directory=&

But it would be better to publish it as a WIKI page or include in BBv2
documentation. Any ideas?

I also attached the final version of .idl support for the msvc package.
As usual, idl.jam should be placed together with the modified msvc.jam.
After all I've decided to implement only very basic logic giving a
developer maximum level of flexibility.

Hope all this will be useful.

Best regards,
Alexey Pakhunov.

 --------------040403040201090304000100 Content-Type: text/plain;
name="idl.jam"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="idl.jam"

#~ Copyright (c) 2005 Alexey Pakhunov
#~ Distributed under the Boost Software License, Version 1.0.
#~ (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)

import type ;
import generators ;
import feature ;
import errors ;
import scanner ;

type.register IDL : idl ;

rule init ( )
{
}

# Register scanner for .idl
class idl-scanner : scanner
{
import regex virtual-target path scanner ;

rule __init__ ( includes * )
{
scanner.__init__ ;

self.includes = $(includes) ;
}

rule pattern ( )
{
return
"(((include[ ]*\"[^\"]*\"([ ]*,[ ]*\"[^\"]*\")*)|(import[ ]*\"[^\"]*\"([ ]*,[ ]*\"[^\"]*\")*)|(importlib[ ]*[(][ ]*\"[^\"]*\"([ ]*,[ ]*\"[^\"]*\")*[ ]*[)]))[ ]*;)" ;
}

rule process ( target : matches * : binding )
{
local included = [ regex.transform $(matches) : "include[ ]*\"([^\"]*)\"([ ]*,[ ]*\"([^\"]*)\")*[ ]*;" : 1 3 ] ;
local imported = [ regex.transform $(matches) : "import[ ]*\"([^\"]*)\"([ ]*,[ ]*\"([^\"]*)\")*[ ]*;" : 1 3 ] ;
local imported_tlbs = [ regex.transform $(matches) : "importlib[ ]*[(][ ]*\"([^\"]*)\"([ ]*,[ ]*\"([^\"]*)\")*[ ]*[)][ ]*;" : 1 3 ] ;

# CONSIDER: the new scoping rule seem to defeat "on target" variables.
local g = [ on $(target) return $(HDRGRIST) ] ;
local b = [ NORMALIZE_PATH $(binding:D) ] ;

# Attach binding of including file to included targets.
# When target is directly created from virtual target
# this extra information is unnecessary. But in other
# cases, it allows to distinguish between two headers of the
# same name included from different places.
local g2 = $(g)"#"$(b) ;

included = $(included:G=$(g2)) ;
imported = $(imported:G=$(g2)) ;
imported_tlbs = $(imported_tlbs:G=$(g2)) ;

local all = $(included) $(imported) ;

INCLUDES $(target) : $(all) ;
DEPENDS $(target) : $(imported_tlbs) ;
NOCARE $(all) $(imported_tlbs) ;
SEARCH on $(included) = $(b) $(self.includes:G=) ;
SEARCH on $(imported) = $(b) $(self.includes:G=) ;
SEARCH on $(imported_tlbs) = $(b) $(self.includes:G=) ;

scanner.propagate c-scanner : $(included) : $(target) ;
scanner.propagate $(__name__) : $(imported) : $(target) ;
}
}

scanner.register idl-scanner : include ;
type.set-scanner IDL : idl-scanner ;
 --------------040403040201090304000100 Content-Type: text/plain;
name="msvc.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="msvc.diff"

Index: msvc.jam
===================================================================
RCS file: /cvsroot/boost/boost/tools/build/v2/tools/msvc.jam,v
retrieving revision 1.47
diff -c -3 -r1.47 msvc.jam
*** msvc.jam 24 Jun 2005 15:38:56 -0000 1.47
--- msvc.jam 27 Jun 2005 17:52:04 -0000
***************
*** 65,71 ****
#
# - if compiler is not found in default locations, PATH will be searched.
: options *
! # options can include <setup>, <compiler>, <linker> and <resource-compiler>
)
{
# setup will be used iff a path has been specified. If setup is
--- 65,71 ----
#
# - if compiler is not found in default locations, PATH will be searched.
: options *
! # options can include <setup>, <compiler>, <linker>, <resource-compiler> and <idl-compiler>
)
{
# setup will be used iff a path has been specified. If setup is
***************
*** 78,83 ****
--- 78,85 ----
linker ?= link ;
resource-compiler = [ get-values <resource-compiler> : $(options) ] ;
resource-compiler ?= rc ;
+ idl-compiler = [ get-values <idl-compiler> : $(options) ] ;
+ idl-compiler ?= midl ;

local condition = [ common.check-init-parameters msvc :
version $(version) ] ;
***************
*** 115,120 ****
--- 117,123 ----

flags msvc.compile .CC $(condition) : $(prefix)$(compiler) ;
flags msvc.compile .RC $(condition) : $(prefix)$(resource-compiler) ;
+ flags msvc.compile .IDL $(condition) : $(prefix)$(idl-compiler) ;
flags msvc.link .LD $(condition) : $(prefix)$(linker) ;
flags msvc.archive .LD $(condition) : $(prefix)$(linker) ;

***************
*** 233,239 ****
generators.register-archiver msvc.archive : OBJ : STATIC_LIB : <toolset>msvc ;
generators.register-c-compiler msvc.compile.c++ : CPP : OBJ : <toolset>msvc ;
generators.register-c-compiler msvc.compile.c : C : OBJ : <toolset>msvc ;
! generators.register-standard msvc.compile.rc : RC : OBJ(%_res) : <toolset>msvc ;
generators.override msvc.compile.rc : rc.resource-compile ;

#
--- 236,245 ----
generators.register-archiver msvc.archive : OBJ : STATIC_LIB : <toolset>msvc ;
generators.register-c-compiler msvc.compile.c++ : CPP : OBJ : <toolset>msvc ;
generators.register-c-compiler msvc.compile.c : C : OBJ : <toolset>msvc ;
!
! # 'register-c-compiler' causes a build directory to be added to INCLUDES
! generators.register-c-compiler msvc.compile.rc : RC : OBJ(%_res) : <toolset>msvc ;
!
generators.override msvc.compile.rc : rc.resource-compile ;

#
***************
*** 380,382 ****
--- 386,414 ----
}

+ #
+ # MIDL-related routines
+ #
+
+ import idl ;
+
+ type.register TLB : tlb ;
+
+ # midl.exe command line options
+ feature midl-stubless-proxy : yes no : propagated ;
+ feature midl-environment : win32 win64 : propagated ;
+ feature midl-robust : yes no : propagated ;
+
+ flags msvc.compile MIDLFLAGS <midl-stubless-proxy>yes : /Oicf ;
+ flags msvc.compile MIDLFLAGS <midl-stubless-proxy>no : /Oic ;
+ flags msvc.compile MIDLFLAGS <midl-environment>win32 : /win32 ;
+ flags msvc.compile MIDLFLAGS <midl-environment>win64 : /win64 ;
+ flags msvc.compile MIDLFLAGS <midl-robust>yes : /robust ;
+ flags msvc.compile MIDLFLAGS <midl-robust>no : /no_robust ;
+
+ generators.register-c-compiler msvc.compile.idl : IDL : TLB H C(%_i) C(%_proxy) C(%_dlldata) H(%_proxy) : <toolset>msvc ;
+
+ actions compile.idl
+ {
+ $(.IDL) /nologo /U$(UNDEFS) /D$(DEFINES) $(MIDLFLAGS) /I"$(INCLUDES)" /tlb "$(<[1]:W)" /h "$(<[2]:W)" /iid "$(<[3]:W)" /proxy "$(<[4]:W)" /dlldata "$(<[5]:W)" "$(>:W)"
+ }
 --------------040403040201090304000100--


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