Boost logo

Boost-Build :

From: Michael Stevens (Michael.Stevens_at_[hidden])
Date: 2004-07-18 12:43:20


Hi Volodya, Hi All,

I have been testing 'msvc.jam'. Previously I was using me own custom version
as I usually cross compile. It seems to me the 'action archive' as defined
for CYGWIN is broken. Has anyone recently created a static library with it?

It results in a command line with all the object files with @ prepended.
I have attached a patch. This also simplifies the common actions and rules
between the NT and CYGWIN branches.

I have not directly testes this under NT so I would appreciate any feedback!

Michael

-- 
___________________________________
Michael Stevens Systems Engineering
Navigation Systems, Estimation and
Bayesian Filtering
http://bayesclasses.sf.net
___________________________________
 --Boundary-00=_4ar+AcpWZOknqco Content-Type: text/x-diff;
charset="iso-8859-1";
name="msvc_action_definitions.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename="msvc_action_definitions.patch"
Index: msvc.jam
===================================================================
RCS file: /cvsroot/boost/boost/tools/build/v2/tools/msvc.jam,v
retrieving revision 1.28
diff -u -r1.28 msvc.jam
--- msvc.jam	6 Jul 2004 07:50:58 -0000	1.28
+++ msvc.jam	18 Jul 2004 17:29:34 -0000
@@ -30,6 +30,8 @@
# to be seen, though ;-)
;
+RM = [ modules.peek common : RM ] ;
+
# Initialize the toolset for a specific version. As the result, path to
# compiler and, possible, program names are set up, and will be used when
# that version of compiler is requested. For example, you might have::
@@ -291,6 +293,26 @@
flags msvc.link LIBRARY_OPTION <toolset>msvc : "" : unchecked ;
+# Declare action for creating static libraries
+# If library exists, remove it before adding files. See
+# http://article.gmane.org/gmane.comp.lib.boost.build/4241 
+# for rationale.
+rule archive ( targets + : sources * : properties * ) 
+{
+ common.response-file $(targets) : $(sources) : $(targets[2]) : $(properties) ; 
+}
+actions archive 
+{ 
+ $(RM) "$(<[1])"
+ $(.LD) /lib /NOLOGO /out:"$(<[1])" @"$(<[2])"
+}
+
+rule link ( targets + : sources * : properties * )
+{
+ common.response-file $(targets) : $(sources) : $(targets[2]) 
+ : $(properties) ;
+}
+ 
# incremental linking a DLL causes no end of problems: if the
# actual exports don't change, the import .lib file is never
# updated. Therefore, the .lib is always out-of-date and gets
@@ -298,15 +320,8 @@
# such a great idea in general, but in this case I'm sure we
# don't want it.
-# Declare action for creating static libraries
if [ os.name ] in NT
{ 
- rule link ( targets + : sources * : properties * )
- {
- common.response-file $(targets) : $(sources) : $(targets[2]) 
- : $(properties) ;
- }
- 
rule link.dll ( targets + : sources * : properties * )
{
common.response-file $(targets) : $(sources) : $(targets[3]) : $(properties) ;
@@ -318,43 +333,16 @@
common.response-file $(targets) : $(sources) : $(targets[2]) : $(properties) ;
}
- # If library exists, remove it before adding files. See
- # http://article.gmane.org/gmane.comp.lib.boost.build/4241 
- # for rationale.
- actions archive 
- { 
- if exist "$(<[1])" DEL "$(<[1])"
- $(.LD) /lib /NOLOGO /out:"$(<[1])" @"$(<[2])"
- }
}
else # CYGWIN
{
- rule link ( targets + : sources * : properties * )
- {
- common.response-file $(targets) : $(sources) : $(targets[2]) 
- : $(properties) ;
- } 
- 
rule link.dll ( targets + : sources + : properties * )
{
common.response-file $(targets) : $(sources) : $(targets[3]) : $(properties) ; 
.cygpath = "cygpath -d " ;
DEPENDS $(<) : [ on $(<) return $(DEF_FILE) ] ;
}
- 
- rule archive ( targets + : sources * : properties * ) 
- {
- common.response-file $(targets) : $(sources) : $(targets[2]) : $(properties) ; 
- }
- actions archive
- {
- _bbv2_out_="$(<)"
- if test -f "$_bbv2_out_" ; then
- _bbv2_existing_="$(<:W)"
- fi
- $(.LD) /lib /NOLOGO "/out:$(<:W)" $_bbv2_existing_ @"$(>:W)"
- }
}
actions link bind DEF_FILE
Index: XX.jam
===================================================================
RCS file: XX.jam
diff -N XX.jam
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ XX.jam	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,44 @@
+import toolset : flags ;
+import generators ;
+import feature ;
+import type ;
+
+feature.extend toolset : XX ;
+feature.subfeature toolset XX : version
+ : 
+ : propagated implicit
+ ;
+
+# Declare generators
+generators.register-linker XX.link : OBJ SEARCHED_LIB STATIC_LIB IMPORT_LIB : EXE : <toolset>XX ;
+generators.register-linker XX.link.dll : OBJ SEARCHED_LIB STATIC_LIB IMPORT_LIB : SHARED_LIB IMPORT_LIB : <toolset>XX ;
+
+generators.register-composing XX.archive : OBJ : STATIC_LIB : <toolset>XX ;
+generators.register-c-compiler XX.compile.c++ : CPP : OBJ : <toolset>XX ;
+generators.register-c-compiler XX.compile.c : C : OBJ : <toolset>XX ;
+
+actions compile.c
+{
+}
+actions compile.c++
+{
+}
+
+actions link
+{
+}
+
+actions archive
+{
+}
+
+actions link.dll
+{
+}
+
+rule init (
+ version # version identification which is being configured
+)
+{
+ feature.extend <toolset>XX version : $(version) ;
+}
Index: gcc-ms.jam
===================================================================
RCS file: gcc-ms.jam
diff -N gcc-ms.jam
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gcc-ms.jam	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,23 @@
+# Copyright (c) 2003 Michael Stevens
+#
+# Use, modification and distribution is subject to the Boost Software
+# License Version 1.0. (See accompanying file LICENSE_1_0.txt or
+# http://www.boost.org/LICENSE_1_0.txt)
+
+# Support altenative initalisation for gcc toolset
+
+import toolset : flags ;
+import feature ;
+import gcc ;
+
+
+# Initializes the gcc toolset with a identified version and path
+rule init ( version : path ? : name ? )
+{
+ name ?= "g++" ;
+ path ?= "" ;
+# feature.extend-subfeature toolset gcc : version : $(version) ;
+
+ modules.call-in gcc : flags gcc NAME <toolset>gcc-$(version) : $(path)$(name) ;
+# modules.call-in gcc : flags gcc.link OPTIONS <linkflags> : "-lstdc++" ;
+}
Index: msvc-X.jam
===================================================================
RCS file: msvc-X.jam
diff -N msvc-X.jam
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ msvc-X.jam	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,89 @@
+# Copyright (c) 2003 Michael Stevens
+#
+# Use, modification and distribution is subject to the Boost Software
+# License Version 1.0. (See accompanying file LICENSE_1_0.txt or
+# http://www.boost.org/LICENSE_1_0.txt)
+
+# Support for the X-Cross compilation (for example using wine) for
+# the msvc toolset.
+
+import toolset : flags ;
+import feature ;
+import type ;
+import common ;
+import msvc ;
+
+# ISSUE Redefinition in external module does not work
+module msvc
+{
+
+rule link.dll ( targets + : sources * : properties * )
+{
+ECHO MSVC-X link rule ;
+ common.response-file $(targets) : $(sources) : $(targets[3]) : $(properties) ;
+ DEPENDS $(<) : [ on $(<) return $(DEF_FILE) ] ;
+}
+
+rule archive ( targets + : sources * : properties * )
+{
+ECHO MSVC-X archive rule ;
+ common.response-file $(targets) : $(sources) : $(targets[2]) : $(properties) ;
+}
+
+actions archive
+{
+#ECHO MSVC-X archive action ;
+ $(RM) "$(<[1])"
+ $(.LD) /lib /NOLOGO /out:"$(<[1])" @"$(<[2])"
+}
+
+} # module msvc
+
+# REMOVED I would like to override the type registration away from the Incorrect spec dependant on OS
+#type.set-generated-target-suffix STATIC_LIB : <toolset>msvc : lib ;
+#type.register STATIC_LIB : lib a : LIB : main ;
+
+
+# Cross compilation as a msvc subfeature
+# Cross compilation is link compatible!
+feature.subfeature toolset msvc : cross
+ :
+ : propagated optional
+ ;
+
+# Configure msvc toolset for Cross compilation
+# Allow direct control of the compilation command line
+# Paths and enviroment variable must be configured elsewhere.
+# NOTE The build configuration remains "msvc".
+# For example, you might have:
+#
+# using msvc-X : 7.0 : "vcrun " ;
+# will invoke the standard compiler tool "cl" with "vcrun cl"
+rule init (
+ version # version identification which is being configured
+ : prefix # literal prefix prepended to command line
+ : cross ? # cross compilation identifiction, default "wine"
+ : compiler ?
+ : linker ? )
+{
+ cross ?= "wine" ;
+ compiler ?= "cl" ;
+ linker ?= "link" ;
+ 
+ local condition = [ common.check-init-parameters msvc : 
+ version $(version) ] ;
+
+ feature.extend <toolset>msvc version : $(version) ;
+ feature.extend <toolset>msvc cross : $(cross) ;
+
+ condition = $(condition) <toolset-msvc:cross>$(cross) ;
+ modules.call-in msvc : flags msvc.compile .CC $(condition) : $(prefix)$(compiler) ;
+ modules.call-in msvc : flags msvc.link .LD $(condition) : $(prefix)$(linker) ;
+ modules.call-in msvc : flags msvc.archive .LD $(condition) : $(prefix)$(linker) ;
+}
+
+rule test
+{
+ ECHO MSVC-X TEST RULE ;
+}
+
 --Boundary-00=_4ar+AcpWZOknqco-- 

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