diff --git a/deps/ox/src/ox/std/CMakeLists.txt b/deps/ox/src/ox/std/CMakeLists.txt index f30a3481..7ecff378 100644 --- a/deps/ox/src/ox/std/CMakeLists.txt +++ b/deps/ox/src/ox/std/CMakeLists.txt @@ -2,6 +2,7 @@ cmake_minimum_required(VERSION 2.8) add_library( OxStd + assert.cpp memops.cpp random.cpp strops.cpp @@ -16,6 +17,7 @@ set_property( install( FILES + assert.hpp bitops.hpp byteswap.hpp memops.hpp diff --git a/deps/ox/src/ox/std/assert.cpp b/deps/ox/src/ox/std/assert.cpp new file mode 100644 index 00000000..1778ea6d --- /dev/null +++ b/deps/ox/src/ox/std/assert.cpp @@ -0,0 +1,19 @@ +/* + * Copyright 2015 - 2018 gtalent2@gmail.com + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#if defined(OX_USE_STDLIB) +#include +#include +#endif + +void oxAssert(const char *file, int line, bool pass, const char *msg) { + if (!pass) { + std::cerr << '(' << file << ':' << line << "): " << msg << std::endl; + std::abort(); + } +} \ No newline at end of file diff --git a/deps/ox/src/ox/std/assert.hpp b/deps/ox/src/ox/std/assert.hpp new file mode 100644 index 00000000..6c0fe8b1 --- /dev/null +++ b/deps/ox/src/ox/std/assert.hpp @@ -0,0 +1,17 @@ +/* + * Copyright 2015 - 2018 gtalent2@gmail.com + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#pragma once + +void oxAssert(const char *file, int line, bool pass, const char *msg); + +#ifdef NDEBUG +#define ox_assert(pass, msg) oxAssert(__FILE__, __LINE__, pass, msg) +#else +#define ox_assert(pass, msg) +#endif \ No newline at end of file