Commit 8665e27e authored by Sang Ik Lee's avatar Sang Ik Lee Committed by Robert Kimball

Fix incorrect header resource. (#2467)

parent 0bdb051a
......@@ -25,13 +25,15 @@ set (SRC
header_rewrite.cpp
)
set(LLVM_LIB_DIR ${LLVM_INCLUDE_DIR}/../lib/clang/5.0.2/include)
get_filename_component(LLVM_LIB_DIR ${LLVM_LIB_DIR} ABSOLUTE)
list(APPEND HEADER_SEARCH_DEFINES CLANG_BUILTIN_HEADERS_PATH="${LLVM_LIB_DIR}")
add_executable(resource_generator EXCLUDE_FROM_ALL ${SRC})
add_dependencies(resource_generator libllvm)
get_target_property(LLVM_INCLUDE_DIR libllvm INTERFACE_INCLUDE_DIRECTORIES)
get_filename_component(CLANG_INCLUDE_DIR ${LLVM_INCLUDE_DIR}/../lib/clang/5.0.2/include ABSOLUTE)
list(APPEND HEADER_SEARCH_DEFINES CLANG_BUILTIN_HEADERS_PATH="${CLANG_INCLUDE_DIR}")
list(APPEND HEADER_SEARCH_DEFINES NGRAPH_HEADERS_PATH="${NGRAPH_INCLUDE_PATH}")
if(NGRAPH_CPU_ENABLE)
add_dependencies(resource_generator libmkldnn libeigen)
get_target_property(MKLDNN_INCLUDE_DIR libmkldnn INTERFACE_INCLUDE_DIRECTORIES)
get_target_property(EIGEN_INCLUDE_DIR libeigen INTERFACE_INCLUDE_DIRECTORIES)
list(APPEND HEADER_SEARCH_DEFINES EIGEN_HEADERS_PATH="${EIGEN_INCLUDE_DIR}")
......@@ -39,17 +41,9 @@ if(NGRAPH_CPU_ENABLE)
endif()
if(NGRAPH_TBB_ENABLE)
list(APPEND HEADER_SEARCH_DEFINES TBB_HEADERS_PATH="${TBB_ROOT}/include")
endif()
add_executable(resource_generator EXCLUDE_FROM_ALL ${SRC})
if (NOT NGRAPH_DEX_ONLY)
add_dependencies(resource_generator ext_llvm)
endif()
if(NGRAPH_CPU_ENABLE)
add_dependencies(resource_generator ext_eigen ext_mkldnn)
add_dependencies(resource_generator libtbb)
get_target_property(TBB_INCLUDE_DIR libtbb INTERFACE_INCLUDE_DIRECTORIES)
list(APPEND HEADER_SEARCH_DEFINES TBB_HEADERS_PATH="${TBB_INCLUDE_DIR}")
endif()
set_source_files_properties(main.cpp PROPERTIES COMPILE_DEFINITIONS "${HEADER_SEARCH_DEFINES}")
......
......@@ -68,6 +68,7 @@ int main(int argc, char** argv)
{
time_t main_timestamp = get_timestamp(argv[0]);
static vector<string> valid_ext = {".h", ".hpp", ".tcc", ""};
static vector<string> invalid_file = {"README"};
string output_path;
string base_name;
......@@ -86,31 +87,18 @@ int main(int argc, char** argv)
vector<ResourceInfo> include_paths;
#ifdef __APPLE__
#ifdef EIGEN_HEADERS_PATH
include_paths.push_back({EIGEN_HEADERS_PATH, {}, true});
#endif
#ifdef MKLDNN_HEADERS_PATH
include_paths.push_back({MKLDNN_HEADERS_PATH, {}, true});
#endif
#ifdef TBB_HEADERS_PATH
include_paths.push_back({TBB_HEADERS_PATH, {}, true});
#endif
include_paths.push_back({NGRAPH_HEADERS_PATH, {}, true});
include_paths.push_back({CLANG_BUILTIN_HEADERS_PATH, {}, true});
#else // __APPLE__
include_paths.push_back({CLANG_BUILTIN_HEADERS_PATH, {}, true});
#ifdef EIGEN_HEADERS_PATH
include_paths.push_back({EIGEN_HEADERS_PATH, {}, true});
include_paths.push_back({EIGEN_HEADERS_PATH, {"Eigen"}, true});
#endif
#ifdef MKLDNN_HEADERS_PATH
include_paths.push_back({MKLDNN_HEADERS_PATH, {}, true});
#endif
include_paths.push_back({NGRAPH_HEADERS_PATH, {}, true});
#ifdef TBB_HEADERS_PATH
include_paths.push_back({TBB_HEADERS_PATH, {}, true});
#endif
#endif
include_paths.push_back({NGRAPH_HEADERS_PATH, {"ngraph"}, true});
if (output_path.empty())
{
......@@ -124,7 +112,10 @@ int main(int argc, char** argv)
{
// cout << "path " << path.source_path << " -> " << path.target_path << endl;
vector<string> path_list;
path_list.push_back(path.search_path);
if (path.subdirs.empty())
{
path_list.push_back(path.search_path);
}
for (const string& p : path.subdirs)
{
path_list.push_back(path_join(path.search_path, p));
......@@ -135,11 +126,14 @@ int main(int argc, char** argv)
[&](const string& file, bool is_dir) {
if (!is_dir)
{
string ext = get_file_ext(file);
if (contains(valid_ext, ext))
if (!contains(invalid_file, file))
{
// cout << "add " << path.search_path << ", " << file << endl;
path.files.push_back(file);
string ext = get_file_ext(file);
if (contains(valid_ext, ext))
{
// cout << "add " << path.search_path << ", " << file << endl;
path.files.push_back(file);
}
}
}
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment