Skip to content

Commit

Permalink
add submodule and fix compile issues
Browse files Browse the repository at this point in the history
  • Loading branch information
sfeiwong authored and taoboyang committed Jul 15, 2023
1 parent ceb4ab0 commit 0db6b0a
Show file tree
Hide file tree
Showing 45 changed files with 353 additions and 363 deletions.
17 changes: 10 additions & 7 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@
[submodule "3rd_party/gtest"]
path = 3rd_party/gtest
url = https://github.com/google/googletest.git
[submodule "bmf/hml/third_party/fmt"]
path = bmf/hml/third_party/fmt
url = https://github.com/fmtlib/fmt.git
[submodule "3rd_party/dlpack"]
path = 3rd_party/dlpack
url = https://github.com/dmlc/dlpack.git
[submodule "3rd_party/json"]
path = 3rd_party/json
url = https://github.com/nlohmann/json.git
[submodule "bmf/hml/third_party/gtest"]
path = bmf/hml/third_party/gtest
url = https://github.com/google/googletest.git
Expand All @@ -22,9 +25,9 @@
[submodule "bmf/hml/third_party/benchmark"]
path = bmf/hml/third_party/benchmark
url = https://github.com/google/benchmark.git
[submodule "3rd_party/breakpad"]
path = 3rd_party/breakpad
url = https://github.com/google/breakpad.git
[submodule "bmf/hml/third_party/dlpack"]
path = bmf/hml/third_party/dlpack
url = https://github.com/dmlc/dlpack.git
url = https://github.com/dmlc/dlpack.git
[submodule "bmf/hml/third_party/fmt"]
path = bmf/hml/third_party/fmt
url = https://github.com/fmtlib/fmt.git
1 change: 1 addition & 0 deletions 3rd_party/dlpack
Submodule dlpack added at ca4d00
1 change: 1 addition & 0 deletions 3rd_party/glog
Submodule glog added at 47ad26
1 change: 1 addition & 0 deletions 3rd_party/gtest
Submodule gtest added at 1a8ecf
1 change: 1 addition & 0 deletions 3rd_party/json
Submodule json added at 5d2754
4 changes: 2 additions & 2 deletions bmf/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,8 @@ if(IOS)
${IOS_ASSEMBLE_ROOT}/include/fmt
COMMAND
${CMAKE_COMMAND} -E copy_directory
${BMF_ASSEMBLE_ROOT}/bmf/include/bmf_nlohmann
${IOS_ASSEMBLE_ROOT}/include/bmf_nlohmann
${BMF_ASSEMBLE_ROOT}/bmf/include/nlohmann
${IOS_ASSEMBLE_ROOT}/include/nlohmann
COMMAND
${CMAKE_COMMAND} -E copy_directory
${CMAKE_CURRENT_SOURCE_DIR}/object-c/include/bmf/oc
Expand Down
2 changes: 1 addition & 1 deletion bmf/c_modules/src/ffmpeg_decoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include <bmf/sdk/exception_factory.h>
#include <bmf/sdk/error_define.h>
#include <bmf/sdk/module_tag.h>
using json = bmf_nlohmann::json;
using json = nlohmann::json;

#define BMF_CONV_FP(x) ((double) (x)) / (1 << 16)

Expand Down
2 changes: 1 addition & 1 deletion bmf/c_modules/test/test_python_module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ void get_python_module_info(JsonParam &node_param, std::string &module_name, std
void create_python_module_from_string(std::string module_name, std::string option,
std::shared_ptr<PythonModule> &python_module) {
std::istringstream s;
bmf_nlohmann::json opt;
nlohmann::json opt;
s.str(option);
s >> opt;
python_module = std::make_shared<PythonModule>(module_name, module_name, 0, JsonParam(opt));
Expand Down
4 changes: 2 additions & 2 deletions bmf/cmd/src/module_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include <bmf/sdk/module.h>
#include <bmf/sdk/module_manager.h>
#include <bmf/sdk/shared_library.h>
#include <bmf_nlohmann/json.hpp>
#include <nlohmann/json.hpp>
#include <cerrno>
#include <cstring>
#include <fstream>
Expand Down Expand Up @@ -127,7 +127,7 @@ int install_module(const bmf_sdk::ModuleInfo &info, bool force) {
fs::copy(original_path, installed_path);

// bmf_sdk::JsonParam meta;
bmf_nlohmann::json meta;
nlohmann::json meta;
meta["name"] = info.module_name;
meta["revision"] = info.module_revision;
meta["type"] = info.module_type;
Expand Down
4 changes: 2 additions & 2 deletions bmf/cmd/src/run_graph.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <fstream>
#include <iostream>
#include <bmf_nlohmann/json.hpp>
#include <nlohmann/json.hpp>
#include <bmf/sdk/compat/path.h>
#ifdef BMF_USE_MEDIACODEC
#include <jni.h>
Expand Down Expand Up @@ -38,7 +38,7 @@ int main(int argc, char ** argv) {

// Load file
std::cout << "Loading graph config from " << filepath << std::endl;
bmf_nlohmann::json graph_json;
nlohmann::json graph_json;
std::ifstream gs(filepath);
gs >> graph_json;
GraphConfig graph_config(graph_json);
Expand Down
32 changes: 16 additions & 16 deletions bmf/engine/c_engine/include/graph_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#ifndef BMF_GRAPH_CONFIG_H
#define BMF_GRAPH_CONFIG_H

#include <bmf_nlohmann/json.hpp>
#include <nlohmann/json.hpp>

#include <bmf/sdk/common.h>
#include <bmf/sdk/json_param.h>
Expand All @@ -32,7 +32,7 @@ BEGIN_BMF_ENGINE_NS
public:
ModuleConfig() = default;

ModuleConfig(bmf_nlohmann::json &module_config);
ModuleConfig(nlohmann::json &module_config);

ModuleConfig(JsonParam &module_config);

Expand All @@ -41,7 +41,7 @@ BEGIN_BMF_ENGINE_NS
std::string get_module_path();
std::string get_module_entry();

bmf_nlohmann::json to_json();
nlohmann::json to_json();

std::string module_name;
std::string module_type;
Expand All @@ -55,14 +55,14 @@ BEGIN_BMF_ENGINE_NS


private:
void init(bmf_nlohmann::json &module_config);
void init(nlohmann::json &module_config);
};

class StreamConfig {
public:
StreamConfig() = default;

StreamConfig(bmf_nlohmann::json &stream_config);
StreamConfig(nlohmann::json &stream_config);

StreamConfig(JsonParam &stream_config);

Expand All @@ -72,7 +72,7 @@ BEGIN_BMF_ENGINE_NS

std::string get_notify();

bmf_nlohmann::json to_json();
nlohmann::json to_json();

std::string identifier;
std::string alias;
Expand All @@ -83,7 +83,7 @@ BEGIN_BMF_ENGINE_NS
}

private:
void init(bmf_nlohmann::json &stream_config);
void init(nlohmann::json &stream_config);
};

class NodeMetaInfo {
Expand All @@ -92,7 +92,7 @@ BEGIN_BMF_ENGINE_NS

NodeMetaInfo(JsonParam &node_meta);

NodeMetaInfo(bmf_nlohmann::json &node_meta);
NodeMetaInfo(nlohmann::json &node_meta);

int32_t get_premodule_id();

Expand All @@ -102,15 +102,15 @@ BEGIN_BMF_ENGINE_NS

std::map<int64_t, uint32_t> get_callback_binding();

bmf_nlohmann::json to_json();
nlohmann::json to_json();

bool operator==(NodeMetaInfo const &rhs){
return this->premodule_id==rhs.premodule_id && this->bundle==rhs.bundle &&
this->queue_size_limit==rhs.queue_size_limit;
}

private:
void init(bmf_nlohmann::json &node_meta);
void init(nlohmann::json &node_meta);

int32_t premodule_id = -1;
int32_t bundle = -1;
Expand All @@ -122,7 +122,7 @@ BEGIN_BMF_ENGINE_NS
public:
NodeConfig() = default;

NodeConfig(bmf_nlohmann::json &node_config);
NodeConfig(nlohmann::json &node_config);

NodeConfig(JsonParam &node_config);

Expand Down Expand Up @@ -152,7 +152,7 @@ BEGIN_BMF_ENGINE_NS

std::string get_action();

bmf_nlohmann::json to_json();
nlohmann::json to_json();

bool operator==(NodeConfig const &rhs){
return this->id==rhs.id && this->module==rhs.module && this->meta==rhs.meta;
Expand All @@ -169,7 +169,7 @@ BEGIN_BMF_ENGINE_NS
std::string alias;
std::string action;
private:
void init(bmf_nlohmann::json &node_config);
void init(nlohmann::json &node_config);
};

class GraphConfig {
Expand All @@ -178,7 +178,7 @@ BEGIN_BMF_ENGINE_NS

GraphConfig(std::string config_file);

GraphConfig(bmf_nlohmann::json &graph_config);
GraphConfig(nlohmann::json &graph_config);

GraphConfig(JsonParam &graph_json);

Expand All @@ -192,7 +192,7 @@ BEGIN_BMF_ENGINE_NS

std::vector<StreamConfig> get_output_streams();

bmf_nlohmann::json to_json();
nlohmann::json to_json();

std::vector<NodeConfig> nodes;
BmfMode mode;
Expand All @@ -201,7 +201,7 @@ BEGIN_BMF_ENGINE_NS
JsonParam option;

private:
void init(bmf_nlohmann::json &graph_config);
void init(nlohmann::json &graph_config);
};
END_BMF_ENGINE_NS

Expand Down
4 changes: 2 additions & 2 deletions bmf/engine/c_engine/include/optimizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include <bmf/sdk/module.h>
#include "../include/graph_config.h"
#include "../include/module_factory.h"
#include <bmf_nlohmann/json_fwd.hpp>
#include <nlohmann/json_fwd.hpp>
#include <iostream>
#include <string>
#include <list>
Expand All @@ -32,7 +32,7 @@
#include <unordered_set>
#include <unordered_map>

using json = bmf_nlohmann::json;
using json = nlohmann::json;

#define Py_ADD_GIL PyGILState_STATE gstate = PyGILState_Ensure();{
#define Py_RELEASE_GIL }PyGILState_Release(gstate);
Expand Down
Loading

0 comments on commit 0db6b0a

Please sign in to comment.