Kaydet (Commit) 85b184e2 authored tarafından Miklos Vajna's avatar Miklos Vajna

solenv: generate the ifdefs in native-code.py in a more elegant fashion

Commit 369b84e8 (We don't build
libxsec_xmlsec for Android currently, 2014-08-13) added
platform-dependent guards to have components only on Android or only not
on Android. Generalize that a bit more, so adding new Android-only
components is a single line of code change.

Change-Id: I54711ffcdf64c4ddd986e2f59129797462dcfe58
üst 19d09504
...@@ -47,7 +47,7 @@ core_factory_list = [ ...@@ -47,7 +47,7 @@ core_factory_list = [
("libutllo.a", "utl_component_getFactory"), ("libutllo.a", "utl_component_getFactory"),
("libxmlsecurity.a", "xmlsecurity_component_getFactory"), ("libxmlsecurity.a", "xmlsecurity_component_getFactory"),
("libxolo.a", "xo_component_getFactory"), ("libxolo.a", "xo_component_getFactory"),
("libxsec_xmlsec.a", "xsec_xmlsec_component_getFactory"), ("libxsec_xmlsec.a", "xsec_xmlsec_component_getFactory", "#ifndef ANDROID"),
("libxstor.a", "xstor_component_getFactory"), ("libxstor.a", "xstor_component_getFactory"),
] ]
...@@ -153,7 +153,7 @@ draw_constructor_list = [ ...@@ -153,7 +153,7 @@ draw_constructor_list = [
] ]
writer_factory_list = [ writer_factory_list = [
("libsblo.a", "sb_component_getFactory"), ("libsblo.a", "sb_component_getFactory", "#ifdef ANDROID"),
("libswdlo.a", "swd_component_getFactory"), ("libswdlo.a", "swd_component_getFactory"),
("libswlo.a", "sw_component_getFactory"), ("libswlo.a", "sw_component_getFactory"),
("libwriterfilterlo.a", "writerfilter_component_getFactory"), ("libwriterfilterlo.a", "writerfilter_component_getFactory"),
...@@ -197,15 +197,16 @@ extern "C" { ...@@ -197,15 +197,16 @@ extern "C" {
if options.groups: if options.groups:
for factory_group in options.groups: for factory_group in options.groups:
for (factory_name,factory_function) in factory_map[factory_group]: for entry in factory_map[factory_group]:
if factory_function == 'sb_component_getFactory': factory_name = entry[0]
print ('#ifdef ANDROID') factory_function = entry[1]
if factory_function == 'xsec_xmlsec_component_getFactory': factory_guard = None
print ('#ifndef ANDROID') if len(entry) > 2:
factory_guard = entry[2]
if factory_guard:
print (factory_guard)
print ('void * '+factory_function+'( const char* , void* , void* );') print ('void * '+factory_function+'( const char* , void* , void* );')
if factory_function == 'sb_component_getFactory': if factory_guard:
print ('#endif')
if factory_function == 'xsec_xmlsec_component_getFactory':
print ('#endif') print ('#endif')
print ('') print ('')
...@@ -222,15 +223,16 @@ lo_get_factory_map(void) ...@@ -222,15 +223,16 @@ lo_get_factory_map(void)
if options.groups: if options.groups:
for factory_group in options.groups: for factory_group in options.groups:
for (factory_name,factory_function) in factory_map[factory_group]: for entry in factory_map[factory_group]:
if factory_function == 'sb_component_getFactory': factory_name = entry[0]
print ('#ifdef ANDROID') factory_function = entry[1]
if factory_function == 'xsec_xmlsec_component_getFactory': factory_guard = None
print ('#ifndef ANDROID') if len(entry) > 2:
factory_guard = entry[2]
if factory_guard:
print (factory_guard)
print (' { "'+factory_name+'", '+factory_function+' },') print (' { "'+factory_name+'", '+factory_function+' },')
if factory_function == 'sb_component_getFactory': if factory_guard:
print ('#endif')
if factory_function == 'xsec_xmlsec_component_getFactory':
print ('#endif') print ('#endif')
print (""" print ("""
...@@ -278,3 +280,5 @@ print (""" ...@@ -278,3 +280,5 @@ print ("""
} }
}""") }""")
# vim:set shiftwidth=4 softtabstop=4 expandtab:
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment