提交 6a6dd2e0 编写于 作者: T Tianyi Zhao 提交者: Gines

Unity plugin compatibility (#975)

上级 fc6d3599
......@@ -273,7 +273,7 @@ if (WIN32)
endif (WIN32)
# Unity
# option(BUILD_UNITY_SUPPORT "Build OpenPose as a Unity plugin." OFF)
option(BUILD_UNITY_SUPPORT "Build OpenPose as a Unity plugin." OFF)
# Build as shared library
option(BUILD_SHARED_LIBS "Build as shared lib." ON)
......
......@@ -37,6 +37,9 @@
// tracking module
#include <openpose/tracking/headers.hpp>
// unity module
#include <openpose/unity/headers.hpp>
// utilities module
#include <openpose/utilities/headers.hpp>
......
#ifndef OPENPOSE_UNITY_HEADERS_HPP
#define OPENPOSE_UNITY_HEADERS_HPP
// unity module
#include <openpose/unity/unityBinding.hpp>
#endif // OPENPOSE_UNITY_HEADERS_HPP
// Temporarily, all the code is located in
// src/openpose/unity/unityBinding.cpp
// TODO: Move functionality from unityBinding.cpp to this class
......@@ -24,4 +24,3 @@ if (UNIX OR APPLE)
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib/openpose)
endif (UNIX OR APPLE)
set(SOURCES_OP_POSE
set(SOURCES_OP_POSE
defineTemplates.cpp
poseCpuRenderer.cpp
poseExtractor.cpp
......
set(SOURCES_OP_UNITY
unityBinding.cpp
)
include(${CMAKE_SOURCE_DIR}/cmake/Utils.cmake)
set(SOURCES_OP_UNITY_WITH_CP "" PARENT_SCOPE)
prepend(SOURCES_OP_UNITY_WITH_CP ${CMAKE_CURRENT_SOURCE_DIR} ${SOURCES_OP_UNITY})
set(SOURCES_OP_UNITY_WITH_CP ${SOURCES_OP_UNITY_WITH_CP} PARENT_SCOPE)
set(SOURCES_OP_FILESTREAM_WITH_CP ${SOURCES_OP_FILESTREAM_WITH_CP} PARENT_SCOPE)
set(SOURCES_OPENPOSE ${SOURCES_OPENPOSE} ${SOURCES_OP_UNITY_WITH_CP} PARENT_SCOPE)
if (UNIX OR APPLE)
add_library(openpose_unity ${SOURCES_OP_UNITY})
# target_link_libraries(openpose_unity openpose_pose ${OpenCV_LIBS})
install(TARGETS openpose_unity
EXPORT OpenPose
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib/openpose)
endif (UNIX OR APPLE)
此差异已折叠。
......@@ -10,34 +10,25 @@ namespace op
namespace UnityDebugger
{
typedef void(__stdcall * DebugCallback) (const char* const str, int type);
DebugCallback gDebugCallback;
DebugCallback unityDebugCallback;
bool unityDebugEnabled = true;
extern "C" void OP_API OP_RegisterDebugCallback(DebugCallback& debugCallback)
{
extern "C" void OP_API _OPRegisterDebugCallback(DebugCallback debugCallback) {
if (debugCallback)
gDebugCallback = debugCallback;
unityDebugCallback = debugCallback;
}
void DebugInUnity(const std::string& message, const int type)
{
if (gDebugCallback)
gDebugCallback(message.c_str(), type);
}
extern "C" void OP_API _OPSetDebugEnable(bool enable) {
unityDebugEnabled = enable;
}
void log(const std::string& message)
{
DebugInUnity(message, 0);
void DebugInUnity(const std::string& message, const int type) {
if (unityDebugEnabled) if (unityDebugCallback) unityDebugCallback(message.c_str(), type);
}
void logWarning(const std::string& message)
{
DebugInUnity(message, 1);
}
void logError(const std::string& message)
{
DebugInUnity(message, -1);
}
void log(const std::string& message) { DebugInUnity(message, 0); }
void logWarning(const std::string& message) { DebugInUnity(message, 1); }
void logError(const std::string& message) { DebugInUnity(message, -1); }
}
#endif
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册