diff --git a/CMakeLists.txt b/CMakeLists.txt index fb1f6f85b9..bdcef544c8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -94,6 +94,8 @@ INCLUDE (find_flex) FIND_FLEX() ADD_SUBDIRECTORY(opal) +# set up the libevent include dirs +INCLUDE_DIRECTORIES (${LIBEVENT_INCLUDE_DIRS}) ADD_SUBDIRECTORY(ompi) ADD_SUBDIRECTORY(orte) diff --git a/contrib/platform/win32/CMakeModules/opal_event_config.cmake b/contrib/platform/win32/CMakeModules/opal_event_config.cmake index 9c572c6acc..104b5a5caa 100644 --- a/contrib/platform/win32/CMakeModules/opal_event_config.cmake +++ b/contrib/platform/win32/CMakeModules/opal_event_config.cmake @@ -7,58 +7,85 @@ # $HEADER$ # -MESSAGE(STATUS "configure libevent.") +# Only one libevent component should be used, selection is done by editing .windows in_use property. -# set up event include directories. -INCLUDE_DIRECTORIES ("${CURRENT_PATH}/libevent/compat" - "${CURRENT_PATH}/libevent/WIN32-Code/" - "${CURRENT_PATH}/libevent/include/" - "${CURRENT_PATH}/libevent" - "${PROJECT_BINARY_DIR}/mca/event/libevent207/libevent/include/") +FILE(STRINGS ${CURRENT_PATH}/.windows IN_USE REGEX "^in_use=") -IF(WIN32) +IF(IN_USE STREQUAL "0") -# generating config.h -# windows doesn't need this file, just make an empty one -FILE(WRITE ${PROJECT_BINARY_DIR}/mca/event/libevent207/libevent/include/config.h - " /* config.h. Generated automatically by CMake. */ ") + SET(RESULT FALSE) - SET(RESULT_SOURCE_FILES - ${RESULT_SOURCE_FILES} - ${CURRENT_PATH}/libevent207_component.c - ${CURRENT_PATH}/libevent207_module.c - #system sources - ${CURRENT_PATH}/libevent/win32select.c - ${CURRENT_PATH}/libevent/evthread_win32.c - ${CURRENT_PATH}/libevent/buffer_iocp.c - ${CURRENT_PATH}/libevent/event_iocp.c - ${CURRENT_PATH}/libevent/bufferevent_async.c - #core sources - ${CURRENT_PATH}/libevent/event.c - ${CURRENT_PATH}/libevent/evthread.c - ${CURRENT_PATH}/libevent/buffer.c - ${CURRENT_PATH}/libevent/bufferevent.c - ${CURRENT_PATH}/libevent/bufferevent_sock.c - ${CURRENT_PATH}/libevent/bufferevent_filter.c - ${CURRENT_PATH}/libevent/bufferevent_pair.c - ${CURRENT_PATH}/libevent/listener.c - ${CURRENT_PATH}/libevent/bufferevent_ratelim.c - ${CURRENT_PATH}/libevent/evmap.c - ${CURRENT_PATH}/libevent/log.c - ${CURRENT_PATH}/libevent/evutil.c - ${CURRENT_PATH}/libevent/evutil_rand.c - ${CURRENT_PATH}/libevent/strlcpy.c - ${CURRENT_PATH}/libevent/signal.c - ${CURRENT_PATH}/libevent/event_tagging.c - ) +ELSE(IN_USE STREQUAL "0") - OMPI_DEF(OPAL_HAVE_WORKING_EVENTOPS 1 - "Whether our event component has working event operations or not if not, then assumedly it only has working timers and signals)." 0 1) + IF(LIBEVENT_CONFIG_DONE) + MESSAGE(STATUS "multiple libevent selected, only one is configured.") + SET(RESULT FALSE) -ELSE(WIN32) - SET(RESULT_SOURCE_FILES - ${RESULT_SOURCE_FILES} - ) -ENDIF(WIN32) + ELSE(LIBEVENT_CONFIG_DONE) + SET(LIBEVENT_FOUND TRUE CACHE INTERNAL "allow only one event mca.") -SET(RESULT TRUE) \ No newline at end of file + MESSAGE(STATUS "configure libevent.") + + # set up event include directories. + INCLUDE_DIRECTORIES ("${CURRENT_PATH}/libevent/compat" + "${CURRENT_PATH}/libevent/WIN32-Code/" + "${CURRENT_PATH}/libevent/include/" + "${CURRENT_PATH}/libevent" + "${PROJECT_BINARY_DIR}/mca/event/libevent207/libevent/include/") + + SET(LIBEVENT_INCLUDE_DIRS ${CURRENT_PATH}/libevent/compat;${CURRENT_PATH}/libevent/WIN32-Code/;${CURRENT_PATH}/libevent/include/;${CURRENT_PATH}/libevent;${PROJECT_BINARY_DIR}/mca/event/libevent207/libevent/include/ + CACHE INTERNAL "the libevent dirs that have to be included on the top level.") + + IF(WIN32) + + # generating config.h + # windows doesn't need this file, just make an empty one + FILE(WRITE ${PROJECT_BINARY_DIR}/mca/event/libevent207/libevent/include/config.h + " /* config.h. Generated automatically by CMake. */ ") + + SET(RESULT_SOURCE_FILES + ${RESULT_SOURCE_FILES} + ${CURRENT_PATH}/libevent207_component.c + ${CURRENT_PATH}/libevent207_module.c + #system sources + ${CURRENT_PATH}/libevent/win32select.c + ${CURRENT_PATH}/libevent/evthread_win32.c + ${CURRENT_PATH}/libevent/buffer_iocp.c + ${CURRENT_PATH}/libevent/event_iocp.c + ${CURRENT_PATH}/libevent/bufferevent_async.c + #core sources + ${CURRENT_PATH}/libevent/event.c + ${CURRENT_PATH}/libevent/evthread.c + ${CURRENT_PATH}/libevent/buffer.c + ${CURRENT_PATH}/libevent/bufferevent.c + ${CURRENT_PATH}/libevent/bufferevent_sock.c + ${CURRENT_PATH}/libevent/bufferevent_filter.c + ${CURRENT_PATH}/libevent/bufferevent_pair.c + ${CURRENT_PATH}/libevent/listener.c + ${CURRENT_PATH}/libevent/bufferevent_ratelim.c + ${CURRENT_PATH}/libevent/evmap.c + ${CURRENT_PATH}/libevent/log.c + ${CURRENT_PATH}/libevent/evutil.c + ${CURRENT_PATH}/libevent/evutil_rand.c + ${CURRENT_PATH}/libevent/strlcpy.c + ${CURRENT_PATH}/libevent/signal.c + ${CURRENT_PATH}/libevent/event_tagging.c + ) + + OMPI_DEF(OPAL_HAVE_WORKING_EVENTOPS 1 + "Whether our event component has working event operations or not if not, then assumedly it only has working timers and signals)." 0 1) + + OMPI_DEF(MCA_event_IMPLEMENTATION_HEADER "${CURRENT_PATH}/libevent207.h" + "Header to include for event implementation" 1 1) + + ELSE(WIN32) + SET(RESULT_SOURCE_FILES + ${RESULT_SOURCE_FILES} + ) + ENDIF(WIN32) + + SET(RESULT TRUE) + + ENDIF(LIBEVENT_CONFIG_DONE) + +ENDIF(IN_USE STREQUAL "0") \ No newline at end of file diff --git a/opal/mca/event/libevent207/.windows b/opal/mca/event/libevent207/.windows index 61fba52e8f..4ff95dc143 100644 --- a/opal/mca/event/libevent207/.windows +++ b/opal/mca/event/libevent207/.windows @@ -9,5 +9,5 @@ # not_single_shared_lib=1 - +in_use=1 required_check=opal_event_config \ No newline at end of file diff --git a/opal/mca/event/libevent207/libevent/include/event2/event.h b/opal/mca/event/libevent207/libevent/include/event2/event.h index 5f90e882d3..7e9fed37e1 100644 --- a/opal/mca/event/libevent207/libevent/include/event2/event.h +++ b/opal/mca/event/libevent207/libevent/include/event2/event.h @@ -321,7 +321,7 @@ int event_base_set(struct event_base *, struct event *); registered. @see event_loopexit(), event_base_loop() */ -int event_base_loop(struct event_base *, int); +OPAL_DECLSPEC int event_base_loop(struct event_base *, int); /** Exit the event loop after the specified time (threadsafe variant). @@ -469,7 +469,7 @@ typedef void (*event_callback_fn)(evutil_socket_t, short, void *); @see event_add(), event_del(), event_once() */ -int event_assign(struct event *, struct event_base *, evutil_socket_t, short, event_callback_fn, void *); +OPAL_DECLSPEC int event_assign(struct event *, struct event_base *, evutil_socket_t, short, event_callback_fn, void *); /** Create and allocate a new event structure, ready to be added. @@ -523,7 +523,7 @@ int event_base_once(struct event_base *, evutil_socket_t, short, event_callback_ @return 0 if successful, or -1 if an error occurred @see event_del(), event_set() */ -int event_add(struct event *, const struct timeval *); +OPAL_DECLSPEC int event_add(struct event *, const struct timeval *); /** Remove an event from the set of monitored events. @@ -536,7 +536,7 @@ int event_add(struct event *, const struct timeval *); @return 0 if successful, or -1 if an error occurred @see event_add() */ -int event_del(struct event *); +OPAL_DECLSPEC int event_del(struct event *); /** diff --git a/opal/mca/event/libevent207/libevent207.h b/opal/mca/event/libevent207/libevent207.h index dcb1b0ed47..63933ba758 100644 --- a/opal/mca/event/libevent207/libevent207.h +++ b/opal/mca/event/libevent207/libevent207.h @@ -42,7 +42,9 @@ #include #include #include +#ifndef WIN32 #include +#endif #include "opal/class/opal_object.h" #include "opal/threads/mutex.h" diff --git a/orte/runtime/orte_wait.c b/orte/runtime/orte_wait.c index bea3eabde1..296201f158 100644 --- a/orte/runtime/orte_wait.c +++ b/orte/runtime/orte_wait.c @@ -1121,7 +1121,7 @@ int orte_wait_event(opal_event_t **event, orte_trigger_event_t *trig, trig->name = strdup(trigger_name); /* create the event */ - *event = OBJ_NEW(opal_event_t); + *event = (opal_event_t *) malloc(sizeof(opal_event_t)); /* setup the trigger and its associated lock */ OBJ_CONSTRUCT(trig, orte_trigger_event_t);