Enable building of first commit.

This commit is contained in:
Doru Bercea 2019-12-19 14:24:37 -05:00
parent b6a2a50dd8
commit 63427030ca
9 changed files with 91 additions and 15 deletions

9
.gitmodules vendored Normal file
View File

@ -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

View File

@ -12,8 +12,29 @@ set(CMAKE_CXX_FLAGS_DEBUG "-g")
set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG") set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG")
set(ONNF_ROOT "${CMAKE_CURRENT_SOURCE_DIR}") 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 cxx standard only for onnf project files.
set(CMAKE_CXX_STANDARD 14) 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)

10
src/CMakeLists.txt Normal file
View File

@ -0,0 +1,10 @@
add_executable(onnf main.cpp)
target_include_directories(onnf PRIVATE ..)
target_link_libraries(onnf
builder
${Boost_LIBRARIES}
)

View File

@ -1,3 +1,5 @@
add_definitions(-DBOOST_LOG_DYN_LINK)
add_library(builder add_library(builder
sgir.cpp sgir.cpp
) )
@ -77,7 +79,7 @@ set(MLIRLIBS ${MLIRLIBANALYSIS} ${MLIRLIBIR} ${MLIRLIBPARSER} ${MLIRLIBTRANSFORM
${LLVMLIBSUPPORT}) ${LLVMLIBSUPPORT})
target_link_libraries(builder compiler op onnx ${MLIRLIBS} curses) target_link_libraries(builder onnx ${MLIRLIBS} curses)
target_include_directories(builder target_include_directories(builder
PRIVATE PRIVATE
${CMAKE_SOURCE_DIR}/third_party/onnx ${CMAKE_SOURCE_DIR}/third_party/onnx

View File

@ -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();

44
src/main.cpp Normal file
View File

@ -0,0 +1,44 @@
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <random>
#include <tuple>
#include <boost/date_time/posix_time/posix_time_types.hpp>
#include <boost/log/attributes/named_scope.hpp>
#include <boost/log/core.hpp>
#include <boost/log/expressions.hpp>
#include <boost/log/sinks/sync_frontend.hpp>
#include <boost/log/sinks/text_file_backend.hpp>
#include <boost/log/sinks/text_ostream_backend.hpp>
#include <boost/log/sources/logger.hpp>
#include <boost/log/support/date_time.hpp>
#include <boost/log/trivial.hpp>
#include <boost/log/utility/setup/common_attributes.hpp>
#include <boost/log/utility/setup/console.hpp>
#include <boost/log/utility/setup/file.hpp>
#include <boost/program_options.hpp>
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<string>()->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;
}

1
third_party/benchmark vendored Submodule

@ -0,0 +1 @@
Subproject commit b57c11391d9c749d6ef2b6139a339acac69bbb76

1
third_party/onnx vendored Submodule

@ -0,0 +1 @@
Subproject commit 1439eab5542c625bb3da49860f0cd68c3eafdc18

1
third_party/pybind11 vendored Submodule

@ -0,0 +1 @@
Subproject commit 6e39b765b2333cd191001f22fe57ea218bd6ccf2