src/platform/python/_builder.py (view raw)
1import cffi
2import os.path
3import subprocess
4import sys
5
6ffi = cffi.FFI()
7src = os.path.join(os.path.dirname(__file__), "..", "..")
8
9ffi.set_source("mgba._pylib", """
10#include "util/common.h"
11#include "core/core.h"
12""", include_dirs=[src],
13 extra_compile_args=sys.argv[1:],
14 libraries=["mgba"],
15 library_dirs=[os.path.join(os.getcwd(), "..")])
16
17with open(os.path.join(os.getcwd(), "_builder.h")) as core:
18 ffi.cdef(core.read())
19
20ffi.compile()