From bfeeac6e4889d1e9a1083b3c7efc59652981b168 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Mon, 1 Aug 2016 08:20:23 +0200 Subject: o Moving the generation logic to Python, embedding a Python interpreter with the help of pybind11. o Adding install configuration to CMake to make it easier to reuse the project later on. o Splitting out the examples into its own project to make it easier to test the whole installation setup and python/template loading. o Trying to reorganize the code a bit, not very much better yet. --- python/include/trygvis/kicad/GenerateHeaderPy.h | 45 +++++++++++++++++++++++++ python/include/trygvis/kicad/python.h | 3 ++ 2 files changed, 48 insertions(+) create mode 100644 python/include/trygvis/kicad/GenerateHeaderPy.h create mode 100644 python/include/trygvis/kicad/python.h (limited to 'python/include') diff --git a/python/include/trygvis/kicad/GenerateHeaderPy.h b/python/include/trygvis/kicad/GenerateHeaderPy.h new file mode 100644 index 0000000..893b7ed --- /dev/null +++ b/python/include/trygvis/kicad/GenerateHeaderPy.h @@ -0,0 +1,45 @@ +#ifndef KICAD_UTILS_GENERATEHEADEPY_H +#define KICAD_UTILS_GENERATEHEADEPY_H + +#include "trygvis/kicad.h" +#include "pybind11/pybind11.h" +#include +#include + +namespace trygvis { +namespace kicad { +namespace python { + +namespace py = pybind11; + +using nl = trygvis::kicad::netlist::netlist; + +class GenerateHeaderPy { +public: + GenerateHeaderPy(const std::string &ref, nl *netlist); + + virtual ~GenerateHeaderPy(); + + std::string ref(); + + nl *netlist(); + + std::string str(); + + void print(const std::string &str); + + void println(const std::string &str); + +private: + std::string ref_; + + nl *netlist_; + + std::stringstream buf_; +}; + +} // namespace python +} // namespace kicad +} // namespace trygvis + +#endif diff --git a/python/include/trygvis/kicad/python.h b/python/include/trygvis/kicad/python.h new file mode 100644 index 0000000..f2ae816 --- /dev/null +++ b/python/include/trygvis/kicad/python.h @@ -0,0 +1,3 @@ +#pragma once + +#include "trygvis/kicad/GenerateHeaderPy.h" -- cgit v1.2.3