Added support for building with MSVC.
[luabind.git] / Jamroot
blob597d347f90987a2f5dd098359c2fbc47dafa0587
1 import os ;
2 import errors ;
4 BOOST_ROOT = [ os.environ BOOST_ROOT ] ;
6 rule debug-message ( txt * )
8     if --debug-build in [ modules.peek : ARGV ]
9     {
10         echo [luabind DEBUG] $(txt) ;
11     }
14 debug-message figuring out which libraries to link to... ;
15 debug-message os.name is [ os.name ] ;
17 if [ os.name ] = NT
19     if ! $(BOOST_ROOT)
20     {
21         errors.user-error "*** BOOST_ROOT must be set to a Boost installation." ;
22     }
24     LUA_PATH = [ os.environ LUA_PATH ] ;
26     if ! $(LUA_PATH)
27     {
28         errors.user-error "*** LUA_PATH must be set." ;
29     }
31     local includes = [ GLOB $(LUA_PATH)/include $(LUA_PATH)/src : lua.h ] ;
33     if ! $(includes)
34     {
35         errors.user-error "*** Unable to determine Lua include directory." ;
36     }
38     includes = $(includes:D) ;
40     debug-message found include directory in $(includes) ;
42     if [ GLOB $(LUA_PATH) : lib ]
43     {
44         lib lua : : <link>static <name>lua5.1 <search>$(LUA_PATH)/lib/static : : <include>$(includes) ;
45         lib lua : : <link>shared <name>lua5.1 <search>$(LUA_PATH)/lib : : <include>$(includes) ;
46     }
47     else if [ GLOB $(LUA_PATH) : lua5.1.dll ]
48     {
49         lib lua : : <name>lua5.1 <search>$(LUA_PATH) : : <include>$(includes) ;
50     }
52 else if [ os.name ] = LINUX
54     local includes = [ GLOB /usr/include : lua5.1 ] ;
56     if ! $(includes)
57     {
58         debug-message couldn't find lua include directory ;
59     }
61     debug-message found lua include directory in $(includes) ;
63     lib m : : <link>shared ;
64     lib dl : : <link>shared ;
65     lib lua : m dl : <name>lua5.1 : : <include>$(includes) ;
68 SOURCES =
69     class.cpp
70     class_info.cpp
71     class_registry.cpp
72     class_rep.cpp
73     create_class.cpp
74     error.cpp
75     find_best_match.cpp
76     function.cpp
77     implicit_cast.cpp
78     link_compatibility.cpp
79     object_rep.cpp
80     open.cpp
81     overload_rep.cpp
82     pcall.cpp
83     ref.cpp
84     scope.cpp
85     stack_content_by_name.cpp
86     weak_ref.cpp
87     wrapper_base.cpp ;
89 usage-requirements =
90     <library>lua
91     <toolset>msvc,<link>shared:<define>LUABIND_IMPORT=__declspec(dllimport)
92     <toolset>msvc,<link>shared:<define>LUABIND_EXPORT=__declspec(dllexport) ;
94 lib luabind
95     : src/$(SOURCES)
96     # requirements
97     : <define>LUABIND_BUILDING
98       <include>. <include>$(BOOST_ROOT)
99       $(usage-requirements)
100     # default-build
101     :
102     # usage-requirements
103     : <include>. <include>$(BOOST_ROOT)
104       $(usage-requirements)
105     ;
107 alias test
108   : test//test
109   # requirements
110   :
111   # default-build
112   : <link>static <link>shared release debug ;
114 explicit test ;