Fix crash on Windows with out_of_range exception & update docs

This commit is contained in:
Konstantinos Sideris 2018-06-30 22:43:55 +03:00
parent 5b5d35fd1f
commit 765ff5dcb5
3 changed files with 39 additions and 8 deletions

View File

@ -11,9 +11,13 @@
"name": "CMAKE_TOOLCHAIN_FILE",
"value": "${workspaceRoot}\\vcpkg\\scripts\\buildsystems\\vcpkg.cmake" // <-- change vcpkg location here
},
{
"name": "CMAKE_INSTALL_PREFIX",
"value": "${workspaceRoot}/.deps"
},
{
"name": "Qt5_DIR",
"value": "C:\\Qt\\5.10.1\\msvc2017_64\\lib\\cmake\\Qt5" // <-- change qt location here
"value": "C:\\Qt\\5.11.1\\msvc2017_64\\lib\\cmake\\Qt5" // <-- change qt location here
}
]
},
@ -28,11 +32,15 @@
"name": "CMAKE_TOOLCHAIN_FILE",
"value": "${workspaceRoot}\\vcpkg\\scripts\\buildsystems\\vcpkg.cmake" // <-- change vcpkg location here
},
{
"name": "CMAKE_INSTALL_PREFIX",
"value": "${workspaceRoot}/.deps"
},
{
"name": "Qt5_DIR",
"value": "C:\\Qt\\5.10.1\\msvc2017_64\\lib\\cmake\\Qt5" // <-- change qt location here
"value": "C:\\Qt\\5.11.1\\msvc2017_64\\lib\\cmake\\Qt5" // <-- change qt location here
}
]
},
]
}
}

View File

@ -133,14 +133,37 @@ brew install qt5 lmdb cmake llvm libsodium spdlog boost
Make sure to install the `MSVC 2017 64-bit` toolset for at least Qt 5.9
(lower versions does not support VS2017).
3. Install lmdb and openssl with `vcpkg`. You can simply clone it into a subfolder
3. Install dependencies with `vcpkg`. You can simply clone it into a subfolder
of the root nheko source directory.
```powershell
git clone http:\\github.com\Microsoft\vcpkg
cd vcpkg
.\bootstrap-vcpkg.bat
.\vcpkg install --triplet x64-windows lmdb openssl
.\vcpkg install --triplet x64-windows \
boost-asio \
boost-beast \
boost-iostreams \
boost-random \
boost-signals2 \
boost-system \
boost-thread \
libsodium \
lmdb \
openssl \
zlib
```
4. Install dependencies not managed by vcpkg. (libolm, libmtxclient, libmatrix_structs)
Inside the project root run the following (replacing the path to vcpkg as necessary).
```bash
cmake -G "Visual Studio 15 2017 Win64" -Hdeps -B.deps
-DCMAKE_TOOLCHAIN_FILE=C:/Users/<your-path>/vcpkg/scripts/buildsystems/vcpkg.cmake
-DUSE_BUNDLED_BOOST=OFF
cmake --build .deps --config Release
cmake --build .deps --config Debug
```
### Building

View File

@ -48,11 +48,11 @@ struct SearchResult
QString display_name;
};
inline int
static int
numeric_key_comparison(const MDB_val *a, const MDB_val *b)
{
auto lhs = std::stoul(std::string((char *)a->mv_data, a->mv_size));
auto rhs = std::stoul(std::string((char *)b->mv_data, b->mv_size));
auto lhs = std::stoull(std::string((char *)a->mv_data, a->mv_size));
auto rhs = std::stoull(std::string((char *)b->mv_data, b->mv_size));
if (lhs < rhs)
return 1;