nasa-jpl / autoRIFT

A Python module of a fast and intelligent algorithm for finding the pixel displacement between two images
Apache License 2.0
218 stars 53 forks source link

Change the code of setup to this #95

Open itstalmeez opened 1 year ago

itstalmeez commented 1 year ago

import numpy as np import os from distutils.core import setup from distutils.extension import Extension

Check for NumPy

try: import numpy as np except ImportError: raise Exception('NumPy does not appear to be installed. Install before proceeding ... ')

Check and print OpenCV path

try: import cv2 path = [line.split()[-1] for line in cv2.getBuildInformation().splitlines() if 'Install to:' in line][0] print('OpenCV path:', path) except ImportError: raise Exception('OpenCV does not appear to be installed. Install before proceeding ... ')

extensions = [ Extension( name="autoRIFT.autoriftcore", sources=['geo_autoRIFT/autoRIFT/bindings/autoriftcoremodule.cpp'], include_dirs=[np.get_include(), 'geo_autoRIFT/autoRIFT/include', os.path.join(path, 'include/opencv4/')], library_dirs=[os.path.join(path, 'lib')], libraries=['opencv_core', 'opencv_imgproc'], extra_compile_args=['-std=c++11'], language="c++" ), Extension( name="geogrid.geogridOptical", sources=['geo_autoRIFT/geogrid/bindings/geogridOpticalmodule.cpp', 'geo_autoRIFT/geogrid/src/geogridOptical.cpp'], include_dirs=[np.get_include(), 'geo_autoRIFT/geogrid/include', os.path.join(path, 'include')], library_dirs=[os.path.join(path, 'lib')], libraries=['gomp', 'gdal'], extra_compile_args=['-std=c++11'], language="c++" ) ]

setup( name='geo_autoRIFT', version='1.5.0', description='This is the autoRIFT python package', package_dir={'autoRIFT': 'geo_autoRIFT/autoRIFT', 'geogrid': 'geo_autoRIFT/geogrid'}, packages=['autoRIFT', 'geogrid'], ext_modules=extensions )