parent
f705020348
commit
059d63cceb
6 changed files with 145 additions and 13 deletions
@ -0,0 +1,50 @@ |
||||
#/usr/bin/env python |
||||
|
||||
def substitute(build, output_dir): |
||||
|
||||
# setup the template engine |
||||
template_dir = os.path.join(os.path.dirname(__file__), 'templates') |
||||
jtemplate = Environment(loader=FileSystemLoader(template_dir), trim_blocks=True, lstrip_blocks=True) |
||||
|
||||
# add the filters |
||||
jtemplate.filters['csv'] = csv |
||||
jtemplate.filters['stripExtraSpaces'] = stripExtraSpaces |
||||
|
||||
# load the template |
||||
template = jtemplate.get_template('template_build_info.m') |
||||
|
||||
# create the build directory |
||||
output_dir = output_dir+'/+cv' |
||||
if not os.path.isdir(output_dir): |
||||
os.mkdir(output_dir) |
||||
|
||||
# populate templates |
||||
populated = template.render(build=build) |
||||
with open(os.path.join(output_dir, 'buildInformation.m'), 'wb') as f: |
||||
f.write(populated) |
||||
|
||||
if __name__ == "__main__": |
||||
|
||||
# parse the input options |
||||
import sys, re, os |
||||
from argparse import ArgumentParser |
||||
parser = ArgumentParser() |
||||
parser.add_argument('--os') |
||||
parser.add_argument('--arch', nargs=2) |
||||
parser.add_argument('--compiler', nargs='+') |
||||
parser.add_argument('--mex_arch') |
||||
parser.add_argument('--mex_script') |
||||
parser.add_argument('--mex_opts', default=['-largeArrayDims'], nargs='*') |
||||
parser.add_argument('--cxx_flags', default=[], nargs='*') |
||||
parser.add_argument('--opencv_version', default='', nargs='?') |
||||
parser.add_argument('--commit', default='Not in working git tree', nargs='?') |
||||
parser.add_argument('--modules', nargs='+') |
||||
parser.add_argument('--configuration') |
||||
parser.add_argument('--outdir') |
||||
build = parser.parse_args() |
||||
|
||||
from filters import * |
||||
from jinja2 import Environment, FileSystemLoader |
||||
|
||||
# populate the build info template |
||||
substitute(build, build.outdir) |
@ -0,0 +1,39 @@ |
||||
function buildInformation() |
||||
%CV.BUILDINFORMATION display OpenCV Toolbox build information |
||||
% |
||||
% Call CV.BUILDINFORMATION() to get a printout of diagonstic information |
||||
% pertaining to your particular build of the OpenCV Toolbox. If you ever |
||||
% run into issues with the Toolbox, it is useful to submit this |
||||
% information alongside a bug report to the OpenCV team. |
||||
% |
||||
info = { |
||||
' ------------------------------------------------------------------------' |
||||
' <strong>OpenCV Toolbox</strong>' |
||||
' Build and diagnostic information' |
||||
' ------------------------------------------------------------------------' |
||||
'' |
||||
' <strong>Platform</strong>' |
||||
' OS: {{ build.os }}' |
||||
' Architecture: {{ build.arch[0] }}-bit {{ build.arch[1] }}' |
||||
' Compiler: {{ build.compiler | csv(' ') }}' |
||||
'' |
||||
' <strong>Matlab</strong>' |
||||
[' Version: ' version()] |
||||
[' Mex extension: ' mexext()] |
||||
' Architecture: {{ build.mex_arch }}' |
||||
' Mex path: {{ build.mex_script }}' |
||||
' Mex flags: {{ build.mex_opts | csv(' ') }}' |
||||
' CXX flags: {{ build.cxx_flags | csv(' ') | stripExtraSpaces | wordwrap(60, True, '\'\n\' ') }}' |
||||
'' |
||||
' <strong>OpenCV</strong>' |
||||
' Version: {{ build.opencv_version }}' |
||||
' Commit: {{ build.commit }}' |
||||
' Configuration: {{ build.configuration }}' |
||||
' Modules: {{ build.modules | csv | wordwrap(60, True, '\'\n\' ') }}' |
||||
'' |
||||
}; |
||||
|
||||
info = cellfun(@(x) [x '\n'], info, 'UniformOutput', false); |
||||
info = horzcat(info{:}); |
||||
fprintf(info); |
||||
end |
@ -0,0 +1,15 @@ |
||||
function help() |
||||
%CV.HELP display help information for the OpenCV Toolbox |
||||
% |
||||
% Calling: |
||||
% >> cv.help(); |
||||
% |
||||
% is equivalent to calling: |
||||
% >> help cv; |
||||
% |
||||
% It displays high-level usage information about the OpenCV toolbox |
||||
% along with resources to find out more information. |
||||
% |
||||
% See also: cv.buildInformation |
||||
help('cv'); |
||||
end |
Loading…
Reference in new issue