You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ac...@apache.org on 2017/04/12 22:52:10 UTC

[3/3] qpid-proton git commit: PROTON-1460: Improved proactor selection in cmake.

PROTON-1460: Improved proactor selection in cmake.

Pick a proactor with `cmake -DPROACTOR=name` where name is 'epoll', 'libuv' or 'none'.
'none' disables the proactor even if a default is available.

PROACTOR="" (the default) picks the first proactor that has its build
requirements satisfied.

Presently 'epoll' is not included as a default. When it is ready, enable the
commented part of this line:

    if (PROACTOR STREQUAL "epoll") # OR (NOT PROACTOR AND NOT PROACTOR_OK))


Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/c05c398e
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/c05c398e
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/c05c398e

Branch: refs/heads/master
Commit: c05c398e38c60bb29adec0b97e114494fb604d11
Parents: 2529bea
Author: Alan Conway <ac...@redhat.com>
Authored: Wed Apr 12 18:38:32 2017 -0400
Committer: Alan Conway <ac...@redhat.com>
Committed: Wed Apr 12 18:38:32 2017 -0400

----------------------------------------------------------------------
 proton-c/CMakeLists.txt             | 43 ++++++++++++++++++++++++--------
 tools/cmake/Modules/FindLibuv.cmake |  2 +-
 2 files changed, 33 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/c05c398e/proton-c/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/proton-c/CMakeLists.txt b/proton-c/CMakeLists.txt
index 086c5a2..7894de3 100644
--- a/proton-c/CMakeLists.txt
+++ b/proton-c/CMakeLists.txt
@@ -221,7 +221,6 @@ option(ENABLE_UNDEFINED_ERROR "Check for unresolved library symbols" ${DEFAULT_U
 option(ENABLE_LINKTIME_OPTIMIZATION "Perform link time optimization" ${DEFAULT_LINKTIME_OPTIMIZATION})
 option(ENABLE_HIDE_UNEXPORTED_SYMBOLS "Only export library symbols that are explicitly requested" ${DEFAULT_HIDE_UNEXPORTED_SYMBOLS})
 
-option(ENABLE_EPOLL "Use the Linux epoll proactor implementation" OFF)
 # Set any additional compiler specific flags
 if (CMAKE_COMPILER_IS_GNUCC)
   if (ENABLE_WARNING_ERROR)
@@ -474,24 +473,46 @@ set (qpid-proton-include-extra
   include/proton/url.h
 )
 
-# Select proactor sources and build flags
-if (ENABLE_EPOLL)
-  set (qpid-proton-proactor src/proactor/epoll.c)
-  set (PROACTOR_LIBS "")
-  set_source_files_properties (${qpid-proton-proactor} PROPERTIES
+#
+# Choose a proactor: user can set PROACTOR, or if not set pick a default.
+# The default is the first one that passes its build test, in order listed below.
+# "none" disables the proactor even if a default is available.
+#
+set(PROACTOR "" CACHE STRING "Override default proactor, one of: epoll, libuv, none")
+string(TOLOWER "${PROACTOR}" PROACTOR)
+
+# FIXME aconway 2017-04-12: not enabling epoll by default, must use PROACTOR=epoll
+# When it is more stable, enable as default by uncommenting # OR (NOT PROACTOR...
+if (PROACTOR STREQUAL "epoll") # OR (NOT PROACTOR AND NOT PROACTOR_OK))
+  check_symbol_exists(epoll_wait "sys/epoll.h" HAVE_EPOLL)
+  if (HAVE_EPOLL)
+    set (PROACTOR_OK epoll)
+    set (qpid-proton-proactor src/proactor/epoll.c)
+    set (PROACTOR_LIBS "")
+    set_source_files_properties (${qpid-proton-proactor} PROPERTIES
       COMPILE_FLAGS "${COMPILE_WARNING_FLAGS} ${COMPILE_LANGUAGE_FLAGS} ${LTO}"
-    )
-else (ENABLE_EPOLL)
+      )
+  endif()
+endif()
+
+if (PROACTOR STREQUAL "libuv" OR (NOT PROACTOR AND NOT PROACTOR_OK))
   find_package(Libuv)
-  if (Libuv_FOUND)
+  if (LIBUV_FOUND)
+    set (PROACTOR_OK libuv)
     set (qpid-proton-proactor src/proactor/libuv.c)
     set (PROACTOR_LIBS ${Libuv_LIBRARIES})
     set_source_files_properties (${qpid-proton-proactor} PROPERTIES
       # Skip COMPILE_LANGUAGE_FLAGS, libuv.h won't compile with --std=c99
       COMPILE_FLAGS "${COMPILE_WARNING_FLAGS} ${LTO} "
       )
-  endif(Libuv_FOUND)
-endif (ENABLE_EPOLL)
+  endif()
+endif()
+
+if (PROACTOR_OK)
+  message(STATUS "Building the ${PROACTOR_OK} proactor")
+elseif (PROACTOR AND NOT PROACTOR STREQUAL "none")
+  message(FATAL_ERROR "Cannot build the ${PROACTOR} proactor")
+endif()
 
 # note: process bindings after the source lists have been defined so
 # the bindings can reference them

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/c05c398e/tools/cmake/Modules/FindLibuv.cmake
----------------------------------------------------------------------
diff --git a/tools/cmake/Modules/FindLibuv.cmake b/tools/cmake/Modules/FindLibuv.cmake
index ae3ab70..048025d 100644
--- a/tools/cmake/Modules/FindLibuv.cmake
+++ b/tools/cmake/Modules/FindLibuv.cmake
@@ -34,4 +34,4 @@ find_library(Libuv_LIBRARIES Names uv libuv HINTS ${LIBUV_LIBRARYDIR} ${LIBUV_RO
 find_path(Libuv_INCLUDE_DIRS NAMES uv.h HINTS ${LIBUV_INCLUDEDIR} ${LIBUV_ROOT} ${LIBUV_ROOT}/include ${CMAKE_INSTALL_PREFIX}/include PATHS /usr/include)
 
 include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args(Libuv DEFAULT_MSG Libuv_LIBRARIES Libuv_INCLUDE_DIRS)
+find_package_handle_standard_args(Libuv REQUIRED_VARS Libuv_LIBRARIES Libuv_INCLUDE_DIRS)


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org