)
INCLUDE(FindPkgConfig)
-pkg_check_modules(hal-backend-device-common_pkgs REQUIRED libusbgx libsyscommon)
+pkg_check_modules(hal-backend-device-common_pkgs REQUIRED libusbgx libsyscommon dlog)
FOREACH(flag ${hal-backend-device-common_pkgs_CFLAGS})
SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRCS})
+IF(ENABLE_DLOG STREQUAL on)
+ ADD_DEFINITIONS("-DFEATURE_DLOG")
+ENDIF()
+
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${hal-backend-device-common_pkgs_LDFLAGS})
INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${HAL_LIB_DIR} COMPONENT RuntimeLibraries)
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.Apache-2.0 DESTINATION ${HAL_LICENSE_DIR}/${PROJECT_NAME})
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/hal-backend-common-usb_gadget.h DESTINATION ${HAL_INCLUDE_DIR}/device)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/hal-backend-common.h DESTINATION ${HAL_INCLUDE_DIR}/device)
CONFIGURE_FILE(hal-backend-device-common.pc.in hal-backend-device-common.pc @ONLY)
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/hal-backend-device-common.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
Name: HAL backend device common
Description: Library for HAL backend device modules
+Requires: dlog
Version: 1.1
-Libs: -L@HAL_LIB_DIR@ -Wl,-rpath,@HAL_LIB_DIR@ -lhal-backend-device-common
\ No newline at end of file
+
+Libs: -L@HAL_LIB_DIR@ -Wl,-rpath,@HAL_LIB_DIR@ -lhal-backend-device-common -ldlog
--- /dev/null
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#ifndef __HAL_BACKEND_COMMON_H__
+#define __HAL_BACKEND_COMMON_H__
+
+#ifdef FEATURE_DLOG
+ #define LOG_TAG "HAL_BACKEND_DEVICE"
+ #include <dlog.h>
+ #define _D(fmt, args...) SLOGD(fmt, ##args)
+ #define _I(fmt, args...) SLOGI(fmt, ##args)
+ #define _W(fmt, args...) SLOGW(fmt, ##args)
+ #define _E(fmt, args...) SLOGE(fmt, ##args)
+#else
+ #define _D(x, ...)
+ #define _I(x, ...)
+ #define _W(x, ...)
+ #define _E(x, ...)
+#endif
+
+#define EXPORT __attribute__ ((visibility("default")))
+
+#define ARRAY_SIZE(name) (sizeof(name)/sizeof(name[0]))
+#endif /* __HAL_BACKEND_COMMON_H__ */
BuildRequires: pkgconfig(libusbgx)
BuildRequires: pkgconfig(hal-api-device)
BuildRequires: pkgconfig(libsyscommon)
+BuildRequires: pkgconfig(dlog)
%description
Library for HAL backend device modules
%build
%cmake . -DHAL_LIB_DIR=%{_hal_libdir} \
-DHAL_INCLUDE_DIR=%{_hal_includedir} \
- -DHAL_LICENSE_DIR=%{_hal_licensedir}
+ -DHAL_LICENSE_DIR=%{_hal_licensedir} \
+ -DENABLE_DLOG=on
make %{?jobs:-j%jobs}
%files devel
%manifest %{name}.manifest
%{_hal_licensedir}/%{name}/LICENSE.Apache-2.0
-%{_hal_includedir}/device/hal-backend-common-usb_gadget.h
+%{_hal_includedir}/device/hal-backend-common*.h
%{_libdir}/pkgconfig/*.pc