• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#
2# libwebsockets - small server side websockets and web server implementation
3#
4# Copyright (C) 2010 - 2020 Andy Green <andy@warmcat.com>
5#
6# Permission is hereby granted, free of charge, to any person obtaining a copy
7# of this software and associated documentation files (the "Software"), to
8# deal in the Software without restriction, including without limitation the
9# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10# sell copies of the Software, and to permit persons to whom the Software is
11# furnished to do so, subject to the following conditions:
12#
13# The above copyright notice and this permission notice shall be included in
14# all copies or substantial portions of the Software.
15#
16# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
22# IN THE SOFTWARE.
23#
24
25include_directories(.)
26
27macro(create_evlib_plugin PLUGIN_NAME MAIN_SRC PLUGIN_HDR EVLIB)
28
29	set(PLUGIN_SRCS ${MAIN_SRC})
30
31	source_group("Headers Private"   FILES ${PLUGIN_HDR})
32	source_group("Sources"   FILES ${MAIN_SRC})
33	add_library(websockets-${PLUGIN_NAME} SHARED ${MAIN_SRC} ${PLUGIN_HDR})
34
35	if (APPLE)
36		set_property(TARGET websockets-${PLUGIN_NAME} PROPERTY MACOSX_RPATH YES)
37	endif()
38
39	foreach(libpath ${LWS_DEP_LIB_PATHS})
40		target_link_directories(${TEST_NAME} ${libpath})
41	endforeach()
42
43	target_link_libraries(websockets-${PLUGIN_NAME} websockets_shared ${EVLIB})
44	add_dependencies(websockets-${PLUGIN_NAME} websockets_shared)
45	target_compile_definitions(websockets-${PLUGIN_NAME} PRIVATE LWS_BUILDING_SHARED)
46
47	target_include_directories(websockets-${PLUGIN_NAME} PRIVATE
48			${PLUGIN_INCLUDE} ${LWS_LIB_BUILD_INC_PATHS})
49
50	# Set test app specific defines.
51	#	set_property(TARGET ${PLUGIN_NAME}
52	#	     PROPERTY COMPILE_DEFINITIONS
53	#	     INSTALL_DATADIR="${CMAKE_INSTALL_PREFIX}/evlib-plugins"
54	#)
55
56	set(CMAKE_POSITION_INDEPENDENT_CODE ON)
57
58	install(TARGETS websockets-${PLUGIN_NAME}
59		EXPORT LibwebsocketsTargets
60		LIBRARY DESTINATION "${LWS_INSTALL_LIB_DIR}${LIB_SUFFIX}"
61		COMPONENT ${PLUGIN_NAME})
62
63	list(APPEND EVLIB_PLUGINS_LIST websockets-${PLUGIN_NAME})
64
65endmacro()
66
67#
68# poll support gets built into the lib as the default
69#
70
71if (LWS_WITH_POLL)
72	add_subdir_include_directories(poll)
73endif()
74
75if (LWS_WITH_LIBUV OR LWS_WITH_LIBUV_INTERNAL)
76	add_subdir_include_directories(libuv)
77	set(LWS_HAVE_UV_VERSION_H ${LWS_HAVE_UV_VERSION_H} PARENT_SCOPE)
78	set(LWS_HAVE_NEW_UV_VERSION_H ${LWS_HAVE_NEW_UV_VERSION_H} PARENT_SCOPE)
79endif()
80
81if (LWS_WITH_LIBEVENT)
82	add_subdir_include_directories(libevent)
83endif()
84
85if (LWS_WITH_GLIB)
86	add_subdir_include_directories(glib)
87endif()
88
89if (LWS_WITH_LIBEV)
90	add_subdir_include_directories(libev)
91	set(LWS_HAVE_EVBACKEND_LINUXAIO ${LWS_HAVE_EVBACKEND_LINUXAIO} PARENT_SCOPE)
92	set(LWS_HAVE_EVBACKEND_IOURING ${LWS_HAVE_EVBACKEND_IOURING} PARENT_SCOPE)
93endif()
94
95if (LWS_WITH_SDEVENT)
96	add_subdir_include_directories(sdevent)
97endif()
98
99if (LWS_WITH_ULOOP)
100	add_subdir_include_directories(uloop)
101endif()
102
103#
104# Keep explicit parent scope exports at end
105#
106
107export_to_parent_intermediate()
108set(EVLIB_PLUGINS_LIST ${EVLIB_PLUGINS_LIST} PARENT_SCOPE)
109
110