Skip to content

Patch for Windows DLL naming #630

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Jan 9, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 22 additions & 2 deletions Release/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,15 @@ if(POLICY CMP0042)
cmake_policy(SET CMP0042 NEW) # use MACOSX_RPATH
endif()
if(UNIX)
project(cpprest C CXX)
project(cpprestsdk C CXX)
else()
project(cpprest CXX)
project(cpprestsdk CXX)
endif()

set(CPPREST_VERSION_MAJOR 2)
set(CPPREST_VERSION_MINOR 10)
set(CPPREST_VERSION_REVISION 1)

enable_testing()

set(WERROR ON CACHE BOOL "Treat Warnings as Errors.")
Expand All @@ -32,6 +36,22 @@ else()
set(BUILD_SAMPLES ON CACHE BOOL "Build sample applications.")
endif()

if(WIN32)
set(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "Default filename postfix for libraries under configuration DEBUG")
else()
set(CMAKE_DEBUG_POSTFIX "" CACHE STRING "Default filename postfix for libraries under configuration DEBUG")
endif()

if(WIN32)
set(TOOLSET)
if(CMAKE_VS_PLATFORM_TOOLSET)
string(REGEX REPLACE "^v" "" TOOLSET "${CMAKE_VS_PLATFORM_TOOLSET}")
endif()
set(CPPREST_ABI_TAG "${TOOLSET}_${CPPREST_VERSION_MAJOR}_${CPPREST_VERSION_MINOR}" CACHE STRING "Postfix tag for the cpprest abi")
else()
set(CPPREST_ABI_TAG "" CACHE STRING "Postfix tag for the cpprest abi")
endif()

if(ANDROID)
set(Boost_USE_STATIC_LIBS ON CACHE BOOL "Link against boost statically.")
else()
Expand Down
1 change: 1 addition & 0 deletions Release/include/cpprest/streams.h
Original file line number Diff line number Diff line change
Expand Up @@ -1714,6 +1714,7 @@ class type_parser<CharType,char> : public _type_parser_base<CharType>
template<class CharType>
class type_parser<CharType, std::enable_if_t<sizeof(CharType) == 1, std::basic_string<wchar_t>>> : public _type_parser_base<CharType>
{
typedef typename concurrency::streams::streambuf<CharType>::int_type int_type;
public:
static pplx::task<std::wstring> parse(streams::streambuf<CharType> buffer)
{
Expand Down
3 changes: 2 additions & 1 deletion Release/include/pplx/threadpool.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,10 @@ class threadpool
boost::asio::io_service& service() { return m_service; }

protected:
threadpool(size_t num_threads) : m_service(num_threads) {}
threadpool(size_t num_threads) : m_service(static_cast<int>(num_threads)) {}

boost::asio::io_service m_service;
};

}

7 changes: 1 addition & 6 deletions Release/src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
cmake_policy(SET CMP0022 NEW)

set(CPPREST_VERSION_MAJOR 2)
set(CPPREST_VERSION_MINOR 10)
set(CPPREST_VERSION_REVISION 1)

file(GLOB HEADERS_CPPREST "../include/cpprest/*.h" "../include/cpprest/*.hpp" "../include/cpprest/*.dat")
file(GLOB HEADERS_PPLX "../include/pplx/*.h" "../include/pplx/*.hpp")
file(GLOB HEADERS_DETAILS "../include/cpprest/details/*.h" "../include/cpprest/details/*.hpp" "../include/cpprest/details/*.dat" "../include/pplx/*.hpp" "../include/pplx/*.dat")
Expand Down Expand Up @@ -214,9 +210,8 @@ elseif(WINDOWS_STORE)
endif()
endif()

set_target_properties(cpprest PROPERTIES OUTPUT_NAME "cpprest${CPPREST_ABI_TAG}")
if(WIN32)
set_target_properties(cpprest PROPERTIES
OUTPUT_NAME "cpprest_${CPPREST_VERSION_MAJOR}_${CPPREST_VERSION_MINOR}")
elseif(ANDROID)
# Do not use SOVERSION on android. It is completely unsupported (and causes problems).
# Perhaps revisit in the future? (NDK r9d, 8/7/14)
Expand Down
2 changes: 1 addition & 1 deletion Release/src/http/client/http_client_winhttp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,7 @@ class winhttp_client : public _http_client_communicator
DWORD access_type;
LPCWSTR proxy_name;
LPCWSTR proxy_bypass = WINHTTP_NO_PROXY_BYPASS;
utility::string_t proxy_str;
http::uri uri;

const auto& config = client_config();
Expand Down Expand Up @@ -485,7 +486,6 @@ class winhttp_client : public _http_client_communicator
}
else
{
utility::string_t proxy_str;
if (uri.port() > 0)
{
utility::ostringstream_t ss;
Expand Down
3 changes: 3 additions & 0 deletions Release/src/http/client/http_client_winrt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ using namespace std;
using namespace Platform;
using namespace Microsoft::WRL;

#undef min
#undef max

namespace web
{
namespace http
Expand Down
4 changes: 2 additions & 2 deletions Release/src/http/listener/http_server_asio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,7 @@ will_deref_and_erase_t asio_server_connection::handle_http_line(const boost::sys
{
m_request.set_request_uri(utility::conversions::to_string_t(http_path_and_version.substr(1, http_path_and_version.size() - VersionPortionSize - 1)));
}
catch(const web::uri_exception &e)
catch (const std::exception& e) // may be std::range_error indicating invalid Unicode, or web::uri_exception
{
m_request.reply(status_codes::BadRequest, e.what());
m_close = true;
Expand Down Expand Up @@ -913,7 +913,7 @@ will_deref_and_erase_t asio_server_connection::dispatch_request_to_listener()
{
pListener = m_p_parent->find_listener(m_request.relative_uri());
}
catch (const web::uri_exception&)
catch (const std::exception&) // may be web::uri_exception, or std::range_error indicating invalid Unicode
{
m_request.reply(status_codes::BadRequest);
(will_erase_from_parent_t)do_response();
Expand Down