From 63427030ca78e0117cbaf67aa23ccf66eaf2a570 Mon Sep 17 00:00:00 2001 From: Doru Bercea Date: Thu, 19 Dec 2019 14:24:37 -0500 Subject: [PATCH] Enable building of first commit. --- .gitmodules | 9 +++++++ CMakeLists.txt | 23 +++++++++++++++++- src/CMakeLists.txt | 10 ++++++++ src/builder/CMakeLists.txt | 4 +++- src/builder/onnx_importer.cpp | 13 ----------- src/main.cpp | 44 +++++++++++++++++++++++++++++++++++ third_party/benchmark | 1 + third_party/onnx | 1 + third_party/pybind11 | 1 + 9 files changed, 91 insertions(+), 15 deletions(-) create mode 100644 .gitmodules create mode 100644 src/CMakeLists.txt delete mode 100644 src/builder/onnx_importer.cpp create mode 100644 src/main.cpp create mode 160000 third_party/benchmark create mode 160000 third_party/onnx create mode 160000 third_party/pybind11 diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..285a7ac --- /dev/null +++ b/.gitmodules @@ -0,0 +1,9 @@ +[submodule "third_party/onnx"] + path = third_party/onnx + url = https://github.com/onnx/onnx.git +[submodule "third_party/benchmark"] + path = third_party/benchmark + url = https://github.com/tjingrant/google-benchmark.git +[submodule "third_party/pybind11"] + path = third_party/pybind11 + url = https://github.com/pybind/pybind11.git diff --git a/CMakeLists.txt b/CMakeLists.txt index 2a1130f..46ccd32 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,8 +12,29 @@ set(CMAKE_CXX_FLAGS_DEBUG "-g") set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG") set(ONNF_ROOT "${CMAKE_CURRENT_SOURCE_DIR}") +add_subdirectory(third_party/onnx) +add_subdirectory(third_party/benchmark) +add_subdirectory(third_party/pybind11) + # Set cxx standard only for onnf project files. set(CMAKE_CXX_STANDARD 14) -add_subdirectory(src/builder) +# Boost 1.61.0 required for boost::dll:program_location() +find_package(Boost 1.61.0 + COMPONENTS graph + program_options + log_setup + log + system + filesystem + REQUIRED) + +if(Boost_FOUND) + message("Boost_INCLUDE_DIRS = ${Boost_INCLUDE_DIRS}") + message("Boost_LIBRARY_DIRS = ${Boost_LIBRARY_DIRS}") + include_directories(${Boost_INCLUDE_DIRS}) +endif() + +add_subdirectory(src/builder) +add_subdirectory(src) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000..7c16c0b --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,10 @@ + +add_executable(onnf main.cpp) + +target_include_directories(onnf PRIVATE ..) + +target_link_libraries(onnf + builder + ${Boost_LIBRARIES} + ) + diff --git a/src/builder/CMakeLists.txt b/src/builder/CMakeLists.txt index 4e3ec6c..31756ae 100644 --- a/src/builder/CMakeLists.txt +++ b/src/builder/CMakeLists.txt @@ -1,3 +1,5 @@ +add_definitions(-DBOOST_LOG_DYN_LINK) + add_library(builder sgir.cpp ) @@ -77,7 +79,7 @@ set(MLIRLIBS ${MLIRLIBANALYSIS} ${MLIRLIBIR} ${MLIRLIBPARSER} ${MLIRLIBTRANSFORM ${LLVMLIBSUPPORT}) -target_link_libraries(builder compiler op onnx ${MLIRLIBS} curses) +target_link_libraries(builder onnx ${MLIRLIBS} curses) target_include_directories(builder PRIVATE ${CMAKE_SOURCE_DIR}/third_party/onnx diff --git a/src/builder/onnx_importer.cpp b/src/builder/onnx_importer.cpp deleted file mode 100644 index 4235856..0000000 --- a/src/builder/onnx_importer.cpp +++ /dev/null @@ -1,13 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// Copyright 2019 The IBM Research Authors. -// -// ============================================================================= -// -//===----------------------------------------------------------------------===// - -#include "sgir.hpp" - -//empty module for MLIR is generated to test the compile/link of MLIR code -onnf::SGIRTest(); - diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000..764d012 --- /dev/null +++ b/src/main.cpp @@ -0,0 +1,44 @@ +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +using namespace std; + +int main(int ac, char* av[]) { + namespace po = boost::program_options; + + po::options_description desc("ONNF available options"); + // clang-format off + desc.add_options()("help", "produce help message")( + "onnx-model", po::value()->required(), + "onnx model file"); + // clang-format on + + po::variables_map vm; + po::store(po::parse_command_line(ac, av, desc), vm); + + if (vm.count("help")) { + cout << desc << endl; + return 0; + } + + return 0; +} diff --git a/third_party/benchmark b/third_party/benchmark new file mode 160000 index 0000000..b57c113 --- /dev/null +++ b/third_party/benchmark @@ -0,0 +1 @@ +Subproject commit b57c11391d9c749d6ef2b6139a339acac69bbb76 diff --git a/third_party/onnx b/third_party/onnx new file mode 160000 index 0000000..1439eab --- /dev/null +++ b/third_party/onnx @@ -0,0 +1 @@ +Subproject commit 1439eab5542c625bb3da49860f0cd68c3eafdc18 diff --git a/third_party/pybind11 b/third_party/pybind11 new file mode 160000 index 0000000..6e39b76 --- /dev/null +++ b/third_party/pybind11 @@ -0,0 +1 @@ +Subproject commit 6e39b765b2333cd191001f22fe57ea218bd6ccf2