Make all examples compile with GCC on Ubuntu

This commit is contained in:
Alex Hultman
2019-06-09 09:32:55 +02:00
parent 996703dde6
commit 5e787b19b3
4 changed files with 17 additions and 14 deletions
+12 -12
View File
@@ -1,25 +1,25 @@
.PHONY: examples .PHONY: examples
examples: examples:
# HelloWorld (non-SSL, non-Zlib compile) # HelloWorld (non-SSL, non-Zlib compile)
clang -DLIBUS_NO_SSL -flto -O3 -c -IuSockets/src uSockets/src/*.c uSockets/src/eventing/*.c $(CC) -DLIBUS_NO_SSL -flto -O3 -c -IuSockets/src uSockets/src/*.c uSockets/src/eventing/*.c
clang++ -DLIBUS_NO_SSL -DUWS_NO_ZLIB -flto -O3 -c -std=c++17 -Isrc -IuSockets/src examples/HelloWorld.cpp $(CXX) -DLIBUS_NO_SSL -DUWS_NO_ZLIB -flto -O3 -c -std=c++17 -Isrc -IuSockets/src examples/HelloWorld.cpp
clang++ -flto -O3 -s *.o -o HelloWorld $(CXX) -flto -O3 -s *.o -o HelloWorld
rm *.o rm *.o
# HelloWorldThreaded (non-SSL, non-Zlib compile) # HelloWorldThreaded (non-SSL, non-Zlib compile)
clang -DLIBUS_NO_SSL -flto -O3 -c -IuSockets/src uSockets/src/*.c uSockets/src/eventing/*.c $(CC) -DLIBUS_NO_SSL -flto -O3 -c -IuSockets/src uSockets/src/*.c uSockets/src/eventing/*.c
clang++ -DLIBUS_NO_SSL -DUWS_NO_ZLIB -flto -O3 -c -std=c++17 -Isrc -IuSockets/src examples/HelloWorldThreaded.cpp $(CXX) -DLIBUS_NO_SSL -DUWS_NO_ZLIB -flto -O3 -c -std=c++17 -Isrc -IuSockets/src examples/HelloWorldThreaded.cpp
clang++ -lpthread -flto -O3 -s *.o -o HelloWorldThreaded $(CXX) -pthread -flto -O3 -s *.o -o HelloWorldThreaded
rm *.o rm *.o
# EchoServer (non-SSL, non-Zlib compile) # EchoServer (non-SSL, non-Zlib compile)
clang -DLIBUS_NO_SSL -flto -O3 -c -IuSockets/src uSockets/src/*.c uSockets/src/eventing/*.c $(CC) -DLIBUS_NO_SSL -flto -O3 -c -IuSockets/src uSockets/src/*.c uSockets/src/eventing/*.c
clang++ -DLIBUS_NO_SSL -DUWS_NO_ZLIB -flto -O3 -c -std=c++17 -Isrc -IuSockets/src examples/EchoServer.cpp $(CXX) -DLIBUS_NO_SSL -DUWS_NO_ZLIB -flto -O3 -c -std=c++17 -Isrc -IuSockets/src examples/EchoServer.cpp
clang++ -flto -O3 -s *.o -o EchoServer $(CXX) -flto -O3 -s *.o -o EchoServer
rm *.o rm *.o
# EchoServerThreaded (non-SSL, non-Zlib compile) # EchoServerThreaded (non-SSL, non-Zlib compile)
clang -DLIBUS_NO_SSL -flto -O3 -c -IuSockets/src uSockets/src/*.c uSockets/src/eventing/*.c $(CC) -DLIBUS_NO_SSL -flto -O3 -c -IuSockets/src uSockets/src/*.c uSockets/src/eventing/*.c
clang++ -DLIBUS_NO_SSL -DUWS_NO_ZLIB -flto -O3 -c -std=c++17 -Isrc -IuSockets/src examples/EchoServerThreaded.cpp $(CXX) -DLIBUS_NO_SSL -DUWS_NO_ZLIB -flto -O3 -c -std=c++17 -Isrc -IuSockets/src examples/EchoServerThreaded.cpp
clang++ -lpthread -flto -O3 -s *.o -o EchoServerThreaded $(CXX) -pthread -flto -O3 -s *.o -o EchoServerThreaded
rm *.o rm *.o
+1
View File
@@ -11,6 +11,7 @@ int main() {
/* Settings */ /* Settings */
.compression = uWS::SHARED_COMPRESSOR, .compression = uWS::SHARED_COMPRESSOR,
.maxPayloadLength = 16 * 1024, .maxPayloadLength = 16 * 1024,
.idleTimeout = 10,
/* Handlers */ /* Handlers */
.open = [](auto *ws, auto *req) { .open = [](auto *ws, auto *req) {
+1
View File
@@ -19,6 +19,7 @@ int main() {
/* Settings */ /* Settings */
.compression = uWS::SHARED_COMPRESSOR, .compression = uWS::SHARED_COMPRESSOR,
.maxPayloadLength = 16 * 1024, .maxPayloadLength = 16 * 1024,
.idleTimeout = 10,
/* Handlers */ /* Handlers */
.open = [](auto *ws, auto *req) { .open = [](auto *ws, auto *req) {
+3 -2
View File
@@ -25,14 +25,15 @@
namespace uWS { namespace uWS {
template <bool, bool> struct WebSocketContext;
template <bool SSL> template <bool SSL>
struct AsyncSocket { struct AsyncSocket {
template <bool> friend struct HttpContext; template <bool> friend struct HttpContext;
template <bool, bool> friend struct WebSocketContext; template <bool, bool> friend struct WebSocketContext;
friend struct TopicTree; friend struct TopicTree;
/* For now, we don't even compile on GCC without this. FIX! */
/*protected*/public:
protected:
/* Get loop data for socket */ /* Get loop data for socket */
LoopData *getLoopData() { LoopData *getLoopData() {
return (LoopData *) us_loop_ext(us_new_socket_context_loop(SSL, us_new_socket_context(SSL, (us_new_socket_t *) this))); return (LoopData *) us_loop_ext(us_new_socket_context_loop(SSL, us_new_socket_context(SSL, (us_new_socket_t *) this)));