added handling of constants equaling constants. e.g. FMT_DEFAULT = FMT_MATLAB
This commit is contained in:
parent
c5720213e4
commit
6b88a21be8
@ -194,3 +194,7 @@ install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/+cv/private/
|
|||||||
DESTINATION ${CMAKE_INSTALL_PREFIX}/matlab/+cv/private
|
DESTINATION ${CMAKE_INSTALL_PREFIX}/matlab/+cv/private
|
||||||
FILES_MATCHING PATTERN "*.${MATLAB_MEXEXT}"
|
FILES_MATCHING PATTERN "*.${MATLAB_MEXEXT}"
|
||||||
)
|
)
|
||||||
|
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/
|
||||||
|
DESTINATION ${CMAKE_INSTALL_PREFIX}/matlab
|
||||||
|
FILES_MATCHING PATTERN "cv.m"
|
||||||
|
)
|
||||||
|
@ -43,6 +43,13 @@ def noutputs(args):
|
|||||||
'''Counts the number of output arguments in the input list'''
|
'''Counts the number of output arguments in the input list'''
|
||||||
return len(outputs(args))
|
return len(outputs(args))
|
||||||
|
|
||||||
|
def convertibleToInt(string):
|
||||||
|
try:
|
||||||
|
int(string)
|
||||||
|
return True
|
||||||
|
except ValueError:
|
||||||
|
return False
|
||||||
|
|
||||||
def capitalizeFirst(text):
|
def capitalizeFirst(text):
|
||||||
return text[0].upper() + text[1:]
|
return text[0].upper() + text[1:]
|
||||||
|
|
||||||
|
@ -20,6 +20,7 @@ class MatlabWrapperGenerator(object):
|
|||||||
jtemplate = Environment(loader=PackageLoader('templates', ''), trim_blocks=True, lstrip_blocks=True)
|
jtemplate = Environment(loader=PackageLoader('templates', ''), trim_blocks=True, lstrip_blocks=True)
|
||||||
|
|
||||||
# add the custom filters
|
# add the custom filters
|
||||||
|
jtemplate.filters['convertibleToInt'] = convertibleToInt
|
||||||
jtemplate.filters['toUpperCamelCase'] = toUpperCamelCase
|
jtemplate.filters['toUpperCamelCase'] = toUpperCamelCase
|
||||||
jtemplate.filters['toLowerCamelCase'] = toLowerCamelCase
|
jtemplate.filters['toLowerCamelCase'] = toLowerCamelCase
|
||||||
jtemplate.filters['toUnderCase'] = toUnderCase
|
jtemplate.filters['toUnderCase'] = toUnderCase
|
||||||
@ -79,7 +80,7 @@ class MatlabWrapperGenerator(object):
|
|||||||
populatedm = tconstm.render(constants=const)
|
populatedm = tconstm.render(constants=const)
|
||||||
with open(output_map_dir+'/map.cpp', 'wb') as f:
|
with open(output_map_dir+'/map.cpp', 'wb') as f:
|
||||||
f.write(populatedc)
|
f.write(populatedc)
|
||||||
with open(output_map_dir+'/map.m', 'wb') as f:
|
with open(output_dir+'/cv.m', 'wb') as f:
|
||||||
f.write(populatedm)
|
f.write(populatedm)
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,14 +0,0 @@
|
|||||||
#/usr/bin/env python
|
|
||||||
|
|
||||||
# add the hdr_parser to the path
|
|
||||||
import sys
|
|
||||||
sys.path.append(sys.argv[1])
|
|
||||||
|
|
||||||
# get the IO from the command line arguments
|
|
||||||
input_files = sys.argv[2:-1]
|
|
||||||
output_dir = sys.argv[-1]
|
|
||||||
|
|
||||||
# create the generator
|
|
||||||
from gen_matlab import MatlabWrapperGenerator
|
|
||||||
mwg = MatlabWrapperGenerator()
|
|
||||||
mwg.gen(input_files, output_dir)
|
|
@ -23,7 +23,11 @@
|
|||||||
classdef cv
|
classdef cv
|
||||||
properties (Constant = true)
|
properties (Constant = true)
|
||||||
{% for key, val in constants.items() %}
|
{% for key, val in constants.items() %}
|
||||||
|
{% if val|convertibleToInt %}
|
||||||
{{key}} = {{val}};
|
{{key}} = {{val}};
|
||||||
|
{% else %}
|
||||||
|
{{key}} = {{constants[val]}};
|
||||||
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user