CMakeLists.txt 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. #
  2. # libwebsockets - small server side websockets and web server implementation
  3. #
  4. # Copyright (C) 2010 - 2020 Andy Green <[email protected]>
  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. include_directories(.)
  25. macro(create_evlib_plugin PLUGIN_NAME MAIN_SRC PLUGIN_HDR EVLIB)
  26. set(PLUGIN_SRCS ${MAIN_SRC})
  27. source_group("Headers Private" FILES ${PLUGIN_HDR})
  28. source_group("Sources" FILES ${MAIN_SRC})
  29. add_library(websockets-${PLUGIN_NAME} SHARED ${MAIN_SRC} ${PLUGIN_HDR})
  30. if (APPLE)
  31. set_property(TARGET websockets-${PLUGIN_NAME} PROPERTY MACOSX_RPATH YES)
  32. endif()
  33. foreach(libpath ${LWS_DEP_LIB_PATHS})
  34. target_link_directories(${TEST_NAME} ${libpath})
  35. endforeach()
  36. target_link_libraries(websockets-${PLUGIN_NAME} websockets_shared ${EVLIB})
  37. add_dependencies(websockets-${PLUGIN_NAME} websockets_shared)
  38. target_include_directories(websockets-${PLUGIN_NAME} PRIVATE
  39. ${PLUGIN_INCLUDE} ${LWS_LIB_BUILD_INC_PATHS})
  40. # Set test app specific defines.
  41. # set_property(TARGET ${PLUGIN_NAME}
  42. # PROPERTY COMPILE_DEFINITIONS
  43. # INSTALL_DATADIR="${CMAKE_INSTALL_PREFIX}/evlib-plugins"
  44. #)
  45. set(CMAKE_POSITION_INDEPENDENT_CODE ON)
  46. install(TARGETS websockets-${PLUGIN_NAME}
  47. EXPORT LibwebsocketsTargets
  48. LIBRARY DESTINATION "${LWS_INSTALL_LIB_DIR}${LIB_SUFFIX}"
  49. COMPONENT ${PLUGIN_NAME})
  50. list(APPEND EVLIB_PLUGINS_LIST websockets-${PLUGIN_NAME})
  51. endmacro()
  52. #
  53. # poll support gets built into the lib as the default
  54. #
  55. if (LWS_WITH_POLL)
  56. add_subdir_include_directories(poll)
  57. endif()
  58. if (LWS_WITH_LIBUV OR LWS_WITH_LIBUV_INTERNAL)
  59. add_subdir_include_directories(libuv)
  60. set(LWS_HAVE_UV_VERSION_H ${LWS_HAVE_UV_VERSION_H} PARENT_SCOPE)
  61. set(LWS_HAVE_NEW_UV_VERSION_H ${LWS_HAVE_NEW_UV_VERSION_H} PARENT_SCOPE)
  62. endif()
  63. if (LWS_WITH_LIBEVENT)
  64. add_subdir_include_directories(libevent)
  65. endif()
  66. if (LWS_WITH_GLIB)
  67. add_subdir_include_directories(glib)
  68. endif()
  69. if (LWS_WITH_LIBEV)
  70. add_subdir_include_directories(libev)
  71. set(LWS_HAVE_EVBACKEND_LINUXAIO ${LWS_HAVE_EVBACKEND_LINUXAIO} PARENT_SCOPE)
  72. set(LWS_HAVE_EVBACKEND_IOURING ${LWS_HAVE_EVBACKEND_IOURING} PARENT_SCOPE)
  73. endif()
  74. #
  75. # Keep explicit parent scope exports at end
  76. #
  77. export_to_parent_intermediate()
  78. set(EVLIB_PLUGINS_LIST ${EVLIB_PLUGINS_LIST} PARENT_SCOPE)