Revert "Export static symbols when building ws with shared library (#370)"

This reverts commit a3d2fa4b7e.
This commit is contained in:
Benjamin Sergeant 2022-04-12 08:39:58 -07:00 committed by GitHub
parent 20921f341a
commit b1a72f6133
8 changed files with 34 additions and 79 deletions

View File

@ -99,7 +99,6 @@ set( IXWEBSOCKET_HEADERS
ixwebsocket/IXWebSocketCloseConstants.h ixwebsocket/IXWebSocketCloseConstants.h
ixwebsocket/IXWebSocketCloseInfo.h ixwebsocket/IXWebSocketCloseInfo.h
ixwebsocket/IXWebSocketErrorInfo.h ixwebsocket/IXWebSocketErrorInfo.h
ixwebsocket/IXWebsocketExport.h
ixwebsocket/IXWebSocketHandshake.h ixwebsocket/IXWebSocketHandshake.h
ixwebsocket/IXWebSocketHandshakeKeyGen.h ixwebsocket/IXWebSocketHandshakeKeyGen.h
ixwebsocket/IXWebSocketHttpHeaders.h ixwebsocket/IXWebSocketHttpHeaders.h
@ -174,10 +173,6 @@ else()
${IXWEBSOCKET_SOURCES} ${IXWEBSOCKET_SOURCES}
${IXWEBSOCKET_HEADERS} ${IXWEBSOCKET_HEADERS}
) )
if( MSVC )
target_compile_definitions(ixwebsocket PUBLIC IXWEBSOCKET_STATIC_DEFINE)
endif()
endif() endif()
if (USE_TLS) if (USE_TLS)
@ -291,7 +286,6 @@ if (IXWEBSOCKET_INSTALL)
install(TARGETS ixwebsocket install(TARGETS ixwebsocket
EXPORT ixwebsocket EXPORT ixwebsocket
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/ixwebsocket/ PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/ixwebsocket/
) )

View File

@ -11,7 +11,6 @@
#pragma once #pragma once
#include "IXCancellationRequest.h" #include "IXCancellationRequest.h"
#include "IXWebsocketExport.h"
#include <atomic> #include <atomic>
#include <memory> #include <memory>
#include <mutex> #include <mutex>
@ -55,7 +54,7 @@ namespace ix
std::string _hostname; std::string _hostname;
int _port; int _port;
int64_t _wait; int64_t _wait;
IXWEBSOCKET_EXPORT const static int64_t kDefaultWait; const static int64_t kDefaultWait;
struct addrinfo* _res; struct addrinfo* _res;
std::mutex _resMutex; std::mutex _resMutex;

View File

@ -10,7 +10,6 @@
#include "IXSocket.h" #include "IXSocket.h"
#include "IXSocketTLSOptions.h" #include "IXSocketTLSOptions.h"
#include "IXWebSocketHttpHeaders.h" #include "IXWebSocketHttpHeaders.h"
#include "IXWebsocketExport.h"
#include <algorithm> #include <algorithm>
#include <atomic> #include <atomic>
#include <condition_variable> #include <condition_variable>
@ -92,12 +91,12 @@ namespace ix
std::string urlEncode(const std::string& value); std::string urlEncode(const std::string& value);
IXWEBSOCKET_EXPORT const static std::string kPost; const static std::string kPost;
IXWEBSOCKET_EXPORT const static std::string kGet; const static std::string kGet;
IXWEBSOCKET_EXPORT const static std::string kHead; const static std::string kHead;
IXWEBSOCKET_EXPORT const static std::string kDelete; const static std::string kDelete;
IXWEBSOCKET_EXPORT const static std::string kPut; const static std::string kPut;
IXWEBSOCKET_EXPORT const static std::string kPatch; const static std::string kPatch;
private: private:
void log(const std::string& msg, HttpRequestArgsPtr args); void log(const std::string& msg, HttpRequestArgsPtr args);

View File

@ -9,7 +9,6 @@
#include "IXHttp.h" #include "IXHttp.h"
#include "IXSocketServer.h" #include "IXSocketServer.h"
#include "IXWebSocket.h" #include "IXWebSocket.h"
#include "IXWebsocketExport.h"
#include <functional> #include <functional>
#include <memory> #include <memory>
#include <mutex> #include <mutex>
@ -47,7 +46,7 @@ namespace ix
OnConnectionCallback _onConnectionCallback; OnConnectionCallback _onConnectionCallback;
std::atomic<int> _connectedClientsCount; std::atomic<int> _connectedClientsCount;
IXWEBSOCKET_EXPORT const static int kDefaultTimeoutSecs; const static int kDefaultTimeoutSecs;
int _timeoutSecs; int _timeoutSecs;
// Methods // Methods

View File

@ -10,7 +10,6 @@
#include "IXNetSystem.h" #include "IXNetSystem.h"
#include "IXSelectInterrupt.h" #include "IXSelectInterrupt.h"
#include "IXSocketTLSOptions.h" #include "IXSocketTLSOptions.h"
#include "IXWebsocketExport.h"
#include <atomic> #include <atomic>
#include <condition_variable> #include <condition_variable>
#include <functional> #include <functional>
@ -49,11 +48,11 @@ namespace ix
// that inherits from ConnectionState but has its own methods. // that inherits from ConnectionState but has its own methods.
void setConnectionStateFactory(const ConnectionStateFactory& connectionStateFactory); void setConnectionStateFactory(const ConnectionStateFactory& connectionStateFactory);
IXWEBSOCKET_EXPORT const static int kDefaultPort; const static int kDefaultPort;
IXWEBSOCKET_EXPORT const static std::string kDefaultHost; const static std::string kDefaultHost;
IXWEBSOCKET_EXPORT const static int kDefaultTcpBacklog; const static int kDefaultTcpBacklog;
IXWEBSOCKET_EXPORT const static size_t kDefaultMaxConnections; const static size_t kDefaultMaxConnections;
IXWEBSOCKET_EXPORT const static int kDefaultAddressFamily; const static int kDefaultAddressFamily;
void start(); void start();
std::pair<bool, std::string> listen(); std::pair<bool, std::string> listen();

View File

@ -6,7 +6,6 @@
#pragma once #pragma once
#include "IXWebsocketExport.h"
#include <cstdint> #include <cstdint>
#include <string> #include <string>
@ -14,25 +13,25 @@ namespace ix
{ {
struct WebSocketCloseConstants struct WebSocketCloseConstants
{ {
IXWEBSOCKET_EXPORT static const uint16_t kNormalClosureCode; static const uint16_t kNormalClosureCode;
IXWEBSOCKET_EXPORT static const uint16_t kInternalErrorCode; static const uint16_t kInternalErrorCode;
IXWEBSOCKET_EXPORT static const uint16_t kAbnormalCloseCode; static const uint16_t kAbnormalCloseCode;
IXWEBSOCKET_EXPORT static const uint16_t kProtocolErrorCode; static const uint16_t kProtocolErrorCode;
IXWEBSOCKET_EXPORT static const uint16_t kNoStatusCodeErrorCode; static const uint16_t kNoStatusCodeErrorCode;
IXWEBSOCKET_EXPORT static const uint16_t kInvalidFramePayloadData; static const uint16_t kInvalidFramePayloadData;
IXWEBSOCKET_EXPORT static const std::string kNormalClosureMessage; static const std::string kNormalClosureMessage;
IXWEBSOCKET_EXPORT static const std::string kInternalErrorMessage; static const std::string kInternalErrorMessage;
IXWEBSOCKET_EXPORT static const std::string kAbnormalCloseMessage; static const std::string kAbnormalCloseMessage;
IXWEBSOCKET_EXPORT static const std::string kPingTimeoutMessage; static const std::string kPingTimeoutMessage;
IXWEBSOCKET_EXPORT static const std::string kProtocolErrorMessage; static const std::string kProtocolErrorMessage;
IXWEBSOCKET_EXPORT static const std::string kNoStatusCodeErrorMessage; static const std::string kNoStatusCodeErrorMessage;
IXWEBSOCKET_EXPORT static const std::string kProtocolErrorReservedBitUsed; static const std::string kProtocolErrorReservedBitUsed;
IXWEBSOCKET_EXPORT static const std::string kProtocolErrorPingPayloadOversized; static const std::string kProtocolErrorPingPayloadOversized;
IXWEBSOCKET_EXPORT static const std::string kProtocolErrorCodeControlMessageFragmented; static const std::string kProtocolErrorCodeControlMessageFragmented;
IXWEBSOCKET_EXPORT static const std::string kProtocolErrorCodeDataOpcodeOutOfSequence; static const std::string kProtocolErrorCodeDataOpcodeOutOfSequence;
IXWEBSOCKET_EXPORT static const std::string kProtocolErrorCodeContinuationOpCodeOutOfSequence; static const std::string kProtocolErrorCodeContinuationOpCodeOutOfSequence;
IXWEBSOCKET_EXPORT static const std::string kInvalidFramePayloadDataMessage; static const std::string kInvalidFramePayloadDataMessage;
IXWEBSOCKET_EXPORT static const std::string kInvalidCloseCodeMessage; static const std::string kInvalidCloseCodeMessage;
}; };
} // namespace ix } // namespace ix

View File

@ -8,7 +8,6 @@
#include "IXSocketServer.h" #include "IXSocketServer.h"
#include "IXWebSocket.h" #include "IXWebSocket.h"
#include "IXWebsocketExport.h"
#include <condition_variable> #include <condition_variable>
#include <functional> #include <functional>
#include <memory> #include <memory>
@ -51,7 +50,7 @@ namespace ix
void makeBroadcastServer(); void makeBroadcastServer();
bool listenAndStart(); bool listenAndStart();
IXWEBSOCKET_EXPORT const static int kDefaultHandShakeTimeoutSecs; const static int kDefaultHandShakeTimeoutSecs;
int getHandshakeTimeoutSecs(); int getHandshakeTimeoutSecs();
bool isPongEnabled(); bool isPongEnabled();
@ -68,7 +67,7 @@ namespace ix
std::mutex _clientsMutex; std::mutex _clientsMutex;
std::set<std::shared_ptr<WebSocket>> _clients; std::set<std::shared_ptr<WebSocket>> _clients;
IXWEBSOCKET_EXPORT const static bool kDefaultEnablePong; const static bool kDefaultEnablePong;
// Methods // Methods
virtual void handleConnection(std::unique_ptr<Socket> socket, virtual void handleConnection(std::unique_ptr<Socket> socket,

View File

@ -1,33 +0,0 @@
#ifndef IXWEBSOCKET_EXPORT_H
#define IXWEBSOCKET_EXPORT_H
#ifdef _WIN32
#ifdef IXWEBSOCKET_STATIC_DEFINE
/* Building and using static library */
# define IXWEBSOCKET_EXPORT
# define IXWEBSOCKET_NO_EXPORT
#else
# ifndef IXWEBSOCKET_EXPORT
# ifdef ixwebsocket_EXPORTS /* Comes from cmake, documented in DEFINE_SYMBOL */
/* Building dynamic library */
# define IXWEBSOCKET_EXPORT __declspec(dllexport)
# else
/* Using dynamic library */
# define IXWEBSOCKET_EXPORT __declspec(dllimport)
# endif
# endif
# ifndef IXWEBSOCKET_NO_EXPORT
# define IXWEBSOCKET_NO_EXPORT
# endif
#endif
#else /* _WIN32 */
# define IXWEBSOCKET_EXPORT
# define IXWEBSOCKET_NO_EXPORT
#endif /* _WIN32 */
#endif /* IXWEBSOCKET_EXPORT_H */