Skip to content

Commit

Permalink
Merge pull request #1 from ILLIXR/convertingToPlugin
Browse files Browse the repository at this point in the history
Initial working version
  • Loading branch information
astro-friedel authored Sep 4, 2024
2 parents 247e56d + 28b54de commit 6177975
Show file tree
Hide file tree
Showing 57 changed files with 2,209 additions and 787 deletions.
11 changes: 9 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,12 @@
.idea*

# Build files
build*
cmake-build*
build/*
cmake-build*
mediapipe/demo_run_graph_main.cc

mediapipe/modules/hand_landmark/hand_landmark_cpu.pbtxt

mediapipe/modules/hand_landmark/hand_landmark_model_loader.pbtxt

mediapipe/modules/palm_detection/palm_detection_model_loader.pbtxt
50 changes: 34 additions & 16 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.17)
project(ILLIXRHandTracking)
project(ILLIXR_hand_tracking)
set(CMAKE_VERBOSE_MAKEFILE True)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_PREFIX_PATH "${CMAKE_INSTALL_PREFIX}/lib/cmake")
Expand All @@ -16,7 +16,7 @@ if(HT_ENABLE_GPU)
else()
add_definitions(-DMEDIAPIPE_DISABLE_GPU=1)
endif()

add_compile_options(-Wno-deprecated-declarations)
if(HT_ENABLE_GRAPH_PROFILER)
add_definitions(-DMEDIAPIPE_PROFILER_AVAILABLE=1)
if(HT_ENABLE_WEB_PROFILING)
Expand All @@ -28,11 +28,19 @@ set(CMAKE_MODULE_PATH
${CMAKE_MODULE_PATH}
${CMAKE_INSTALL_PREFIX}/lib/cmake
)

find_package(PkgConfig)

if(ILLIXR_ROOT)
set(ILLIXR_HDR_PATH ${ILLIXR_ROOT} CACHE PATH "Location of ILLIXR headers")
#add_definitions(-DBUILD_ILLIXR)
else()
message(FATAL_ERROR "ILLIXR_ROOT must be specified")
endif()

set(protobuf_MODULE_COMPATIBLE ON)
find_package(ZLIB REQUIRED)
find_package(protobuf 3.19 REQUIRED CONFIG)
find_package(Protobuf 3.19 REQUIRED CONFIG)
pkg_check_modules(glog REQUIRED libglog)
pkg_check_modules(egl REQUIRED egl)
pkg_check_modules(glesv2 REQUIRED glesv2)
Expand All @@ -43,17 +51,12 @@ set(ENABLE_OPENCV ON)
set(PROTOBUF_DESCRIPTORS "" CACHE INTERNAL "")
pkg_check_modules(cpuinfo REQUIRED libcpuinfo)

add_library(XNNPACKLIB SHARED IMPORTED)
set_property(TARGET XNNPACKLIB PROPERTY
IMPORTED_LOCATION ${CMAKE_INSTALL_PREFIX}/lib/libXNNPACK.so
)
add_library(PTHREADLIB SHARED IMPORTED)
set_property(TARGET PTHREADLIB PROPERTY
IMPORTED_LOCATION ${CMAKE_INSTALL_PREFIX}/lib/libpthreadpool.so
)
find_package(tensorflow-lite REQUIRED)
if(XNNPACK_BINARY_DIR)
add_link_options(-L${XNNPACK_BINARY_DIR})
find_package(tfl-XNNPACK REQUIRED CONFIG)
find_package(pthreadpool REQUIRED CONFIG)
find_package(tensorflow-lite REQUIRED CONFIG)

if(tfl-XNNPACK_BINARY_DIR)
add_link_options(-L${tfl-XNNPACK_BINARY_DIR})
endif()

include(mediapipe/protobuf.cmake)
Expand Down Expand Up @@ -93,11 +96,26 @@ add_custom_target(make_message_type
# DEPENDS encode_descriptor_sets make_message_type
#)

add_subdirectory(mediapipe)

set(PLUGIN_NAME plugin.hand_tracking${ILLIXR_BUILD_SUFFIX})
add_library(${PLUGIN_NAME} SHARED plugin.cpp)

add_subdirectory(mediapipe)

#message_type_util --input_path=bazel-out/k8-opt/bin/mediapipe/calculators/tensor/inference_calculator_proto_direct-direct-descriptor-set.proto.bin --root_type_macro_output_path=bazel-out/k8-opt/bin/mediapipe/calculators/tensor/inference_calculator_options_lib_type_name.h ')
target_link_libraries(${PLUGIN_NAME} PUBLIC
${OpenCV_LIBRARIES}
absl::base
absl::flags_parse
fmt
)

target_include_directories(${PLUGIN_NAME} PRIVATE
${ILLIXR_HDR_PATH}
${OpenCV_INCLUDE_DIRS}
${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}
)
install(TARGETS ${PLUGIN_NAME} DESTINATION lib)

#get_cmake_property(_variableNames VARIABLES)
#foreach (_variableName ${_variableNames})
Expand Down
9 changes: 0 additions & 9 deletions cmake/FindProtobuf2.cmake

This file was deleted.

11 changes: 0 additions & 11 deletions cmake/Findtensorflow-lite.cmake

This file was deleted.

17 changes: 0 additions & 17 deletions cmake/NEON_2_SSE.cmake

This file was deleted.

5 changes: 2 additions & 3 deletions cmake/make_pb_binary.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ function(make_proto_binary)
)

target_link_libraries(${make_proto_binary_BINARY_NAME} PUBLIC
${Protobuf_LIBRARIES}
protobuf::libprotobuf
${glog_LIBRARIES}
${tensorflow-lite_LIBRARIES}
tensorflow-lite::tensorflow-lite
${zlib_LIBRARIES}
absl::status
absl::absl_log
Expand Down Expand Up @@ -57,7 +57,6 @@ function(make_proto_binary)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/simple_subgraph_template.cc.in
${CMAKE_BINARY_DIR}/${FILE_PATH_NAME}_linked.cc
)
message("${make_proto_binary_FILE_BASE_NAME}_linked")
add_library(${make_proto_binary_FILE_BASE_NAME}_linked OBJECT
${CMAKE_BINARY_DIR}/${FILE_PATH_NAME}_linked.cc
${CMAKE_BINARY_DIR}/${FILE_PATH_NAME}.inc
Expand Down
25 changes: 0 additions & 25 deletions cmake/protobuf.cmake

This file was deleted.

32 changes: 0 additions & 32 deletions cmake/tensorflow-lite.cmake

This file was deleted.

Loading

0 comments on commit 6177975

Please sign in to comment.