1
0
Fork 0
mirror of https://github.com/gwm17/catima.git synced 2024-11-22 18:28:51 -05:00

setuptools support

This commit is contained in:
Andrej Prochazka 2021-05-19 16:17:29 +02:00
parent adcd23c1c7
commit 3eff6abe0c
2 changed files with 31 additions and 2 deletions

View File

@ -14,7 +14,7 @@ option(GSL_INTEGRATION "use GSL integration" OFF)
option(GSL_INTERPOLATION "use GSL inteRPOLATION" OFF) option(GSL_INTERPOLATION "use GSL inteRPOLATION" OFF)
option(THIN_TARGET_APPROXIMATION "thin target approximation" ON) option(THIN_TARGET_APPROXIMATION "thin target approximation" ON)
option(GENERATE_DATA "make data tables generator" OFF) option(GENERATE_DATA "make data tables generator" OFF)
option(PYTHON_WHEEL "make python wheel" OFF)
######## build type ############ ######## build type ############
if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug") if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
set(CMAKE_BUILD_TYPE "Release") set(CMAKE_BUILD_TYPE "Release")
@ -122,8 +122,10 @@ if(PYTHON_MODULE)
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/libs> $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/libs>
$<INSTALL_INTERFACE:include>) $<INSTALL_INTERFACE:include>)
target_link_libraries(pycatima PRIVATE catima) target_link_libraries(pycatima PRIVATE catima)
endif(PYTHON_MODULE ) endif(PYTHON_MODULE )
if(PYTHON_WHEEL)
execute_process(COMMAND ${Python_EXECUTABLE} ${PROJECT_SOURCE_DIR}/pymodule/setup.py bdist_wheel)
endif(PYTHON_WHEEL)
########## Sub Directories ########### ########## Sub Directories ###########
if(EXAMPLES) if(EXAMPLES)

27
pymodule/setup.py Normal file
View File

@ -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},
)