diff --git a/appveyor.yml b/appveyor.yml index 07848e2..4fbbfbf 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -36,7 +36,7 @@ install: - set BOOST_BUILD_PATH=%BOOST_ROOT%\tools\build - echo %BOOST_ROOT% - echo %BOOST_BUILD_PATH% - - set PATH=%PATH%;%BOOST_BUILD_PATH%\src\engine\bin.ntx86 + - set PATH=%PATH%;%BOOST_BUILD_PATH%\src\engine\bin.ntx64 - ps: '"using msvc : 14.0 ;`nusing gcc : : : -std=c++14 ;`n" | Set-Content $env:HOMEDRIVE\$env:HOMEPATH\user-config.jam' - type %HOMEDRIVE%%HOMEPATH%\user-config.jam - cd %ROOT_DIRECTORY% @@ -48,8 +48,6 @@ install: - cd %BOOST_ROOT% - bjam cxxstd=14 release --with-system --layout=system address-model=64 link=shared stage - - choco install ninja - - cd %APPVEYOR_BUILD_FOLDER%\bindings\lib\libtorrent - mkdir build && cd build - set BOOST_LIBRARYDIR=%BOOST_ROOT%\stage\lib diff --git a/bindings/CMakeLists.txt b/bindings/CMakeLists.txt index d1c32cc..764de5f 100644 --- a/bindings/CMakeLists.txt +++ b/bindings/CMakeLists.txt @@ -9,6 +9,8 @@ set(CMAKE_BUILD_TYPE Release) # Windows things... if (MSVC_VERSION GREATER_EQUAL "1900") + set(CMAKE_GENERATOR_PLATFORM x64) + include(CheckCXXCompilerFlag) CHECK_CXX_COMPILER_FLAG("/std:c++14" _cpp_14_flag_supported) if (_cpp_14_flag_supported) diff --git a/bindings/src/name_parser/wrapper.cc b/bindings/src/name_parser/wrapper.cc index 538a502..20114f1 100644 --- a/bindings/src/name_parser/wrapper.cc +++ b/bindings/src/name_parser/wrapper.cc @@ -42,6 +42,8 @@ std::wstring Wrapper::ToWideString(Napi::String input, Napi::Env env) { std::wstring_convert> converter; return converter.from_bytes(_input); } catch(std::range_error& e) { + (void)e; + size_t length = _input.length(); std::wstring result; diff --git a/bindings/src/torrent/client_session.cc b/bindings/src/torrent/client_session.cc index ad6f6e6..e179328 100644 --- a/bindings/src/torrent/client_session.cc +++ b/bindings/src/torrent/client_session.cc @@ -187,7 +187,7 @@ Napi::Value Client::GetClientInfo(const Napi::CallbackInfo& info) { double download_rate = 0.0; double upload_rate = 0.0; float progress = 0; - int nb_torrents = torrents.size(); + size_t nb_torrents = torrents.size(); for (auto const& torrent : torrents) { lt::torrent_status status = torrent.status(); diff --git a/bindings/src/torrent/client_session.h b/bindings/src/torrent/client_session.h index b85210b..8ff8ac5 100644 --- a/bindings/src/torrent/client_session.h +++ b/bindings/src/torrent/client_session.h @@ -15,12 +15,6 @@ #ifndef BINDINGS_SRC_TORRENT_CLIENT_SESSION_H_ #define BINDINGS_SRC_TORRENT_CLIENT_SESSION_H_ -#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__) -// Windows 10, Needed by Boost -#define WINVER 0x0A00 -#define _WIN32_WINNT 0x0A00 -#endif - #include #include @@ -39,6 +33,7 @@ #include #include +#include "windows.h" #include "utils.h" namespace LtSession { diff --git a/bindings/src/torrent/utils.h b/bindings/src/torrent/utils.h index c6730b4..d31674a 100644 --- a/bindings/src/torrent/utils.h +++ b/bindings/src/torrent/utils.h @@ -23,6 +23,8 @@ #include #include +#include "windows.h" + namespace LtUtils { Napi::Object formatTorrentInfo(Napi::Env env, lt::torrent_handle torrent); diff --git a/bindings/src/torrent/windows.h b/bindings/src/torrent/windows.h new file mode 100644 index 0000000..15ae0cb --- /dev/null +++ b/bindings/src/torrent/windows.h @@ -0,0 +1,24 @@ +/** + * Copyright (c) 2019 Kylart + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + */ + +#ifndef BINDINGS_SRC_TORRENT_WINDOWS_H_ +#define BINDINGS_SRC_TORRENT_WINDOWS_H_ + +#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__) +// Windows 10, Needed by Boost +#define WINVER 0x0A00 +#define _WIN32_WINNT 0x0A00 +#endif + +#endif // BINDINGS_SRC_TORRENT_WINDOWS_H_