Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r74311 - trunk/libs/spirit/example/qi/compiler_tutorial
From: joel_at_[hidden]
Date: 2011-09-08 11:59:20


Author: djowel
Date: 2011-09-08 11:59:19 EDT (Thu, 08 Sep 2011)
New Revision: 74311
URL: http://svn.boost.org/trac/boost/changeset/74311

Log:
Better Jamfile
Text files modified:
   trunk/libs/spirit/example/qi/compiler_tutorial/Jamfile | 126 ++++++++++++++++++++++++++-------------
   1 files changed, 85 insertions(+), 41 deletions(-)

Modified: trunk/libs/spirit/example/qi/compiler_tutorial/Jamfile
==============================================================================
--- trunk/libs/spirit/example/qi/compiler_tutorial/Jamfile (original)
+++ trunk/libs/spirit/example/qi/compiler_tutorial/Jamfile 2011-09-08 11:59:19 EDT (Thu, 08 Sep 2011)
@@ -14,12 +14,35 @@
 
 import modules ;
 
-exe calc1 : calc1.cpp ;
-exe calc2 : calc2.cpp ;
-exe calc3 : calc3.cpp ;
-exe calc4 : calc4.cpp ;
-exe calc5 : calc5.cpp ;
-exe calc6 : calc6.cpp ;
+exe calc1 : calc1.cpp
+: <variant>release:<location>"bin/release"
+ <variant>debug:<location>"bin/debug"
+;
+
+exe calc2 : calc2.cpp
+: <variant>release:<location>"bin/release"
+ <variant>debug:<location>"bin/debug"
+;
+
+exe calc3 : calc3.cpp
+: <variant>release:<location>"bin/release"
+ <variant>debug:<location>"bin/debug"
+;
+
+exe calc4 : calc4.cpp
+: <variant>release:<location>"bin/release"
+ <variant>debug:<location>"bin/debug"
+;
+
+exe calc5 : calc5.cpp
+: <variant>release:<location>"bin/release"
+ <variant>debug:<location>"bin/debug"
+;
+
+exe calc6 : calc6.cpp
+: <variant>release:<location>"bin/release"
+ <variant>debug:<location>"bin/debug"
+;
 
 exe calc7 :
     calc7/vm.cpp
@@ -27,7 +50,9 @@
     calc7/expression.cpp
     calc7/statement.cpp
     calc7/main.cpp
- ;
+: <variant>release:<location>"bin/release"
+ <variant>debug:<location>"bin/debug"
+;
 
 exe calc8 :
     calc8/vm.cpp
@@ -35,7 +60,9 @@
     calc8/expression.cpp
     calc8/statement.cpp
     calc8/main.cpp
- ;
+: <variant>release:<location>"bin/release"
+ <variant>debug:<location>"bin/debug"
+;
 
 exe mini_c :
     mini_c/vm.cpp
@@ -44,7 +71,9 @@
     mini_c/statement.cpp
     mini_c/function.cpp
     mini_c/main.cpp
- ;
+: <variant>release:<location>"bin/release"
+ <variant>debug:<location>"bin/debug"
+;
 
 exe conjure1 :
     conjure1/vm.cpp
@@ -53,7 +82,9 @@
     conjure1/statement.cpp
     conjure1/function.cpp
     conjure1/main.cpp
- ;
+: <variant>release:<location>"bin/release"
+ <variant>debug:<location>"bin/debug"
+;
 
 exe conjure2 :
     conjure2/compiler.cpp
@@ -63,6 +94,8 @@
     conjure2/main.cpp
     conjure2/statement.cpp
     conjure2/vm.cpp
+: <variant>release:<location>"bin/release"
+ <variant>debug:<location>"bin/debug"
     ;
 
 #==============================================================================
@@ -80,14 +113,49 @@
 
 if $(LLVM_PATH)
 {
- LLVM_LIB_DEBUG_PATH = $(LLVM_PATH)/lib/Debug ;
- LLVM_LIB_RELEASE_PATH = $(LLVM_PATH)/lib/Release ;
- LLVM_LINKER_FLAGS =
- "advapi32.lib"
- "shell32.lib"
- ;
+ path-constant LLVM_LIB_DEBUG_PATH : $(LLVM_PATH)/lib/Debug ;
+ path-constant LLVM_LIB_RELEASE_PATH : $(LLVM_PATH)/lib/Release ;
+
+ llvm_linker_flags =
+ "advapi32.lib"
+ "shell32.lib"
+ ;
+
+ llvm_debug_libs = [ glob $(LLVM_LIB_DEBUG_PATH)/LLVM*.lib ] ;
+ llvm_release_libs = [ glob $(LLVM_LIB_RELEASE_PATH)/LLVM*.lib ] ;
+
+ rule build_exe_1 ( target-name : sources + : requirements * )
+ {
+ local llvm_lib ;
+ local target_location ;
+ if <variant>debug in $(requirements)
+ {
+ llvm_lib = $(llvm_debug_libs) ;
+ target_location = "bin/debug" ;
+ }
+ else
+ {
+ llvm_lib = $(llvm_release_libs) ;
+ target_location = "bin/release" ;
+ }
+
+ exe $(target-name)
+ : $(sources) $(llvm_lib)
+ : $(requirements)
+ <toolset>msvc
+ <include>$(LLVM_PATH)/include
+ <linkflags>$(llvm_linker_flags)
+ <location>$(target_location)
+ ;
+ }
+
+ rule build_exe ( target-name : sources + )
+ {
+ build_exe_1 $(target-name) : $(sources) : <variant>debug ;
+ build_exe_1 $(target-name) : $(sources) : <variant>release ;
+ }
 
- conjure3sources =
+ build_exe conjure3 :
         conjure3/compiler.cpp
         conjure3/expression.cpp
         conjure3/function.cpp
@@ -95,30 +163,6 @@
         conjure3/main.cpp
         conjure3/statement.cpp
         conjure3/vm.cpp
- ;
-
- exe conjure3 :
- $(conjure3sources)
-
- # bring in the LLVM libs
- [ glob $(LLVM_LIB_DEBUG_PATH)/LLVM*.lib ]
- :
- <variant>debug
- <toolset>msvc
- <include>$(LLVM_PATH)/include
- <linkflags>$(LLVM_LINKER_FLAGS)
- ;
-
- exe conjure3 :
- $(conjure3sources)
-
- # bring in the LLVM libs
- [ glob $(LLVM_LIB_RELEASE_PATH)/LLVM*.lib ]
- :
- <variant>release
- <toolset>msvc
- <include>$(LLVM_PATH)/include
- <linkflags>$(LLVM_LINKER_FLAGS)
     ;
 }
 


Boost-Commit 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