Package pycv :: Module extension
[hide private]
[frames] | no frames]

Source Code for Module pycv.extension

 1  # PyCV - A Computer Vision Package for Python Incorporating Fast Training of Face Detection 
 2   
 3  # Copyright 2007 Nanyang Technological University, Singapore. 
 4  # Authors: Minh-Tri Pham, Viet-Dung D. Hoang, and Tat-Jen Cham. 
 5   
 6  # This file is part of PyCV. 
 7   
 8  # PyCV is free software: you can redistribute it and/or modify 
 9  # it under the terms of the GNU General Public  
10  # License as published by the Free Software Foundation, either version  
11  # 3 of the License, or (at your option) any later version. 
12   
13  # PyCV is distributed in the hope that it will be useful, 
14  # but WITHOUT ANY WARRANTY; without even the implied warranty of 
15  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
16  # GNU General Public License for more details. 
17   
18  # You should have received a copy of the GNU General Public License 
19  # along with this program.  If not, see <http://www.gnu.org/licenses/>. 
20   
21  # --------------------------------------------------------------------- 
22  #!/usr/bin/env python 
23   
24  from scipy.weave.ext_tools import * 
25   
26  from system_info import get_info 
27   
28  mod = None 
29   
30 -def initialize_ext():
31 """ Build an extension module for this package. 32 """ 33 # ============================================================================== 34 # Building a C++ extension module 35 # ============================================================================== 36 global mod 37 mod = ext_module('ext') 38 39 #---------------------------------------------------------- 40 # headers 41 #---------------------------------------------------------- 42 mod.customize.add_header('<plat_det.h>') 43 mod.customize.add_header('<argsort.h>') 44 45 #---------------------------------------------------------- 46 # link to external libraries 47 #---------------------------------------------------------- 48 mod.customize.add_library('sdcpp') 49 mod.customize.add_library('cblas_ext') 50 mod.customize.add_library('cephesd') 51 mod.customize.add_library('plat_det') 52 53 info = get_info('numpy_blas') 54 55 [mod.customize.add_library(x) for x in info['libraries']] 56 [mod.customize.add_library_dir(x) for x in info['library_dirs']] 57 [mod.customize.add_extra_compile_arg(x) for x in info['extra_compiler_args']]
58 59 60
61 -def get_ext():
62 """Get a reference to the extension module. 63 """ 64 return mod
65
66 -def finalize_ext(location='.', **kwds):
67 """Finalize the module. 68 """ 69 #---------------------------------------------------------- 70 # return the module and reset the module 71 #---------------------------------------------------------- 72 global mod 73 z = mod.setup_extension(location, **kwds) 74 mod = None 75 return z
76