Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
05cdcd0
win32: fix unistd includes for mono binding
joaoantoniocardoso Sep 3, 2020
ea5b37f
win32: fix unistd includes for cxx binding
joaoantoniocardoso Sep 3, 2020
5b436d3
win32: Enable dotnet with mono binding
joaoantoniocardoso Sep 18, 2020
cc8b864
win32: skip .sh execution on windows
joaoantoniocardoso Sep 18, 2020
3f21d27
win32: Don't pass empty -e parameter
joaoantoniocardoso Sep 23, 2020
649ebd5
win32: Fixes in klass_def to build on windows
joaoantoniocardoso Sep 23, 2020
f6e4627
win32: Force eldbus exclusion from the build
joaoantoniocardoso Sep 23, 2020
0bf6e03
win32: fix wrong types being used for .cs generation
joaoantoniocardoso Sep 24, 2020
3f3f8f6
win32: Fix separators; Use PATH instead of LD_LIBRARY_PATH
joaoantoniocardoso Sep 25, 2020
63b2795
win32:^Compile the right source for the target OS
joaoantoniocardoso Sep 25, 2020
d4eb2cb
win32: class partial -> class partial
joaoantoniocardoso Sep 25, 2020
6c3a8f1
win32: fix library name (e.g. lib.dll to lib-1.dll)
joaoantoniocardoso Sep 29, 2020
b4b05ee
win32: Implement UnloadLibrary() as FreeLibrary() wrapper
joaoantoniocardoso Sep 29, 2020
fa2b6d2
win32: Use platform-dependent method LoadFunctionPointer instead of d…
joaoantoniocardoso Sep 29, 2020
60606cd
win32: add debug logs to GetProcAddress
joaoantoniocardoso Sep 29, 2020
11521e8
win32: fix package name passed to dllimport parameter of eolian_mono_gen
joaoantoniocardoso Sep 29, 2020
1bc88de
[PHAB] efl-mono: Correctly load dynamic libs for OSX
Sep 23, 2020
db7370d
eo_mono: add a method to get last error from dll import
joaoantoniocardoso Sep 29, 2020
b71a0ab
win32: fix wrong dll name and unecessary lib load
joaoantoniocardoso Sep 29, 2020
d93d4c6
win32: fix wrong dll name
joaoantoniocardoso Sep 29, 2020
5d37059
win32: efl_unref is from Eo, not from CustomExports
joaoantoniocardoso Sep 29, 2020
30195fe
eo_mono: use efl.Libs.Eo instead of hard-coded string
joaoantoniocardoso Sep 29, 2020
c7f288d
[WIP] Increase timeout time to help debug
joaoantoniocardoso Sep 29, 2020
17bd0c8
[TEST_ONLY] set --prefix
joaoantoniocardoso Oct 1, 2020
fe27033
efl-mono: Use single-threading apartment model in test
joaoantoniocardoso Oct 2, 2020
69fed8b
[WIP] Disabling all tests to identify the root of the crash problem
joaoantoniocardoso Oct 2, 2020
ea760d7
win32: fix elementary modules not loading when running in tree
joaoantoniocardoso Oct 2, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion configure.bat
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ exit /B 0
-Dsystemd=false^
-Dgstreamer=false^
-Ddbus=false^
-Ddotnet=true^
-Daudio=false^
-Davahi=false^
-Dv4l2=false^
Expand All @@ -140,7 +141,8 @@ exit /B 0
"-Devas-loaders-disabler=gst,pdf,ps,raw,svg,rsvg,xcf,bmp,dds,generic,gif,ico,jp2k,pmaps,psd,tga,tgv,tiff,wbmp,webp,xpm,json"^
-Dopengl=none^
"-Demotion-loaders-disabler=gstreamer1,libvlc,xine"^
-Dbindings=^
--prefix=%cd%\_install^
-Dbindings=mono^
--buildtype=debug^
--native-file native-file-windows.txt

Expand Down
8 changes: 6 additions & 2 deletions src/bin/efl_mono_msbuild_gen/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,13 @@
#include <fstream>

#include <stdlib.h>
#include <unistd.h>
#ifndef _MSC_VER
# include <unistd.h>
# include <libgen.h>
#else
# include <evil_private.h>
#endif
#include <getopt.h>
#include <libgen.h>

#include <string>
#include <algorithm>
Expand Down
8 changes: 6 additions & 2 deletions src/bin/eolian_cxx/eolian_cxx.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,13 @@
#include <fstream>

#include <stdlib.h>
#include <unistd.h>
#ifndef _MSC_VER
# include <unistd.h>
# include <libgen.h>
#else
# include <evil_private.h>
#endif
#include <getopt.h>
#include <libgen.h>

#include <string>
#include <algorithm>
Expand Down
16 changes: 16 additions & 0 deletions src/bin/eolian_mono/eolian/mono/type_impl.hh
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,11 @@ struct visitor_generate
, {"bool", nullptr, [&] { return replace_base_type(regular, "bool?"); }}
, {"short", nullptr, [&] { return replace_base_opt_integer<short>(regular); }}
, {"int", nullptr, [&] { return replace_base_opt_integer<int>(regular); }}
#ifdef _MSC_VER
//, {"long", nullptr, [&] { return replace_base_type(regular, "long?"); }}
#else
, {"long", nullptr, [&] { return replace_base_opt_integer<long>(regular); }}
#endif
Comment on lines +128 to +132
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not an ifndef?

, {"llong", nullptr, [&] { return replace_base_opt_integer<long long>(regular); }}
, {"int8", nullptr, [&] { return replace_base_type(regular, "sbyte?"); }}
, {"int16", nullptr, [&] { return replace_base_type(regular, "short?"); }}
Expand All @@ -136,7 +140,11 @@ struct visitor_generate
, {"ubyte", nullptr, [&] { return replace_base_type(regular, "byte?"); }}
, {"ushort", nullptr, [&] { return replace_base_opt_integer<unsigned short>(regular); }}
, {"uint", nullptr, [&] { return replace_base_opt_integer<unsigned int>(regular); }}
#ifdef _MSC_VER
//, {"ulong", nullptr, [&] { return replace_base_type(regular, "ulong?"); }}
#else
, {"ulong", nullptr, [&] { return replace_base_opt_integer<unsigned long>(regular); }}
#endif
, {"ullong", nullptr, [&] { return replace_base_opt_integer<unsigned long long>(regular); }}
, {"uint8", nullptr, [&] { return replace_base_type(regular, "byte?"); }}
, {"uint16", nullptr, [&] { return replace_base_type(regular, "ushort?"); }}
Expand All @@ -156,7 +164,11 @@ struct visitor_generate
{"byte", nullptr, [&] { return replace_base_type(regular, "sbyte"); }}
, {"short", nullptr, [&] { return replace_base_integer<short>(regular); }}
, {"int", nullptr, [&] { return replace_base_integer<int>(regular); }}
#ifdef _MSC_VER
//, {"long", nullptr, [&] { return replace_base_type(regular, "long"); }}
#else
, {"long", nullptr, [&] { return replace_base_integer<long>(regular); }}
#endif
, {"llong", nullptr, [&] { return replace_base_integer<long long>(regular); }}
, {"int8", nullptr, [&] { return replace_base_type(regular, "sbyte"); }}
, {"int16", nullptr, [&] { return replace_base_type(regular, "short"); }}
Expand All @@ -167,7 +179,11 @@ struct visitor_generate
, {"ubyte", nullptr, [&] { return replace_base_type(regular, "byte"); }}
, {"ushort", nullptr, [&] { return replace_base_integer<unsigned short>(regular); }}
, {"uint", nullptr, [&] { return replace_base_integer<unsigned int>(regular); }}
#ifdef _MSC_VER
//, {"ulong", nullptr, [&] { return replace_base_type(regular, "ulong"); }}
#else
, {"ulong", nullptr, [&] { return replace_base_integer<unsigned long>(regular); }}
#endif
, {"ullong", nullptr, [&] { return replace_base_integer<unsigned long long>(regular); }}
, {"uint8", nullptr, [&] { return replace_base_type(regular, "byte"); }}
, {"uint16", nullptr, [&] { return replace_base_type(regular, "ushort"); }}
Expand Down
8 changes: 6 additions & 2 deletions src/bin/eolian_mono/eolian_mono.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,13 @@
#include <fstream>

#include <stdlib.h>
#include <unistd.h>
#ifndef _MSC_VER
# include <unistd.h>
# include <libgen.h>
#else
# include <evil_private.h>
#endif
#include <getopt.h>
#include <libgen.h>

#include <string>
#include <map>
Expand Down
7 changes: 6 additions & 1 deletion src/bin/ethumb_client/meson.build
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
ethumbd_deps = [ecore, ethumb, ethumb_client, ecore]
if not sys_windows
ethumbd_deps += eldbus
endif

ethumbd = executable('ethumbd',
'ethumbd.c',
install: true,
dependencies : [ecore, ethumb, ethumb_client, ecore, eldbus],
dependencies : ethumbd_deps,
include_directories : config_dir,
c_args : package_c_args,
)
Expand Down
4 changes: 4 additions & 0 deletions src/bindings/mono/efl_mono/efl_all.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,9 @@ public static void Init(Efl.Csharp.Components components = Efl.Csharp.Components
ecore_init();
ecore_init_ex(0, IntPtr.Zero);
evas_init();
#if ELDBUS_ENABLED
eldbus.Config.Init();
#endif
}

if ((initComponents & Efl.Csharp.Components.Ui)
Expand Down Expand Up @@ -140,8 +142,10 @@ public static void Shutdown()
if ((initComponents & Efl.Csharp.Components.Basic)
== Efl.Csharp.Components.Basic)
{
#if ELDBUS_ENABLED
Eina.Log.Debug("Shutting down Eldbus");
eldbus.Config.Shutdown();
#endif
Eina.Log.Debug("Shutting down Evas");
evas_shutdown();
Eina.Log.Debug("Shutting down Ecore");
Expand Down
4 changes: 4 additions & 0 deletions src/bindings/mono/efl_mono/efl_csharp_application.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,9 @@ private static void Init(Efl.Csharp.Components components = Components.All)
ecore_init();
ecore_init_ex(0, IntPtr.Zero);
evas_init();
#if ELDBUS_ENABLED
eldbus.Config.Init();
#endif
}

if ((initComponents & Components.Ui) == Components.Ui)
Expand Down Expand Up @@ -136,7 +138,9 @@ private static void Shutdown()

if ((initComponents & Components.Basic) == Components.Basic)
{
#if ELDBUS_ENABLED
eldbus.Config.Shutdown();
#endif
evas_shutdown();
ecore_shutdown();
Efl.Eo.Config.Shutdown();
Expand Down
12 changes: 9 additions & 3 deletions src/bindings/mono/efl_mono/efl_libs.cs.in
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,11 @@ internal class Libs {

internal const string CustomExports = "@CUSTOM_EXPORTS_MONO_DL_MONO@";

internal const string Libdl = "libdl.so";
internal const string Kernel32 = "kernel32.dll";
#if sys_windows
internal const string Kernel32 = "@KERNEL32_DL_MONO@";
#else
internal const string Libdl = "@LIBDL_DL_MONO@";
#endif

internal static readonly Efl.Eo.NativeModule EflModule = new Efl.Eo.NativeModule(Efl);
internal static readonly Efl.Eo.NativeModule CoreModule = new Efl.Eo.NativeModule(Ecore);
Expand All @@ -46,8 +49,11 @@ internal class Libs {
internal static readonly Efl.Eo.NativeModule ElementaryModule = new Efl.Eo.NativeModule(Elementary);
internal static readonly Efl.Eo.NativeModule EldbusModule = new Efl.Eo.NativeModule(Eldbus);
internal static readonly Efl.Eo.NativeModule CustomExportsModule = new Efl.Eo.NativeModule(CustomExports);
internal static readonly Efl.Eo.NativeModule LibdlModule = new Efl.Eo.NativeModule(Libdl);
#if sys_windows
internal static readonly Efl.Eo.NativeModule Kernel32Module = new Efl.Eo.NativeModule(Kernel32);
#else
internal static readonly Efl.Eo.NativeModule LibdlModule = new Efl.Eo.NativeModule(Libdl);
#endif
}

}
35 changes: 30 additions & 5 deletions src/bindings/mono/efl_mono/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,38 @@ mono_files += files(

bash = find_program('bash')

map = run_command('map_generate.sh').stdout()
if not sys_windows
map = run_command('map_generate.sh').stdout()
else
map = ''
endif


efl_libs = configuration_data()
efl_libs.set('EFL_MONO_LIBRARY_MAP', map)
efl_libs.set('CUSTOM_EXPORTS_MONO_DL_MONO', 'eflcustomexportsmono')

if sys_windows
eflcustomexportsmono_name = 'eflcustomexportsmono-1'
else
eflcustomexportsmono_name = 'eflcustomexportsmono'
endif
efl_libs.set('CUSTOM_EXPORTS_MONO_DL_MONO', eflcustomexportsmono_name)
efl_libs.set('EVIL_DL_MONO', 'dl')
if sys_osx
efl_libs.set('LIBDL_DL_MONO', 'dl.dylib')
elif sys_windows
efl_libs.set('KERNEL32_DL_MONO', 'kernel32.dll')
else
efl_libs.set('LIBDL_DL_MONO', 'libdl.so')
endif

foreach mono_libs : mono_sublibs
key = mono_libs[0].to_upper()+'_DL_MONO'
efl_libs.set(key, mono_libs[0].to_lower())
if sys_windows
efl_libs.set(key, mono_libs[0].to_lower() + '-1')
else
efl_libs.set(key, mono_libs[0].to_lower())
endif
endforeach

configure_file(
Expand Down Expand Up @@ -97,13 +118,17 @@ efl_mono_lib = library('eflcustomexportsmono',

foreach eo_file : mono_eo_files
if not blacklisted_files.contains(eo_file)
examples_param = []
if get_option('mono-examples-dir') != ''
examples_param = ['-e', get_option('mono-examples-dir')]
endif
mono_generator_target += custom_target('eolian_mono_gen_'+eo_file.underscorify()+'',
input : join_paths('..', '..', '..', 'lib', 'efl_mono', eo_file),
output : [eo_file + '.cs'],
command : [eolian_mono_gen, beta_option, '-I', meson.current_source_dir(), eolian_include_directories,
'--dllimport', 'eflcustomexportsmono',
'--dllimport', eflcustomexportsmono_name,
'-o', join_paths(meson.current_build_dir(), eo_file + '.cs'),
'-e', get_option('mono-examples-dir'),
examples_param,
'@INPUT@'])

endif
Expand Down
13 changes: 11 additions & 2 deletions src/bindings/mono/efl_sharp.csproj.in
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,22 @@
<DefineConstants>@EFL_BETA@</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition=" '$(OS)' == 'UNIX' ">
<DefineConstants>ELDBUS_ENABLED;$(DefineConstants)</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(OS)' == 'Windows_NT' ">
<DefineConstants>sys_windows;$(DefineConstants)</DefineConstants>
</PropertyGroup>

<ItemGroup>
<Compile Include="@BINDING_SRC@/efl_mono/*.cs" />
<!-- FIXME Windows support -->
<Compile Include="@BINDING_SRC@/eo_mono/*.cs" Exclude="@BINDING_SRC@/eo_mono/*Windows.cs" />
<Compile Include="@BINDING_SRC@/eo_mono/*.cs" />
<Compile Remove="@BINDING_SRC@/eo_mono/*Windows.cs" Condition=" '$(OS)' != 'Windows_NT' "/>
<Compile Remove="@BINDING_SRC@/eo_mono/*Unix.cs" Condition=" '$(OS)' != 'UNIX' "/>
<Compile Include="@BINDING_SRC@/eina_mono/*.cs" />
<Compile Include="@BINDING_SRC@/eolian_mono/*.cs" />
<Compile Include="@BINDING_SRC@/eldbus_mono/*.cs" />
<Compile Include="@BINDING_SRC@/eldbus_mono/*.cs" Condition=" '$(OS)' == 'UNIX' "/>
</ItemGroup>

<!-- Calling `dotnet build` from a different folder seems to mess up the automatic source file discovery.
Expand Down
6 changes: 3 additions & 3 deletions src/bindings/mono/eo_mono/EoWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -411,9 +411,9 @@ private void AddWrapperSupervisor()
/// <summary>Register handlers to ownership events, in order to control the object lifetime. For internal use only.</summary>
private void AddOwnershipEventHandlers()
{
AddNativeEventHandler("eo", "_EFL_EVENT_INVALIDATE", ownershipUniqueDelegate, ownershipUniqueDelegate);
AddNativeEventHandler("eo", "_EFL_EVENT_OWNERSHIP_UNIQUE", ownershipUniqueDelegate, ownershipUniqueDelegate);
AddNativeEventHandler("eo", "_EFL_EVENT_OWNERSHIP_SHARED", ownershipSharedDelegate, ownershipSharedDelegate);
AddNativeEventHandler(efl.Libs.Eo, "_EFL_EVENT_INVALIDATE", ownershipUniqueDelegate, ownershipUniqueDelegate);
AddNativeEventHandler(efl.Libs.Eo, "_EFL_EVENT_OWNERSHIP_UNIQUE", ownershipUniqueDelegate, ownershipUniqueDelegate);
AddNativeEventHandler(efl.Libs.Eo, "_EFL_EVENT_OWNERSHIP_SHARED", ownershipSharedDelegate, ownershipSharedDelegate);
Eina.Error.RaiseIfUnhandledException();
}

Expand Down
4 changes: 2 additions & 2 deletions src/bindings/mono/eo_mono/FunctionWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ internal static IntPtr LoadFunctionPointer(string moduleName, string functionNam
{
IntPtr module = NativeModule.LoadLibrary(moduleName);
Eina.Log.Debug($"searching {module} for {functionName}");
var s = FunctionInterop.dlsym(module, functionName);
var s = FunctionInterop.LoadFunctionPointer(module, functionName);
Eina.Log.Debug($"searching {module} for{functionName}, result {s}");
return s;
}
Expand All @@ -51,7 +51,7 @@ internal static IntPtr LoadFunctionPointer(string moduleName, string functionNam
internal static IntPtr LoadFunctionPointer(string functionName)
{
Eina.Log.Debug($"searching {null} for {functionName}");
var s = FunctionInterop.dlsym(IntPtr.Zero, functionName);
var s = FunctionInterop.LoadFunctionPointer(IntPtr.Zero, functionName);
Eina.Log.Debug($"searching {null} for {functionName}, result {s}");
return s;
}
Expand Down
21 changes: 16 additions & 5 deletions src/bindings/mono/eo_mono/FunctionWrapper_Windows.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,24 @@
namespace Efl.Eo
{

static partial class FunctionInterop
internal static partial class FunctionInterop
{
[DllImport(efl.Libs.Libdl)]
internal static extern IntPtr GetProcAddress(IntPtr handle, string symbol);
[DllImport(efl.Libs.Kernel32)]
private static extern IntPtr GetProcAddress(IntPtr handle, string symbol);

private static IntPtr LoadFunctionPointer(IntPtr nativeLibraryHandle, string functionName)
=> FunctionInterop.GetProcAddress(nativeLibraryHandle, functionName);
/// <summary>Loads a function pointer from the given module.
/// <para>Since EFL 1.23.</para>
/// </summary>
/// <param name="nativeLibraryHandle">The module containing the function.</param>
/// <param name="functionName">The name of the function to search for.</param>
/// <returns>A function pointer that can be used with delegates.</returns>
internal static IntPtr LoadFunctionPointer(IntPtr nativeLibraryHandle, string functionName)
{
Eina.Log.Debug($"searching {nativeLibraryHandle} for {functionName}");
var s = FunctionInterop.GetProcAddress(nativeLibraryHandle, functionName);
Eina.Log.Debug($"searching {nativeLibraryHandle} for {functionName}, result {s}");
return s;
}
}

}
21 changes: 21 additions & 0 deletions src/bindings/mono/eo_mono/NativeModule_Unix.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ internal static void UnloadLibrary(IntPtr handle)
///<item>
///<description><c>libfilename.so</c></description>
///</item>
///<item>
///<description><c>filename.dylib</c></description>
///</item>
///<item>
///<description><c>libfilename.dylib</c></description>
///</item>
///</list>
///</summary>
///<param name="filename">The name to search for.</param>
Expand All @@ -73,12 +79,27 @@ internal static IntPtr LoadLibrary(string filename)
if (r == IntPtr.Zero)
{
r = dlopen("lib" + filename + ".so", RTLD_NOW | RTLD_GLOBAL);
if (r == IntPtr.Zero)
{
r = dlopen(filename + ".dylib", RTLD_NOW | RTLD_GLOBAL);
if (r == IntPtr.Zero)
{
r = dlopen("lib" + filename + ".dylib", RTLD_NOW | RTLD_GLOBAL);
}
}


}
}
}

return r;
}

internal static string GetError()
{
return Eina.StringConversion.NativeUtf8ToManagedString(Efl.Eo.Globals.dlerror());
}
}

}
Loading