Accept "nil" in char const* converter.
[luabind.git] / Jamroot
blobedc0336f4c2d76ad2aaafd9e5eb01727280d7fe7
1 import docutils ;
2 import os ;
3 import errors ;
4 import notfile ;
5 import package ;
6 import path ;
7 import virtual-target ;
9 VERSION = 0.9.0 ;
10 BOOST_ROOT = [ os.environ BOOST_ROOT ] ;
12 rule debug-message ( txt * )
14     if --debug-build in [ modules.peek : ARGV ]
15     {
16         echo [luabind DEBUG] $(txt) ;
17     }
20 debug-message figuring out which libraries to link to... ;
21 debug-message os.name is [ os.name ] ;
23 if [ os.name ] = NT
25     if ! $(BOOST_ROOT)
26     {
27         errors.user-error "*** BOOST_ROOT must be set to a Boost installation." ;
28     }
30     LUA_PATH = [ os.environ LUA_PATH ] ;
32     if ! $(LUA_PATH)
33     {
34         errors.user-error "*** LUA_PATH must be set." ;
35     }
37     local includes = [ GLOB $(LUA_PATH)/include $(LUA_PATH)/src : lua.h ] ;
39     if ! $(includes)
40     {
41         errors.user-error "*** Unable to determine Lua include directory." ;
42     }
44     includes = $(includes:D) ;
46     debug-message found include directory in $(includes) ;
48     if [ GLOB $(LUA_PATH) : lib ]
49     {
50         lib lua : : <link>static <name>lua5.1 <search>$(LUA_PATH)/lib/static : : <include>$(includes) ;
51         lib lua : : <link>shared <name>lua5.1 <search>$(LUA_PATH)/lib : : <include>$(includes) ;
52     }
53     else if [ GLOB $(LUA_PATH) : lua5.1.dll ]
54     {
55         lib lua : : <name>lua5.1 <search>$(LUA_PATH) : : <include>$(includes) ;
56     }
58 else if [ os.name ] in LINUX MACOSX FREEBSD
60     LUA_PATH = [ os.environ LUA_PATH ] ;
61     HOME = [ os.environ HOME ] ;
63     local possible-prefixes =
64         $(LUA_PATH) $(HOME)/Library/Frameworks /Library/Frameworks /usr /usr/local /opt/local /opt ;
66     local possible-suffixes =
67         include/lua5.1 include/lua51 include/lua include ;
69     local includes = [ GLOB $(possible-prefixes)/$(possible-suffixes) : lua.h ] ;
71     if ! $(includes)
72     {
73         errors.user-error "*** Unable to determine Lua include directory." ;
74     }
76     local includes = $(includes[1]:D) ;
77     local prefix = $(includes:D) ;
79     if $(prefix:B) = "include"
80     {
81         prefix = $(prefix:D) ;
82     }
84     local lib = $(prefix)/lib ;
86     local names = liblua5.1 liblua51 liblua ;
87     local extensions = .a .so ;
89     library = [ GLOB $(lib)/lua51 $(lib)/lua5.1 $(lib)/lua $(lib) :
90         $(names)$(extensions) ] ;
91     lib-name = [ MATCH "lib(.*)" : $(library[1]:B) ] ;
93     debug-message prefix: $(prefix) ;
94     debug-message includes: $(includes) ;
95     debug-message lib: $(library:D) ;
96     debug-message candidates: $(library) ;
97     debug-message linking to: $(lib-name) ;
99     if ! $(lib-name)
100     {
101         errors.user-error "*** Unable to find Lua library." ;
102     }
104     lib m : : <link>shared ;
105     if [ os.name ] = LINUX
106     {
107         lib dl : : <link>shared ;
108     }
109     else
110     {
111         alias dl ;
112     }
113     lib lua : m dl : <name>$(lib-name) <search>$(library:D) : : <include>$(includes) ;
116 rule tag-names ( name : type ? : property-set )
118     if $(type) in STATIC_LIB SHARED_LIB IMPORT_LIB &&
119         [ $(property-set).get <variant> ] = debug
120     {
121         name = $(name)d ;
122     }
124     local result = [ virtual-target.add-prefix-and-suffix $(name) : $(type) : $(property-set) ] ;
126     if $(type) = SHARED_LIB &&
127         ( ! ( [ $(property-set).get <target-os> ] in windows cygwin darwin aix ) &&
128           ! ( [ $(property-set).get <toolset> ] in pgi ) )
129     {
130         result = $(result).$(VERSION) ;
131     }
133     return $(result) ;
136 SOURCES =
137     class.cpp
138     class_info.cpp
139     class_registry.cpp
140     class_rep.cpp
141     create_class.cpp
142     error.cpp
143     exception_handler.cpp
144     function.cpp
145     implicit_cast.cpp
146     inheritance.cpp
147     link_compatibility.cpp
148     object_rep.cpp
149     open.cpp
150     pcall.cpp
151     scope.cpp
152     stack_content_by_name.cpp
153     weak_ref.cpp
154     wrapper_base.cpp ;
156 usage-requirements =
157     <library>lua
158     <toolset>msvc,<link>shared:<cxxflags>/wd4251
159     <link>shared:<define>LUABIND_DYNAMIC_LINK
160     <tag>@tag-names ;
162 lib luabind
163     : src/$(SOURCES)
164     # requirements
165     : <include>. <include>$(BOOST_ROOT)
166       $(usage-requirements)
167     # default-build
168     :
169     # usage-requirements
170     : <include>. <include>$(BOOST_ROOT)
171       $(usage-requirements)
172     ;
174 alias test
175   : test//test
176   # requirements
177   :
178   # default-build
179   : <link>static <link>shared release debug ;
181 explicit test ;
183 rule git-describe ( )
185     local result = [ SHELL "git describe HEAD 2>&1" : exit-status ] ;
187     if $(result[2]) = 0
188     {
189         return [ MATCH "^v([a-zA-Z.0-9\\-]+)" : $(result[1]) ] ;
190     }
193 version-tag = [ git-describe ] ;
195 if $(version-tag)
197     actions make-version-file
198     {
199         echo ".. |version| replace:: $(version-tag)" > doc/version.rst
200     }
202     notfile make-version-file : @make-version-file ;
204 else
206     alias make-version-file ;
209 if docs in [ modules.peek : ARGV ] 
211     local result = [ SHELL "rst2html.py --version 2>&1" : exit-status ] ;
212     if $(result[2]) = 0
213     {
214         found-rst2html = rst2html.py ;
215     }
218 html docs.html
219   : doc/docs.rst
220   : <dependency>make-version-file
221     <docutils-cmd>$(found-rst2html)
222     <docutils-html>"--traceback -gdt --stylesheet=style.css --link-stylesheet" ;
224 stage docs : docs.html : <location>doc ;
225 explicit docs docs.html make-version-file ;
227 headers = [ path.glob-tree luabind : *.hpp ] ;
229 package.install install
230   : <install-header-subdir>luabind
231     <install-source-root>luabind
232     <install-no-version-symlinks>on
233   :
234   : luabind
235   : $(headers)
236   ;
238 local stage-locate = [ MATCH "^--stagedir=(.*)" : [ modules.peek : ARGV ] ] ;
239 stage-locate ?= stage ;
241 install stage
242   : luabind
243   : <location>$(stage-locate)
244     <install-no-version-symlinks>on
245     <install-dependencies>on
246     <install-type>LIB
247   ;
249 explicit stage ;