Support ubuntu build
authorKwanghoon Son <k.son@samsung.com>
Tue, 20 Feb 2024 06:57:53 +0000 (06:57 +0000)
committerKwanghoon Son <k.son@samsung.com>
Wed, 6 Mar 2024 02:20:30 +0000 (11:20 +0900)
- Why
Recently, there are experimental requirements to use mediavision on
other platforms. In addition, if it can be built on the existing pc,
the test, debug, and development speed may be faster because gbs do
not have to be used.

Change-Id: Iae832d9692c19ede33ef76a91bd6ab623fc65121
Signed-off-by: Kwanghoon Son <k.son@samsung.com>
CMakeLists.txt
mv_common/CMakeLists.txt
mv_common/src/mv_feature_key.cpp
mv_common/src/tizen/mv_feature_key.cpp [new file with mode: 0644]

index f7c5dc0..059d134 100644 (file)
@@ -48,7 +48,19 @@ set(MV_IMAGE_SEGMENTATION_LIB_NAME "mv_image_segmentation" CACHE STRING
 include(FindPkgConfig)
 include(GNUInstallDirs)
 
+pkg_check_modules(TIZEN_PKG QUIET capi-system-info)
+if(TIZEN_PKG_FOUND)
+    set(IS_TIZEN ON)
+else()
+    set(IS_TIZEN OFF)
+    add_compile_definitions("MV_CONFIG_PATH=\"${PROJECT_SOURCE_DIR}/\"")
+endif()
+
 add_subdirectory(mv_common)
+if(NOT ${IS_TIZEN})
+    return()
+endif()
+
 add_subdirectory(mv_machine_learning)
 add_subdirectory(mv_barcode)
 add_subdirectory(mv_image)
index fc36248..ce8727a 100644 (file)
@@ -1,20 +1,30 @@
 project(${MV_COMMON_LIB_NAME})
 cmake_minimum_required(VERSION 3.13)
 
-file(GLOB MV_COMMON_SRC_LIST "${PROJECT_SOURCE_DIR}/src/*.cpp")
-
 find_package(OpenCV REQUIRED imgproc)
 if(NOT OpenCV_FOUND)
     message(SEND_ERROR "Failed to find OpenCV")
     return()
 endif()
 
-pkg_check_modules(${PROJECT_NAME}_DEP REQUIRED json-glib-1.0 capi-system-info capi-media-tool dlog)
-
+set(MV_COMMON_SRC_LIST
+    src/CommonUtils.cpp src/EngineConfig.cpp src/MediaSource.cpp src/mv_common.cpp)
 add_library(${PROJECT_NAME} SHARED ${MV_COMMON_SRC_LIST})
+
+set(MV_COMMON_DEP json-glib-1.0 dlog capi-media-tool)
+
+if(${IS_TIZEN})
+    list(APPEND MV_COMMON_DEP capi-system-info)
+    target_sources(${PROJECT_NAME} PRIVATE src/tizen/mv_feature_key.cpp)
+    target_compile_options(${PROJECT_NAME} PRIVATE -Werror)
+else()
+    target_sources(${PROJECT_NAME} PRIVATE src/mv_feature_key.cpp)
+endif()
+
+pkg_check_modules(${PROJECT_NAME}_DEP REQUIRED ${MV_COMMON_DEP})
 target_link_libraries(${PROJECT_NAME} ${OpenCV_LIBS} ${${PROJECT_NAME}_DEP_LIBRARIES})
 target_include_directories(${PROJECT_NAME} PUBLIC include ${${PROJECT_NAME}_DEP_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR}/include)
-target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra -Werror)
+target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra)
 install(TARGETS ${PROJECT_NAME} DESTINATION ${LIB_INSTALL_DIR})
 install(
         DIRECTORY ${PROJECT_SOURCE_DIR}/../include/ DESTINATION include/media
index e8638bf..3677748 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd All Rights Reserved
+ * 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.
  */
 
 #include "mv_feature_key.h"
-#include <system_info.h>
 
 bool mv_check_feature_key(const char *keys[], size_t num_keys, bool at_least_one)
 {
-       bool or_result = false;
-       for (size_t i = 0; i < num_keys; i++) {
-               bool supported = false;
-
-               if (system_info_get_platform_bool(keys[i], &supported)) {
-                       return false;
-               }
-
-               or_result |= supported;
-               if (!supported && !at_least_one)
-                       return false;
-       }
-
-       return or_result;
+       return true;
 }
diff --git a/mv_common/src/tizen/mv_feature_key.cpp b/mv_common/src/tizen/mv_feature_key.cpp
new file mode 100644 (file)
index 0000000..471f892
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2023 - 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 "mv_feature_key.h"
+#include <system_info.h>
+
+bool mv_check_feature_key(const char *keys[], size_t num_keys, bool at_least_one)
+{
+       bool or_result = false;
+       for (size_t i = 0; i < num_keys; i++) {
+               bool supported = false;
+
+               if (system_info_get_platform_bool(keys[i], &supported)) {
+                       return false;
+               }
+
+               or_result |= supported;
+               if (!supported && !at_least_one)
+                       return false;
+       }
+
+       return or_result;
+}