diff options
author | Felipe Magno de Almeida <felipe@expertisesolutions.com.br> | 2016-10-28 19:18:38 -0200 |
---|---|---|
committer | Felipe Magno de Almeida <felipe@expertisesolutions.com.br> | 2016-10-29 12:23:21 -0200 |
commit | b2f427eadf4f4c951cedc8e4d8c14a599c294c94 (patch) | |
tree | 47304c6694fcae078538aadd805969ab1ee81dd3 | |
parent | a7c464e73a17c15db6b321f085007df231888b22 (diff) | |
download | efl-b2f427eadf4f4c951cedc8e4d8c14a599c294c94.tar.gz |
mono: Lots of things
-rw-r--r-- | configure.ac | 1 | ||||
-rw-r--r-- | src/Makefile_Eolian_Mono.am | 72 | ||||
-rw-r--r-- | src/bin/eolian_mono/eolian_mono.cc | 8 | ||||
-rw-r--r-- | src/bin/eolian_mono/eolian_mono/keyword.hh | 2 | ||||
-rw-r--r-- | src/bin/eolian_mono/eolian_mono/klass.hh | 6 | ||||
-rw-r--r-- | src/bin/eolian_mono/eolian_mono/type_impl.hh | 6 | ||||
-rw-r--r-- | src/bindings/mono/eo_mono/workaround.cs | 15 | ||||
-rw-r--r-- | src/tests/eo_mono/EcoreEvas.cs | 31 | ||||
-rw-r--r-- | src/tests/eo_mono/Main.cs | 9 | ||||
-rw-r--r-- | src/tests/eo_mono/eo_mono.exe.config | 5 | ||||
-rw-r--r-- | src/tests/eo_mono/eo_mono.exe.config.in | 7 |
11 files changed, 138 insertions, 24 deletions
diff --git a/configure.ac b/configure.ac index ec6c7d033e..5072613de0 100644 --- a/configure.ac +++ b/configure.ac @@ -5799,6 +5799,7 @@ src/lib/ecore_x/ecore_x_version.h src/lib/efl/Efl_Config.h src/lib/elementary/Elementary.h src/scripts/eo/eo_debug +src/tests/eo_mono/eo_mono.exe.config elm_intro.h spec/efl.spec pc/evil.pc diff --git a/src/Makefile_Eolian_Mono.am b/src/Makefile_Eolian_Mono.am index 6798300945..db6031d9e6 100644 --- a/src/Makefile_Eolian_Mono.am +++ b/src/Makefile_Eolian_Mono.am @@ -14,12 +14,35 @@ bin_eolian_mono_eolian_mono_LDADD = @CHECK_LIBS@ @USE_EOLIAN_LIBS@ bin_eolian_mono_eolian_mono_DEPENDENCIES = @USE_EOLIAN_INTERNAL_LIBS@ +evas_eolian_blacklisted_files = \ +lib/evas/canvas/efl_canvas_text_cursor.eo.cs \ +lib/evas/canvas/efl_canvas_text.eo.cs \ +lib/evas/canvas/efl_canvas_scene3d.eo.cs \ +lib/evas/canvas/evas_canvas3d_camera.eo.cs \ +lib/evas/canvas/evas_canvas3d_light.eo.cs \ +lib/evas/canvas/evas_canvas3d_material.eo.cs \ +lib/evas/canvas/evas_canvas3d_mesh.eo.cs \ +lib/evas/canvas/evas_canvas3d_node.eo.cs \ +lib/evas/canvas/evas_canvas3d_object.eo.cs \ +lib/evas/canvas/evas_canvas3d_primitive.eo.cs \ +lib/evas/canvas/evas_canvas3d_scene.eo.cs \ +lib/evas/canvas/evas_canvas3d_texture.eo.cs \ +lib/evas/canvas/efl_vg.eo.cs \ +lib/evas/canvas/efl_vg_container.eo.cs \ +lib/evas/canvas/efl_vg_gradient.eo.cs \ +lib/evas/canvas/efl_vg_gradient_radial.eo.cs \ +lib/evas/canvas/efl_vg_gradient_linear.eo.cs \ +lib/evas/canvas/efl_vg_root_node.eo.cs \ +lib/evas/canvas/efl_vg_shape.eo.cs + efl_eolian_mono_files = \ $(filter-out lib/eo/efl_object_override.eo.cs, $(eo_eolian_files:%.eo=%.eo.cs)) \ $(ecore_eolian_files_public:%.eo=%.eo.cs) \ $(ecore_eolian_type_files:%.eot=%.eot.cs) \ $(efl_eolian_files:%.eo=%.eo.cs) \ -$(efl_eolian_type_files:%.eot=%.eot.cs) +$(efl_eolian_type_files:%.eot=%.eot.cs) \ +$(filter-out $(evas_eolian_blacklisted_files),$(evas_eolian_pub_files:%.eo=%.eo.cs)) \ +$(evas_eolian_type_files:%.eot=%.eot.cs) ### Efl C++ installed_eflmonomainheadersdir = $(includedir)/efl-mono-@VMAJ@/ @@ -45,7 +68,8 @@ bin_PROGRAMS += lib/eo_mono/libeo_mono.dll lib_eo_mono_libeo_mono_dll_SOURCES = \ bindings/mono/eo_mono/object.cs \ - bindings/mono/eo_mono/iwrapper.cs + bindings/mono/eo_mono/iwrapper.cs \ + bindings/mono/eo_mono/workaround.cs lib/eo_mono/libeo_mono.dll$(EXEEXT): $(lib_eo_mono_libeo_mono_dll_SOURCES) lib/eo_mono/$(am__dirstamp) $(efl_eolian_mono_files) @rm -f lib/eo_mono/libeo_mono.dll$(EXEEXT) @@ -53,22 +77,19 @@ lib/eo_mono/libeo_mono.dll$(EXEEXT): $(lib_eo_mono_libeo_mono_dll_SOURCES) lib/e if EFL_ENABLE_TESTS -LD_LIBRARY_PATH_APPEND=lib/eina/.libs:lib/ecore/.libs:lib/efl/.libs +#LD_LIBRARY_PATH_APPEND=$(abs_top_builddir)/lib/eina/.libs:$(abs_top_builddir)/lib/ecore/.libs:$(abs_top_builddir)/lib/efl/.libs:$(abs_top_builddir)/lib/evas/.libs:$(abs_top_builddir)/lib/ecore_evas/.libs AM_TESTS_ENVIRONMENT += MONO='mono'; export MONO; -AM_TESTS_ENVIRONMENT += MONO_CONFIG='$(srcdir)/tests/eo_mono/eo_mono.exe.config'; export MONO_CONFIG; +AM_TESTS_ENVIRONMENT += MONO_CONFIG='$(builddir)/tests/eo_mono/eo_mono.exe.config'; export MONO_CONFIG; AM_TESTS_ENVIRONMENT += MONO_BUILDPATH='$(abs_top_builddir)'; export MONO_BUILDPATH; AM_TESTS_ENVIRONMENT += MONO_PATH='$(abs_top_builddir)/src/lib/eo_mono:$(LD_LIBRARY_PATH_APPEND)'; export MONO_PATH; -#AM_TESTS_ENVIRONMENT += MONO_LOG_LEVEL=debug; export MONO_LOG_LEVEL; -#AM_TESTS_ENVIRONMENT += LD_LIBRARY_PATH=$(LD_LIBRARY_PATH_APPEND) +AM_TESTS_ENVIRONMENT += EINA_LOG_LEVEL=8; export EINA_LOG_LEVEL; check_PROGRAMS += tests/eo_mono/eo_mono.exe TESTS += tests/eo_mono/mono_test_driver.sh tests_eo_mono_eo_mono_exe_SOURCES = \ - tests/eo_mono/Main.cs - -LD_LIBRARY_PATH_APPEND=$(top_builddir)/src/lib/eina:$(top_builddir)/src/lib/ecore:$(top_builddir)/src/lib/efl + tests/eo_mono/Main.cs tests/eo_mono/EcoreEvas.cs tests/eo_mono/eo_mono.exe$(EXEEXT): $(tests_eo_mono_eo_mono_exe_SOURCES) tests/eo_mono/$(am__dirstamp) lib/eo_mono/libeo_mono.dll @rm -f tests/eo_mono/eo_mono_exe$(EXEEXT) @@ -76,15 +97,40 @@ tests/eo_mono/eo_mono.exe$(EXEEXT): $(tests_eo_mono_eo_mono_exe_SOURCES) tests/e SUFFIXES += .eo.cs -%.eo.cs: %.eo $(_EOLIAN_MONO_DEP) +lib/eo/%.eo.cs: lib/eo/%.eo $(_EOLIAN_MONO_DEP) + $(AM_V_EOLMONO) \ + $(MKDIR_P) $(dir $@); \ + $(EOLIAN_MONO) $(EOLIAN_FLAGS) --dllimport eo -o $@ $< + +lib/ecore/%.eo.cs: lib/ecore/%.eo $(_EOLIAN_MONO_DEP) + $(AM_V_EOLMONO) \ + $(MKDIR_P) $(dir $@); \ + $(EOLIAN_MONO) $(EOLIAN_FLAGS) --dllimport ecore -o $@ $< + +lib/evas/%.eo.cs: lib/evas/%.eo $(_EOLIAN_MONO_DEP) + $(AM_V_EOLMONO) \ + $(MKDIR_P) $(dir $@); \ + $(EOLIAN_MONO) $(EOLIAN_FLAGS) --dllimport evas -o $@ $< + +lib/efl/%.eo.cs: lib/efl/%.eo $(_EOLIAN_MONO_DEP) + $(AM_V_EOLMONO) \ + $(MKDIR_P) $(dir $@); \ + $(EOLIAN_MONO) $(EOLIAN_FLAGS) --dllimport efl -o $@ $< + +lib/ecore/%.eot.cs: lib/ecore/%.eot $(_EOLIAN_MONO_DEP) + $(AM_V_EOLMONO) \ + $(MKDIR_P) $(dir $@); \ + $(EOLIAN_MONO) $(EOLIAN_FLAGS) --dllimport ecore -o $@ $< + +lib/evas/%.eot.cs: lib/evas/%.eot $(_EOLIAN_MONO_DEP) $(AM_V_EOLMONO) \ $(MKDIR_P) $(dir $@); \ - $(EOLIAN_MONO) $(EOLIAN_FLAGS) -o $@ $< + $(EOLIAN_MONO) $(EOLIAN_FLAGS) --dllimport evas -o $@ $< -%.eot.cs: %.eot $(_EOLIAN_MONO_DEP) +lib/efl/%.eot.cs: lib/efl/%.eot $(_EOLIAN_MONO_DEP) $(AM_V_EOLMONO) \ $(MKDIR_P) $(dir $@); \ - $(EOLIAN_MONO) $(EOLIAN_FLAGS) -o $@ $< + $(EOLIAN_MONO) $(EOLIAN_FLAGS) --dllimport efl -o $@ $< endif endif diff --git a/src/bin/eolian_mono/eolian_mono.cc b/src/bin/eolian_mono/eolian_mono.cc index 606d24a2e3..84c2562d1d 100644 --- a/src/bin/eolian_mono/eolian_mono.cc +++ b/src/bin/eolian_mono/eolian_mono.cc @@ -34,6 +34,7 @@ struct options_type std::vector<std::string> include_dirs; std::string in_file; std::string out_file; + std::string dllimport; }; efl::eina::log_domain domain("eolian_mono"); @@ -91,7 +92,7 @@ run(options_type const& opts) efl::eolian::grammar::attributes::klass_def klass_def(klass); std::vector<efl::eolian::grammar::attributes::klass_def> klasses{klass_def}; - eolian_mono::klass.generate(iterator, klass_def, efl::eolian::grammar::context_cons<eolian_mono::library_context>({"ecore"})); + eolian_mono::klass.generate(iterator, klass_def, efl::eolian::grammar::context_cons<eolian_mono::library_context>({opts.dllimport})); } //else { @@ -192,6 +193,7 @@ opts_get(int argc, char **argv) { "out-file", required_argument, 0, 'o' }, { "version", no_argument, 0, 'v' }, { "help", no_argument, 0, 'h' }, + { "dllimport", required_argument, 0, 'l' }, { 0, 0, 0, 0 } }; const char* options = "I:D:o:c:arvh"; @@ -212,6 +214,10 @@ opts_get(int argc, char **argv) { _usage(argv[0]); } + else if (c == 'l') + { + opts.dllimport = optarg; + } else if (c == 'v') { _print_version(); diff --git a/src/bin/eolian_mono/eolian_mono/keyword.hh b/src/bin/eolian_mono/eolian_mono/keyword.hh index 651bc3f2b1..0d556fff58 100644 --- a/src/bin/eolian_mono/eolian_mono/keyword.hh +++ b/src/bin/eolian_mono/eolian_mono/keyword.hh @@ -5,7 +5,7 @@ namespace eolian_mono { inline std::string escape_keyword(std::string const& name) { - if(name == "delete" || name == "register" || name == "do") + if(name == "delete" || name == "register" || name == "do" || name == "lock") return "mono_" + name; return name; } diff --git a/src/bin/eolian_mono/eolian_mono/klass.hh b/src/bin/eolian_mono/eolian_mono/klass.hh index 3f3797a90d..b5daa5d803 100644 --- a/src/bin/eolian_mono/eolian_mono/klass.hh +++ b/src/bin/eolian_mono/eolian_mono/klass.hh @@ -96,8 +96,12 @@ struct klass << scope_tab << scope_tab << "System.IntPtr eo = _efl_add_internal_start(\"file\", 0, klass, parent, 0, 0);\n" << scope_tab << scope_tab << "handle = _efl_add_end(eo, 0, 0);\n" << scope_tab << "}\n" + << scope_tab << "public " << string << "Concrete(System.IntPtr raw)\n" + << scope_tab << "{\n" + << scope_tab << scope_tab << "handle = raw;\n" + << scope_tab << "}\n" ) - .generate(sink, std::make_tuple(cls.cxx_name, cls.cxx_name, cls.namespaces, cls.eolian_name, cls.cxx_name, cls.namespaces, cls.eolian_name), context)) + .generate(sink, std::make_tuple(cls.cxx_name, cls.cxx_name, cls.namespaces, cls.eolian_name, cls.cxx_name, cls.namespaces, cls.eolian_name, cls.cxx_name), context)) return false; if(!as_generator(*(function_definition)) diff --git a/src/bin/eolian_mono/eolian_mono/type_impl.hh b/src/bin/eolian_mono/eolian_mono/type_impl.hh index 7ba58b6c62..8c54106fa8 100644 --- a/src/bin/eolian_mono/eolian_mono/type_impl.hh +++ b/src/bin/eolian_mono/eolian_mono/type_impl.hh @@ -262,7 +262,7 @@ struct visitor_generate { {"list", true, nullptr, [&] { - (*this)(regular_type_def{" int", complex.outer.base_qualifier, {}}); + (*this)(regular_type_def{" System.Collections.Generic.List", complex.outer.base_qualifier, {}}); return attributes::type_def::variant_type(); // generate_container(sink, complex, *context, " ::efl::eina::list"); // return attributes::type_def::variant_type(); @@ -270,7 +270,7 @@ struct visitor_generate , {"list", false, nullptr, [&] { return replace_outer - (complex, regular_type_def{" int", complex.outer.base_qualifier, {}}); + (complex, regular_type_def{" System.Collections.Generic.List", complex.outer.base_qualifier, {}}); // generate_container(sink, complex, *context, " ::efl::eina::range_list"); // return attributes::type_def::variant_type(); }} @@ -292,7 +292,7 @@ struct visitor_generate , [&] { return replace_outer - (complex, regular_type_def{" int", complex.outer.base_qualifier, {}}); + (complex, regular_type_def{" System.Collections.Generic.Dictionary", complex.outer.base_qualifier, {}}); // regular_type_def r{"Eina_Hash*", complex.outer.base_qualifier, {}}; // return r; }} diff --git a/src/bindings/mono/eo_mono/workaround.cs b/src/bindings/mono/eo_mono/workaround.cs new file mode 100644 index 0000000000..bbf2928c6a --- /dev/null +++ b/src/bindings/mono/eo_mono/workaround.cs @@ -0,0 +1,15 @@ + +namespace evas { namespace font { + +public struct Hinting_Flags {} + +} + +public struct Modifier_Mask {} + +public struct Coord {} + +public struct Touch_Point_State {} + +} + diff --git a/src/tests/eo_mono/EcoreEvas.cs b/src/tests/eo_mono/EcoreEvas.cs new file mode 100644 index 0000000000..f905b0f146 --- /dev/null +++ b/src/tests/eo_mono/EcoreEvas.cs @@ -0,0 +1,31 @@ + +using System; +using System.Runtime.InteropServices; + +public class EcoreEvas +{ + [DllImport("ecore_evas")] static extern void ecore_evas_init(); + // [DllImport("ecore_evas")] static extern IntPtr ecore_evas_new([MarshalAs(UnmanagedType.LPStr)] String engine_name, int x, int y, int w, int h + // , [MarshalAs(UnmanagedType.LPStr)] String extra_options); + [DllImport("ecore_evas")] static extern IntPtr ecore_evas_new(IntPtr engine_name, int x, int y, int w, int h + , IntPtr extra_options); + [DllImport("ecore_evas")] static extern IntPtr ecore_evas_get(IntPtr ecore_evas); + [DllImport("ecore_evas")] static extern IntPtr ecore_evas_show(IntPtr ecore_evas); + + IntPtr handle; + public EcoreEvas() + { + ecore_evas_init(); + handle = ecore_evas_new(IntPtr.Zero, 0, 0, 640, 480, IntPtr.Zero); + if(handle == IntPtr.Zero) + System.Console.WriteLine("Couldn't create a ecore evas"); + ecore_evas_show(handle); + } + + public efl.canvas.Object canvas + { + get { return new efl.canvas.ObjectConcrete(ecore_evas_get(handle)); } + } + +} + diff --git a/src/tests/eo_mono/Main.cs b/src/tests/eo_mono/Main.cs index 419cba3113..59cecf27ad 100644 --- a/src/tests/eo_mono/Main.cs +++ b/src/tests/eo_mono/Main.cs @@ -5,12 +5,21 @@ class TestMain { [DllImport("eo")] static extern void efl_object_init(); [DllImport("ecore")] static extern void ecore_init(); + [DllImport("evas")] static extern void evas_init(); static void Main(string[] args) { efl_object_init(); ecore_init(); + evas_init(); + efl.Loop loop = new efl.LoopConcrete(); + + EcoreEvas ecore_evas = new EcoreEvas(); System.Console.WriteLine("Hello World"); + + efl.canvas.Object canvas = ecore_evas.canvas; + canvas.visible_set(); + loop.begin(); } } diff --git a/src/tests/eo_mono/eo_mono.exe.config b/src/tests/eo_mono/eo_mono.exe.config deleted file mode 100644 index 7975bf82b1..0000000000 --- a/src/tests/eo_mono/eo_mono.exe.config +++ /dev/null @@ -1,5 +0,0 @@ - -<configuration> - <dllmap target="/home/felipe/dev/samsung/upstream/efl/build/src/lib/ecore/.libs/libecore.so" dll="ecore" /> - <dllmap target="/home/felipe/dev/samsung/upstream/efl/build/src/lib/eo/.libs/libeo.so" dll="eo" /> -</configuration> diff --git a/src/tests/eo_mono/eo_mono.exe.config.in b/src/tests/eo_mono/eo_mono.exe.config.in new file mode 100644 index 0000000000..b23aab19a1 --- /dev/null +++ b/src/tests/eo_mono/eo_mono.exe.config.in @@ -0,0 +1,7 @@ + +<configuration> + <dllmap target="@abs_top_builddir@/src/lib/ecore/.libs/libecore.so" dll="ecore" /> + <dllmap target="@abs_top_builddir@/src/lib/eo/.libs/libeo.so" dll="eo" /> + <dllmap target="@abs_top_builddir@/src/lib/evas/.libs/libevas.so" dll="evas" /> + <dllmap target="@abs_top_builddir@/src/lib/ecore_evas/.libs/libecore_evas.so" dll="ecore_evas" /> +</configuration> |