log: do built-in log 26/312926/4
authorInki Dae <inki.dae@samsung.com>
Mon, 17 Jun 2024 09:14:14 +0000 (18:14 +0900)
committerInki Dae <inki.dae@samsung.com>
Wed, 19 Jun 2024 00:19:30 +0000 (09:19 +0900)
Just do built-in log. This patch makes log directory to be built-in
instead of building an library file.

Change-Id: I2d374309041b85fe6ded8171d8c3a2bd74c31a36
Signed-off-by: Inki Dae <inki.dae@samsung.com>
log/CMakeLists.txt
log/src/SIngleLogBackend.cpp [deleted file]
log/src/SingleoLogBackend.cpp [new file with mode: 0644]
packaging/singleo.spec
services/CMakeLists.txt
visualizer/CMakeLists.txt

index 209a06b576645454f299e4d9979567993845f27b..df5b5d604041c9e45adca315e94c24714c766f46 100644 (file)
@@ -1,18 +1,14 @@
-PROJECT("singleo_log")
-CMAKE_MINIMUM_REQUIRED(VERSION 3.13)
+SET(LOG_DIRECTORY ${ROOT_DIRECTORY}/log)
 
 if (${PLATFORM_IS_TIZEN})
-    FILE(GLOB SINGLEO_SERVICE_OD_SOURCE_FILES "${PROJECT_SOURCE_DIR}/tizen/*.cpp")
+    SET(SINGLEO_SERVICE_SOURCE_FILES ${SINGLEO_SERVICE_SOURCE_FILES} ${LOG_DIRECTORY}/tizen/SingleoLogBackend.cpp)
 else()
-    FILE(GLOB SINGLEO_SERVICE_OD_SOURCE_FILES "${PROJECT_SOURCE_DIR}/src/*.cpp")
+    SET(SINGLEO_SERVICE_SOURCE_FILES ${SINGLEO_SERVICE_SOURCE_FILES} ${LOG_DIRECTORY}/src/SingleoLogBackend.cpp)
 endif()
 
-ADD_LIBRARY(${PROJECT_NAME} SHARED ${SINGLEO_SERVICE_OD_SOURCE_FILES})
+LIST(APPEND LOG_HEADER_LIST ${LOG_HEADER_LIST} ${LOG_DIRECTORY}/include)
 
 if (${PLATFORM_IS_TIZEN})
-    TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} PRIVATE include /usr/include/dlog)
-else()
-    TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} PRIVATE include)
-endif()
-
-INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${LIB_INSTALL_DIR})
\ No newline at end of file
+       LIST(APPEND LOG_HEADER_LIST ${LOG_HEADER_LIST} /usr/include/dlog)
+       LIST(APPEND LOG_LIBRARY_LIST ${LOG_LIBRARY_LIST} dlog)
+endif()
\ No newline at end of file
diff --git a/log/src/SIngleLogBackend.cpp b/log/src/SIngleLogBackend.cpp
deleted file mode 100644 (file)
index ee5a544..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-/**
- * Copyright (c) 2024 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.
- */
-
-#include <iostream>
-#include "SingleoLogBackend.h"
-
-using namespace std;
-
-SingleoLogType singleoCurrentLogLevel = SingleoLogType::ERROR;
-
-void singleo_log_output(SingleoLogType level, const char *format, ...)
-{
-       if (level > singleoCurrentLogLevel)
-               return;
-
-       va_list args;
-       va_start(args, format);
-
-       int size = vsnprintf(nullptr, 0, format, args);
-       va_end(args);
-
-       string buffer(size + 1, '\0');
-
-       va_start(args, format);
-       vsnprintf(&buffer[0], buffer.size(), format, args);
-       va_end(args);
-
-       cout << buffer << endl;
-}
-
-void setSingleoLogLevel(SingleoLogType level)
-{
-       singleoCurrentLogLevel = level;
-}
diff --git a/log/src/SingleoLogBackend.cpp b/log/src/SingleoLogBackend.cpp
new file mode 100644 (file)
index 0000000..ee5a544
--- /dev/null
@@ -0,0 +1,47 @@
+/**
+ * Copyright (c) 2024 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.
+ */
+
+#include <iostream>
+#include "SingleoLogBackend.h"
+
+using namespace std;
+
+SingleoLogType singleoCurrentLogLevel = SingleoLogType::ERROR;
+
+void singleo_log_output(SingleoLogType level, const char *format, ...)
+{
+       if (level > singleoCurrentLogLevel)
+               return;
+
+       va_list args;
+       va_start(args, format);
+
+       int size = vsnprintf(nullptr, 0, format, args);
+       va_end(args);
+
+       string buffer(size + 1, '\0');
+
+       va_start(args, format);
+       vsnprintf(&buffer[0], buffer.size(), format, args);
+       va_end(args);
+
+       cout << buffer << endl;
+}
+
+void setSingleoLogLevel(SingleoLogType level)
+{
+       singleoCurrentLogLevel = level;
+}
index 3e8f96b82e95006ba10823f56eee0ad83abbf7b7..adc94e968b7ba2a7edf16bdff2af299bf3eeacf9 100644 (file)
@@ -82,7 +82,6 @@ rm -rf %{buildroot}
 
 %files devel
 %{_libdir}/pkgconfig/*.pc
-%{_libdir}/libsingleo_log.so
 %{_libdir}/libsingleo_service.so
 %{_libdir}/libsingleo_visualizer.so
 
index 189479c9269969c6ece0d5dd3f1b4c51f4dc6cf6..771fe92b8b3fba62f3e16bd49922653a13ad64ff 100644 (file)
@@ -5,6 +5,7 @@ FILE(GLOB SINGLEO_SERVICE_SOURCE_FILES "${PROJECT_SOURCE_DIR}/*.cpp"
                                        "${PROJECT_SOURCE_DIR}/src/*.cpp"
                                        "${PROJECT_SOURCE_DIR}/common/src/*.cpp")
 
+INCLUDE(${ROOT_DIRECTORY}/log/CMakeLists.txt)
 INCLUDE(${ROOT_DIRECTORY}/input/CMakeLists.txt)
 INCLUDE(${ROOT_DIRECTORY}/inference/CMakeLists.txt)
 
@@ -16,7 +17,7 @@ ENDIF()
 
 ADD_LIBRARY(${PROJECT_NAME} SHARED ${SINGLEO_SERVICE_SOURCE_FILES})
 
-TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} PRIVATE include common/include ${ROOT_DIRECTORY}/capi/ ${ROOT_DIRECTORY}/log/include ${ROOT_DIRECTORY}/common/include ${INPUT_HEADER_LIST} ${INFERENCE_HEADER_LIST} ${SERVICE_HEADER_LIST})
-TARGET_LINK_LIBRARIES(${PROJECT_NAME} PRIVATE opencv_core opencv_imgcodecs opencv_highgui opencv_videoio singleo_log ${INFERENCE_LIBRARY_LIST} ${SERVICE_LIBRARY_LIST})
+TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} PRIVATE include common/include ${ROOT_DIRECTORY}/capi/ ${ROOT_DIRECTORY}/common/include ${INPUT_HEADER_LIST} ${INFERENCE_HEADER_LIST} ${SERVICE_HEADER_LIST} ${LOG_HEADER_LIST})
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} PRIVATE opencv_core opencv_imgcodecs opencv_highgui opencv_videoio ${INFERENCE_LIBRARY_LIST} ${SERVICE_LIBRARY_LIST} ${LOG_LIBRARY_LIST})
 
 INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${LIB_INSTALL_DIR})
\ No newline at end of file
index e6c2fe236e469ad33170313540ab68697c14b739..f23e0111c48519451bb0f3617a632f88767c7a89 100644 (file)
@@ -31,5 +31,5 @@ TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} PUBLIC
                                                   ../common/include
                            ../log/include)
 TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${${PROJECT_NAME}_DEP_LIBRARIES}
-                        ${OpenCV_LIBS} singleo_log)
+                        ${OpenCV_LIBS})
 INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${LIB_INSTALL_DIR})