Produce release builds without exceptions and RTTI
parent
f5f8770f7f
commit
6b14925798
|
@ -350,6 +350,9 @@ if("${build_type_lc}" STREQUAL "debug")
|
|||
add_definitions(-D_DEBUG -DDEBUG)
|
||||
else()
|
||||
add_definitions(-DNO_DEBUG -DEIGEN_NO_DEBUG)
|
||||
if(NOT MSVC)
|
||||
add_compile_options(-fno-rtti -fno-exceptions)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Turning all debug on dramatically decreases performance
|
||||
|
|
|
@ -6,7 +6,14 @@
|
|||
#else
|
||||
#include <sys/stat.h>
|
||||
#endif
|
||||
#if defined(_MSC_VER) && !defined(__clang__)
|
||||
// M$VC++ build without C++ exceptions are not supported yet
|
||||
#define __cpp_exceptions 1
|
||||
#endif
|
||||
|
||||
#if ! __cpp_exceptions
|
||||
#include <cstdlib>
|
||||
#endif
|
||||
|
||||
namespace celestia
|
||||
{
|
||||
|
@ -339,7 +346,11 @@ uintmax_t file_size(const path& p)
|
|||
std::error_code ec;
|
||||
uintmax_t s = file_size(p, ec);
|
||||
if (ec)
|
||||
#if __cpp_exceptions
|
||||
throw filesystem_error(ec, "celfs::file_size error");
|
||||
#else
|
||||
std::abort();
|
||||
#endif
|
||||
return s;
|
||||
}
|
||||
|
||||
|
@ -383,7 +394,11 @@ bool exists(const path& p)
|
|||
std::error_code ec;
|
||||
bool r = exists(p, ec);
|
||||
if (ec)
|
||||
#if __cpp_exceptions
|
||||
throw filesystem_error(ec, "celfs::exists error");
|
||||
#else
|
||||
std::abort();
|
||||
#endif
|
||||
return r;
|
||||
}
|
||||
|
||||
|
@ -415,7 +430,11 @@ bool is_directory(const path& p)
|
|||
std::error_code ec;
|
||||
bool r = is_directory(p, ec);
|
||||
if (ec)
|
||||
#if __cpp_exceptions
|
||||
throw filesystem_error(ec, "celfs::is_directory error");
|
||||
#else
|
||||
std::abort();
|
||||
#endif
|
||||
return r;
|
||||
}
|
||||
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
#if defined(_MSC_VER) && !defined(__clang__)
|
||||
// M$VC++ 2015 doesn't have required features
|
||||
#define CEL_CPP_VER (_MSC_VER == 1900 ? 201103L : _MSVC_LANG)
|
||||
// M$VC++ build without C++ exceptions are not supported yet
|
||||
#define __cpp_exceptions 1
|
||||
#else
|
||||
#define CEL_CPP_VER __cplusplus
|
||||
#endif
|
||||
|
@ -28,6 +30,10 @@
|
|||
#define CEL_constexpr /* constexpr */
|
||||
#endif
|
||||
|
||||
#if ! __cpp_exceptions
|
||||
#include <cstdlib>
|
||||
#endif
|
||||
|
||||
namespace std
|
||||
{
|
||||
template<
|
||||
|
@ -101,8 +107,11 @@ template<
|
|||
{
|
||||
if (pos < size())
|
||||
return m_data[pos];
|
||||
|
||||
#if __cpp_exceptions
|
||||
throw std::out_of_range("pos >= size()");
|
||||
#else
|
||||
std::abort();
|
||||
#endif
|
||||
}
|
||||
constexpr const_reference front() const
|
||||
{
|
||||
|
@ -166,7 +175,11 @@ template<
|
|||
size_type copy(CharT* dest, size_type count, size_type pos = 0) const
|
||||
{
|
||||
if (pos > m_size)
|
||||
#if __cpp_exceptions
|
||||
throw std::out_of_range("pos >= size()");
|
||||
#else
|
||||
std::abort();
|
||||
#endif
|
||||
|
||||
auto rcount = std::min(count, m_size - pos);
|
||||
return Traits::copy(dest, m_data + pos, rcount);
|
||||
|
@ -174,7 +187,11 @@ template<
|
|||
CEL_constexpr basic_string_view substr(size_type pos = 0, size_type count = npos ) const
|
||||
{
|
||||
if (pos > m_size)
|
||||
#if __cpp_exceptions
|
||||
throw std::out_of_range("pos >= size()");
|
||||
#else
|
||||
std::abort();
|
||||
#endif
|
||||
|
||||
auto rcount = std::min(count, m_size - pos);
|
||||
return { m_data + pos, rcount };
|
||||
|
|
|
@ -20,3 +20,7 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
|||
|
||||
build_cmod_tool(cmodview WIN32 cmodview.cpp glframebuffer.cpp glshader.cpp mainwindow.cpp materialwidget.cpp modelviewwidget.cpp glsupport.cpp)
|
||||
qt5_use_modules(cmodview ${QT_LIBS})
|
||||
|
||||
if(NOT MSVC)
|
||||
target_compile_options(cmodview PRIVATE "-frtti")
|
||||
endif()
|
||||
|
|
Loading…
Reference in New Issue