diff --git a/CMakeLists.txt b/CMakeLists.txt index a37bded..224f5e8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,7 +14,7 @@ option(GSL_INTEGRATION "use GSL integration" OFF) option(GSL_INTERPOLATION "use GSL inteRPOLATION" OFF) option(THIN_TARGET_APPROXIMATION "thin target approximation" ON) option(GENERATE_DATA "make data tables generator" OFF) - +option(PYTHON_WHEEL "make python wheel" OFF) ######## build type ############ if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug") set(CMAKE_BUILD_TYPE "Release") @@ -122,8 +122,10 @@ if(PYTHON_MODULE) $ $) target_link_libraries(pycatima PRIVATE catima) - endif(PYTHON_MODULE ) +if(PYTHON_WHEEL) + execute_process(COMMAND ${Python_EXECUTABLE} ${PROJECT_SOURCE_DIR}/pymodule/setup.py bdist_wheel) +endif(PYTHON_WHEEL) ########## Sub Directories ########### if(EXAMPLES) diff --git a/pymodule/setup.py b/pymodule/setup.py new file mode 100644 index 0000000..12626fa --- /dev/null +++ b/pymodule/setup.py @@ -0,0 +1,27 @@ +from pathlib import Path + +from pybind11.setup_helpers import Pybind11Extension, build_ext +from setuptools import setup + +DIR = Path(__file__).parents[0] + +SRC = [str(DIR/'pycatima.cpp')]+[str(fname.resolve()) for fname in DIR.glob('../*.cpp')] +SRCG = [str(fname.resolve()) for fname in DIR.glob('../global/*.c')] +SRC += SRCG +print (SRC) +example_module = Pybind11Extension( + 'pycatima', + SRC, + include_dirs=['../build/include','../global'], + extra_compile_args=['-O3'] +) + +setup( + name='pycatima', + version=1.54, + author='Andrej Prochazka', + author_email='hrocho@vodacionline.sk', + description='python interface to catima library', + ext_modules=[example_module], + cmdclass={"build_ext": build_ext}, +)