Skip to content

Commit

Permalink
refactor(*): rm unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
lzx1413 committed Sep 2, 2023
1 parent d332d20 commit 51741b3
Show file tree
Hide file tree
Showing 205 changed files with 100 additions and 35,734 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
find_package(absl REQUIRED)
find_package(glog REQUIRED)
find_package(protobuf REQUIRED)
find_package(protobuf CONFIG REQUIRED)
if(NOT BUILD_GRAPH_ONLY)
find_package(OpenCV REQUIRED)
find_package(Eigen3 REQUIRED)
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,16 @@ Builds the mediapipe graph module using cmake, conan, and allows conan packaging
# The model in the config file is at https://drive.google.com/file/d/1U9cm5qfOxnGwyB6ypJjYvB6OeOjLZqpC/view?usp=drive_link
# Download and place in mediapipe/models folder
# The test image package can be downloaded from https://drive.google.com/file/d/1IjP8aT_iQ8fV_FCuUJk8TH3_e1X2Y_3Q/view?usp=drive_link
bin/object_detection --calculator_graph_config_file=../mediapipe/graphs/object_detection/object_detection_desktop_live.pbtxt --input_video_path=$IMAGE_DIR --output_video_path=$OUTPUT_DIR
bin/object_detection --calculator_graph_config_file=../examples/desktop/object_detection/object_detection_desktop_live.pbtxt --input_video_path=$IMAGE_DIR --output_video_path=$OUTPUT_DIR
# run object detection example with all verbose logs
GLOG_v=5 bin/object_detection --calculator_graph_config_file=../mediapipe/graphs/object_detection/object_detection_desktop_live.pbtxt --input_video_path=$IMAGE_DIR --output_video_path=$OUTPUT_DIR
GLOG_v=5 bin/object_detection --calculator_graph_config_file=../examples/desktop/object_detection/object_detection_desktop_live.pbtxt --input_video_path=$IMAGE_DIR --output_video_path=$OUTPUT_DIR
```
4. Project Architecture
* libgraph depends only on protobuf, abseil and glog, and is 1.7M in size for x86 environments.
* libframework contains libgraph and other auxiliary projects.
5. conan package
```bash
conan create . --build=missing -s build_type=Release -pr:h=docker/x86_gcc_profile
conan create . --build=missing -s build_type=Release -pr:h=docker/x86_gcc_profile -o 'export_package=True'
```
6. Examples of using Graph

Expand Down
2 changes: 1 addition & 1 deletion README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
* libframework 包含libgraph和其他辅助工程的整合包
5. conan 打包
```bash
conan create . --build=missing -s build_type=Release
conan create . --build=missing -s build_type=Release -pr:h=docker/x86_gcc_profile -o 'export_package=True'
```
6. Graph使用示例

Expand Down
134 changes: 85 additions & 49 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,31 @@ class MediapieliteRecipe(ConanFile):
topics = ("compute graph", "cpp", "pipeline")
# Binary configuration
settings = "os", "compiler", "build_type", "arch"
options = {"shared": [True, False], "fPIC": [True, False], "enable_profiler": [True, False], 'enable_rtti': [True, False]}
default_options = {"shared": False, "fPIC": True, "enable_profiler": False, "enable_rtti": True}
options = {
"shared": [True, False],
"fPIC": [True, False],
"enable_profiler": [True, False],
"enable_rtti": [True, False],
'export_package': [True, False]
}
default_options = {
"shared": False,
"fPIC": True,
"enable_profiler": False,
"enable_rtti": True,
'export_package': False
}
exports_sources = "CMakeLists.txt", "mediapipe/*", "cmake/*"

@property
def _compilers_minimum_version(self):
return {
"gcc": "6",
"clang": "5",
"apple-clang": "10",
"Visual Studio": "15",
"msvc": "191",
}
"gcc": "6",
"clang": "5",
"apple-clang": "10",
"Visual Studio": "15",
"msvc": "191",
}

def config_options(self):
if self.settings.os == "Windows":
Expand All @@ -41,70 +53,83 @@ def config_options(self):
def configure(self):
if self.options.shared:
self.options.rm_safe("fPIC")
self.options['glog'].with_unwind = False
self.options["opencv/*"].with_gtk = False
self.options["opencv/*"].with_vulkan = False
self.options["opencv/*"].with_ffmpeg = False
self.options["opencv/*"].gapi = False
self.options["opencv/*"].objdetect = False
self.options["opencv/*"].photo = False
self.options["opencv/*"].dnn = False
self.options["opencv/*"].optflow = True
self.options["opencv/*"].ximgproc = True

@property
def _min_cppstd(self):
return "14"

def validate(self):
if self.settings.compiler.cppstd:
check_min_cppstd(self, self._min_cppstd)
minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False)
if minimum_version and Version(self.settings.compiler.version) < minimum_version:
minimum_version = self._compilers_minimum_version.get(
str(self.settings.compiler), False
)
if (
minimum_version
and Version(self.settings.compiler.version) < minimum_version
):
raise ConanInvalidConfiguration(
f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support."
)

if self.options.shared and is_msvc(self):
# upstream tries its best to export symbols, but it's broken for the moment
raise ConanInvalidConfiguration(f"{self.ref} shared not availabe for Visual Studio (yet)")

raise ConanInvalidConfiguration(
f"{self.ref} shared not availabe for Visual Studio (yet)"
)

def layout(self):
cmake_layout(self)
self.folders.generators = f'build_{self.settings.os}'
self.folders.generators = f"build_{self.settings.os}"

def requirements(self):
self.requires("abseil/20230125.1", visible=True)
self.requires("protobuf/3.21.12", visible=True)
self.requires("glog/0.5.0", visible=True)
self.test_requires("gtest/1.13.0")
self.test_requires("zlib/1.2.13")
self.test_requires("opencv/4.5.5")
self.test_requires("tensorflow-lite/2.10.0")
self.test_requires("cpuinfo/cci.20220228")
self.test_requires("pybind11/2.10.1")
self.test_requires("stb/cci.20220909")
self.test_requires("xz_utils/5.4.2")
self.test_requires("benchmark/1.7.1")
self.test_requires("libjpeg/9e")
self.test_requires("eigen/3.4.0")
self.requires("glog/0.6.0", visible=True)

def build_requirements(self):
if not self.options.export_package:
self.test_requires("gtest/1.13.0")
self.test_requires("zlib/1.2.13")
self.test_requires(
"opencv/4.5.5",
options={
"with_gtk": False,
"with_vulkan": False,
"with_ffmpeg": False,
"gapi": False,
"objdetect": False,
"photo": False,
"dnn": False,
"optflow": True,
"ximgproc": True,
},
)
self.test_requires("tensorflow-lite/2.10.0")
self.test_requires("cpuinfo/cci.20220228")
self.test_requires("pybind11/2.10.1")
self.test_requires("stb/cci.20220909")
self.test_requires("xz_utils/5.4.2")
self.test_requires("benchmark/1.7.1")
self.test_requires("libjpeg/9e")
self.test_requires("eigen/3.4.0")

def generate(self):
tc = CMakeToolchain(self)
tc.variables["BUILD_TESTS"] = False
tc.variables["BUILD_PYTHON"] = False
tc.variables["BUILD_EXAMPLES"] = False
tc.variables['BUILD_GRAPH_ONLY'] = True
if self.settings.os == 'Android':
tc.variables['BUILD_PROTO_FILES'] = False
tc.variables["BUILD_GRAPH_ONLY"] = True
if self.settings.os == "Android":
tc.variables["BUILD_PROTO_FILES"] = False
if self.options.enable_rtti:
tc.variables['ENABLE_RTTI'] = True
tc.variables["ENABLE_RTTI"] = True
else:
tc.variables['ENABLE_RTTI'] = False
tc.variables["ENABLE_RTTI"] = False
if self.options.enable_profiler:
tc.variables['ENABLE_PROFILER'] = True
tc.variables["ENABLE_PROFILER"] = True
else:
tc.variables['ENABLE_PROFILER'] = False
tc.variables["ENABLE_PROFILER"] = False
tc.generate()
deps = CMakeDeps(self)
deps.generate()
Expand All @@ -122,14 +147,25 @@ def package(self):

def package_info(self):
self.cpp_info.set_property("cmake_file_name", "mediapipelite")
self.cpp_info.components["graph"].set_property("cmake_target_name", "mediapipelite::graph")
self.cpp_info.components["graph"].set_property("cmake_target_aliases", ["mediapipelite::graph"])
self.cpp_info.components["graph"].set_property("pkg_config_name", "libmediapipelite_graph")
self.cpp_info.components["graph"].set_property(
"cmake_target_name", "mediapipelite::graph"
)
self.cpp_info.components["graph"].set_property(
"cmake_target_aliases", ["mediapipelite::graph"]
)
self.cpp_info.components["graph"].set_property(
"pkg_config_name", "libmediapipelite_graph"
)
self.cpp_info.components["graph"].libs = ["graph"]
self.cpp_info.components["stream_handler"].set_property("cmake_target_name", "mediapipelite::stream_handler")
self.cpp_info.components["stream_handler"].set_property("cmake_target_aliases", ["mediapipelite::stream_handler"])
self.cpp_info.components["stream_handler"].set_property("pkg_config_name", "libmediapipelite_stream_handler")
self.cpp_info.components["stream_handler"].set_property(
"cmake_target_name", "mediapipelite::stream_handler"
)
self.cpp_info.components["stream_handler"].set_property(
"cmake_target_aliases", ["mediapipelite::stream_handler"]
)
self.cpp_info.components["stream_handler"].set_property(
"pkg_config_name", "libmediapipelite_stream_handler"
)
self.cpp_info.components["stream_handler"].libs = ["stream_handler"]
self.cpp_info.names["cmake_find_package"] = "mediapipelite"
self.cpp_info.names["cmake_find_package_multi"] = "mediapipelite"

25 changes: 0 additions & 25 deletions examples/desktop/autoflip/README.md

This file was deleted.

Loading

0 comments on commit 51741b3

Please sign in to comment.