Some more Cmake stuff.
This commit is contained in:
parent
08e434eb66
commit
add3926b17
2 changed files with 193 additions and 16 deletions
|
@ -11,13 +11,26 @@ set(PACKAGE_TARNAME "${PACKAGE}")
|
|||
set(PACKAGE_URL "http://libwebsockets.org")
|
||||
set(VERSION "{PACKAGE_VERSION}")
|
||||
|
||||
option(WITH_SSL "Include SSL support", ON)
|
||||
option(WITH_SSL "Include SSL support (default OpenSSL, CyaSSL if USE_CYASSL is set)" ON)
|
||||
option(USE_INCLUDED_WIN32_ZLIB "Use the internal version of ZLib instead of searching the system" ON)
|
||||
option(USE_CYASSL "Use CyaSSL replacement for OpenSSL" OFF)
|
||||
option(WITH_BUILTIN_GETIFADDRS "Use BSD getifaddrs implementation from libwebsockets... default is your libc provides it" OFF)
|
||||
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(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)
|
||||
|
||||
set(CYASSL_LIB ON CACHE STRING "")
|
||||
set(CYASSL_INCLUDE_DIRS ON CACHE STRING "")
|
||||
|
||||
if (USE_CYASSL)
|
||||
if (NOT CYASSL_LIB OR NOT CYASSL_INCLUDE_DIRS)
|
||||
error("You must set CYASSL_LIB and CYASSL_INCLUDE_DIRS when USE_CYASSL is turned on")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake/")
|
||||
include_directories(${PROJECT_BINARY_DIR})
|
||||
|
||||
|
@ -93,13 +106,14 @@ if (WIN32)
|
|||
add_definitions(-D_WIN32_WINNT=0x0501)
|
||||
endif(WIN32)
|
||||
|
||||
|
||||
# Group headers and sources.
|
||||
# Some IDEs use this for nicer file structure.
|
||||
set(HDR_PRIVATE
|
||||
lib/private-libwebsockets.h)
|
||||
|
||||
set(HDR_PUBLIC
|
||||
lib/private-libwebsockets.h
|
||||
lib/extension-deflate-frame.h
|
||||
lib/lib/extension-deflate-stream.h
|
||||
lib/lib/extension-deflate-stream.h)
|
||||
|
||||
set(HDR_PUBLIC
|
||||
lib/libwebsockets.h
|
||||
)
|
||||
|
||||
|
@ -110,7 +124,7 @@ set(SOURCES
|
|||
lib/client-parser.c
|
||||
lib/daemonize.c
|
||||
lib/extension.c
|
||||
lib/extension-defalte-frame.c
|
||||
lib/extension-deflate-frame.c
|
||||
lib/extension-deflate-stream.c
|
||||
lib/handshake.c
|
||||
lib/libwebsockets.c
|
||||
|
@ -122,16 +136,43 @@ set(SOURCES
|
|||
lib/sha-1.c
|
||||
)
|
||||
|
||||
# Add helper files for Windows.
|
||||
if (WIN32)
|
||||
set(WIN32_HELPERS_PATH ${PROJECT_SOURCE_DIR}/win32port/win32helpers)
|
||||
|
||||
list(APPEND HDR_PRIVATE
|
||||
${WIN32_HELPERS_PATH}/websock-w32.h
|
||||
${WIN32_HELPERS_PATH}/gettimeofday.h
|
||||
)
|
||||
|
||||
list(APPEND SOURCES
|
||||
${WIN32_HELPERS_PATH}/websock-w32.c
|
||||
${WIN32_HELPERS_PATH}/gettimeofday.c
|
||||
)
|
||||
endif()
|
||||
|
||||
if (UNIX)
|
||||
if (!WITH_BUILTIN_GETIFADDRS)
|
||||
list(APPEND HDR_PRIVATE lib/getifaddrs.h)
|
||||
list(APPEND SOURCES lib/getifaddrs.c)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
source_group("Headers Private" FILES ${HDR_PRIVATE})
|
||||
source_group("Headers Public" FILES ${HDR_PUBLIC})
|
||||
source_group("Sources" FILES ${SOURCES})
|
||||
|
||||
if (UNIX)
|
||||
if (!WITH_BUILTIN_GETIFADDRS)
|
||||
list(APPEND HDR_PUBLIC lib/getifaddrs.h)
|
||||
list(APPEND SOURCES lib/getifaddrs.c)
|
||||
endif()
|
||||
endif()
|
||||
#
|
||||
# Create the lib.
|
||||
#
|
||||
add_library(websocket STATIC
|
||||
${HDR_PRIVATE}
|
||||
${HDR_PUBLIC}
|
||||
${SOURCES})
|
||||
|
||||
#
|
||||
# Find libraries.
|
||||
#
|
||||
|
||||
#
|
||||
# ZLIB.
|
||||
|
@ -172,7 +213,7 @@ else()
|
|||
endif()
|
||||
|
||||
include_directories(${ZLIB_INCLUDE_DIRS})
|
||||
target_link_libraries(websockets ${ZLIB_LIBRARIES})
|
||||
target_link_libraries(websocket ${ZLIB_LIBRARIES})
|
||||
|
||||
#
|
||||
# OpenSSL
|
||||
|
@ -187,8 +228,9 @@ if (WITH_SSL)
|
|||
# TODO: Add support for STATIC also.
|
||||
find_package(OpenSSL REQUIRED)
|
||||
endif()
|
||||
|
||||
include_directories(${OPENSSL_INCLUDE_DIR})
|
||||
target_link_libraries(websocket ${OPENSSL_LIBRARIES})
|
||||
endif()
|
||||
|
||||
include_directories(${OPENSSL_INCLUDE_DIR})
|
||||
target_link_libraries(websockets ${OPENSSL_LIBRARIES})
|
||||
|
||||
|
|
135
config.h.cmake
Normal file
135
config.h.cmake
Normal file
|
@ -0,0 +1,135 @@
|
|||
/* config.h.in. Generated from configure.ac by autoheader. */
|
||||
|
||||
#cmakedefine USE_CYASSL
|
||||
|
||||
/* Define to 1 if you have the `bzero' function. */
|
||||
#cmakedefine HAVE_BZERO
|
||||
|
||||
/* Define to 1 if you have the <dlfcn.h> header file. */
|
||||
#cmakedefine HAVE_DLFCN_H
|
||||
|
||||
/* Define to 1 if you have the <fcntl.h> header file. */
|
||||
#cmakedefine HAVE_FCNTL_H
|
||||
|
||||
/* Define to 1 if you have the `fork' function. */
|
||||
#cmakedefine HAVE_FORK
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#cmakedefine HAVE_INTTYPES_H
|
||||
|
||||
/* Define to 1 if you have the `ssl' library (-lssl). */
|
||||
//#cmakedefine HAVE_LIBSSL
|
||||
|
||||
/* Define to 1 if your system has a GNU libc compatible `malloc' function, and
|
||||
to 0 otherwise. */
|
||||
#cmakedefine HAVE_MALLOC
|
||||
|
||||
/* Define to 1 if you have the <memory.h> header file. */
|
||||
#cmakedefine HAVE_MEMORY_H
|
||||
|
||||
/* Define to 1 if you have the `memset' function. */
|
||||
#cmakedefine HAVE_MEMSET
|
||||
|
||||
/* Define to 1 if you have the <netinet/in.h> header file. */
|
||||
#cmakedefine HAVE_NETINET_IN_H
|
||||
|
||||
/* Define to 1 if your system has a GNU libc compatible `realloc' function,
|
||||
and to 0 otherwise. */
|
||||
#cmakedefine HAVE_REALLOC
|
||||
|
||||
/* Define to 1 if you have the `socket' function. */
|
||||
#cmakedefine HAVE_SOCKET
|
||||
|
||||
/* Define to 1 if you have the <stdint.h> header file. */
|
||||
#cmakedefine HAVE_STDINT_H
|
||||
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||
#cmakedefine HAVE_STDLIB_H
|
||||
|
||||
/* Define to 1 if you have the `strerror' function. */
|
||||
#cmakedefine HAVE_STRERROR
|
||||
|
||||
/* Define to 1 if you have the <strings.h> header file. */
|
||||
#cmakedefine HAVE_STRINGS_H
|
||||
|
||||
/* Define to 1 if you have the <string.h> header file. */
|
||||
#cmakedefine HAVE_STRING_H
|
||||
|
||||
/* Define to 1 if you have the <sys/prctl.h> header file. */
|
||||
#cmakedefine HAVE_SYS_PRCTL_H
|
||||
|
||||
/* Define to 1 if you have the <sys/socket.h> header file. */
|
||||
#cmakedefine HAVE_SYS_SOCKET_H
|
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
#cmakedefine HAVE_SYS_STAT_H
|
||||
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
#cmakedefine HAVE_SYS_TYPES_H
|
||||
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#cmakedefine HAVE_UNISTD_H
|
||||
|
||||
/* Define to 1 if you have the `vfork' function. */
|
||||
#cmakedefine HAVE_VFORK
|
||||
|
||||
/* Define to 1 if you have the <vfork.h> header file. */
|
||||
#cmakedefine HAVE_VFORK_H
|
||||
|
||||
/* Define to 1 if `fork' works. */
|
||||
#cmakedefine HAVE_WORKING_FORK
|
||||
|
||||
/* Define to 1 if `vfork' works. */
|
||||
#cmakedefine HAVE_WORKING_VFORK
|
||||
|
||||
/* Define to 1 if you have the <zlib.h> header file. */
|
||||
#cmakedefine HAVE_ZLIB_H
|
||||
|
||||
/* Define to the sub-directory in which libtool stores uninstalled libraries.
|
||||
*/
|
||||
#undef LT_OBJDIR // We're not using libtool
|
||||
|
||||
/* Name of package */
|
||||
#cmakedefine PACKAGE
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#cmakedefine PACKAGE_BUGREPORT
|
||||
|
||||
/* Define to the full name of this package. */
|
||||
#cmakedefine PACKAGE_NAME
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#cmakedefine PACKAGE_STRING
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#cmakedefine PACKAGE_TARNAME
|
||||
|
||||
/* Define to the home page for this package. */
|
||||
#cmakedefine PACKAGE_URL
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#cmakedefine PACKAGE_VERSION
|
||||
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
#cmakedefine STDC_HEADERS
|
||||
|
||||
/* Version number of package */
|
||||
#cmakedefine VERSION
|
||||
|
||||
/* Define to rpl_malloc if the replacement function should be used. */
|
||||
#cmakedefine malloc
|
||||
|
||||
/* Define to `int' if <sys/types.h> does not define. */
|
||||
#cmakedefine pid_t
|
||||
|
||||
/* Define to rpl_realloc if the replacement function should be used. */
|
||||
#cmakedefine realloc
|
||||
|
||||
/* Define to `unsigned int' if <sys/types.h> does not define. */
|
||||
#cmakedefine size_t
|
||||
|
||||
/* Define to 1 if we have getifaddrs */
|
||||
#cmakedefine HAVE_GETIFADDRS
|
||||
|
||||
/* Define as `fork' if `vfork' does not work. */
|
||||
//#cmakedefine vfork
|
Loading…
Add table
Reference in a new issue