mirror of
https://github.com/ThePhD/sol2.git
synced 2024-03-22 13:10:44 +08:00
Fix Visual Studio 2015 builds, fix error handling printouts / exceptions, fix constexpr usage that trips up Visual Studio 2015.
This commit is contained in:
parent
42fe70f081
commit
c72a012927
|
@ -25,7 +25,7 @@
|
|||
cmake_minimum_required(VERSION 3.5.0)
|
||||
|
||||
# # # project declaration
|
||||
project(sol2 VERSION 2.19.0 LANGUAGES CXX C)
|
||||
project(sol2 VERSION 2.20.0 LANGUAGES CXX C)
|
||||
|
||||
include(GNUInstallDirs)
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
version: 2.19.0-{build}
|
||||
version: 2.20.0-{build}
|
||||
|
||||
max_jobs: 4
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#define SOL_CHECK_ARGUMENTS 1
|
||||
#include <sol.hpp>
|
||||
|
||||
// Something that can't be collided with
|
||||
constexpr static const auto& script_key = "GlobalResource.MySpecialIdentifier123";
|
||||
#define SOL_CHECK_ARGUMENTS 1
|
||||
#include <sol.hpp>
|
||||
|
||||
// Something that can't be collided with
|
||||
static const auto& script_key = "GlobalResource.MySpecialIdentifier123";
|
||||
|
||||
struct GlobalResource {
|
||||
int value = 2;
|
||||
|
|
|
@ -46,8 +46,8 @@ namespace sol {
|
|||
#else
|
||||
(void)L;
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
inline int default_at_panic(lua_State* L) {
|
||||
#if defined(SOL_NO_EXCEPTIONS) && SOL_NO_EXCEPTIONS
|
||||
(void)L;
|
||||
|
@ -89,14 +89,14 @@ namespace sol {
|
|||
//std::cerr << std::endl;
|
||||
#endif // Printing
|
||||
return stack::push(L, msg);
|
||||
}
|
||||
|
||||
inline void set_default_state(lua_State* L, lua_CFunction panic_function = &default_at_panic, lua_CFunction traceback_function = c_call<decltype(&default_traceback_error_handler), &default_traceback_error_handler>, exception_handler_function exf = detail::default_exception_handler) {
|
||||
}
|
||||
|
||||
inline void set_default_state(lua_State* L, lua_CFunction panic_function = &default_at_panic, lua_CFunction traceback_function = c_call<decltype(&default_traceback_error_handler), &default_traceback_error_handler>, exception_handler_function exf = detail::default_exception_handler) {
|
||||
lua_atpanic(L, panic_function);
|
||||
protected_function::set_default_handler(object(L, in_place, traceback_function));
|
||||
set_default_exception_handler(L, exf);
|
||||
register_main_thread(L);
|
||||
stack::luajit_exception_handler(L);
|
||||
stack::luajit_exception_handler(L);
|
||||
}
|
||||
|
||||
inline std::size_t total_memory_used(lua_State* L) {
|
||||
|
@ -149,7 +149,6 @@ namespace sol {
|
|||
std::cerr << err;
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
#if !(defined(SOL_NO_EXCEPTIONS) && SOL_NO_EXCEPTIONS)
|
||||
// replacing information of stack error into pfr
|
||||
int target = result.stack_index();
|
||||
if (result.pop_count() > 0) {
|
||||
|
@ -161,11 +160,12 @@ namespace sol {
|
|||
if (towards != 0) {
|
||||
lua_rotate(L, top, towards);
|
||||
}
|
||||
#if defined(SOL_NO_EXCEPTIONS) && SOL_NO_EXCEPTIONS
|
||||
return result;
|
||||
#else
|
||||
// just throw our error
|
||||
throw error(detail::direct_error, err);
|
||||
#endif
|
||||
return result;
|
||||
#endif // If exceptions are allowed
|
||||
}
|
||||
|
||||
inline protected_function_result script_default_on_error(lua_State* L, protected_function_result pfr) {
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
# # # # sol2 tests
|
||||
|
||||
if (CMAKE_GENERATOR MATCHES "Visual Studio 14 2015")
|
||||
find_package(Catch 1.1.12 REQUIRED)
|
||||
find_package(Catch 1.12.1 REQUIRED)
|
||||
else()
|
||||
find_package(Catch 2.1.2 REQUIRED)
|
||||
endif()
|
||||
|
@ -71,8 +71,6 @@ function(CREATE_TEST test_target_name test_name is_single)
|
|||
target_compile_definitions(${test_target_name}
|
||||
PRIVATE SOL2_CI)
|
||||
endif()
|
||||
target_compile_features(${test_target_name}
|
||||
PRIVATE ${CXX_FEATURES})
|
||||
if (CMAKE_DL_LIBS)
|
||||
target_link_libraries(${test_target_name}
|
||||
${CMAKE_DL_LIBS})
|
||||
|
|
Loading…
Reference in New Issue
Block a user