Add new definition to support custom connection (default on).
Signed-off-by: Jaeyun Jung <jy1210.jung@samsung.com>
OPTION(ENABLE_TIZEN "Enable Tizen build" OFF)
# Default features. You may change the features according to your needs.
+OPTION(ENABLE_CUSTOM_CONNECTION "Enable custom connection" ON)
OPTION(MQTT_SUPPORT "Enable MQTT" OFF)
IF (NOT DEFINED VERSION)
ADD_DEFINITIONS(${EDGE_REQUIRE_PKGS_CFLAGS})
ENDIF()
+# Support custom connection
+IF(ENABLE_CUSTOM_CONNECTION)
+ SET(NNS_EDGE_FLAGS "${NNS_EDGE_FLAGS} -DENABLE_CUSTOM_CONNECTION=1")
+ENDIF()
+
# MQTT Library
IF(MQTT_SUPPORT)
FIND_LIBRARY(MOSQUITTO_LIB NAMES mosquitto)
# nnstreamer-edge sources
NNSTREAMER_EDGE_SRCS := \
- $(NNSTREAMER_EDGE_ROOT)/src/libnnstreamer-edge/nnstreamer-edge-custom-impl.c \
$(NNSTREAMER_EDGE_ROOT)/src/libnnstreamer-edge/nnstreamer-edge-data.c \
$(NNSTREAMER_EDGE_ROOT)/src/libnnstreamer-edge/nnstreamer-edge-event.c \
$(NNSTREAMER_EDGE_ROOT)/src/libnnstreamer-edge/nnstreamer-edge-internal.c \
# Default features for Tizen releases
%define mqtt_support 1
+%define custom_connection_support 1
# Define features for TV releases
%if "%{?profile}" == "tv"
%define enable_mqtt -DMQTT_SUPPORT=OFF
%endif
+%if 0%{?custom_connection_support}
+%define enable_custom_connection -DENABLE_CUSTOM_CONNECTION=ON
+%else
+%define enable_custom_connection -DENABLE_CUSTOM_CONNECTION=OFF
+%endif
+
%prep
%setup -q
cp %{SOURCE1001} .
%cmake .. \
-DCMAKE_INSTALL_PREFIX=%{_prefix} \
-DVERSION=%{version} \
- %{enable_tizen} %{enable_unittest} %{enable_mqtt}
+ %{enable_tizen} %{enable_unittest} %{enable_mqtt} %{enable_custom_connection}
make %{?jobs:-j%jobs}
popd
%if 0%{?unit_test}
LD_LIBRARY_PATH=./src bash %{test_script} ./tests/unittest_nnstreamer-edge
+
+%if 0%{?custom_connection_support}
LD_LIBRARY_PATH=./src:./tests bash %{test_script} ./tests/unittest_nnstreamer-edge-custom
+%endif
%if 0%{?mqtt_support}
LD_LIBRARY_PATH=./src bash %{test_script} ./tests/unittest_nnstreamer-edge-mqtt
%files devel
%{_includedir}/nnstreamer/nnstreamer-edge.h
-%{_includedir}/nnstreamer/nnstreamer-edge-custom.h
%{_includedir}/nnstreamer/nnstreamer-edge-data.h
%{_includedir}/nnstreamer/nnstreamer-edge-event.h
%{_libdir}/pkgconfig/nnstreamer-edge.pc
+%if 0%{?custom_connection_support}
+%{_includedir}/nnstreamer/nnstreamer-edge-custom.h
+%endif
%if 0%{?unit_test}
%files unittest
%manifest nnstreamer-edge.manifest
%defattr(-,root,root,-)
%{_bindir}/unittest_nnstreamer-edge
+%if 0%{?custom_connection_support}
%{_bindir}/unittest_nnstreamer-edge-custom
%{_libdir}/libnnstreamer-edge-custom-test.so*
-
+%endif
%if 0%{?mqtt_support}
%{_bindir}/unittest_nnstreamer-edge-mqtt
%endif
# NNStreamer-Edge library
SET(NNS_EDGE_SRCS
- ${NNS_EDGE_SRC_DIR}/nnstreamer-edge-custom-impl.c
${NNS_EDGE_SRC_DIR}/nnstreamer-edge-metadata.c
${NNS_EDGE_SRC_DIR}/nnstreamer-edge-data.c
${NNS_EDGE_SRC_DIR}/nnstreamer-edge-event.c
${NNS_EDGE_SRC_DIR}/nnstreamer-edge-util.c
${NNS_EDGE_SRC_DIR}/nnstreamer-edge-queue.c
)
+
+IF(ENABLE_CUSTOM_CONNECTION)
+ SET(NNS_EDGE_SRCS ${NNS_EDGE_SRCS} ${NNS_EDGE_SRC_DIR}/nnstreamer-edge-custom-impl.c)
+ENDIF()
+
IF (NOT ENABLE_TIZEN)
SET(NNS_EDGE_SRCS ${NNS_EDGE_SRCS} ${NNS_EDGE_SRC_DIR}/nnstreamer-edge-log.c)
ENDIF()
INSTALL (TARGETS ${NNS_EDGE_LIB_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR})
INSTALL (FILES ${INCLUDE_DIR}/nnstreamer-edge.h DESTINATION ${INCLUDE_INSTALL_DIR})
-INSTALL (FILES ${INCLUDE_DIR}/nnstreamer-edge-custom.h DESTINATION ${INCLUDE_INSTALL_DIR})
INSTALL (FILES ${INCLUDE_DIR}/nnstreamer-edge-data.h DESTINATION ${INCLUDE_INSTALL_DIR})
INSTALL (FILES ${INCLUDE_DIR}/nnstreamer-edge-event.h DESTINATION ${INCLUDE_INSTALL_DIR})
+IF(ENABLE_CUSTOM_CONNECTION)
+ INSTALL (FILES ${INCLUDE_DIR}/nnstreamer-edge-custom.h DESTINATION ${INCLUDE_INSTALL_DIR})
+ENDIF()
void *priv;
} custom_connection_s;
+#if defined(ENABLE_CUSTOM_CONNECTION)
/**
* @brief Internal function to load custom connection from library.
*/
* @brief Internal function to get information from custom connection.
*/
int nns_edge_custom_get_info (custom_connection_s *custom, const char *key, char **value);
+#else
+#define nns_edge_custom_load(...) (NNS_EDGE_ERROR_NOT_SUPPORTED)
+#define nns_edge_custom_release(...) (NNS_EDGE_ERROR_NOT_SUPPORTED)
+#define nns_edge_custom_start(...) (NNS_EDGE_ERROR_NOT_SUPPORTED)
+#define nns_edge_custom_stop(...) (NNS_EDGE_ERROR_NOT_SUPPORTED)
+#define nns_edge_custom_set_event_callback(...) (NNS_EDGE_ERROR_NOT_SUPPORTED)
+#define nns_edge_custom_connect(...) (NNS_EDGE_ERROR_NOT_SUPPORTED)
+#define nns_edge_custom_is_connected(...) (NNS_EDGE_ERROR_NOT_SUPPORTED)
+#define nns_edge_custom_send_data(...) (NNS_EDGE_ERROR_NOT_SUPPORTED)
+#define nns_edge_custom_set_info(...) (NNS_EDGE_ERROR_NOT_SUPPORTED)
+#define nns_edge_custom_get_info(...) (NNS_EDGE_ERROR_NOT_SUPPORTED)
+#endif /* ENABLE_CUSTOM_CONNECTION */
#ifdef __cplusplus
}
INSTALL (TARGETS unittest_nnstreamer-edge DESTINATION ${BIN_INSTALL_DIR})
# Custom connection lib for unit test
+IF(ENABLE_CUSTOM_CONNECTION)
SET(NNS_EDGE_CUSTOM_TEST_LIB_NAME nnstreamer-edge-custom-test)
SET(NNS_EDGE_CUSTOM_SRCS ${NNS_EDGE_SRCS} nnstreamer-edge-custom-test.c)
ADD_LIBRARY(${NNS_EDGE_CUSTOM_TEST_LIB_NAME} SHARED ${NNS_EDGE_CUSTOM_SRCS})
TARGET_INCLUDE_DIRECTORIES(unittest_nnstreamer-edge-custom PRIVATE ${EDGE_REQUIRE_PKGS_INCLUDE_DIRS} ${INCLUDE_DIR} ${NNS_EDGE_SRC_DIR})
TARGET_LINK_LIBRARIES(unittest_nnstreamer-edge-custom ${TEST_REQUIRE_PKGS_LDFLAGS} ${NNS_EDGE_LIB_NAME} ${NNS_EDGE_CUSTOM_TEST_LIB_NAME})
INSTALL (TARGETS unittest_nnstreamer-edge-custom DESTINATION ${BIN_INSTALL_DIR})
+ENDIF()
# MQTT test
IF(MQTT_SUPPORT)