Skip to content

Commit

Permalink
update wxWidgets, added ninja in doc
Browse files Browse the repository at this point in the history
  • Loading branch information
antonvw committed Aug 11, 2023
1 parent d024392 commit 6a90354
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 18 deletions.
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,19 @@ shows a usage of this library, offering a full featured source code text editor.
```bash
git clone --recursive https://github.com/antonvw/wex.git
mkdir build && cd build
cmake .. && make && make install
```

For Visual Studio do
and for Linux, osx do
`cmake -G Ninja .. && ninja && ninja install` or
`cmake .. && make && make install`,
for Visual Studio do
`devenv wex.sln /build Release`,
for mingw add `-G "MinGW Makefiles"` and do `mingw32-make`.
and for mingw add `-G "MinGW Makefiles"` and do `mingw32-make`.

If you would like to use shared libs for Boost, wxWidgets and wex add
`-DwexBUILD_SHARED=ON`.

To use wex lib in your own application do `make install`
To use wex lib in your own application do `ninja install` or `make install`
(on windows as administrator `cmake.exe -P cmake_install.cmake`)
and do `find_package(WEX)` in your CMakeLists.txt. This will provide the
`wex_FOUND`, `wex_INCLUDE_DIR`, `wex_LIB_DIR` and `wex_LIBRARIES` variables.
Expand Down
2 changes: 1 addition & 1 deletion cmake/options-wx.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ option(wxUSE_PROPGRID "Use propgrid" OFF)
option(wxUSE_REGEX "Use wx regex" builtin)
option(wxUSE_RIBBON "Use ribbon" OFF)
option(wxUSE_RICHTEXT "Use richtext" OFF)
option(wxUSE_STL "Use STL" ON)
option(wxUSE_STD_STRING_CONV_IN_WXSTRING "Use std::string" 1)
option(wxUSE_UNICODE "Use Unicode" ON)
option(wxUSE_WEBVIEW "Use webview" OFF)
option(wxUSE_WEBVIEW_WEBKIT "Use webviewkit" OFF)
Expand Down
3 changes: 1 addition & 2 deletions doc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -425,8 +425,7 @@ It benefits from the following boost libraries:

lib | info
-----|------
boost::algorithm lib | uses find_tail, icontains, iequals, replace_all,
to_upper, trim
boost::algorithm lib | uses find_tail, icontains, iequals, replace_all, to_upper, trim
boost::json lib | to implement wex::config
boost::log lib | to implement wex::log
boost::process lib | to implement wex::process
Expand Down
2 changes: 1 addition & 1 deletion external/wxWidgets
Submodule wxWidgets updated 1016 files
9 changes: 4 additions & 5 deletions include/wex/core/log.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,10 @@ class log
void flush();
const std::string S(); // separator

const std::string m_topic;
std::stringstream m_ss;
std::wstringstream m_wss;
bool m_separator{true};
level_t m_level;
const std::string m_topic;
std::stringstream m_ss;
bool m_separator{true};
level_t m_level;

static inline bool m_initialized{false};
static inline level_t m_level_filter;
Expand Down
17 changes: 12 additions & 5 deletions src/core/log.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,19 @@
#include <wx/app.h>
#include <wx/log.h>

#include <codecvt>
#include <iomanip>

namespace logging = boost::log;

std::string ws2s(const std::wstring& wstr)
{
using convert_typeX = std::codecvt_utf8<wchar_t>;
std::wstring_convert<convert_typeX, wchar_t> converterX;

return converterX.to_bytes(wstr);
}

wex::log::log(const std::string& topic)
: log(topic, LEVEL_ERROR)
{
Expand Down Expand Up @@ -115,7 +124,7 @@ wex::log& wex::log::operator<<(const char* r)

wex::log& wex::log::operator<<(const wchar_t* r)
{
m_wss << S() << r;
m_ss << S() << ws2s(r);
return *this;
}

Expand Down Expand Up @@ -218,10 +227,8 @@ void wex::log::flush()

const std::string wex::log::get() const
{
return (!m_topic.empty() && (!m_ss.str().empty() || !m_wss.str().empty()) ?
m_topic + ":" :
m_topic) +
m_ss.str() + m_wss.str();
return (!m_topic.empty() && !m_ss.str().empty() ? m_topic + ":" : m_topic) +
m_ss.str();
}

std::string wex::log::get_level_info()
Expand Down

0 comments on commit 6a90354

Please sign in to comment.