Browse Source

suitable name for the generated extension module

REWORK
heck 5 years ago
parent
commit
0792869686
  1. 4
      Makefile
  2. 18
      setup.py
  3. 2
      src/pEp/Makefile.conf
  4. 4
      src/pEp/__init__.py
  5. 2
      src/pEp/_gen/Makefile
  6. 2
      src/pEp/_gen/pEpModule.cc

4
Makefile

@ -94,8 +94,8 @@ clean-docs:
# ====================================== # ======================================
makefile-build: makefile-build:
$(MAKE) -C src/pEp/_pEp $(MAKE) -C src/pEp/_pEp
$(MAKE) -C src/pEp/_pybind $(MAKE) -C src/pEp/_gen
makefile-clean: makefile-clean:
$(MAKE) -C src/pEp/_pEp clean $(MAKE) -C src/pEp/_pEp clean
$(MAKE) -C src/pEp/_pybind clean $(MAKE) -C src/pEp/_gen clean

18
setup.py

@ -174,11 +174,11 @@ class BuildExtCommand(build_ext):
module_pEp.libraries = libs module_pEp.libraries = libs
module_pEp.extra_compile_args = compile_flags module_pEp.extra_compile_args = compile_flags
global module_pybind11 global module_gen
module_pybind11.include_dirs = includes module_gen.include_dirs = includes
module_pybind11.library_dirs = libdirs module_gen.library_dirs = libdirs
# module_pybind11.libraries = libs # module_gen.libraries = libs
module_pybind11.extra_compile_args = compile_flags module_gen.extra_compile_args = compile_flags
pEpLog("Include Dirs:", module_pEp.include_dirs) pEpLog("Include Dirs:", module_pEp.include_dirs)
pEpLog("Libs Dirs:", module_pEp.library_dirs) pEpLog("Libs Dirs:", module_pEp.library_dirs)
@ -212,10 +212,10 @@ module_pEp = Extension(
], ],
) )
module_pybind11 = Extension( module_gen = Extension(
'pEp._pybind', 'pEp._gen',
sources=[ sources=[
'src/pEp/_pybind/pEpmodule.cc', 'src/pEp/_gen/pEpmodule.cc',
], ],
) )
@ -224,7 +224,7 @@ module_pybind11 = Extension(
setup( setup(
package_dir={'': 'src'}, package_dir={'': 'src'},
packages=['pEp'], packages=['pEp'],
ext_modules=[module_pEp, module_pybind11], ext_modules=[module_pEp, module_gen],
cmdclass={ cmdclass={
'build_ext': BuildExtCommand, 'build_ext': BuildExtCommand,
}, },

2
src/pEp/Makefile.conf

@ -2,7 +2,7 @@ HERE:=$(dir $(lastword $(MAKEFILE_LIST)))
-include $(HERE)../../local.conf -include $(HERE)../../local.conf
TARGET_PEP=_pEp.so TARGET_PEP=_pEp.so
TARGET_PYBIND=_pybind.so TARGET_GEN=_gen.so
# General Build settings # General Build settings
CXX=g++ CXX=g++

4
src/pEp/__init__.py

@ -25,12 +25,12 @@ except ImportError:
# Imports all symbols EXCEPT the ones beginning with underscore # Imports all symbols EXCEPT the ones beginning with underscore
from ._pEp import * from ._pEp import *
from ._pybind import * from ._gen import *
# import the native module into the current namespace because we also need to access the names beginning # import the native module into the current namespace because we also need to access the names beginning
# with an underscore (of _pEp), but we dont want to import them into this module # with an underscore (of _pEp), but we dont want to import them into this module
import pEp._pEp import pEp._pEp
import pEp._pybind import pEp._gen
# Executed on module import # Executed on module import
def init(): def init():

2
src/pEp/_pybind/Makefile → src/pEp/_gen/Makefile

@ -1,5 +1,5 @@
include ../Makefile.conf include ../Makefile.conf
TARGET=$(TARGET_PYBIND) TARGET=$(TARGET_GEN)
# Specific Build settings # Specific Build settings
CXXFLAGS+= CXXFLAGS+=

2
src/pEp/_pybind/pEpModule.cc → src/pEp/_gen/pEpModule.cc

@ -7,7 +7,7 @@ string testfunc() {
return "fsdfg"; return "fsdfg";
} }
PYBIND11_MODULE(_pybind, m) { PYBIND11_MODULE(_gen, m) {
m.doc() = "pybind11 example plugin"; // optional module docstring m.doc() = "pybind11 example plugin"; // optional module docstring
m.def("add", &testfunc, "A function which adds two numbers"); m.def("add", &testfunc, "A function which adds two numbers");
} }
Loading…
Cancel
Save