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# The strategy is to only export to PARENT_SCOPE 25# 26# - changes to LIB_LIST 27# - changes to SOURCES 28# - includes via include_directories 29# 30# and keep everything else private 31 32include_directories(.) 33 34list(APPEND SOURCES 35 plat/windows/windows-fds.c 36 plat/windows/windows-file.c 37 plat/windows/windows-init.c 38 plat/windows/windows-misc.c 39 plat/windows/windows-pipe.c 40 plat/windows/windows-plugins.c 41 plat/windows/windows-service.c 42 plat/windows/windows-sockets.c 43 ) 44if (LWS_WITH_SYS_ASYNC_DNS) 45 list(APPEND SOURCES plat/windows/windows-resolv.c) 46endif() 47 48if (LWS_WITH_SPAWN) 49 list(APPEND SOURCES plat/windows/windows-spawn.c) 50endif() 51 52if (LWS_WITH_ZLIB AND LWS_WITH_BUNDLED_ZLIB) 53 set(WIN32_ZLIB_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../../win32port/zlib") 54 set(ZLIB_SRCS 55 ${WIN32_ZLIB_PATH}/adler32.c 56 ${WIN32_ZLIB_PATH}/compress.c 57 ${WIN32_ZLIB_PATH}/crc32.c 58 ${WIN32_ZLIB_PATH}/deflate.c 59 ${WIN32_ZLIB_PATH}/gzlib.c 60 ${WIN32_ZLIB_PATH}/gzread.c 61 ${WIN32_ZLIB_PATH}/gzwrite.c 62 ${WIN32_ZLIB_PATH}/infback.c 63 ${WIN32_ZLIB_PATH}/inffast.c 64 ${WIN32_ZLIB_PATH}/inflate.c 65 ${WIN32_ZLIB_PATH}/inftrees.c 66 ${WIN32_ZLIB_PATH}/trees.c 67 ${WIN32_ZLIB_PATH}/uncompr.c 68 ${WIN32_ZLIB_PATH}/zutil.c) 69 add_library(zlib_internal STATIC ${ZLIB_SRCS}) 70 set(ZLIB_INCLUDE_DIRS ${WIN32_ZLIB_PATH}) 71 set(ZLIB_LIBRARIES "") 72 set(ZLIB_FOUND 1) 73 # Make sure zlib_internal is compiled before the libs. 74 foreach (lib ${LWS_LIBRARIES}) 75 add_dependencies(${lib} zlib_internal) 76 endforeach() 77endif() 78 79# Add helper files for Windows 80 81# (from ./lib perspective) 82set(WIN32_HELPERS_PATH ../win32port/win32helpers) 83 84# from our perspective in ./lib/plat/windows 85include_directories(../../${WIN32_HELPERS_PATH}) 86 87list(APPEND SOURCES 88 ${WIN32_HELPERS_PATH}/gettimeofday.c 89) 90 91list(APPEND HDR_PRIVATE 92 ${WIN32_HELPERS_PATH}/gettimeofday.h 93) 94 95# 96# Keep explicit parent scope exports at end 97# 98 99exports_to_parent_scope() 100set(WIN32_HELPERS_PATH ${WIN32_HELPERS_PATH} PARENT_SCOPE) 101set(HDR_PRIVATE ${HDR_PRIVATE} PARENT_SCOPE) 102set(ZLIB_FOUND ${ZLIB_FOUND} PARENT_SCOPE) 103set(LIB_LIST_AT_END ${LIB_LIST_AT_END} PARENT_SCOPE) 104