meson: here comes cxx bindings

this commits is bringing cxx bindings.
You can enable / disable them with the cxx option.

Differential Revision: https://phab.enlightenment.org/D7181
This commit is contained in:
Marcel Hollerbach 2018-10-19 16:18:39 +02:00
parent e19d239147
commit e85311c992
20 changed files with 551 additions and 1 deletions

View File

@ -313,7 +313,14 @@ subdir(join_paths('src', 'bin', 'efl'))
subdir(join_paths('src', 'generic', 'evas'))
subdir(join_paths('src', 'generic', 'emotion'))
subdir(join_paths('src', 'bindings', 'luajit'))
bindings = ['luajit', 'cxx']
foreach binding : bindings
if get_option(binding)
subdir(join_paths('src', 'bindings', binding))
endif
endforeach
subdir(join_paths('src', 'edje_external'))

View File

@ -309,3 +309,15 @@ option('nls',
value: true,
description: 'enable localization: (default=true)'
)
option('luajit',
type: 'boolean',
value: true,
description: 'Flag for handling lua bindings'
)
option('cxx',
type: 'boolean',
value: true,
description: 'Flag for handling cxx bindings'
)

View File

@ -0,0 +1,6 @@
eolian_cxx_gen = executable('eolian_cxx',
'eolian_cxx.cc',
dependencies: [eolian_cxx, eina_cxx, eolian],
install: true,
cpp_args : package_c_args,
)

View File

@ -0,0 +1,4 @@
cxx_header_src += files(
'Ecore.hh',
'Ecore_Manual.hh',
)

View File

@ -0,0 +1,6 @@
cxx_header_src += files(
'eet_type.hh',
'eet_register.hh',
'eet_composite.hh',
'Eet.hh'
)

View File

@ -0,0 +1,5 @@
cxx_header_src += join_paths(file_location, 'Efl.hh')
install_headers(join_paths('..', file_location, 'cxx', 'efl_part_impl.hh'),
subdir: join_paths(dir_package_include, 'cxx')
)

View File

@ -0,0 +1,54 @@
eina_cxx_deps = [eina, eo]
eina_cxx_pub_deps = []
eina_cxx_header_src = files(
'eina_accessor.hh',
'eina_aligned_union.hh',
'eina_array.hh',
'eina_clone_allocators.hh',
'eina_deleter.hh',
'eina_error.hh',
'eina_future.hh',
'eina_eo_concrete_fwd.hh',
'eina_fold.hh',
'eina_function.hh',
'eina_inarray.hh',
'eina_inlist.hh',
'eina_integer_sequence.hh',
'eina_iterator.hh',
'eina_lists_auxiliary.hh',
'eina_list.hh',
'eina_log.hh',
'eina_logical.hh',
'eina_optional.hh',
'eina_pp.hh',
'eina_ptrarray.hh',
'eina_ptrlist.hh',
'eina_range_types.hh',
'eina_ref.hh',
'eina_stringshare.hh',
'eina_strbuf.hh',
'eina_string_view.hh',
'eina_thread.hh',
'eina_throw.hh',
'eina_tuple.hh',
'eina_tuple_c.hh',
'eina_tuple_unwrap.hh',
'eina_type_traits.hh',
'eina_value.hh',
'eina_workarounds.hh',
'eina_copy_traits.hh',
'eina_variant.hh',
'Eina.hh'
)
eina_cxx_lib = disabler()
eina_cxx = declare_dependency(
include_directories: [include_directories('.')],
dependencies: eina_cxx_deps
)
install_headers(eina_cxx_header_src,
subdir: dir_package_include
)

View File

@ -0,0 +1,14 @@
cxx_header_src += files(
'eldbus_basic.hh',
'eldbus_error.hh',
'eldbus_freedesktop.hh',
'Eldbus.hh',
'eldbus_integer_sequence.hh',
'eldbus_message_arguments.hh',
'eldbus_message.hh',
'Eldbus_Model.hh',
'eldbus_proxy_call.hh',
'eldbus_raw_tuple.hh',
'eldbus_service.hh',
'eldbus_signature_traits.hh',
)

View File

@ -0,0 +1,11 @@
cxx_header_src = files(
'eo_concrete.hh',
'eo_cxx_interop.hh',
'eo_event.hh',
'Eo.hh',
'eo_init.hh',
'eo_ops.hh',
'eo_wref.hh',
'eo_private.hh',
'efl_object_impl.hh'
)

View File

@ -0,0 +1,72 @@
name_eolian_cxx_header_src= [
'Eolian_Cxx.hh'
]
name_grammer_eolian_cxx_header_src= [
'address_of.hpp',
'alternative.hpp',
'attribute_conditional.hpp',
'attribute_reorder.hpp',
'attribute_replace.hpp',
'attributes.hpp',
'blacklist.hpp',
'base_class_definition.hpp',
'case.hpp',
'class_declaration.hpp',
'class_definition.hpp',
'class_implementation.hpp',
'container.hpp',
'context.hpp',
'converting_argument.hpp',
'c_type.hpp',
'eps.hpp',
'function_declaration.hpp',
'function_definition.hpp',
'generator.hpp',
'header_guards.hpp',
'header.hpp',
'header_include_directive.hpp',
'html_escaped_string.hpp',
'implementation_include_directive.hpp',
'impl_header.hpp',
'indentation.hpp',
'integral.hpp',
'keyword.hpp',
'klass_def.hpp',
'kleene.hpp',
'list.hpp',
'meta.hpp',
'namespace.hpp',
'parameter.hpp',
'part_declaration.hpp',
'part_implementation.hpp',
'qualifier_def.hpp',
'sequence.hpp',
'string.hpp',
'type_function_declaration.hpp',
'type.hpp',
'type_impl.hpp',
'types_definition.hpp',
'type_traits.hpp'
]
cxx_header_src = []
foreach header : name_eolian_cxx_header_src
cxx_header_src += files(join_paths('..', '..', '..', 'lib', 'eolian_cxx', header))
endforeach
foreach header : name_grammer_eolian_cxx_header_src
cxx_header_src += files(join_paths('..', '..', '..', 'lib', 'eolian_cxx', 'grammar', header))
endforeach
inc_dir = include_directories(join_paths('..', '..', '..', 'lib', 'eolian_cxx'))
eolian_cxx_gen = executable('eolian_cxx',
join_paths('..', '..', '..', 'bin', 'eolian_cxx', 'eolian_cxx.cc'),
dependencies: [eina_cxx, eolian],
install: true,
include_directories : inc_dir,
cpp_args : package_c_args,
)

View File

@ -0,0 +1,112 @@
# ['eina', 'eolian', 'eo'] those three are build in the root meson.build reason for this is the super special handling
cxx_sublibs = [
['Eina', true, true, false, [eo]],
['Eolian', true, true, false, []],
['Eo', true, true, false, []],
['Ecore', true, true, true, []],
['Eet', true, true, false, []],
['Efl', true, false, true, []],
['Eio', false, false, true, []],
['Evas', false, true, true, []],
['Edje', false, false, true, []],
['Eldbus', true, true, true, []],
['Elementary', false, true, true, []]
]
increased_dependency = []
growing_deps = []
foreach lib : cxx_sublibs
package_name = lib[0].to_lower()
package_top_header = lib[3]
package_has_tests = lib[2]
package_manual_binded = lib[1]
package_version_name = '-'.join(package_name.split('_')) + '-cxx-' + version_major
tmp_package_subdirs = [package_version_name]
package_c_args = [
'-DPACKAGE_DATA_DIR="'+ join_paths(dir_data, package_name)+'"',
'-DNEED_RUN_IN_TREE=1'
]
dir_package_include = join_paths(dir_include, package_version_name)
dir_package_modules = join_paths(dir_lib, package_name, 'modules')
cxx_generator_target = []
cxx_header_src = []
file_location = join_paths('..', '..', 'lib', package_name)
eo_file_list = []
eo_file_subdirs = get_variable(package_name + '_eo_subdirs')
#generate files for each .eo files
foreach eo_file_subdir : eo_file_subdirs
if eo_file_subdir != ''
cxx_pub_eo_files = get_variable(package_name + '_' + eo_file_subdir +'_eo_files')
else
cxx_pub_eo_files = get_variable(package_name +'_eo_files')
endif
subdir_file_location = join_paths(file_location, eo_file_subdir)
foreach cxx_gen_file : cxx_pub_eo_files
cxx_generator_target += custom_target('eolian_cxx_gen_'+cxx_gen_file.underscorify()+'',
input : join_paths(subdir_file_location, cxx_gen_file),
output : [cxx_gen_file + '.hh', cxx_gen_file + '.impl.hh'],
install : true,
install_dir : join_paths(dir_package_include, eo_file_subdir),
command : [eolian_cxx_gen, '-I', meson.current_source_dir(), eolian_include_directories,
'-o', join_paths(meson.current_build_dir(), cxx_gen_file + '.hh'),
'@INPUT@'])
eo_file_list += files(join_paths(subdir_file_location, cxx_gen_file))
endforeach
endforeach
#generate the package.eo.hh file
if package_top_header
cxx_generator_target += custom_target('eolian_cxx_gen_'+package_name+'.eo.hh',
input : eo_file_list,
output : [lib[0] + '.eo.hh'],
install : true,
install_dir : join_paths(dir_package_include),
command : [eolian_cxx_gen, '-I', meson.current_source_dir(), eolian_include_directories, '-m',
'-o', '@OUTPUT@',
'@INPUT@'])
endif
if package_manual_binded
inc_dir = include_directories(package_name+'_cxx', '.')
subdir(package_name+'_cxx')
else
inc_dir = include_directories(file_location, '.')
cxx_header_src += files(join_paths(file_location, lib[0]+'.hh'))
endif
dep = declare_dependency(
include_directories: inc_dir,
sources : cxx_generator_target,
dependencies: [get_variable(package_name)] + get_variable(package_name + '_pub_deps') + lib[4] + increased_dependency
)
increased_dependency += dep
set_variable(package_name + '_cxx', dep)
if package_has_tests
test_dirs += package_name + '_cxx'
endif
foreach subdir : get_variable(package_name + '_eo_subdirs')
tmp_package_subdirs += join_paths(package_version_name, subdir)
endforeach
install_headers(cxx_header_src,
subdir: dir_package_include
)
pkgconfig.generate(
name : '-'.join(package_name.split('_')) + '-cxx',
description : lib[0]+' cxx bindings',
subdirs : tmp_package_subdirs,
version : version_major + '.' + version_minor,
libraries : dep,
requires : growing_deps + [package_name],
)
growing_deps += package_name + '-cxx'
endforeach

View File

@ -0,0 +1,29 @@
ecore_cxx_suite_deps = [check, ecore_cxx]
ecore_cxx_suite_src = [
'ecore_cxx_suite.cc',
'ecore_cxx_suite.h',
'ecore_cxx_test_safe_call.cc',
]
ecore_cxx_suite = executable('ecore_cxx_suite',
ecore_cxx_suite_src,
dependencies: [ecore_cxx_suite_deps, check],
cpp_args : [
'-DTESTS_BUILD_DIR="'+meson.current_build_dir()+'"',
'-DTESTS_SRC_DIR="'+meson.current_source_dir()+'"']
)
executable('ecore_cxx_suite_compile_test',
'cxx_compile_test.cc',
dependencies: [ecore_cxx_suite_deps, check],
cpp_args : [
'-DTESTS_BUILD_DIR="'+meson.current_build_dir()+'"',
'-DTESTS_SRC_DIR="'+meson.current_source_dir()+'"']
)
test('ecore_cxx-suite', ecore_cxx_suite,
timeout : 10*60,
env : test_env
)

View File

@ -0,0 +1,9 @@
edje_cxx_suite_deps = [check, edje_cxx]
executable('edje_cxx_suite_compile_test',
'cxx_compile_test.cc',
dependencies: [edje_cxx_suite_deps, check],
cpp_args : [
'-DTESTS_BUILD_DIR="'+meson.current_build_dir()+'"',
'-DTESTS_SRC_DIR="'+meson.current_source_dir()+'"']
)

View File

@ -0,0 +1,21 @@
eet_cxx_suite_deps = [check, eet_cxx]
eet_cxx_suite_src = [
'eet_cxx_suite.cc',
'eet_cxx_suite.h',
'eet_cxx_test_descriptors.cc',
]
eet_cxx_suite = executable('eet_cxx_suite',
eet_cxx_suite_src,
dependencies: [eet_cxx_suite_deps, check],
cpp_args : [
'-DTESTS_BUILD_DIR="'+meson.current_build_dir()+'"',
'-DTESTS_SRC_DIR="'+meson.current_source_dir()+'"']
)
test('ecore_cxx-suite', eet_cxx_suite,
timeout : 10*60,
env : test_env
)

View File

@ -0,0 +1,55 @@
eina_cxx_suite_deps = [check]
eina_cxx_suite_src = [
'eina_cxx_suite.cc',
'eina_cxx_test_inlist.cc',
'eina_cxx_test_log.cc',
'eina_cxx_test_inarray.cc',
'eina_cxx_test_iterator.cc',
'eina_cxx_test_ptrarray.cc',
'eina_cxx_test_ptrlist.cc',
'eina_cxx_test_stringshare.cc',
'eina_cxx_test_error.cc',
'eina_cxx_test_accessor.cc',
'eina_cxx_test_thread.cc',
'eina_cxx_test_optional.cc',
'eina_cxx_test_value.cc',
'simple.c',
'eina_cxx_suite.h'
]
pub_eo_files = [
'simple.eo'
]
foreach eo_file : pub_eo_files
priv_eo_file_target += custom_target('eolian_gen_eina_cxx_' + eo_file,
input : eo_file,
output : [eo_file + '.h'],
command : [eolian_gen, '-I', meson.current_source_dir(), eolian_include_directories,
'-o', 'h:' + join_paths(meson.current_build_dir(), eo_file + '.h'),
'-o', 'c:' + join_paths(meson.current_build_dir(), eo_file + '.c'),
'-gch', '@INPUT@'])
priv_eo_file_target += custom_target('eolian_cxx_gen_eina_cxx_' + eo_file,
input : eo_file,
output : [eo_file + '.hh'],
command : [eolian_cxx_gen, '-I', meson.current_source_dir(), eolian_include_directories,
'-o', join_paths(meson.current_build_dir(), eo_file + '.hh'),
'@INPUT@'])
endforeach
eina_cxx_suite = executable('eina_cxx_suite',
eina_cxx_suite_src + priv_eo_file_target,
include_directories : config_dir,
dependencies: [eina_cxx_suite_deps, check, eina, eina_cxx, eo_cxx, ecore],
cpp_args : [
'-DTESTS_BUILD_DIR="'+meson.current_build_dir()+'"',
'-DTESTS_SRC_DIR="'+meson.current_source_dir()+'"'
]
)
test('eina_cxx-suite', eina_cxx_suite,
timeout : 10*60,
env : test_env
)

View File

@ -0,0 +1,21 @@
eldbus_cxx_suite_deps = [check, eldbus_cxx]
eldbus_cxx_suite_src = [
'eldbus_cxx_suite.cc',
'eldbus_cxx_suite.h',
'eldbus_cxx_test_eldbus_client.cc',
'eldbus_cxx_test_eldbus_connect.cc',
]
eldbus_cxx_suite = executable('eldbus_cxx_suite',
eldbus_cxx_suite_src,
dependencies: [eldbus_cxx_suite_deps, check],
cpp_args : [
'-DTESTS_BUILD_DIR="'+meson.current_build_dir()+'"',
'-DTESTS_SRC_DIR="'+meson.current_source_dir()+'"']
)
test('eldbus_cxx-suite', eldbus_cxx_suite,
timeout : 10*60,
env : test_env
)

View File

@ -0,0 +1,9 @@
elementary_cxx_suite_deps = [check, elementary_cxx]
executable('elementary_cxx_suite_compile_test',
['cxx_compile_test.cc', 'cxx_dummy_compile_test.cc'],
dependencies: [elementary_cxx_suite_deps, check],
cpp_args : [
'-DTESTS_BUILD_DIR="'+meson.current_build_dir()+'"',
'-DTESTS_SRC_DIR="'+meson.current_source_dir()+'"']
)

View File

@ -0,0 +1,20 @@
eo_cxx_suite_deps = [check, eina_cxx, eo_cxx]
eo_cxx_suite_src = [
'eo_cxx_suite.cc',
'eo_cxx_suite.h'
]
eo_cxx_suite = executable('eo_cxx_suite',
eo_cxx_suite_src,
include_directories : config_dir,
dependencies: [eo_cxx_suite_deps, check],
cpp_args : [
'-DTESTS_BUILD_DIR="'+meson.current_build_dir()+'"',
'-DTESTS_SRC_DIR="'+meson.current_source_dir()+'"']
)
test('eo_cxx-suite', eo_cxx_suite,
timeout : 10*60,
env : test_env
)

View File

@ -0,0 +1,74 @@
eolian_cxx_suite_deps = [check, eolian_cxx, eina_cxx, eo_cxx, ecore]
eolian_cxx_suite_src = files([
'eolian_cxx_suite.cc',
'eolian_cxx_test_parse.cc',
'a.c',
'b.c',
'c.c',
'd.c',
'eolian_cxx_test_binding.cc',
'eolian_cxx_test_address_of.cc',
'eolian_cxx_test_wrapper.cc',
'simple.c',
'name_name.c',
'name_name_cxx.cc',
'generic.c',
'name1_name2_type_generation.c',
'eolian_cxx_test_inheritance.cc',
'eolian_cxx_test_generate.cc',
'eolian_cxx_test_documentation.cc',
'eolian_cxx_test_cyclic.cc',
'complex.c',
'complex_cxx.cc',
'eolian_cxx_suite.h'
])
pub_eo_files = [
'a.eo',
'b.eo',
'c.eo',
'd.eo',
'complex.eo',
'cyclic1.eo',
'cyclic2.eo',
'docs.eo',
'generic.eo',
'name1_name2_type_generation.eo',
'name_name.eo',
'ns_name.eo',
'ns_name_other.eo',
'simple.eo'
]
pub_eo_file_target = []
foreach eo_file : pub_eo_files
pub_eo_file_target += custom_target('eolian_cxx_gen_' + eo_file,
input : eo_file,
output : [eo_file + '.hh'],
command : [eolian_cxx_gen, '-I', meson.current_source_dir(), eolian_include_directories,
'-o', join_paths(meson.current_build_dir(), eo_file + '.hh'),
'@INPUT@'])
pub_eo_file_target += custom_target('eolian_gen_' + eo_file,
input : eo_file,
output : [eo_file + '.h'],
command : [eolian_gen, '-I', meson.current_source_dir(), eolian_include_directories,
'-o', 'h:' + join_paths(meson.current_build_dir(), eo_file + '.h'),
'-o', 'c:' + join_paths(meson.current_build_dir(), eo_file + '.c'),
'-gch', '@INPUT@'])
endforeach
eolian_cxx_suite = executable('eolian_cxx_suite',
eolian_cxx_suite_src + pub_eo_file_target,
dependencies: [eolian_cxx_suite_deps, eo_cxx, check],
# package_c_args contains -D definitions for the package
cpp_args : package_c_args +[
'-DTESTS_BUILD_DIR="'+meson.current_build_dir()+'"',
'-DTESTS_SRC_DIR="'+meson.current_source_dir()+'"']
)
test('eolian_cxx-suite', eolian_cxx_suite,
timeout : 10*60,
env : test_env
)

View File

@ -0,0 +1,9 @@
evas_cxx_suite_deps = [check, evas_cxx]
executable('evas_cxx_suite_compile_test',
'cxx_compile_test.cc',
dependencies: [evas_cxx_suite_deps, check],
cpp_args : [
'-DTESTS_BUILD_DIR="'+meson.current_build_dir()+'"',
'-DTESTS_SRC_DIR="'+meson.current_source_dir()+'"']
)