diff --git a/CMakeLists.txt b/CMakeLists.txt index e29a426e..0fec0843 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -58,7 +58,7 @@ ENDIF() include_directories(include) -SET(Boost_ADDITIONAL_VERSIONS "1.43" "1.43.0" "1.42" "1.42.0" "1.41") +SET(Boost_ADDITIONAL_VERSIONS "1.44" "1.44.0" "1.43" "1.43.0" "1.42" "1.42.0" "1.41") SET(Boost_USE_MULTITHREADED ON) if (MULTITHREAD_SUPPORT_ENABLED) @@ -77,17 +77,27 @@ if (CMAKE_HOST_UNIX) SET(DYNAMIC_LOADER "dl") endif(CMAKE_HOST_UNIX) +if (MSVC) + # Boost on MSVC does automatic linking + SET(LIBS ${DYNAMIC_LOADER} ${READLINE_LIB}) +else() + SET(LIBS ${DYNAMIC_LOADER} ${Boost_LIBRARIES} ${READLINE_LIB}) +endif() + +if (CMAKE_COMPILER_2005) + # vs2005 is a bit too loud about possible loss of data warnings + ADD_DEFINITIONS(/wd4244) +endif() include_directories(${Boost_INCLUDE_DIRS}) add_executable(chai src/main.cpp) -#add_executable(dispatchkit_test contrib/test/dispatchkit_test.cpp) -target_link_libraries(chai ${DYNAMIC_LOADER} ${Boost_LIBRARIES} ${READLINE_LIB}) +target_link_libraries(chai ${LIBS}) add_library(stl_extra MODULE src/stl_extra.cpp) -target_link_libraries(stl_extra ${Boost_LIBRARIES}) +target_link_libraries(stl_extra ${LIBS}) add_library(reflection MODULE src/reflection.cpp) -target_link_libraries(reflection ${Boost_LIBRARIES}) +target_link_libraries(reflection ${LIBS}) file(GLOB UNIT_TESTS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/unittests/ ${CMAKE_CURRENT_SOURCE_DIR}/unittests/*.chai) @@ -107,23 +117,23 @@ IF(BUILD_TESTING) IF (NOT UNIT_TEST_LIGHT) add_executable(utility_test unittests/utility_test.cpp) - target_link_libraries(utility_test ${DYNAMIC_LOADER} ${Boost_LIBRARIES} ${READLINE_LIB}) + target_link_libraries(utility_test ${LIBS}) add_test(NAME Utility_Test COMMAND utility_test) add_executable(dynamic_object_test unittests/dynamic_object_test.cpp) - target_link_libraries(dynamic_object_test ${DYNAMIC_LOADER} ${Boost_LIBRARIES} ${READLINE_LIB}) + target_link_libraries(dynamic_object_test ${LIBS}) add_test(NAME Dynamic_Object_Test COMMAND dynamic_object_test) add_executable(functor_creation_test unittests/functor_creation_test.cpp) - target_link_libraries(functor_creation_test ${DYNAMIC_LOADER} ${Boost_LIBRARIES} ${READLINE_LIB}) + target_link_libraries(functor_creation_test ${LIBS}) add_test(NAME Functor_Creation_Test COMMAND functor_creation_test) add_executable(functor_cast_test unittests/functor_cast_test.cpp) - target_link_libraries(functor_cast_test ${DYNAMIC_LOADER} ${Boost_LIBRARIES} ${READLINE_LIB}) + target_link_libraries(functor_cast_test ${LIBS}) add_test(NAME Functor_Cast_Test COMMAND functor_cast_test) add_library(test_module MODULE src/test_module.cpp) - target_link_libraries(test_module ${Boost_LIBRARIES}) + target_link_libraries(test_module ${LIBS}) install(TARGETS test_module RUNTIME DESTINATION bin LIBRARY DESTINATION lib/chaiscript) ENDIF() diff --git a/include/chaiscript/dispatchkit/bootstrap_stl.hpp b/include/chaiscript/dispatchkit/bootstrap_stl.hpp index 472c0338..e66aed49 100644 --- a/include/chaiscript/dispatchkit/bootstrap_stl.hpp +++ b/include/chaiscript/dispatchkit/bootstrap_stl.hpp @@ -267,6 +267,9 @@ namespace chaiscript ModulePtr front_insertion_sequence_type(const std::string &, ModulePtr m = ModulePtr(new Module())) { typedef typename ContainerType::reference (ContainerType::*frontptr)(); + typedef typename void (ContainerType::*pushptr)(ContainerType::const_reference); + typedef typename void (ContainerType::*popptr)(); + m->add(fun(static_cast(&ContainerType::front)), "front"); std::string push_front_name; @@ -276,8 +279,9 @@ namespace chaiscript } else { push_front_name = "push_front"; } - m->add(fun(&ContainerType::push_front), push_front_name); - m->add(fun(&ContainerType::pop_front), "pop_front"); + + m->add(fun(static_cast(&ContainerType::push_front)), push_front_name); + m->add(fun(static_cast(&ContainerType::pop_front)), "pop_front"); return m; } diff --git a/include/chaiscript/language/chaiscript_common.hpp b/include/chaiscript/language/chaiscript_common.hpp index 483c43a1..5ab0ba7e 100644 --- a/include/chaiscript/language/chaiscript_common.hpp +++ b/include/chaiscript/language/chaiscript_common.hpp @@ -112,7 +112,6 @@ namespace chaiscript virtual Boxed_Value eval(Dispatch_Engine &) { Boxed_Value bv; throw std::runtime_error("Undispatched ast_node (internal error)"); - return bv; } }; diff --git a/src/reflection.cpp b/src/reflection.cpp index fcb34286..18fae77e 100644 --- a/src/reflection.cpp +++ b/src/reflection.cpp @@ -3,6 +3,14 @@ #include #include + +// MSVC doesn't like that we are using C++ return types from our C declared module +// but this is the best way to do it for cross platform compatibility +#ifdef BOOST_MSVC +#pragma warning(push) +#pragma warning(disable : 4190) +#endif + CHAISCRIPT_MODULE_EXPORT chaiscript::ModulePtr create_chaiscript_module_reflection() { chaiscript::ModulePtr m(new chaiscript::Module()); @@ -39,3 +47,8 @@ CHAISCRIPT_MODULE_EXPORT chaiscript::ModulePtr create_chaiscript_module_reflect return m; } + + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif diff --git a/src/stl_extra.cpp b/src/stl_extra.cpp index 27a1c99d..3a6dd802 100644 --- a/src/stl_extra.cpp +++ b/src/stl_extra.cpp @@ -3,8 +3,19 @@ #include #include +// MSVC doesn't like that we are using C++ return types from our C declared module +// but this is the best way to do it for cross platform compatibility +#ifdef BOOST_MSVC +#pragma warning(push) +#pragma warning(disable : 4190) +#endif CHAISCRIPT_MODULE_EXPORT chaiscript::ModulePtr create_chaiscript_module_stl_extra() { return chaiscript::bootstrap::list_type >("List"); } + + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif diff --git a/src/test_module.cpp b/src/test_module.cpp index 91d30bd0..96573da3 100644 --- a/src/test_module.cpp +++ b/src/test_module.cpp @@ -22,6 +22,14 @@ std::string hello_world() return "Hello World"; } +// MSVC doesn't like that we are using C++ return types from our C declared module +// but this is the best way to do it for cross platform compatibility +#ifdef BOOST_MSVC +#pragma warning(push) +#pragma warning(disable : 4190) +#endif + + CHAISCRIPT_MODULE_EXPORT chaiscript::ModulePtr create_chaiscript_module_test_module() { chaiscript::ModulePtr m(new chaiscript::Module()); @@ -43,3 +51,8 @@ CHAISCRIPT_MODULE_EXPORT chaiscript::ModulePtr create_chaiscript_module_test_mo return m; } + + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif