mirror of
https://github.com/boostorg/build.git
synced 2026-02-16 01:12:13 +00:00
Added future generators test -- not automated now.
[SVN r14926]
This commit is contained in:
5
test/generators-test/Jamfile
Normal file
5
test/generators-test/Jamfile
Normal file
@@ -0,0 +1,5 @@
|
||||
|
||||
exe a : a.cpp b.cpp c.ui d.wd x.l y.x_pro lib/aux ;
|
||||
#exe a : a.cpp b.cpp c.ui d.wd x.l y.x_pro ;
|
||||
|
||||
nm_exe e : e.cpp ;
|
||||
10
test/generators-test/a.cpp
Normal file
10
test/generators-test/a.cpp
Normal file
@@ -0,0 +1,10 @@
|
||||
|
||||
int foo();
|
||||
int bar();
|
||||
|
||||
int main()
|
||||
{
|
||||
foo();
|
||||
bar();
|
||||
return 0;
|
||||
}
|
||||
2
test/generators-test/b.cpp
Normal file
2
test/generators-test/b.cpp
Normal file
@@ -0,0 +1,2 @@
|
||||
|
||||
int foo() { return 0; }
|
||||
0
test/generators-test/c.ui
Normal file
0
test/generators-test/c.ui
Normal file
0
test/generators-test/d.wd
Normal file
0
test/generators-test/d.wd
Normal file
0
test/generators-test/e.cpp
Normal file
0
test/generators-test/e.cpp
Normal file
56
test/generators-test/extra.jam
Normal file
56
test/generators-test/extra.jam
Normal file
@@ -0,0 +1,56 @@
|
||||
|
||||
rule whale ( targets * : sources * : properties * )
|
||||
{
|
||||
}
|
||||
|
||||
actions whale
|
||||
{
|
||||
echo "Whale consuming " $(>)
|
||||
touch $(<)
|
||||
}
|
||||
|
||||
rule dolphin ( targets * : source * : properties * )
|
||||
{
|
||||
}
|
||||
|
||||
actions dolphin
|
||||
{
|
||||
echo "Dolphin consuming" $(>)
|
||||
touch $(<)
|
||||
}
|
||||
|
||||
rule wd ( targets * : source * : properties * )
|
||||
{
|
||||
}
|
||||
|
||||
actions wd
|
||||
{
|
||||
echo "WD consuming" $(>)
|
||||
touch $(<)
|
||||
}
|
||||
|
||||
rule x ( target * : source * : properties * )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
actions x
|
||||
{
|
||||
echo "X: source is " $(>)
|
||||
touch $(<)
|
||||
}
|
||||
|
||||
rule x_pro ( target * : source * : properties * )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
actions x_pro
|
||||
{
|
||||
echo "X_PRO: source is " $(>)
|
||||
touch $(<)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
52
test/generators-test/gcc.jam
Normal file
52
test/generators-test/gcc.jam
Normal file
@@ -0,0 +1,52 @@
|
||||
|
||||
import property ;
|
||||
|
||||
rule compile ( target : sources * : property-set * )
|
||||
{
|
||||
local options ;
|
||||
for local p in $(property-set)
|
||||
{
|
||||
if $(p) = <optimization>on
|
||||
{
|
||||
options += -O2 ;
|
||||
}
|
||||
else if $(p) = <debug-symbols>on
|
||||
{
|
||||
options += -g ;
|
||||
}
|
||||
else if $(p:G) = <define>
|
||||
{
|
||||
options += -D$(p:G=) ;
|
||||
}
|
||||
}
|
||||
OPTIONS on $(target) = $(options) ;
|
||||
}
|
||||
|
||||
actions compile
|
||||
{
|
||||
g++ $(OPTIONS) -c -o $(<) $(>)
|
||||
}
|
||||
|
||||
rule link ( target : sources * : property-set * )
|
||||
{
|
||||
local options ;
|
||||
if <debug-symbols>on in $(property-set)
|
||||
{
|
||||
options += -g ;
|
||||
}
|
||||
OPTIONS on $(target) = $(options) ;
|
||||
}
|
||||
|
||||
actions link
|
||||
{
|
||||
g++ $(OPTIONS) -o $(<) $(>)
|
||||
}
|
||||
|
||||
rule archive ( target : sources * : property-set * )
|
||||
{
|
||||
}
|
||||
|
||||
actions archive
|
||||
{
|
||||
ar ur $(<) $(>)
|
||||
}
|
||||
9
test/generators-test/lex.jam
Normal file
9
test/generators-test/lex.jam
Normal file
@@ -0,0 +1,9 @@
|
||||
|
||||
rule lex ( target : source : properties * )
|
||||
{
|
||||
}
|
||||
|
||||
actions lex
|
||||
{
|
||||
flex -o$(<) $(>)
|
||||
}
|
||||
2
test/generators-test/lib/Jamfile
Normal file
2
test/generators-test/lib/Jamfile
Normal file
@@ -0,0 +1,2 @@
|
||||
|
||||
lib aux : c.cpp ;
|
||||
2
test/generators-test/lib/c.cpp
Normal file
2
test/generators-test/lib/c.cpp
Normal file
@@ -0,0 +1,2 @@
|
||||
|
||||
int bar() { return 0; }
|
||||
25
test/generators-test/nm.jam
Normal file
25
test/generators-test/nm.jam
Normal file
@@ -0,0 +1,25 @@
|
||||
|
||||
rule target-source ( targets * : sources * : properties * )
|
||||
{
|
||||
}
|
||||
|
||||
actions target-source
|
||||
{
|
||||
echo "NM target source consuming " $(>)
|
||||
echo "int main() {}" > $(<)
|
||||
}
|
||||
|
||||
rule cpp-mark ( targets * : sources * : properties * )
|
||||
{
|
||||
}
|
||||
|
||||
actions cpp-mark
|
||||
{
|
||||
echo "CPP-MARK consuming " $(>)
|
||||
touch $(<)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
116
test/generators-test/project-root.jam
Normal file
116
test/generators-test/project-root.jam
Normal file
@@ -0,0 +1,116 @@
|
||||
|
||||
import class : class new ;
|
||||
|
||||
import gcc ;
|
||||
import lex ;
|
||||
import qt ;
|
||||
import extra ;
|
||||
|
||||
import type ;
|
||||
|
||||
type.register EXE : : : main ;
|
||||
type.register LIB : : : main ;
|
||||
type.register CPP : cpp ;
|
||||
type.register C : c ;
|
||||
type.register OBJ : o ;
|
||||
type.register LEX : l ;
|
||||
type.register WHL : whl ;
|
||||
type.register DLP : dlp ;
|
||||
type.register WHL-LR0 : lr0 ;
|
||||
type.register WD : wd ;
|
||||
type.register H : h ;
|
||||
type.register UI : ui ;
|
||||
type.register UIC-H : h ;
|
||||
|
||||
type.register X1 : x1 ;
|
||||
type.register X2 : x2 ;
|
||||
type.register X_PRO : x_pro ;
|
||||
|
||||
import generators ;
|
||||
|
||||
generators.register-composing gcc.link : LIB OBJ : EXE : <toolset>gcc ;
|
||||
generators.register-composing gcc.archive : OBJ : LIB : <toolset>gcc ;
|
||||
generators.register-standard gcc.compile : CPP : OBJ : <toolset>gcc ;
|
||||
generators.register-standard gcc.compile : C : OBJ : <toolset>gcc ;
|
||||
generators.register-standard lex.lex : LEX : C ;
|
||||
|
||||
generators.register-standard extra.whale : WHL : CPP WHL-LR0 ;
|
||||
generators.register-standard extra.dolphin : DLP : CPP ;
|
||||
generators.register-standard extra.wd : WD : WHL DLP ;
|
||||
generators.register-standard qt.uic : UI UIC-H : CPP ;
|
||||
generators.register-standard qt.uic-h : UI : UIC-H ;
|
||||
|
||||
# That's an interesting example. Currently, X_PRO will be processed
|
||||
# twice.
|
||||
generators.register-standard extra.x : X1 X2 : CPP ;
|
||||
generators.register-standard extra.x_pro : X_PRO : X1 X2 ;
|
||||
|
||||
# The point of this setup of to implement this functionality
|
||||
# "When main target type is EST_EXE, build OBJ from CPP-MARKED, not
|
||||
# for anything else (like CPP)
|
||||
# Unfortunately, this does not really works.
|
||||
|
||||
#if $(no-var) {
|
||||
import nm ;
|
||||
|
||||
type.register CPP-MARKED : marked.cpp : CPP ;
|
||||
type.register POSITIONS : positions ;
|
||||
type.register NM.TARGET.CPP : target.cpp : CPP ;
|
||||
type.register NM_EXE : : EXE : main ;
|
||||
|
||||
# Should inherit generators from base class?
|
||||
generators.register-composing gcc.link : OBJ : NM_EXE : <toolset>gcc ;
|
||||
generators.register-standard nm.target-source : CPP-MARKED : NM.TARGET.CPP ;
|
||||
generators.register-standard nm.cpp-mark : CPP : CPP-MARKED POSITIONS ;
|
||||
|
||||
|
||||
rule nm.target.cpp-obj-generator
|
||||
{
|
||||
generator.__init__ nm.target-obj : NM.TARGET.CPP : OBJ ;
|
||||
|
||||
rule requirements ( )
|
||||
{
|
||||
return <main-target-type>NM_EXE ;
|
||||
}
|
||||
|
||||
rule optional-properties ( )
|
||||
{
|
||||
return <main-target-type>NM_EXE ;
|
||||
}
|
||||
|
||||
# Consider: it it OK to ignore all other generated targets except for the first?
|
||||
rule run ( project name ? : properties * : source : multiple ? )
|
||||
{
|
||||
if [ $(source).type ] = CPP {
|
||||
local converted = [ generators.construct-dbg $(project) : NM.TARGET.CPP : $(properties) : $(source) ] ;
|
||||
local first = [ $(converted).at 1 ] ;
|
||||
if ! [ $(first).empty ]
|
||||
{
|
||||
converted = [ $(first).get ] ;
|
||||
local result = [ generators.construct-dbg $(project) : OBJ : $(properties) : $(converted) ] ;
|
||||
return [ $(result).get-at 1 ] ;
|
||||
}
|
||||
else
|
||||
{
|
||||
return ;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return ;
|
||||
}
|
||||
}
|
||||
}
|
||||
class nm.target.cpp-obj-generator : generator ;
|
||||
|
||||
generators.register [ new nm.target.cpp-obj-generator ] ;
|
||||
#}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
19
test/generators-test/qt.jam
Normal file
19
test/generators-test/qt.jam
Normal file
@@ -0,0 +1,19 @@
|
||||
|
||||
rule uic ( target : sources * : properties * )
|
||||
{
|
||||
}
|
||||
|
||||
actions uic
|
||||
{
|
||||
echo "//" $(>) > $(<)
|
||||
}
|
||||
|
||||
rule uic-h ( target : sources * : properties * )
|
||||
{
|
||||
}
|
||||
|
||||
actions uic-h
|
||||
{
|
||||
echo "//" $(>) > $(<)
|
||||
}
|
||||
|
||||
5
test/generators-test/x.l
Normal file
5
test/generators-test/x.l
Normal file
@@ -0,0 +1,5 @@
|
||||
%option noyywrap
|
||||
|
||||
%%
|
||||
|
||||
%%
|
||||
0
test/generators-test/y.x_pro
Normal file
0
test/generators-test/y.x_pro
Normal file
5
v2/test/generators-test/Jamfile
Normal file
5
v2/test/generators-test/Jamfile
Normal file
@@ -0,0 +1,5 @@
|
||||
|
||||
exe a : a.cpp b.cpp c.ui d.wd x.l y.x_pro lib/aux ;
|
||||
#exe a : a.cpp b.cpp c.ui d.wd x.l y.x_pro ;
|
||||
|
||||
nm_exe e : e.cpp ;
|
||||
10
v2/test/generators-test/a.cpp
Normal file
10
v2/test/generators-test/a.cpp
Normal file
@@ -0,0 +1,10 @@
|
||||
|
||||
int foo();
|
||||
int bar();
|
||||
|
||||
int main()
|
||||
{
|
||||
foo();
|
||||
bar();
|
||||
return 0;
|
||||
}
|
||||
2
v2/test/generators-test/b.cpp
Normal file
2
v2/test/generators-test/b.cpp
Normal file
@@ -0,0 +1,2 @@
|
||||
|
||||
int foo() { return 0; }
|
||||
0
v2/test/generators-test/c.ui
Normal file
0
v2/test/generators-test/c.ui
Normal file
0
v2/test/generators-test/d.wd
Normal file
0
v2/test/generators-test/d.wd
Normal file
0
v2/test/generators-test/e.cpp
Normal file
0
v2/test/generators-test/e.cpp
Normal file
56
v2/test/generators-test/extra.jam
Normal file
56
v2/test/generators-test/extra.jam
Normal file
@@ -0,0 +1,56 @@
|
||||
|
||||
rule whale ( targets * : sources * : properties * )
|
||||
{
|
||||
}
|
||||
|
||||
actions whale
|
||||
{
|
||||
echo "Whale consuming " $(>)
|
||||
touch $(<)
|
||||
}
|
||||
|
||||
rule dolphin ( targets * : source * : properties * )
|
||||
{
|
||||
}
|
||||
|
||||
actions dolphin
|
||||
{
|
||||
echo "Dolphin consuming" $(>)
|
||||
touch $(<)
|
||||
}
|
||||
|
||||
rule wd ( targets * : source * : properties * )
|
||||
{
|
||||
}
|
||||
|
||||
actions wd
|
||||
{
|
||||
echo "WD consuming" $(>)
|
||||
touch $(<)
|
||||
}
|
||||
|
||||
rule x ( target * : source * : properties * )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
actions x
|
||||
{
|
||||
echo "X: source is " $(>)
|
||||
touch $(<)
|
||||
}
|
||||
|
||||
rule x_pro ( target * : source * : properties * )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
actions x_pro
|
||||
{
|
||||
echo "X_PRO: source is " $(>)
|
||||
touch $(<)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
52
v2/test/generators-test/gcc.jam
Normal file
52
v2/test/generators-test/gcc.jam
Normal file
@@ -0,0 +1,52 @@
|
||||
|
||||
import property ;
|
||||
|
||||
rule compile ( target : sources * : property-set * )
|
||||
{
|
||||
local options ;
|
||||
for local p in $(property-set)
|
||||
{
|
||||
if $(p) = <optimization>on
|
||||
{
|
||||
options += -O2 ;
|
||||
}
|
||||
else if $(p) = <debug-symbols>on
|
||||
{
|
||||
options += -g ;
|
||||
}
|
||||
else if $(p:G) = <define>
|
||||
{
|
||||
options += -D$(p:G=) ;
|
||||
}
|
||||
}
|
||||
OPTIONS on $(target) = $(options) ;
|
||||
}
|
||||
|
||||
actions compile
|
||||
{
|
||||
g++ $(OPTIONS) -c -o $(<) $(>)
|
||||
}
|
||||
|
||||
rule link ( target : sources * : property-set * )
|
||||
{
|
||||
local options ;
|
||||
if <debug-symbols>on in $(property-set)
|
||||
{
|
||||
options += -g ;
|
||||
}
|
||||
OPTIONS on $(target) = $(options) ;
|
||||
}
|
||||
|
||||
actions link
|
||||
{
|
||||
g++ $(OPTIONS) -o $(<) $(>)
|
||||
}
|
||||
|
||||
rule archive ( target : sources * : property-set * )
|
||||
{
|
||||
}
|
||||
|
||||
actions archive
|
||||
{
|
||||
ar ur $(<) $(>)
|
||||
}
|
||||
9
v2/test/generators-test/lex.jam
Normal file
9
v2/test/generators-test/lex.jam
Normal file
@@ -0,0 +1,9 @@
|
||||
|
||||
rule lex ( target : source : properties * )
|
||||
{
|
||||
}
|
||||
|
||||
actions lex
|
||||
{
|
||||
flex -o$(<) $(>)
|
||||
}
|
||||
2
v2/test/generators-test/lib/Jamfile
Normal file
2
v2/test/generators-test/lib/Jamfile
Normal file
@@ -0,0 +1,2 @@
|
||||
|
||||
lib aux : c.cpp ;
|
||||
2
v2/test/generators-test/lib/c.cpp
Normal file
2
v2/test/generators-test/lib/c.cpp
Normal file
@@ -0,0 +1,2 @@
|
||||
|
||||
int bar() { return 0; }
|
||||
25
v2/test/generators-test/nm.jam
Normal file
25
v2/test/generators-test/nm.jam
Normal file
@@ -0,0 +1,25 @@
|
||||
|
||||
rule target-source ( targets * : sources * : properties * )
|
||||
{
|
||||
}
|
||||
|
||||
actions target-source
|
||||
{
|
||||
echo "NM target source consuming " $(>)
|
||||
echo "int main() {}" > $(<)
|
||||
}
|
||||
|
||||
rule cpp-mark ( targets * : sources * : properties * )
|
||||
{
|
||||
}
|
||||
|
||||
actions cpp-mark
|
||||
{
|
||||
echo "CPP-MARK consuming " $(>)
|
||||
touch $(<)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
116
v2/test/generators-test/project-root.jam
Normal file
116
v2/test/generators-test/project-root.jam
Normal file
@@ -0,0 +1,116 @@
|
||||
|
||||
import class : class new ;
|
||||
|
||||
import gcc ;
|
||||
import lex ;
|
||||
import qt ;
|
||||
import extra ;
|
||||
|
||||
import type ;
|
||||
|
||||
type.register EXE : : : main ;
|
||||
type.register LIB : : : main ;
|
||||
type.register CPP : cpp ;
|
||||
type.register C : c ;
|
||||
type.register OBJ : o ;
|
||||
type.register LEX : l ;
|
||||
type.register WHL : whl ;
|
||||
type.register DLP : dlp ;
|
||||
type.register WHL-LR0 : lr0 ;
|
||||
type.register WD : wd ;
|
||||
type.register H : h ;
|
||||
type.register UI : ui ;
|
||||
type.register UIC-H : h ;
|
||||
|
||||
type.register X1 : x1 ;
|
||||
type.register X2 : x2 ;
|
||||
type.register X_PRO : x_pro ;
|
||||
|
||||
import generators ;
|
||||
|
||||
generators.register-composing gcc.link : LIB OBJ : EXE : <toolset>gcc ;
|
||||
generators.register-composing gcc.archive : OBJ : LIB : <toolset>gcc ;
|
||||
generators.register-standard gcc.compile : CPP : OBJ : <toolset>gcc ;
|
||||
generators.register-standard gcc.compile : C : OBJ : <toolset>gcc ;
|
||||
generators.register-standard lex.lex : LEX : C ;
|
||||
|
||||
generators.register-standard extra.whale : WHL : CPP WHL-LR0 ;
|
||||
generators.register-standard extra.dolphin : DLP : CPP ;
|
||||
generators.register-standard extra.wd : WD : WHL DLP ;
|
||||
generators.register-standard qt.uic : UI UIC-H : CPP ;
|
||||
generators.register-standard qt.uic-h : UI : UIC-H ;
|
||||
|
||||
# That's an interesting example. Currently, X_PRO will be processed
|
||||
# twice.
|
||||
generators.register-standard extra.x : X1 X2 : CPP ;
|
||||
generators.register-standard extra.x_pro : X_PRO : X1 X2 ;
|
||||
|
||||
# The point of this setup of to implement this functionality
|
||||
# "When main target type is EST_EXE, build OBJ from CPP-MARKED, not
|
||||
# for anything else (like CPP)
|
||||
# Unfortunately, this does not really works.
|
||||
|
||||
#if $(no-var) {
|
||||
import nm ;
|
||||
|
||||
type.register CPP-MARKED : marked.cpp : CPP ;
|
||||
type.register POSITIONS : positions ;
|
||||
type.register NM.TARGET.CPP : target.cpp : CPP ;
|
||||
type.register NM_EXE : : EXE : main ;
|
||||
|
||||
# Should inherit generators from base class?
|
||||
generators.register-composing gcc.link : OBJ : NM_EXE : <toolset>gcc ;
|
||||
generators.register-standard nm.target-source : CPP-MARKED : NM.TARGET.CPP ;
|
||||
generators.register-standard nm.cpp-mark : CPP : CPP-MARKED POSITIONS ;
|
||||
|
||||
|
||||
rule nm.target.cpp-obj-generator
|
||||
{
|
||||
generator.__init__ nm.target-obj : NM.TARGET.CPP : OBJ ;
|
||||
|
||||
rule requirements ( )
|
||||
{
|
||||
return <main-target-type>NM_EXE ;
|
||||
}
|
||||
|
||||
rule optional-properties ( )
|
||||
{
|
||||
return <main-target-type>NM_EXE ;
|
||||
}
|
||||
|
||||
# Consider: it it OK to ignore all other generated targets except for the first?
|
||||
rule run ( project name ? : properties * : source : multiple ? )
|
||||
{
|
||||
if [ $(source).type ] = CPP {
|
||||
local converted = [ generators.construct-dbg $(project) : NM.TARGET.CPP : $(properties) : $(source) ] ;
|
||||
local first = [ $(converted).at 1 ] ;
|
||||
if ! [ $(first).empty ]
|
||||
{
|
||||
converted = [ $(first).get ] ;
|
||||
local result = [ generators.construct-dbg $(project) : OBJ : $(properties) : $(converted) ] ;
|
||||
return [ $(result).get-at 1 ] ;
|
||||
}
|
||||
else
|
||||
{
|
||||
return ;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return ;
|
||||
}
|
||||
}
|
||||
}
|
||||
class nm.target.cpp-obj-generator : generator ;
|
||||
|
||||
generators.register [ new nm.target.cpp-obj-generator ] ;
|
||||
#}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
19
v2/test/generators-test/qt.jam
Normal file
19
v2/test/generators-test/qt.jam
Normal file
@@ -0,0 +1,19 @@
|
||||
|
||||
rule uic ( target : sources * : properties * )
|
||||
{
|
||||
}
|
||||
|
||||
actions uic
|
||||
{
|
||||
echo "//" $(>) > $(<)
|
||||
}
|
||||
|
||||
rule uic-h ( target : sources * : properties * )
|
||||
{
|
||||
}
|
||||
|
||||
actions uic-h
|
||||
{
|
||||
echo "//" $(>) > $(<)
|
||||
}
|
||||
|
||||
5
v2/test/generators-test/x.l
Normal file
5
v2/test/generators-test/x.l
Normal file
@@ -0,0 +1,5 @@
|
||||
%option noyywrap
|
||||
|
||||
%%
|
||||
|
||||
%%
|
||||
0
v2/test/generators-test/y.x_pro
Normal file
0
v2/test/generators-test/y.x_pro
Normal file
Reference in New Issue
Block a user