mirror of
https://github.com/ConsistentlyInconsistentYT/Pixeltovoxelprojector.git
synced 2025-10-12 20:02:06 +00:00
Create setup.py
This commit is contained in:
parent
2131a4f7cc
commit
3c8421eb85
1 changed files with 43 additions and 0 deletions
43
setup.py
Normal file
43
setup.py
Normal file
|
@ -0,0 +1,43 @@
|
|||
from setuptools import setup, Extension
|
||||
from setuptools.command.build_ext import build_ext
|
||||
import pybind11
|
||||
import sys
|
||||
import os
|
||||
|
||||
# Custom build_ext to add compiler-specific flags
|
||||
class BuildExt(build_ext):
|
||||
c_opts = {
|
||||
'msvc': ['/O2', '/openmp'], # Enable optimization and OpenMP for MSVC
|
||||
'unix': ['-O3', '-fopenmp'],
|
||||
}
|
||||
l_opts = {
|
||||
'msvc': [],
|
||||
'unix': ['-fopenmp'],
|
||||
}
|
||||
|
||||
def build_extensions(self):
|
||||
ct = self.compiler.compiler_type
|
||||
opts = self.c_opts.get(ct, [])
|
||||
link_opts = self.l_opts.get(ct, [])
|
||||
for ext in self.extensions:
|
||||
ext.extra_compile_args = opts
|
||||
ext.extra_link_args = link_opts
|
||||
build_ext.build_extensions(self)
|
||||
|
||||
ext_modules = [
|
||||
Extension(
|
||||
'process_image_cpp',
|
||||
['process_image.cpp'],
|
||||
include_dirs=[
|
||||
pybind11.get_include(), # Use pybind11's function to get the include path
|
||||
],
|
||||
language='c++'
|
||||
),
|
||||
]
|
||||
|
||||
setup(
|
||||
name='process_image_cpp',
|
||||
version='0.0.1',
|
||||
ext_modules=ext_modules,
|
||||
cmdclass={'build_ext': BuildExt},
|
||||
)
|
Loading…
Add table
Add a link
Reference in a new issue