diff --git a/CMakeLists.txt b/CMakeLists.txt index 3de2b6da..b80c1096 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -53,7 +53,8 @@ set(CXX_FEATURES # # # General project flags if (MSVC) add_definitions(/DUNICODE /D_UNICODE /D_SILENCE_CXX17_UNCAUGHT_EXCEPTION_DEPRECATION_WARNING /D_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING /D_CRT_SECURE_NO_WARNINGS /D_CRT_SECURE_NO_DEPRECATE) - add_compile_options(/W4 /EHsc) + # Warning level, exceptions, compile-multiple-files + add_compile_options(/W4 /EHsc /MP) else() add_compile_options(-Wno-unknown-warning -Wno-unknown-warning-option -Wall -Wextra -Wpedantic -pedantic -pedantic-errors) endif() diff --git a/appveyor.yml b/appveyor.yml index a04d14c2..f3f2a5d8 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -35,11 +35,16 @@ environment: matrix: - LUA_VERSION: 5.3.4 MINGW_VERSION: 6.3.0 + PARALLELISM: - LUA_VERSION: 5.3.4 MINGW_VERSION: 5.3.0 + PARALLELISM: - LUA_VERSION: 5.3.4 + PARALLELISM: -- /maxcpucount - LUA_VERSION: 5.2.4 + PARALLELISM: -- /maxcpucount - LUA_VERSION: 5.1.5 + PARALLELISM: -- /maxcpucount platform: - x86 @@ -52,22 +57,23 @@ matrix: # 32-bit builds are temperamental with exceptions - platform: x86 exclude: - - platform: x86 - LUA_VERSION: 5.2.4 - - platform: x86 - LUA_VERSION: 5.1.5 - - platform: x86 - MINGW_VERSION: 6.3.0 + # Necessary: MinGW doesn't exist on VS 2017 images - image: Visual Studio 2017 MINGW_VERSION: 6.3.0 - image: Visual Studio 2017 MINGW_VERSION: 5.3.0 + # Get rid of x86 builds + - platform: x86 + LUA_VERSION: 5.2.4 + - platform: x86 + LUA_VERSION: 5.1.5 + - platform: x86 + MINGW_VERSION: 5.3.0 + # Get rid of redundant Visual Studio 2015 builds - image: Visual Studio 2015 LUA_VERSION: 5.1.5 - image: Visual Studio 2015 LUA_VERSION: 5.2.4 - - image: Visual Studio 2015 - platform: x86 init: # make sure we have Ninja @@ -101,6 +107,7 @@ before_build: - set python_path=C:\Python36 - set mingw_path= - set build_type= +- set parallelism= - if "%CMAKE_GENERATOR%"=="MinGW Makefiles" (set build_type=-DCMAKE_BUILD_TYPE=Release) - if "%CMAKE_GENERATOR%"=="Ninja" (set build_type=-DCMAKE_BUILD_TYPE=Release) - if "%MINGW_VERSION%"=="5.3.0" (set mingw_path=C:\mingw-w64\i686-5.3.0-posix-dwarf-rt_v4-rev0) @@ -116,8 +123,8 @@ before_build: # generates too much debug info for MinGW to handle # TODO: fix the damn compilation space and time already build_script: -- if NOT "%build_type%"=="-DCMAKE_BUILD_TYPE=Release" (cmake --build . --config Debug) -- cmake --build . --config Release +- if NOT "%build_type%"=="-DCMAKE_BUILD_TYPE=Release" (cmake --build . --config Debug %PARALLELISM%) +- cmake --build . --config Release %PARALLELISM% test_script: - if NOT "%build_type%"=="-DCMAKE_BUILD_TYPE=Release" (ctest -C Debug --output-on-failure) diff --git a/examples/assert.hpp b/examples/assert.hpp index f247fca4..a51b1ebf 100644 --- a/examples/assert.hpp +++ b/examples/assert.hpp @@ -1,7 +1,10 @@ -#ifndef MY_ASSERT_HPP -#define MY_ASSERT_HPP +#ifndef EXAMPLES_ASSERT_HPP +#define EXAMPLES_ASSERT_HPP #ifndef NDEBUG +#include +#include + # define m_assert(condition, message) \ do { \ if (! (condition)) { \ @@ -20,11 +23,8 @@ } \ } while (false) #else -#include -#include - # define m_c_assert(condition, message) do { (void)sizeof(condition); (void)sizeof(message); } while (false) # define c_assert(condition) do { (void)sizeof(condition); } while (false) #endif -#endif // MY_ASSERT_HPP +#endif // EXAMPLES_ASSERT_HPP diff --git a/examples/interop/LuaBridge.cpp b/examples/interop/LuaBridge.cpp index f88f975f..a852f52b 100644 --- a/examples/interop/LuaBridge.cpp +++ b/examples/interop/LuaBridge.cpp @@ -5,10 +5,10 @@ #include #include -#include "assert.hpp" +#include "../assert.hpp" // LuaBridge, -// no longer maintained by VinnieFalco: +// no longer maintained, by VinnieFalco: // https://github.com/vinniefalco/LuaBridge struct A { diff --git a/examples/interop/assert.hpp b/examples/interop/assert.hpp deleted file mode 100644 index f247fca4..00000000 --- a/examples/interop/assert.hpp +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef MY_ASSERT_HPP -#define MY_ASSERT_HPP - -#ifndef NDEBUG -# define m_assert(condition, message) \ - do { \ - if (! (condition)) { \ - std::cerr << "Assertion `" #condition "` failed in " << __FILE__ \ - << " line " << __LINE__ << ": " << message << std::endl; \ - std::terminate(); \ - } \ - } while (false) - -# define c_assert(condition) \ - do { \ - if (! (condition)) { \ - std::cerr << "Assertion `" #condition "` failed in " << __FILE__ \ - << " line " << __LINE__ << std::endl; \ - std::terminate(); \ - } \ - } while (false) -#else -#include -#include - -# define m_c_assert(condition, message) do { (void)sizeof(condition); (void)sizeof(message); } while (false) -# define c_assert(condition) do { (void)sizeof(condition); } while (false) -#endif - -#endif // MY_ASSERT_HPP diff --git a/examples/interop/kaguya.cpp b/examples/interop/kaguya.cpp index 0d9f3945..45604972 100644 --- a/examples/interop/kaguya.cpp +++ b/examples/interop/kaguya.cpp @@ -5,7 +5,7 @@ #include #include -#include "assert.hpp" +#include "../assert.hpp" // kaguya code lifted from README.md, // written by satoren: diff --git a/examples/interop/luwra.cpp b/examples/interop/luwra.cpp index d1159f83..bbf256fc 100644 --- a/examples/interop/luwra.cpp +++ b/examples/interop/luwra.cpp @@ -5,7 +5,7 @@ #include #include -#include "assert.hpp" +#include "../assert.hpp" // luwra, // another C++ wrapper library: diff --git a/examples/interop/tolua.cpp b/examples/interop/tolua.cpp index 72862214..414f2bc4 100644 --- a/examples/interop/tolua.cpp +++ b/examples/interop/tolua.cpp @@ -9,7 +9,7 @@ #include "tolua_Player.h" #include -#include "assert.hpp" +#include "../assert.hpp" // tolua code lifted from some blog, if the link dies // I don't know where else you're gonna find the reference, diff --git a/examples/require_dll_example/assert.hpp b/examples/require_dll_example/assert.hpp deleted file mode 100644 index f247fca4..00000000 --- a/examples/require_dll_example/assert.hpp +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef MY_ASSERT_HPP -#define MY_ASSERT_HPP - -#ifndef NDEBUG -# define m_assert(condition, message) \ - do { \ - if (! (condition)) { \ - std::cerr << "Assertion `" #condition "` failed in " << __FILE__ \ - << " line " << __LINE__ << ": " << message << std::endl; \ - std::terminate(); \ - } \ - } while (false) - -# define c_assert(condition) \ - do { \ - if (! (condition)) { \ - std::cerr << "Assertion `" #condition "` failed in " << __FILE__ \ - << " line " << __LINE__ << std::endl; \ - std::terminate(); \ - } \ - } while (false) -#else -#include -#include - -# define m_c_assert(condition, message) do { (void)sizeof(condition); (void)sizeof(message); } while (false) -# define c_assert(condition) do { (void)sizeof(condition); } while (false) -#endif - -#endif // MY_ASSERT_HPP diff --git a/examples/require_dll_example/require_from_dll.cpp b/examples/require_dll_example/require_from_dll.cpp index 969a56a0..202987bd 100644 --- a/examples/require_dll_example/require_from_dll.cpp +++ b/examples/require_dll_example/require_from_dll.cpp @@ -2,7 +2,7 @@ #include #include "my_object.hpp" -#include "assert.hpp" +#include "../assert.hpp" #include diff --git a/examples/tutorials/quick_n_dirty/assert.hpp b/examples/tutorials/quick_n_dirty/assert.hpp deleted file mode 100644 index f247fca4..00000000 --- a/examples/tutorials/quick_n_dirty/assert.hpp +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef MY_ASSERT_HPP -#define MY_ASSERT_HPP - -#ifndef NDEBUG -# define m_assert(condition, message) \ - do { \ - if (! (condition)) { \ - std::cerr << "Assertion `" #condition "` failed in " << __FILE__ \ - << " line " << __LINE__ << ": " << message << std::endl; \ - std::terminate(); \ - } \ - } while (false) - -# define c_assert(condition) \ - do { \ - if (! (condition)) { \ - std::cerr << "Assertion `" #condition "` failed in " << __FILE__ \ - << " line " << __LINE__ << std::endl; \ - std::terminate(); \ - } \ - } while (false) -#else -#include -#include - -# define m_c_assert(condition, message) do { (void)sizeof(condition); (void)sizeof(message); } while (false) -# define c_assert(condition) do { (void)sizeof(condition); } while (false) -#endif - -#endif // MY_ASSERT_HPP diff --git a/examples/tutorials/quick_n_dirty/functions_all.cpp b/examples/tutorials/quick_n_dirty/functions_all.cpp index 23cc2ac8..2637d661 100644 --- a/examples/tutorials/quick_n_dirty/functions_all.cpp +++ b/examples/tutorials/quick_n_dirty/functions_all.cpp @@ -1,7 +1,7 @@ #define SOL_CHECK_ARGUMENTS 1 #include -#include "assert.hpp" +#include "../../assert.hpp" #include void some_function() { diff --git a/examples/tutorials/quick_n_dirty/functions_easy.cpp b/examples/tutorials/quick_n_dirty/functions_easy.cpp index dc995301..82fcfd63 100644 --- a/examples/tutorials/quick_n_dirty/functions_easy.cpp +++ b/examples/tutorials/quick_n_dirty/functions_easy.cpp @@ -1,7 +1,7 @@ #define SOL_CHECK_ARGUMENTS 1 #include -#include "assert.hpp" +#include "../../assert.hpp" int main(int, char*[]) { sol::state lua; diff --git a/examples/tutorials/quick_n_dirty/make_tables.cpp b/examples/tutorials/quick_n_dirty/make_tables.cpp index f703c762..a10d2218 100644 --- a/examples/tutorials/quick_n_dirty/make_tables.cpp +++ b/examples/tutorials/quick_n_dirty/make_tables.cpp @@ -1,7 +1,7 @@ #define SOL_CHECK_ARGUMENTS 1 #include -#include "assert.hpp" +#include "../../assert.hpp" int main(int, char* []) { sol::state lua; diff --git a/examples/tutorials/quick_n_dirty/multiple_returns_from_lua.cpp b/examples/tutorials/quick_n_dirty/multiple_returns_from_lua.cpp index d21361cd..b5787f78 100644 --- a/examples/tutorials/quick_n_dirty/multiple_returns_from_lua.cpp +++ b/examples/tutorials/quick_n_dirty/multiple_returns_from_lua.cpp @@ -1,7 +1,7 @@ #define SOL_CHECK_ARGUMENTS 1 #include -#include "assert.hpp" +#include "../../assert.hpp" int main(int, char* []) { sol::state lua; diff --git a/examples/tutorials/quick_n_dirty/multiple_returns_to_lua.cpp b/examples/tutorials/quick_n_dirty/multiple_returns_to_lua.cpp index 42caf3b8..3d8bee69 100644 --- a/examples/tutorials/quick_n_dirty/multiple_returns_to_lua.cpp +++ b/examples/tutorials/quick_n_dirty/multiple_returns_to_lua.cpp @@ -1,7 +1,7 @@ #define SOL_CHECK_ARGUMENTS 1 #include -#include "assert.hpp" +#include "../../assert.hpp" int main(int, char* []) { sol::state lua; diff --git a/examples/tutorials/quick_n_dirty/namespacing.cpp b/examples/tutorials/quick_n_dirty/namespacing.cpp index c8b8e9fd..13658d7d 100644 --- a/examples/tutorials/quick_n_dirty/namespacing.cpp +++ b/examples/tutorials/quick_n_dirty/namespacing.cpp @@ -2,7 +2,7 @@ #include #include -#include "assert.hpp" +#include "../../assert.hpp" int main() { std::cout << "=== namespacing example ===" << std::endl; diff --git a/examples/tutorials/quick_n_dirty/opening_a_state.cpp b/examples/tutorials/quick_n_dirty/opening_a_state.cpp index 7b483781..3c6d309f 100644 --- a/examples/tutorials/quick_n_dirty/opening_a_state.cpp +++ b/examples/tutorials/quick_n_dirty/opening_a_state.cpp @@ -2,7 +2,7 @@ #include #include -#include "assert.hpp" +#include "../../assert.hpp" int main(int, char*[]) { std::cout << "=== opening a state example ===" << std::endl; diff --git a/examples/tutorials/quick_n_dirty/running_lua_code.cpp b/examples/tutorials/quick_n_dirty/running_lua_code.cpp index 86c7a20e..dcda4a7e 100644 --- a/examples/tutorials/quick_n_dirty/running_lua_code.cpp +++ b/examples/tutorials/quick_n_dirty/running_lua_code.cpp @@ -3,7 +3,7 @@ #include #include -#include "assert.hpp" +#include "../../assert.hpp" int main(int, char*[]) { std::cout << "=== running lua code example ===" << std::endl; diff --git a/examples/tutorials/quick_n_dirty/running_lua_code_low_level.cpp b/examples/tutorials/quick_n_dirty/running_lua_code_low_level.cpp index a090f158..04856cfe 100644 --- a/examples/tutorials/quick_n_dirty/running_lua_code_low_level.cpp +++ b/examples/tutorials/quick_n_dirty/running_lua_code_low_level.cpp @@ -4,7 +4,7 @@ #include #include #include -#include "assert.hpp" +#include "../../assert.hpp" int main(int, char*[]) { std::cout << "=== running lua code (low level) example ===" << std::endl; diff --git a/examples/tutorials/quick_n_dirty/set_and_get_variables.cpp b/examples/tutorials/quick_n_dirty/set_and_get_variables.cpp index d605c104..87537e04 100644 --- a/examples/tutorials/quick_n_dirty/set_and_get_variables.cpp +++ b/examples/tutorials/quick_n_dirty/set_and_get_variables.cpp @@ -1,7 +1,7 @@ #define SOL_CHECK_ARGUMENTS 1 #include -#include "assert.hpp" +#include "../../assert.hpp" int main(int, char*[]) { sol::state lua; diff --git a/examples/tutorials/quick_n_dirty/set_and_get_variables_exists.cpp b/examples/tutorials/quick_n_dirty/set_and_get_variables_exists.cpp index f16d236b..18fe1f5f 100644 --- a/examples/tutorials/quick_n_dirty/set_and_get_variables_exists.cpp +++ b/examples/tutorials/quick_n_dirty/set_and_get_variables_exists.cpp @@ -1,7 +1,7 @@ #define SOL_CHECK_ARGUMENTS 1 #include -#include "assert.hpp" +#include "../../assert.hpp" int main(int, char*[]) { sol::state lua; diff --git a/examples/tutorials/quick_n_dirty/tables_and_nesting.cpp b/examples/tutorials/quick_n_dirty/tables_and_nesting.cpp index f4f3c68b..51bd16ca 100644 --- a/examples/tutorials/quick_n_dirty/tables_and_nesting.cpp +++ b/examples/tutorials/quick_n_dirty/tables_and_nesting.cpp @@ -1,7 +1,7 @@ #define SOL_CHECK_ARGUMENTS 1 #include -#include "assert.hpp" +#include "../../assert.hpp" int main(int, char*[]) { diff --git a/examples/tutorials/quick_n_dirty/userdata.cpp b/examples/tutorials/quick_n_dirty/userdata.cpp index 7163bffc..c51cba03 100644 --- a/examples/tutorials/quick_n_dirty/userdata.cpp +++ b/examples/tutorials/quick_n_dirty/userdata.cpp @@ -1,7 +1,7 @@ #define SOL_CHECK_ARGUMENTS 1 #include -#include "assert.hpp" +#include "../../assert.hpp" #include struct Doge { diff --git a/examples/wip/lua_inheritance.cpp b/examples/wip/lua_inheritance.cpp index 2c8b9fe2..f07e10ab 100644 --- a/examples/wip/lua_inheritance.cpp +++ b/examples/wip/lua_inheritance.cpp @@ -1,7 +1,7 @@ #define SOL_CHECK_ARGUMENTS 1 #include -#include +#include "../assert.hpp" #include int main(int, char*[]) {