1 // Copyright (c) 2003 Daniel Wallin and Arvid Norberg 2 3 // Permission is hereby granted, free of charge, to any person obtaining a 4 // copy of this software and associated documentation files (the "Software"), 5 // to deal in the Software without restriction, including without limitation 6 // the rights to use, copy, modify, merge, publish, distribute, sublicense, 7 // and/or sell copies of the Software, and to permit persons to whom the 8 // Software is furnished to do so, subject to the following conditions: 9 10 // The above copyright notice and this permission notice shall be included 11 // in all copies or substantial portions of the Software. 12 13 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF 14 // ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 15 // TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 16 // PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 17 // SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR 18 // ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 19 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE 21 // OR OTHER DEALINGS IN THE SOFTWARE. 22 23 24 #ifndef LUABIND_CONFIG_HPP_INCLUDED 25 #define LUABIND_CONFIG_HPP_INCLUDED 26 27 #include <boost/config.hpp> 28 #include <boost/version.hpp> 29 #include <boost/detail/workaround.hpp> 30 31 #include <luabind/build_information.hpp> 32 33 #ifdef BOOST_MSVC 34 #define LUABIND_ANONYMOUS_FIX static 35 #else 36 #define LUABIND_ANONYMOUS_FIX 37 #endif 38 39 #if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) 40 #error "Support for your version of Visual C++ has been removed from this version of Luabind" 41 #endif 42 43 // the maximum number of arguments of functions that's 44 // registered. Must at least be 2 45 #ifndef LUABIND_MAX_ARITY 46 #define LUABIND_MAX_ARITY 10 47 #elif LUABIND_MAX_ARITY <= 1 48 #undef LUABIND_MAX_ARITY 49 #define LUABIND_MAX_ARITY 2 50 #endif 51 52 // the maximum number of classes one class 53 // can derive from 54 // max bases must at least be 1 55 #ifndef LUABIND_MAX_BASES 56 #define LUABIND_MAX_BASES 4 57 #elif LUABIND_MAX_BASES <= 0 58 #undef LUABIND_MAX_BASES 59 #define LUABIND_MAX_BASES 1 60 #endif 61 62 // LUABIND_NO_ERROR_CHECKING 63 // define this to remove all error checks 64 // this will improve performance and memory 65 // footprint. 66 // if it is defined matchers will only be called on 67 // overloaded functions, functions that's 68 // not overloaded will be called directly. The 69 // parameters on the lua stack are assumed 70 // to match those of the function. 71 // exceptions will still be catched when there's 72 // no error checking. 73 74 // LUABIND_NOT_THREADSAFE 75 // this define will make luabind non-thread safe. That is, 76 // it will rely on a static variable. You can still have 77 // multiple lua states and use coroutines, but only 78 // one of your real threads may run lua code. 79 80 // LUABIND_NO_EXCEPTIONS 81 // this define will disable all usage of try, catch and throw in 82 // luabind. This will in many cases disable runtime-errors, such 83 // as invalid casts, when calling lua-functions that fails or 84 // returns values that cannot be converted by the given policy. 85 // Luabind requires that no function called directly or indirectly 86 // by luabind throws an exception (throwing exceptions through 87 // C code has undefined behavior, lua is written in C). 88 89 #ifdef LUABIND_DYNAMIC_LINK 90 # if defined (BOOST_WINDOWS) 91 # ifdef LUABIND_BUILDING 92 # define LUABIND_API __declspec(dllexport) 93 # else 94 # define LUABIND_API __declspec(dllimport) 95 # endif 96 # elif defined (__CYGWIN__) 97 # ifdef LUABIND_BUILDING 98 # define LUABIND_API __attribute__ ((dllexport)) 99 # else 100 # define LUABIND_API __attribute__ ((dllimport)) 101 # endif 102 # else 103 # if defined(__GNUC__) && __GNUC__ >=4 104 # define LUABIND_API __attribute__ ((visibility("default"))) 105 # endif 106 # endif 107 #endif 108 109 #ifndef LUABIND_API 110 # define LUABIND_API 111 #endif 112 113 // C++11 features // 114 115 #if ( defined(BOOST_NO_CXX11_SCOPED_ENUMS) \ 116 || defined(BOOST_NO_SCOPED_ENUMS) \ 117 || BOOST_VERSION < 105600 \ 118 && ( defined(BOOST_NO_CXX11_HDR_TYPE_TRAITS) \ 119 || defined(BOOST_NO_0X_HDR_TYPE_TRAITS))) 120 # define LUABIND_NO_SCOPED_ENUM 121 #endif 122 123 #if ( defined(BOOST_NO_CXX11_RVALUE_REFERENCES) \ 124 || defined(BOOST_NO_RVALUE_REFERENCES)) 125 # define LUABIND_NO_RVALUE_REFERENCES 126 #endif 127 128 // If you use Boost <= 1.46 but your compiler is C++11 compliant and marks 129 // destructors as noexcept by default, you need to define LUABIND_USE_NOEXCEPT. 130 #if ( !defined(BOOST_NO_NOEXCEPT) \ 131 && !defined(BOOST_NO_CXX11_NOEXCEPT) \ 132 && BOOST_VERSION >= 104700) 133 # define LUABIND_USE_NOEXCEPT 134 #endif 135 136 #ifndef LUABIND_MAY_THROW 137 # ifdef BOOST_NOEXCEPT_IF 138 # define LUABIND_MAY_THROW BOOST_NOEXCEPT_IF(false) 139 # elif defined(LUABIND_USE_NOEXCEPT) 140 # define LUABIND_MAY_THROW noexcept(false) 141 # else 142 # define LUABIND_MAY_THROW 143 # endif 144 #endif 145 146 #ifndef LUABIND_NOEXCEPT 147 # ifdef BOOST_NOEXCEPT_OR_NOTHROW 148 # define LUABIND_NOEXCEPT BOOST_NOEXCEPT_OR_NOTHROW 149 # elif defined(LUABIND_USE_NOEXCEPT) 150 # define LUABIND_NOEXCEPT noexcept 151 # else 152 # define LUABIND_NOEXCEPT throw() 153 # endif 154 #endif 155 156 namespace luabind { 157 158 LUABIND_API void disable_super_deprecation(); 159 160 } // namespace luabind 161 162 #endif // LUABIND_CONFIG_HPP_INCLUDED 163