mirror of
https://github.com/boostorg/build.git
synced 2026-02-15 13:02:11 +00:00
Added an V2 example.
[SVN r14833]
This commit is contained in:
2
examples-v2/boost-build.jam
Normal file
2
examples-v2/boost-build.jam
Normal file
@@ -0,0 +1,2 @@
|
||||
|
||||
boost-build ../new ;
|
||||
22
examples-v2/make/Jamfile
Normal file
22
examples-v2/make/Jamfile
Normal file
@@ -0,0 +1,22 @@
|
||||
|
||||
# Declare a project id.
|
||||
project make
|
||||
# Specify requirements for this project. They will be propagated to child project.
|
||||
# Use 'bjam -n' to see that MACRO is defined when compiling lib/b.obj
|
||||
: requirements <define>MACRO
|
||||
;
|
||||
|
||||
# Load a project located at "extlib", and associated with project-id "/extlib".
|
||||
use-project /extlib : extlib ;
|
||||
|
||||
# Construct a target 'a' from a list of sources using the specified rule.
|
||||
make a
|
||||
: a.o # Use a target declared in this Jamfile
|
||||
lib/b.o # Use a target from other Jamfile
|
||||
@/extlib/c.o # Refer to a library by project-id
|
||||
|
||||
: gcc.link ;
|
||||
|
||||
|
||||
# Construct another target.
|
||||
make a.o : a.cpp : gcc.compile ;
|
||||
5
examples-v2/make/a.cpp
Normal file
5
examples-v2/make/a.cpp
Normal file
@@ -0,0 +1,5 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
4
examples-v2/make/extlib/Jamfile
Normal file
4
examples-v2/make/extlib/Jamfile
Normal file
@@ -0,0 +1,4 @@
|
||||
|
||||
project extlib ;
|
||||
|
||||
make c.o : c.cpp : gcc.compile ;
|
||||
0
examples-v2/make/extlib/c.cpp
Normal file
0
examples-v2/make/extlib/c.cpp
Normal file
44
examples-v2/make/extlib/gcc.jam
Normal file
44
examples-v2/make/extlib/gcc.jam
Normal file
@@ -0,0 +1,44 @@
|
||||
|
||||
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 $(<) $(>)
|
||||
}
|
||||
|
||||
0
examples-v2/make/extlib/project-root.jam
Normal file
0
examples-v2/make/extlib/project-root.jam
Normal file
44
examples-v2/make/gcc.jam
Normal file
44
examples-v2/make/gcc.jam
Normal file
@@ -0,0 +1,44 @@
|
||||
|
||||
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 $(<) $(>)
|
||||
}
|
||||
|
||||
2
examples-v2/make/lib/Jamfile
Normal file
2
examples-v2/make/lib/Jamfile
Normal file
@@ -0,0 +1,2 @@
|
||||
|
||||
make b.o : b.cpp : gcc.compile ;
|
||||
0
examples-v2/make/lib/b.cpp
Normal file
0
examples-v2/make/lib/b.cpp
Normal file
9
examples-v2/make/project-root.jam
Normal file
9
examples-v2/make/project-root.jam
Normal file
@@ -0,0 +1,9 @@
|
||||
|
||||
import modules ;
|
||||
|
||||
# Temporary workaround.
|
||||
local location = [ project-root get-location ] ;
|
||||
local new_path = [ modules.peek : BOOST_BUILD_PATH ] $(location) ;
|
||||
modules.poke : BOOST_BUILD_PATH : $(new_path) ;
|
||||
|
||||
import gcc ;
|
||||
17
examples-v2/make/readme.txt
Normal file
17
examples-v2/make/readme.txt
Normal file
@@ -0,0 +1,17 @@
|
||||
|
||||
Example of a simple project, which builds an executable using g++.
|
||||
All the transformations are specified explicitly.
|
||||
It illustrates the use of project identifiers to refer to other targets
|
||||
and also project requirements.
|
||||
|
||||
|
||||
Interesting commands would be
|
||||
|
||||
bjam
|
||||
bjam release
|
||||
bjam release clean
|
||||
bjam release debug-symbols=on
|
||||
|
||||
Also, you can use jam's "-n" option to check if "debug"/"release" have any
|
||||
effect on commands executed. (Note that "-n" should go before any non-option
|
||||
elements on command line).
|
||||
2
v2/example/boost-build.jam
Normal file
2
v2/example/boost-build.jam
Normal file
@@ -0,0 +1,2 @@
|
||||
|
||||
boost-build ../new ;
|
||||
22
v2/example/make/Jamfile
Normal file
22
v2/example/make/Jamfile
Normal file
@@ -0,0 +1,22 @@
|
||||
|
||||
# Declare a project id.
|
||||
project make
|
||||
# Specify requirements for this project. They will be propagated to child project.
|
||||
# Use 'bjam -n' to see that MACRO is defined when compiling lib/b.obj
|
||||
: requirements <define>MACRO
|
||||
;
|
||||
|
||||
# Load a project located at "extlib", and associated with project-id "/extlib".
|
||||
use-project /extlib : extlib ;
|
||||
|
||||
# Construct a target 'a' from a list of sources using the specified rule.
|
||||
make a
|
||||
: a.o # Use a target declared in this Jamfile
|
||||
lib/b.o # Use a target from other Jamfile
|
||||
@/extlib/c.o # Refer to a library by project-id
|
||||
|
||||
: gcc.link ;
|
||||
|
||||
|
||||
# Construct another target.
|
||||
make a.o : a.cpp : gcc.compile ;
|
||||
5
v2/example/make/a.cpp
Normal file
5
v2/example/make/a.cpp
Normal file
@@ -0,0 +1,5 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
4
v2/example/make/extlib/Jamfile
Normal file
4
v2/example/make/extlib/Jamfile
Normal file
@@ -0,0 +1,4 @@
|
||||
|
||||
project extlib ;
|
||||
|
||||
make c.o : c.cpp : gcc.compile ;
|
||||
0
v2/example/make/extlib/c.cpp
Normal file
0
v2/example/make/extlib/c.cpp
Normal file
44
v2/example/make/extlib/gcc.jam
Normal file
44
v2/example/make/extlib/gcc.jam
Normal file
@@ -0,0 +1,44 @@
|
||||
|
||||
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 $(<) $(>)
|
||||
}
|
||||
|
||||
0
v2/example/make/extlib/project-root.jam
Normal file
0
v2/example/make/extlib/project-root.jam
Normal file
44
v2/example/make/gcc.jam
Normal file
44
v2/example/make/gcc.jam
Normal file
@@ -0,0 +1,44 @@
|
||||
|
||||
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 $(<) $(>)
|
||||
}
|
||||
|
||||
2
v2/example/make/lib/Jamfile
Normal file
2
v2/example/make/lib/Jamfile
Normal file
@@ -0,0 +1,2 @@
|
||||
|
||||
make b.o : b.cpp : gcc.compile ;
|
||||
0
v2/example/make/lib/b.cpp
Normal file
0
v2/example/make/lib/b.cpp
Normal file
9
v2/example/make/project-root.jam
Normal file
9
v2/example/make/project-root.jam
Normal file
@@ -0,0 +1,9 @@
|
||||
|
||||
import modules ;
|
||||
|
||||
# Temporary workaround.
|
||||
local location = [ project-root get-location ] ;
|
||||
local new_path = [ modules.peek : BOOST_BUILD_PATH ] $(location) ;
|
||||
modules.poke : BOOST_BUILD_PATH : $(new_path) ;
|
||||
|
||||
import gcc ;
|
||||
17
v2/example/make/readme.txt
Normal file
17
v2/example/make/readme.txt
Normal file
@@ -0,0 +1,17 @@
|
||||
|
||||
Example of a simple project, which builds an executable using g++.
|
||||
All the transformations are specified explicitly.
|
||||
It illustrates the use of project identifiers to refer to other targets
|
||||
and also project requirements.
|
||||
|
||||
|
||||
Interesting commands would be
|
||||
|
||||
bjam
|
||||
bjam release
|
||||
bjam release clean
|
||||
bjam release debug-symbols=on
|
||||
|
||||
Also, you can use jam's "-n" option to check if "debug"/"release" have any
|
||||
effect on commands executed. (Note that "-n" should go before any non-option
|
||||
elements on command line).
|
||||
Reference in New Issue
Block a user