<commit_before>#!/usr/bin/env python

from distutils.core import setup, Extension
import numpy as np
import sys
import os
import glob

default_include_dirs = [
    '/usr/local/include',
    '/usr/include',
]

cplus_include_path = os.getenv('CPLUS_INCLUDE_PATH', '')
if cplus_include_path:
    default_include_dirs.extend(cplus_include_path.split(':'))


def find_path(name, hints, path_suffixes=[]):
    suffixes = [''] + path_suffixes
    for c in hints:
        for s in suffixes:
            path = os.path.join(c, s)
            if os.path.isfile(os.path.join(path, name)):
                return path
    return None

def find_include(name, hints, path_suffixes=[]):
    return find_path(name, hints + default_include_dirs, path_suffixes)


libraries = []
library_dirs = ['/usr/local/lib']

# Eigen
eigen_include_dir = find_include('Eigen/Core', [], ['eigen3'])

# Ceres
ceres_libraries = ['ceres', 'glog', 'gflags']
libraries.extend(ceres_libraries)

# Boost Python
boost_python_libraries = ['boost_python']
libraries.extend(boost_python_libraries)

# Akaze
akaze_include_dir = 'opensfm/src/third_party/akaze/lib'
akaze_sources = [
    'opensfm/src/third_party/akaze/lib/AKAZE.cpp',
    'opensfm/src/third_party/akaze/lib/fed.cpp',
    'opensfm/src/third_party/akaze/lib/nldiffusion_functions.cpp',
    'opensfm/src/third_party/akaze/lib/utils.cpp',
]
akaze_depends = [
    'opensfm/src/third_party/akaze/lib/AKAZEConfig.h',
    'opensfm/src/third_party/akaze/lib/AKAZE.h',
    'opensfm/src/third_party/akaze/lib/fed.h',
    'opensfm/src/third_party/akaze/lib/nldiffusion_functions.h',
    'opensfm/src/third_party/akaze/lib/utils.h',
]
akaze_library = ('akaze', {
    'sources': akaze_sources,
    'depends': akaze_depends,
    'include_dirs': [akaze_include_dir],
})

# libmv
libmv_include_dir = 'opensfm/src/third_party'
libmv_sources = [
    'opensfm/src/third_party/libmv/multiview/fundamental.cc',
    'opensfm/src/third_party/libmv/multiview/projection.cc',
    'opensfm/src/third_party/libmv/multiview/five_point.cc',
    'opensfm/src/third_party/libmv/multiview/robust_five_point.cc',<commit_msg>Add opencv dependency on setup.py<commit_after>#!/usr/bin/env python

from distutils.core import setup, Extension
import numpy as np
import sys
import os
import glob

default_include_dirs = [
    '/usr/local/include',
    '/usr/include',
]

cplus_include_path = os.getenv('CPLUS_INCLUDE_PATH', '')
if cplus_include_path:
    default_include_dirs.extend(cplus_include_path.split(':'))


def find_path(name, hints, path_suffixes=[]):
    suffixes = [''] + path_suffixes
    for c in hints:
        for s in suffixes:
            path = os.path.join(c, s)
            if os.path.isfile(os.path.join(path, name)):
                return path
    return None

def find_include(name, hints, path_suffixes=[]):
    return find_path(name, hints + default_include_dirs, path_suffixes)


libraries = []
library_dirs = ['/usr/local/lib']

# Eigen
eigen_include_dir = find_include('Eigen/Core', [], ['eigen3'])

# Ceres
ceres_libraries = ['ceres', 'glog', 'gflags']
libraries.extend(ceres_libraries)

# Boost Python
boost_python_libraries = ['boost_python']
libraries.extend(boost_python_libraries)

# OpenCV
opencv_libraries = ['opencv_ml','opencv_legacy','opencv_imgproc','opencv_highgui','opencv_flann','opencv_core','opencv_contrib']
libraries.extend(opencv_libraries)

# Akaze
akaze_include_dir = 'opensfm/src/third_party/akaze/lib'
akaze_sources = [
    'opensfm/src/third_party/akaze/lib/AKAZE.cpp',
    'opensfm/src/third_party/akaze/lib/fed.cpp',
    'opensfm/src/third_party/akaze/lib/nldiffusion_functions.cpp',
    'opensfm/src/third_party/akaze/lib/utils.cpp',
]
akaze_depends = [
    'opensfm/src/third_party/akaze/lib/AKAZEConfig.h',
    'opensfm/src/third_party/akaze/lib/AKAZE.h',
    'opensfm/src/third_party/akaze/lib/fed.h',
    'opensfm/src/third_party/akaze/lib/nldiffusion_functions.h',
    'opensfm/src/third_party/akaze/lib/utils.h',
]
akaze_library = ('akaze', {
    'sources': akaze_sources,
    'depends': akaze_depends,
    'include_dirs': [akaze_include_dir],
})

# libmv
libmv_include_dir = 'opensfm/src/third_party'
libmv_sources = [
    'opensfm/src/third_party/libmv/multiview/fundamental.cc',
    'opensfm/src/third_party/libmv/multiview/projection.cc',
    'opensfm/src/third_party/libmv/multiview/five_point.cc',
    'opensfm/src/third_party/libmv/multiview/robust_five_point.cc',
{'fraction_non_alphanumeric': 0.14175724637681159, 'fraction_numerical': 0.0004528985507246377, 'mean_word_length': 4.4129901960784315, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3532177', 'n_tokens_mistral': 1716, 'n_tokens_neox': 1680, 'n_words': 219}