Proper forward declarations for object wrappers. Now builds on clang!
[luabind.git] / Jamroot
blob94494bf44a1c2a564ad6175fd7ef156ca0dcd9f2
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     inheritance.cpp
146     link_compatibility.cpp
147     object_rep.cpp
148     open.cpp
149     pcall.cpp
150     scope.cpp
151     stack_content_by_name.cpp
152     weak_ref.cpp
153     wrapper_base.cpp ;
155 usage-requirements =
156     <library>lua
157     <toolset>msvc,<link>shared:<cxxflags>/wd4251
158     <link>shared:<define>LUABIND_DYNAMIC_LINK
159     <tag>@tag-names ;
161 lib luabind
162     : src/$(SOURCES)
163     # requirements
164     : <include>. <include>$(BOOST_ROOT)
165       $(usage-requirements)
166     # default-build
167     :
168     # usage-requirements
169     : <include>. <include>$(BOOST_ROOT)
170       $(usage-requirements)
171     ;
173 alias test
174   : test//test
175   # requirements
176   :
177   # default-build
178   : <link>static <link>shared release debug ;
180 explicit test ;
182 rule git-describe ( )
184     local result = [ SHELL "git describe HEAD 2>&1" : exit-status ] ;
186     if $(result[2]) = 0
187     {
188         return [ MATCH "^v([a-zA-Z.0-9\\-]+)" : $(result[1]) ] ;
189     }
192 version-tag = [ git-describe ] ;
194 if $(version-tag)
196     actions make-version-file
197     {
198         echo ".. |version| replace:: $(version-tag)" > doc/version.rst
199     }
201     notfile make-version-file : @make-version-file ;
203 else
205     alias make-version-file ;
208 if docs in [ modules.peek : ARGV ] 
210     local result = [ SHELL "rst2html.py --version 2>&1" : exit-status ] ;
211     if $(result[2]) = 0
212     {
213         found-rst2html = rst2html.py ;
214     }
217 html docs.html
218   : doc/docs.rst
219   : <dependency>make-version-file
220     <docutils-cmd>$(found-rst2html)
221     <docutils-html>"--traceback -gdt --stylesheet=style.css --link-stylesheet" ;
223 stage docs : docs.html : <location>doc ;
224 explicit docs docs.html make-version-file ;
226 headers = [ path.glob-tree luabind : *.hpp ] ;
228 package.install install
229   : <install-header-subdir>luabind
230     <install-source-root>luabind
231     <install-no-version-symlinks>on
232   :
233   : luabind
234   : $(headers)
235   ;
237 local stage-locate = [ MATCH "^--stagedir=(.*)" : [ modules.peek : ARGV ] ] ;
238 stage-locate ?= stage ;
240 install stage
241   : luabind
242   : <location>$(stage-locate)
243     <install-no-version-symlinks>on
244     <install-dependencies>on
245     <install-type>LIB
246   ;
248 explicit stage ;