aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt6
-rw-r--r--common/pybindings.cc15
2 files changed, 18 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a17a07ce..494353fd 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -48,12 +48,12 @@ foreach (family ${FAMILIES})
aux_source_directory(${family}/ ${ufamily}_FILES)
add_executable(nextpnr-${family} ${COMMON_FILES} ${${ufamily}_FILES})
# TODO: also build an importable Python module
- # PYTHON_ADD_MODULE(pynextpnr_${family} ${COMMON_FILES} ${${ufamily}_FILES})
- set(family_targets nextpnr-${family})
+ PYTHON_ADD_MODULE(nextpnrpy_${family} ${COMMON_FILES} ${${ufamily}_FILES})
+ set(family_targets nextpnr-${family} nextpnrpy_${family})
include(${family}/family.cmake)
foreach (target ${family_targets})
target_include_directories(${target} PRIVATE ${family}/)
- target_compile_definitions(${target} PRIVATE ARCH_${ufamily} ARCHNAME="${family}")
+ target_compile_definitions(${target} PRIVATE ARCH_${ufamily} ARCHNAME=${family})
target_link_libraries(${target} LINK_PUBLIC ${Boost_LIBRARIES} ${PYTHON_LIBRARIES})
endforeach (target)
endforeach (family)
diff --git a/common/pybindings.cc b/common/pybindings.cc
new file mode 100644
index 00000000..43e474e1
--- /dev/null
+++ b/common/pybindings.cc
@@ -0,0 +1,15 @@
+#include "design.h"
+#include "chip.h"
+
+#include <boost/python.hpp>
+#include <boost/python/suite/indexing/vector_indexing_suite.hpp>
+#include <boost/python/suite/indexing/map_indexing_suite.hpp>
+using namespace boost::python;
+
+#define PASTER(x,y) x ## _ ## y
+#define EVALUATOR(x,y) PASTER(x,y)
+#define MODULE_NAME EVALUATOR(nextpnrpy, ARCHNAME)
+
+BOOST_PYTHON_MODULE (MODULE_NAME) {
+
+}