1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-09 00:00:04 +01:00

Fixed build on OSX.

- For some reason the "extern int pid_daemon" usage in libwebsockets.c would cause an "undefined symbols" linker error for the test-apps. This only happens with the CMake project, not the normal Makefiles. I have no clue why this is. Fixed it by getting the pid via a function instead.

- Added test-server-extpoll

- Renamed the library from libwebsocket -> libwebsockets
This commit is contained in:
Joakim Söderberg 2013-02-06 15:27:39 +09:00 committed by Andy Green
parent d2edfec5fa
commit 68e8d730b8
4 changed files with 41 additions and 9 deletions

View file

@ -33,6 +33,7 @@ option(WITH_BUILTIN_GETIFADDRS "Use BSD getifaddrs implementation from libwebsoc
option(WITHOUT_TESTAPPS "Don't build the libwebsocket-test-apps" OFF)
option(WITHOUT_CLIENT "Don't build the client part of the library" OFF)
option(WITHOUT_SERVER "Don't build the server part of the library" OFF)
option(WITHOUT_SERVER_EXTPOLL "Don't build a server version that uses external poll" OFF)
option(WITH_LIBCRYPTO "Use libcrypto MD5 and SHA1 implementations" ON)
option(WITHOUT_PING "Don't build the ping test application" OFF)
option(WITHOUT_DEBUG "Don't compile debug related code" OFF)
@ -237,7 +238,7 @@ source_group("Sources" FILES ${SOURCES})
#
# Create the lib.
#
add_library(websocket STATIC
add_library(websockets STATIC
${HDR_PRIVATE}
${HDR_PUBLIC}
${SOURCES})
@ -287,7 +288,7 @@ endif()
message("ZLib include dirs: ${ZLIB_INCLUDE_DIRS}")
message("ZLib libraries: ${ZLIB_LIBRARIES}")
include_directories(${ZLIB_INCLUDE_DIRS})
target_link_libraries(websocket ${ZLIB_LIBRARIES})
target_link_libraries(websockets ${ZLIB_LIBRARIES})
#
# OpenSSL
@ -310,18 +311,18 @@ if (WITH_SSL)
message("OpenSSL include dir: ${OPENSSL_INCLUDE_DIR}")
message("OpenSSL libraries: ${OPENSSL_LIBRARIES}")
include_directories(${OPENSSL_INCLUDE_DIR})
target_link_libraries(websocket ${OPENSSL_LIBRARIES})
target_link_libraries(websockets ${OPENSSL_LIBRARIES})
endif(WITH_SSL)
#
# Platform specific libs.
#
if (WIN32)
target_link_libraries(websocket ws2_32.lib)
target_link_libraries(websockets ws2_32.lib)
endif()
if (UNIX)
target_link_libraries(websocket m)
target_link_libraries(websockets m)
endif()
#
@ -352,7 +353,7 @@ if (NOT WITHOUT_TESTAPPS)
source_group("Headers" FILES ${TEST_HDR})
source_group("Sources" FILES ${TEST_SRCS})
add_executable(${TEST_NAME} ${TEST_SRCS} ${TEST_HDR})
target_link_libraries(${TEST_NAME} websocket)
target_link_libraries(${TEST_NAME} websockets)
set_property(
TARGET ${TEST_NAME}
@ -382,6 +383,22 @@ if (NOT WITHOUT_TESTAPPS)
"${WIN32_HELPERS_PATH}/netdb.h;${WIN32_HELPERS_PATH}/strings.h;${WIN32_HELPERS_PATH}/unistd.h;${WIN32_HELPERS_PATH}/websock-w32.h")
endif(NOT WITHOUT_SERVER)
#
# test-server-extpoll
#
if (NOT WITHOUT_SERVER_EXTPOLL)
create_test_app(test-server-extpoll
"test-server/test-server.c"
""
"${WIN32_HELPERS_PATH}/netdb.h;${WIN32_HELPERS_PATH}/strings.h;${WIN32_HELPERS_PATH}/unistd.h;${WIN32_HELPERS_PATH}/websock-w32.h")
# Set defines for this executable only.
set_property(
TARGET test-server-extpoll
PROPERTY COMPILE_DEFINITIONS EXTERNAL_POLL INSTALL_DATADIR="${SSL_CERT_DIR}"
)
endif(NOT WITHOUT_SERVER_EXTPOLL)
#
# test-fraggle
#

View file

@ -24,6 +24,11 @@
int pid_daemon;
static char *lock_path;
int get_daemonize_pid()
{
return pid_daemon;
}
static void
child_handler(int signum)
{

View file

@ -1513,7 +1513,8 @@ libwebsocket_create_context(int port, const char *interf,
#endif
#ifndef LWS_NO_DAEMONIZE
extern int pid_daemon;
extern int get_daemonize_pid();
int pid_daemon = get_daemonize_pid();
#endif
lwsl_notice("Initial logging level %d\n", log_level);
@ -1561,6 +1562,7 @@ libwebsocket_create_context(int port, const char *interf,
if (wsdll)
poll = (PFNWSAPOLL)GetProcAddress(wsdll, "WSAPoll");
/* Finally fall back to emulated poll if all else fails */
if (!poll)
poll = emulated_poll;
}

View file

@ -47,6 +47,14 @@
#include <sys/stat.h>
#ifndef inline
#ifdef __inline
#define inline __inline
#elif defined(__inline__)
#define inline __inline__
#endif
#endif
#ifdef WIN32
#define LWS_NO_DAEMONIZE
@ -390,8 +398,8 @@ struct libwebsocket {
};
#ifndef LWS_LATENCY
#define lws_latency(context, wsi, action, ret, completion)
#define lws_latency_pre(context, wsi)
static void lws_latency(struct libwebsocket_context *context, struct libwebsocket *wsi, const char *action, int ret, int completion) { while (0); }
static void lws_latency_pre(struct libwebsocket_context *context, struct libwebsocket *wsi) { while (0); }
#else
#define lws_latency_pre(_context, _wsi) lws_latency(_context, _wsi, NULL, 0, 0)
extern void