yaze_py rename src and header, add boost::python
This commit is contained in:
@@ -1,20 +1,29 @@
|
||||
find_package(Python3 COMPONENTS Interpreter Development REQUIRED)
|
||||
find_package(PythonLibs 3.8 COMPONENTS Interpreter Development REQUIRED)
|
||||
cmake_policy(SET CMP0167 NEW)
|
||||
find_package(Boost COMPONENTS python3 REQUIRED)
|
||||
|
||||
set(CMAKE_SHARED_MODULE_PREFIX "")
|
||||
|
||||
# target x86_64 for module
|
||||
add_library(
|
||||
yaze_py
|
||||
py/yaze_python.cc
|
||||
yaze_py MODULE
|
||||
py/yaze_py.cc
|
||||
)
|
||||
|
||||
set(PYTHON_HEADERS /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/Headers)
|
||||
|
||||
target_include_directories(
|
||||
yaze_py PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/
|
||||
lib/
|
||||
app/
|
||||
${PYTHON_HEADERS}
|
||||
${Boost_INCLUDE_DIRS}
|
||||
${PYTHON_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
target_link_libraries(
|
||||
yaze_py PUBLIC
|
||||
Python
|
||||
${PYTHON_LIBRARIES}
|
||||
Boost::python3
|
||||
)
|
||||
@@ -1,7 +1,22 @@
|
||||
#include "yaze_python.h"
|
||||
#include "yaze_py.h"
|
||||
|
||||
#include <Python.h>
|
||||
|
||||
#include <boost/python.hpp>
|
||||
|
||||
#include "yaze.h"
|
||||
|
||||
BOOST_PYTHON_MODULE(yaze) {
|
||||
using namespace boost::python;
|
||||
def("yaze_init", yaze_init);
|
||||
|
||||
class_<Rom>("Rom")
|
||||
.def_readonly("filename", &Rom::filename)
|
||||
.def_readonly("data", &Rom::data)
|
||||
.def_readonly("size", &Rom::size)
|
||||
.def_readonly("impl", &Rom::impl);
|
||||
}
|
||||
|
||||
static PyObject *SpamError;
|
||||
|
||||
static PyObject *yaze_init(PyObject *self, PyObject *args) {
|
||||
@@ -16,6 +16,6 @@ static struct PyModuleDef yaze_module = {PyModuleDef_HEAD_INIT,
|
||||
-1, // Interpreter state size
|
||||
YazeMethods};
|
||||
|
||||
PyMODINIT_FUNC PyInit_yaze(void) { return PyModule_Create(&yaze_module); }
|
||||
// PyMODINIT_FUNC PyInit_yaze(void) { return PyModule_Create(&yaze_module); }
|
||||
|
||||
#endif // YAZE_PYTHON_H
|
||||
Reference in New Issue
Block a user