1d4afb5ceSopenharmony_ci#
2d4afb5ceSopenharmony_ci# libwebsockets - small server side websockets and web server implementation
3d4afb5ceSopenharmony_ci#
4d4afb5ceSopenharmony_ci# Copyright (C) 2010 - 2020 Andy Green <andy@warmcat.com>
5d4afb5ceSopenharmony_ci#
6d4afb5ceSopenharmony_ci# Permission is hereby granted, free of charge, to any person obtaining a copy
7d4afb5ceSopenharmony_ci# of this software and associated documentation files (the "Software"), to
8d4afb5ceSopenharmony_ci# deal in the Software without restriction, including without limitation the
9d4afb5ceSopenharmony_ci# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10d4afb5ceSopenharmony_ci# sell copies of the Software, and to permit persons to whom the Software is
11d4afb5ceSopenharmony_ci# furnished to do so, subject to the following conditions:
12d4afb5ceSopenharmony_ci#
13d4afb5ceSopenharmony_ci# The above copyright notice and this permission notice shall be included in
14d4afb5ceSopenharmony_ci# all copies or substantial portions of the Software.
15d4afb5ceSopenharmony_ci#
16d4afb5ceSopenharmony_ci# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17d4afb5ceSopenharmony_ci# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18d4afb5ceSopenharmony_ci# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19d4afb5ceSopenharmony_ci# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20d4afb5ceSopenharmony_ci# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21d4afb5ceSopenharmony_ci# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
22d4afb5ceSopenharmony_ci# IN THE SOFTWARE.
23d4afb5ceSopenharmony_ci#
24d4afb5ceSopenharmony_ci# The strategy is to only export to PARENT_SCOPE
25d4afb5ceSopenharmony_ci#
26d4afb5ceSopenharmony_ci#  - changes to LIB_LIST
27d4afb5ceSopenharmony_ci#  - changes to SOURCES
28d4afb5ceSopenharmony_ci#  - includes via include_directories
29d4afb5ceSopenharmony_ci#
30d4afb5ceSopenharmony_ci# and keep everything else private
31d4afb5ceSopenharmony_ci
32d4afb5ceSopenharmony_ciinclude_directories(.)
33d4afb5ceSopenharmony_ci
34d4afb5ceSopenharmony_ciexecute_process( COMMAND grep -c illumos /lib/ld.so.1 
35d4afb5ceSopenharmony_ci		 OUTPUT_VARIABLE ILLUMOS ERROR_QUIET )
36d4afb5ceSopenharmony_ci# Chomp the \n at end of output.
37d4afb5ceSopenharmony_cistring(REGEX REPLACE "[\n]+" "" ILLUMOS "${ILLUMOS}")
38d4afb5ceSopenharmony_ci
39d4afb5ceSopenharmony_ciif (NOT ${ILLUMOS} MATCHES "0")
40d4afb5ceSopenharmony_ci	set(ILLUMOS 1)
41d4afb5ceSopenharmony_ciendif()
42d4afb5ceSopenharmony_ci
43d4afb5ceSopenharmony_ciset(LWS_PLAT_UNIX 1)
44d4afb5ceSopenharmony_cilist(APPEND SOURCES
45d4afb5ceSopenharmony_ci	plat/unix/unix-caps.c
46d4afb5ceSopenharmony_ci	plat/unix/unix-misc.c
47d4afb5ceSopenharmony_ci	plat/unix/unix-init.c
48d4afb5ceSopenharmony_ci)
49d4afb5ceSopenharmony_ciif (LWS_WITH_FILE_OPS)
50d4afb5ceSopenharmony_ci	list(APPEND SOURCES plat/unix/unix-file.c)
51d4afb5ceSopenharmony_ciendif()
52d4afb5ceSopenharmony_ciif (LWS_WITH_NETWORK)
53d4afb5ceSopenharmony_ci	list(APPEND SOURCES
54d4afb5ceSopenharmony_ci		plat/unix/unix-pipe.c
55d4afb5ceSopenharmony_ci		plat/unix/unix-service.c
56d4afb5ceSopenharmony_ci		plat/unix/unix-sockets.c
57d4afb5ceSopenharmony_ci		plat/unix/unix-fds.c
58d4afb5ceSopenharmony_ci	)
59d4afb5ceSopenharmony_ci	if (LWS_WITH_SYS_ASYNC_DNS)
60d4afb5ceSopenharmony_ci		if (LWS_PLAT_ANDROID)
61d4afb5ceSopenharmony_ci			list(APPEND SOURCES plat/unix/android/android-resolv.c)
62d4afb5ceSopenharmony_ci		else()
63d4afb5ceSopenharmony_ci			list(APPEND SOURCES plat/unix/unix-resolv.c)
64d4afb5ceSopenharmony_ci		endif()
65d4afb5ceSopenharmony_ci	endif()
66d4afb5ceSopenharmony_ciendif()
67d4afb5ceSopenharmony_ci	
68d4afb5ceSopenharmony_ciif (LWS_WITH_PLUGINS_API)
69d4afb5ceSopenharmony_ci	list(APPEND SOURCES plat/unix/unix-plugins.c)
70d4afb5ceSopenharmony_ciendif()
71d4afb5ceSopenharmony_ci
72d4afb5ceSopenharmony_ciif (LWS_WITH_SPAWN)
73d4afb5ceSopenharmony_ci	list(APPEND SOURCES plat/unix/unix-spawn.c)
74d4afb5ceSopenharmony_ciendif()
75d4afb5ceSopenharmony_ci
76d4afb5ceSopenharmony_ciif (HAIKU)
77d4afb5ceSopenharmony_ci	set(CMAKE_REQUIRED_LIBRARIES network)
78d4afb5ceSopenharmony_ci	list(APPEND LIB_LIST_AT_END network)
79d4afb5ceSopenharmony_ciendif()
80d4afb5ceSopenharmony_ci
81d4afb5ceSopenharmony_ciIF (CMAKE_SYSTEM_NAME STREQUAL Linux AND NOT LWS_WITHOUT_EVENTFD)
82d4afb5ceSopenharmony_ci	CHECK_FUNCTION_EXISTS(eventfd_read LWS_HAVE_EVENTFD)
83d4afb5ceSopenharmony_ciendif()
84d4afb5ceSopenharmony_ci
85d4afb5ceSopenharmony_cilist(APPEND LIB_LIST_AT_END m)
86d4afb5ceSopenharmony_ci
87d4afb5ceSopenharmony_ciif (ILLUMOS)
88d4afb5ceSopenharmony_ci	list(APPEND LIB_LIST_AT_END socket)
89d4afb5ceSopenharmony_ciendif()
90d4afb5ceSopenharmony_ci
91d4afb5ceSopenharmony_ciif (LWS_HAVE_LIBCAP)
92d4afb5ceSopenharmony_ci	list(APPEND LIB_LIST_AT_END cap)
93d4afb5ceSopenharmony_ciendif()
94d4afb5ceSopenharmony_ci
95d4afb5ceSopenharmony_ciif (${CMAKE_SYSTEM_NAME} MATCHES "QNX")
96d4afb5ceSopenharmony_ci	list(APPEND LIB_LIST_AT_END socket)
97d4afb5ceSopenharmony_ciendif()
98d4afb5ceSopenharmony_ci
99d4afb5ceSopenharmony_cilist(APPEND LIB_LIST_AT_END ${CMAKE_DL_LIBS})
100d4afb5ceSopenharmony_ci
101d4afb5ceSopenharmony_ci#
102d4afb5ceSopenharmony_ci# Keep explicit parent scope exports at end
103d4afb5ceSopenharmony_ci#
104d4afb5ceSopenharmony_ci
105d4afb5ceSopenharmony_ciexports_to_parent_scope()
106d4afb5ceSopenharmony_ciset(LWS_PLAT_UNIX ${LWS_PLAT_UNIX} PARENT_SCOPE)
107d4afb5ceSopenharmony_ciset(ILLUMOS ${ILLUMOS} PARENT_SCOPE)
108d4afb5ceSopenharmony_ciset(LIB_LIST_AT_END ${LIB_LIST_AT_END} PARENT_SCOPE)
109d4afb5ceSopenharmony_ciset(LWS_PLAT_UNIX ${LWS_PLAT_UNIX} PARENT_SCOPE)
110