Skip to content

Commit

Permalink
I hope windows build still workds
Browse files Browse the repository at this point in the history
  • Loading branch information
alesapin committed Oct 2, 2024
1 parent 0af0e7a commit ea47085
Show file tree
Hide file tree
Showing 11 changed files with 163 additions and 161 deletions.
70 changes: 2 additions & 68 deletions contrib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,66 +8,6 @@ unset (_current_dir_name)

set_property(DIRECTORY PROPERTY EXCLUDE_FROM_ALL 1)


#if (CH_ODBC_PREFER_BUNDLED_POCO OR NOT Poco_FOUND)
# if (NOT Poco_FOUND AND NOT CH_ODBC_PREFER_BUNDLED_POCO)
# message (WARNING "Poco: unable to find system Poco, falling back to using the bundled variant of the library")
# endif ()
#
# if (CH_ODBC_ENABLE_SSL AND MSVC)
# set (ENABLE_NETSSL_WIN ON CACHE INTERNAL "")
# endif ()
#
# if (CH_ODBC_THIRD_PARTY_LINK_STATIC)
# set (POCO_STATIC ON CACHE INTERNAL "")
# endif ()
#
# if (CH_ODBC_RUNTIME_LINK_STATIC)
# set (POCO_MT ON CACHE INTERNAL "")
# endif ()
#
# set (CMAKE_MODULE_PATH_bak ${CMAKE_MODULE_PATH})
# set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH_orig})
#
# add_subdirectory (poco)
#
# set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH_bak})
# unset (CMAKE_MODULE_PATH_bak)
#
# if (TARGET NetSSL)
# add_library(Poco::NetSSL ALIAS NetSSL)
# endif ()
#
# if (TARGET NetSSLWin)
# add_library(Poco::NetSSLWin ALIAS NetSSLWin)
# endif ()
#
# add_library(Poco::Net ALIAS Net)
# add_library(Poco::Foundation ALIAS Foundation)
# add_library(Poco::Util ALIAS Util)
#
# # Remove pthread from linking poco's Net
# set_property (TARGET Net PROPERTY INTERFACE_LINK_LIBRARIES "")
# set_property (TARGET Foundation PROPERTY INTERFACE_LINK_LIBRARIES "")
#endif ()
#
## Bug in poco https://github.com/pocoproject/poco/pull/2100 found on macos
#if (OPENSSL_FOUND)
# if (TARGET Crypto)
# target_include_directories (Crypto INTERFACE $<BUILD_INTERFACE:${OPENSSL_INCLUDE_DIR}>)
# elseif (TARGET Poco::Crypto)
# target_include_directories (Poco::Crypto INTERFACE $<BUILD_INTERFACE:${OPENSSL_INCLUDE_DIR}>)
# endif ()
#endif()
#
#if (MSVC)
# if (TARGET Foundation)
# set_property(TARGET Foundation APPEND PROPERTY INTERFACE_LINK_LIBRARIES Iphlpapi)
# elseif (TARGET Poco::Foundation)
# set_property(TARGET Poco::Foundation APPEND PROPERTY INTERFACE_LINK_LIBRARIES Iphlpapi)
# endif ()
#endif ()

# add_contrib cmake_folder[ base_folder1[, ...base_folderN]]
function(add_contrib cmake_folder)
if (ARGN)
Expand Down Expand Up @@ -101,20 +41,14 @@ add_contrib (unixodbc-cmake unixodbc)
add_contrib (nanodbc-cmake nanodbc)
add_contrib (lz4-cmake lz4)
add_contrib (double-conversion-cmake double-conversion)

if (OS_DARWIN OR OS_LINUX)
add_contrib (openssl-cmake openssl)
endif()

add_contrib (zlib-ng-cmake zlib-ng)
set (FOLLY_INLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/folly" CACHE INTERNAL "")

# if (CH_ODBC_PREFER_BUNDLED_FOLLY OR NOT Folly_FOUND)
# if (NOT Folly_FOUND AND NOT CH_ODBC_PREFER_BUNDLED_FOLLY)
# message (WARNING "Folly: unable to find system Folly, falling back to using the bundled variant of the library")
# endif ()
#
# add_subdirectory (folly)
# endif ()

if (CH_ODBC_ENABLE_TESTING)
if (CH_ODBC_PREFER_BUNDLED_GOOGLETEST OR NOT GTEST_FOUND)
if (NOT GTEST_FOUND AND NOT CH_ODBC_PREFER_BUNDLED_GOOGLETEST)
Expand Down
5 changes: 2 additions & 3 deletions contrib/nanodbc-cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

if (OS_DARWIN OR OS_LINIX)
if (OS_DARWIN OR OS_LINUX)
if (NOT TARGET ch_contrib::unixodbc)
message(FATAL_ERROR "Configuration error: unixodbc is not a target")
endif()
Expand All @@ -14,6 +13,7 @@ if (OS_DARWIN OR OS_LINIX)
target_link_libraries(_nanodbc PUBLIC ch_contrib::unixodbc)
target_include_directories(_nanodbc SYSTEM PUBLIC "${LIBRARY_DIR}/")
add_library(ch_contrib::nanodbc ALIAS _nanodbc)

elseif (OS_WINDOWS)
set (LIBRARY_DIR "${CMAKE_SOURCE_DIR}/contrib/nanodbc")
set (SRCS
Expand All @@ -24,5 +24,4 @@ elseif (OS_WINDOWS)
target_link_libraries(_nanodbc PUBLIC ODBC::Driver)
target_include_directories(_nanodbc SYSTEM PUBLIC "${LIBRARY_DIR}/")
add_library(ch_contrib::nanodbc ALIAS _nanodbc)

endif()
3 changes: 2 additions & 1 deletion contrib/poco/Foundation/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ set(SRCS
src/SimpleFileChannel.cpp
src/SortedDirectoryIterator.cpp
src/SplitterChannel.cpp
src/SyslogChannel.cpp
src/Stopwatch.cpp
src/StreamChannel.cpp
src/StreamConverter.cpp
Expand Down Expand Up @@ -179,7 +180,7 @@ set(SRCS
)

if(WIN32)
set(SYSLIBS ${SYSLIBS} iphlpapi)
set(SYSLIBS ${SYSLIBS} iphlpapi)
endif(WIN32)

add_library(_poco_foundation ${SRCS})
Expand Down
2 changes: 2 additions & 0 deletions contrib/poco/Foundation/include/Poco/EventLogChannel.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#ifndef Foundation_EventLogChannel_INCLUDED
#define Foundation_EventLogChannel_INCLUDED

#if defined(POCO_OS_FAMILY_WINDOWS)

#include "Poco/Foundation.h"
#include "Poco/Channel.h"
Expand Down Expand Up @@ -101,5 +102,6 @@ class Foundation_API EventLogChannel: public Channel

} // namespace Poco

#endif

#endif // Foundation_EventLogChannel_INCLUDED
2 changes: 2 additions & 0 deletions contrib/poco/Foundation/include/Poco/WindowsConsoleChannel.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#ifndef Foundation_WindowsConsoleChannel_INCLUDED
#define Foundation_WindowsConsoleChannel_INCLUDED

#if defined(POCO_OS_FAMILY_WINDOWS)

#include "Poco/Foundation.h"
#include "Poco/Channel.h"
Expand Down Expand Up @@ -179,5 +180,6 @@ class Foundation_API WindowsColorConsoleChannel: public Channel

} // namespace Poco

#endif

#endif // Foundation_WindowsConsoleChannel_INCLUDED
4 changes: 4 additions & 0 deletions contrib/poco/Foundation/src/EventLogChannel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
//


#if defined(POCO_OS_FAMILY_WINDOWS)

#include "Poco/EventLogChannel.h"
#include "Poco/Message.h"
#include "Poco/String.h"
Expand Down Expand Up @@ -316,3 +318,5 @@ std::string EventLogChannel::findLibrary(const char* name)


} // namespace Poco

#endif
4 changes: 4 additions & 0 deletions contrib/poco/Foundation/src/WindowsConsoleChannel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
//


#if defined(POCO_OS_FAMILY_WINDOWS)

#include "Poco/WindowsConsoleChannel.h"
#include "Poco/Message.h"
#if defined(POCO_WIN32_UTF8)
Expand Down Expand Up @@ -300,3 +302,5 @@ void WindowsColorConsoleChannel::initColors()


} // namespace Poco

#endif
51 changes: 48 additions & 3 deletions contrib/poco/Net/include/Poco/Net/HTTPClientSession.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

#include "Poco/Net/Net.h"
#include "Poco/Net/HTTPSession.h"
#include "Poco/Net/HTTPSessionFactory.h"
#include "Poco/Net/SocketAddress.h"
#include "Poco/SharedPtr.h"
#include <istream>
Expand Down Expand Up @@ -66,14 +67,19 @@ class Net_API HTTPClientSession: public HTTPSession
/// HTTP proxy server configuration.
{
ProxyConfig():
port(HTTP_PORT)
port(HTTP_PORT), protocol("http"), tunnel(true)
{
}

std::string host;
/// Proxy server host name or IP address.
Poco::UInt16 port;
/// Proxy server TCP port.
std::string protocol;
/// Protocol to use (http or https).
bool tunnel;
/// Use proxy as tunnel (establish 2-way communication through CONNECT request).
/// If tunnel option is 'false' request will be send directly to proxy without CONNECT request.
std::string username;
/// Proxy server username.
std::string password;
Expand Down Expand Up @@ -120,24 +126,41 @@ class Net_API HTTPClientSession: public HTTPSession
/// The port number must not be changed once there is an
/// open connection to the server.

void setResolvedHost(std::string resolved_host) { _resolved_host.swap(resolved_host); }

Poco::UInt16 getPort() const;
/// Returns the port number of the target HTTP server.

void setProxy(const std::string& host, Poco::UInt16 port = HTTPSession::HTTP_PORT);
/// Sets the proxy host name and port number.
std::string getResolvedAddress() const;
/// Returns the resolved host name and port of the target HTTP server.

void setProxy(const std::string& host, Poco::UInt16 port = HTTPSession::HTTP_PORT, const std::string& protocol = "http", bool tunnel = true);
/// Sets the proxy host name, port number, protocol (http or https) and tunnel behaviour.

void setProxyHost(const std::string& host);
/// Sets the host name of the proxy server.

void setProxyPort(Poco::UInt16 port);
/// Sets the port number of the proxy server.

void setProxyProtocol(const std::string& protocol);
/// Sets the proxy protocol (http or https).

void setProxyTunnel(bool tunnel);
/// If 'true' proxy will be used as tunnel.

const std::string& getProxyHost() const;
/// Returns the proxy host name.

Poco::UInt16 getProxyPort() const;
/// Returns the proxy port number.

const std::string& getProxyProtocol() const;
/// Returns the proxy protocol.

bool isProxyTunnel() const;
/// Returns 'true' if proxy is configured as tunnel.

void setProxyCredentials(const std::string& username, const std::string& password);
/// Sets the username and password for proxy authentication.
/// Only Basic authentication is supported.
Expand Down Expand Up @@ -306,8 +329,11 @@ class Net_API HTTPClientSession: public HTTPSession
/// Calls proxyConnect() and attaches the resulting StreamSocket
/// to the HTTPClientSession.

HTTPSessionFactory _proxySessionFactory;
/// Factory to create HTTPClientSession to proxy.
private:
std::string _host;
std::string _resolved_host;
Poco::UInt16 _port;
ProxyConfig _proxyConfig;
Poco::Timespan _keepAliveTimeout;
Expand All @@ -331,6 +357,13 @@ class Net_API HTTPClientSession: public HTTPSession
//
// inlines
//

inline std::string HTTPClientSession::getResolvedAddress() const
{
return (_resolved_host.empty() ? _host : _resolved_host) + ':' + std::to_string(_port);
}


inline const std::string& HTTPClientSession::getHost() const
{
return _host;
Expand All @@ -355,6 +388,18 @@ inline Poco::UInt16 HTTPClientSession::getProxyPort() const
}


inline const std::string& HTTPClientSession::getProxyProtocol() const
{
return _proxyConfig.protocol;
}


inline bool HTTPClientSession::isProxyTunnel() const
{
return _proxyConfig.tunnel;
}


inline const std::string& HTTPClientSession::getProxyUsername() const
{
return _proxyConfig.username;
Expand Down
5 changes: 4 additions & 1 deletion contrib/poco/Net/include/Poco/Net/SocketImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,9 @@ class Net_API SocketImpl: public Poco::RefCountedObject
/// Returns true if the next operation corresponding to
/// mode will not block, false otherwise.

bool pollImpl(Poco::Timespan& timeout, int mode);
/// Modifies `timeout`

virtual void setSendBufferSize(int size);
/// Sets the size of the send buffer.

Expand Down Expand Up @@ -447,7 +450,7 @@ class Net_API SocketImpl: public Poco::RefCountedObject
static void error(int code, const std::string& arg);
/// Throws an appropriate exception for the given error code.

private:
protected:
SocketImpl(const SocketImpl&);
SocketImpl& operator = (const SocketImpl&);

Expand Down
Loading

0 comments on commit ea47085

Please sign in to comment.