Compare commits

..

42 Commits

Author SHA1 Message Date
Kolan Sh e73cf2d921 Small fixes (upgrade Vala) 2020-04-29 09:30:44 +03:00
Kolan Sh 097e41f370 Update git modules paths (git@ -> https:) to clone without ssh-key. 2020-04-29 08:22:06 +03:00
Kolan Sh 8f213ec8f1 LibPackages +=posix 2020-04-29 07:52:46 +03:00
Kolan Sh b15a77a189 cmake/backbone updated: --abi-stability added for libraries/plugins 2019-05-16 12:53:48 +03:00
Kolan Sh f9fea4fe13 cmake/backbone submodule updated. 2019-05-14 12:27:11 +03:00
Kolan Sh 7f822a0b6a Fix: BinValaOpts -> LibValaOpts 2018-06-22 10:33:57 +03:00
Kolan Sh 94cbc852ec Define WINDOWS/UNIX macroses. 2018-06-22 09:39:48 +03:00
Kolan Sh f63c847401 Submodules updated. 2018-06-22 09:39:27 +03:00
Kolan Sh ae0f0e3153 Dependency accounting is needed only under win32, but not under Unix-like systems. 2018-06-21 18:38:38 +03:00
Kolan Sh ee8c6209db Dependency accounting between modules.
Typically, common classes are placed in a separate library
that is loaded by the system, but if this is not done,
then you need to select the correct sequence for loading the modules,
which is done in the loop.
2018-06-21 18:03:51 +03:00
Kolan Sh 9b11bca35b message() -> stderr.printf() 2018-06-21 15:31:39 +03:00
Kolan Sh a8a1e2c66b submodules URLs updated. 2018-06-20 14:19:48 +03:00
Kolan Sh d93eb17d31 Different load methods: load_modules(), load_modules_depth2(). 2018-04-28 17:39:26 +03:00
Kolan Sh c2640021cf submodules URLs updated. 2018-03-29 10:01:11 +03:00
Kolan Sh e19b314c05 lib != lib64, lib != lib32 2018-02-13 23:22:01 +03:00
Kolan Sh 6fa1e6c1ed Module cmake/backbone updated: Check BinPkgModules for empty value. 2017-12-19 08:49:41 +03:00
Kolan Sh f8cda52102 Module cmake/backbone updated: Check LibPkgModules for empty value. 2017-12-19 08:24:14 +03:00
Kolan Sh b17a728b52 Module cmake/backbone updated: CMAKE_INSTALL_FULL_LIBDIR brokes CPack 2017-12-19 08:12:29 +03:00
Kolan Sh 16373e6e3c Backbone's submodules urls fixed. 2017-02-18 18:05:32 +03:00
Kolan Sh 2d30aff257 util/backbone submodule udpated: valadoc 2016-12-08 04:14:29 +03:00
Kolan Sh 8de8b0eb4d cmake/backbone submodule updated: Override NSIS.InstallOptions only if needed. 2016-09-29 22:42:15 +03:00
Kolan Sh cc44d12d93 Bump version number to 0.1.13 2016-09-02 18:04:20 +03:00
Kolan Sh 463dc96bb5 cmake/backbone submodule updated: dlls regresion fxd. 2016-09-02 18:03:49 +03:00
Kolan Sh 52d8626c30 cmake/backbone submodule updated. 2016-08-22 21:28:00 +03:00
Kolan Sh dcbf50cb96 cmake/backbone submodule: Global SO_PATH variable removed. 2016-06-21 16:15:25 +03:00
Kolan Sh d5f982970e cmake/backbone: Combine Vala{Lib,Plugin}CommonRules. 2016-04-01 19:39:02 +03:00
Kolan Sh 0e3acf239f Bump version number to 0.1.12 2016-02-06 04:49:51 +03:00
Kolan Sh 85ee333090 Plugin: Host interface reference should be unowned. 2016-02-06 04:48:35 +03:00
Kolan Sh c8f5085a15 Homepage menu link added. 2015-12-15 18:02:04 +03:00
Kolan Sh 824a4f3854 Bump version number to 0.1.11 2015-11-14 07:07:58 +03:00
Kolan Sh 886bb5bdd1 Library constructor from cmake/backbone/templates. 2015-11-14 05:35:22 +03:00
Kolan Sh 8682acaa15 cmake/backbone submodule updated. 2015-11-07 18:03:23 +03:00
Kolan Sh 66df0fd678 Merge {host,plugin}-iface into one common library. 2015-11-06 02:39:24 +03:00
Kolan Sh 7b89646055 {cmake,util}/backbone submodules updated. 2015-10-24 20:21:28 +03:00
Kolan Sh 1d65a203d0 Plugin: installation flag added. 2015-10-23 18:14:30 +03:00
Kolan Sh 557c30d925 Fix comment. 2015-10-19 20:52:12 +03:00
Kolan Sh 9f72fe6feb cmake/backbone submodule updated. 2015-10-19 20:36:48 +03:00
Kolan Sh 73738be4f4 Bumped version number to 0.1.8 2015-10-12 20:23:52 +03:00
Kolan Sh 2e1ead96e9 cmake/backbone submodule updated 2015-10-12 20:23:03 +03:00
Kolan Sh 07bf71fe73 Bump version number to 0.1.7 2015-10-12 20:02:17 +03:00
Kolan Sh 8d46b72ba2 Fix linker includes in pkg-config. 2015-10-12 20:02:03 +03:00
Kolan Sh 205ad66b0d Bump version number to 0.1.6 2015-10-12 14:49:05 +03:00
32 changed files with 184 additions and 230 deletions

4
.gitmodules vendored
View File

@ -1,6 +1,6 @@
[submodule "cmake"] [submodule "cmake"]
path = cmake/backbone path = cmake/backbone
url = git@git.backbone.ws:cmake/backbone.git url = https://git.backbone.ws/kolan/cmake.backbone.git
[submodule "util/backbone"] [submodule "util/backbone"]
path = util/backbone path = util/backbone
url = git@git.backbone.ws:cmake/backbone-utils.git url = https://git.backbone.ws/kolan/cmake.backbone-utils.git

View File

@ -7,7 +7,7 @@ SET (PROJECT_DESCRIPTION "Host/Plugin Interfaces for GObject Based Applications/
SET (MAJOR 0) SET (MAJOR 0)
SET (MINOR 1) SET (MINOR 1)
SET (PATCH 4) SET (PATCH 13)
LIST (APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/backbone) LIST (APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/backbone)

@ -1 +1 @@
Subproject commit a6437568a530ba24277e25c15c5e94e9accd8e02 Subproject commit 206751e1f4814716d716f6bc297c280d4bf1dcf7

View File

@ -5,6 +5,6 @@ SET (REDHAT_DEPENDENCIES "vala >= 0.24, glib >= 2.33")
SET (REDHAT_SECTION "Development/Libraries") SET (REDHAT_SECTION "Development/Libraries")
SET (LICENSE "LGPLv3+") SET (LICENSE "LGPLv3+")
SET (WIN32_UNINSTALL_NAME "GobjPlug") # <= 8 symbols for the name SET (WIN32_UNINSTALL_NAME "GobjPlug") # <= 8 symbols for the name
SET (CPACK_NSIS_MENU_LINKS "https://redmine.backbone.ws/projects/plugin"
LIST (APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) "Homepage for GObject/Plugin")
INCLUDE (CPackCommon) INCLUDE (CPackCommonRules)

View File

@ -1,17 +1,15 @@
INCLUDE (PkgConfigCommon) INCLUDE (PkgConfigCommonRules)
SET (PkgConfigLibs "") SET (PkgConfigLibs "-L\${libdir}")
IF (WIN32) IF (WIN32)
SET (PkgConfigLibs "${PkgConfigLibs} -l${PROJECT_LOWERCASE_NAME}-iface-${MAJOR}") SET (PkgConfigLibs "${PkgConfigLibs} -l${PROJECT_LOWERCASE_NAME}-iface-${MAJOR}")
SET (PkgConfigLibs "${PkgConfigLibs} -l${PROJECT_LOWERCASE_NAME}-host-iface-${MAJOR}")
SET (PkgConfigLibs "${PkgConfigLibs} -l${PROJECT_LOWERCASE_NAME}-loader-${MAJOR}") SET (PkgConfigLibs "${PkgConfigLibs} -l${PROJECT_LOWERCASE_NAME}-loader-${MAJOR}")
ELSE (WIN32) ELSE (WIN32)
SET (PkgConfigLibs "${PkgConfigLibs} -l${PROJECT_LOWERCASE_NAME}-iface.so.${MAJOR}") SET (PkgConfigLibs "${PkgConfigLibs} -l${PROJECT_LOWERCASE_NAME}-iface.so.${MAJOR}")
SET (PkgConfigLibs "${PkgConfigLibs} -l${PROJECT_LOWERCASE_NAME}-host-iface.so.${MAJOR}")
SET (PkgConfigLibs "${PkgConfigLibs} -l${PROJECT_LOWERCASE_NAME}-loader.so.${MAJOR}") SET (PkgConfigLibs "${PkgConfigLibs} -l${PROJECT_LOWERCASE_NAME}-loader.so.${MAJOR}")
ENDIF (WIN32) ENDIF (WIN32)
CONFIGURE_FILE ( CONFIGURE_FILE (
"${CMAKE_CURRENT_SOURCE_DIR}/pkg-config.pc.in" "${CMAKE_SOURCE_DIR}/cmake/backbone/templates/pkg-config.pc.in"
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_LOWERCASE_NAME}-${MAJOR}.pc" "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_LOWERCASE_NAME}-${MAJOR}.pc"
) )

View File

@ -1,11 +0,0 @@
prefix=@PkgConfigPrefix@
exec_prefix=@PkgConfigExecPrefix@
libdir=@PkgConfigLibDir@
includedir=@PkgConfigIncludeDir@
Name: @PkgConfigName@
Description: @PkgConfigDescription@
Version: @PkgConfigVersion@
Libs: @PkgConfigLibs@
Libs.private: @PkgConfigLibsPrivate@
Cflags: @PkgConfigCflags@

View File

@ -1,41 +1 @@
SET (GETTEXT_PACKAGE "${PROJECT_LOWERCASE_NAME_ABI}") INCLUDE (GettextCommonRules)
ADD_DEFINITIONS (-DGETTEXT_PACKAGE="${GETTEXT_PACKAGE}")
IF (WIN32)
SET (LOCALEDIR "")
ELSE ()
SET (LOCALEDIR "${CMAKE_INSTALL_PREFIX}/share/locale")
ENDIF ()
SET (CUSTOM_LOCALEDIR "" CACHE STRING "Directory to install l10n files into")
IF (NOT CUSTOM_LOCALEDIR STREQUAL "")
SET (LOCALEDIR "${CUSTOM_LOCALEDIR}")
MESSAGE(STATUS "Using LOCALEDIR=${LOCALEDIR}")
ENDIF ()
ADD_DEFINITIONS (-DLOCALEDIR="${LOCALEDIR}")
SET (LOCALE_INSTALL_DIR "share/locale")
LIST (APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
INCLUDE (MacroOptionalAddSubdirectory)
FIND_PACKAGE (Gettext REQUIRED)
MACRO_OPTIONAL_ADD_SUBDIRECTORY (langs)
# configure a header file for Gettext
SET (VERSION ${MAJOR}.${MINOR}.${PATCH})
SET (PROJECT_LOWERCASE_NAME_ABI "${PROJECT_LOWERCASE_NAME}-${MAJOR}")
STRING (TOUPPER "${CMAKE_PROJECT_NAME}" GettextUniqueHeader)
SET (GettextPackageNameAbi "${PROJECT_LOWERCASE_NAME_ABI}")
CONFIGURE_FILE (
"gettext-config.h.in"
"${PROJECT_BINARY_DIR}/po/gettext-config.h"
)
IF (NOT GETTEXT_MSGMERGE_EXECUTABLE)
MESSAGE (FATAL_ERROR "Please install msgmerge binary")
ENDIF (NOT GETTEXT_MSGMERGE_EXECUTABLE)
IF (NOT GETTEXT_MSGFMT_EXECUTABLE)
MESSAGE(FATAL_ERROR "Please install msgmerge binary")
ENDIF (NOT GETTEXT_MSGFMT_EXECUTABLE)

View File

@ -1,11 +0,0 @@
#ifndef @GettextUniqueHeader@_H
#define @GettextUniqueHeader@_H
#define GETTEXT_PACKAGE "@GettextPackageNameAbi@"
#include <glib/gi18n-lib.h>
#ifdef WIN32
#define _(String) dgettext (GETTEXT_PACKAGE, String)
#endif
#endif // @GettextUniqueHeader@_H

View File

@ -1,2 +0,0 @@
ADD_SUBDIRECTORY (ru)
# ADD_SUBDIRECTORY (de)

View File

@ -1,2 +0,0 @@
FILE (GLOB _po_files *.po)
GETTEXT_PROCESS_PO_FILES (ru ALL INSTALL_DESTINATION ${LOCALE_INSTALL_DIR} PO_FILES ${_po_files} )

1
po/ru/CMakeLists.txt Normal file
View File

@ -0,0 +1 @@
INCLUDE (GettextLangRules)

View File

@ -1,5 +1,2 @@
INCLUDE_DIRECTORIES (${CMAKE_BINARY_DIR}/po) ADD_SUBDIRECTORY (iface)
ADD_SUBDIRECTORY (host-iface)
ADD_SUBDIRECTORY (plugin-iface)
ADD_SUBDIRECTORY (loader) ADD_SUBDIRECTORY (loader)

View File

@ -1,6 +0,0 @@
SET (LibName ${PROJECT_LOWERCASE_NAME}-host-iface)
FILE (GLOB_RECURSE LibSources RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} HostInterface.vala)
SET (LibPkgModules gee-0.8 gio-2.0)
SET (LibExtraSources ${PROJECT_SOURCE_DIR}/src/library_constructor.c)
SET (LibInstall ON)
INCLUDE (ValaLibCommonRules)

8
src/iface/CMakeLists.txt Normal file
View File

@ -0,0 +1,8 @@
SET (LibName ${PROJECT_LOWERCASE_NAME}-iface)
FILE (GLOB_RECURSE LibSources RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.vala)
SET (LibPkgModules gee-0.8 gio-2.0)
SET (LibInstall ON)
SET (LibExtraSources ${CMAKE_CURRENT_BINARY_DIR}/library_constructor.c)
SET (LC_RELATIVE_PREFIX "..")
CONFIGURE_FILE ( "${CMAKE_SOURCE_DIR}/cmake/backbone/templates/library_constructor.c.in" "${LibExtraSources}")
INCLUDE (ValaLibCommonRules)

View File

@ -22,7 +22,7 @@ namespace GObject {
/** /**
* Host Interface. * Host Interface.
*/ */
public IHost host { get; set; default = null; } public unowned IHost host { get; set; default = null; }
} }
} }
} }

View File

@ -1,35 +0,0 @@
#if defined(_WIN32) || defined(_WIN64)
#include <windows.h>
#endif
#include "gettext-config.h"
#if defined(_WIN32) || defined(_WIN64)
BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
#elif defined(linux) || defined(UNIX) || defined(__unix__)
void __attribute__ ((constructor)) load_library (void)
#endif
{
#if defined(_WIN32) || defined(_WIN64)
gchar dllPath[FILENAME_MAX],
*dllDir,
*localePath;
GetModuleFileName (hInstance, dllPath, FILENAME_MAX);
dllDir = g_path_get_dirname (dllPath);
localePath = g_build_filename (dllDir, "../share/locale", NULL);
g_free (dllDir);
bindtextdomain (GETTEXT_PACKAGE, localePath);
g_free (localePath);
#endif
#if (!GLIB_CHECK_VERSION (2, 36, 0))
g_type_init ();
#endif
#if defined(_WIN32) || defined(_WIN64)
(void) dwReason; // avoid
(void) lpReserved; // warngings
return TRUE;
#endif
}

View File

@ -1,13 +1,16 @@
SET (LibName ${PROJECT_LOWERCASE_NAME}-loader) SET (LibName ${PROJECT_LOWERCASE_NAME}-loader)
FILE (GLOB_RECURSE LibSources RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} PluginLoader.vala) FILE (GLOB_RECURSE LibSources RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} PluginLoader.vala)
SET (LibPackages gee-0.8 gmodule-2.0 gio-2.0) SET (LibPackages posix gee-0.8 gmodule-2.0 gio-2.0)
SET (LibCustomVapis ${CMAKE_BINARY_DIR}/src/plugin-iface/${PROJECT_LOWERCASE_NAME}-iface-${MAJOR}.vapi SET (LibCustomVapis ${CMAKE_BINARY_DIR}/src/iface/${PROJECT_LOWERCASE_NAME}-iface-${MAJOR}.vapi)
${CMAKE_BINARY_DIR}/src/host-iface/${PROJECT_LOWERCASE_NAME}-host-iface-${MAJOR}.vapi
)
SET (LibExtraSources ${PROJECT_SOURCE_DIR}/src/library_constructor.c)
SET (LibInstall ON) SET (LibInstall ON)
SET (LibLinkLibs ${PROJECT_LOWERCASE_NAME}-iface ${PROJECT_LOWERCASE_NAME}-host-iface gmodule-2.0) SET (LibExtraSources ${CMAKE_CURRENT_BINARY_DIR}/library_constructor.c)
INCLUDE_DIRECTORIES ("${CMAKE_BINARY_DIR}/src/plugin-iface" SET (LC_RELATIVE_PREFIX "..")
"${CMAKE_BINARY_DIR}/src/host-iface" CONFIGURE_FILE ( "${CMAKE_SOURCE_DIR}/cmake/backbone/templates/library_constructor.c.in" "${LibExtraSources}")
) SET (LibLinkLibs ${PROJECT_LOWERCASE_NAME}-iface gmodule-2.0)
INCLUDE_DIRECTORIES ("${CMAKE_BINARY_DIR}/src/iface")
IF (WIN32)
SET (LibValaOpts -D WINDOWS)
ELSE (WIN32)
SET (LibValaOpts -D UNIX)
ENDIF (WIN32)
INCLUDE (ValaLibCommonRules) INCLUDE (ValaLibCommonRules)

View File

@ -34,15 +34,15 @@ namespace GObject {
* Loads the module. * Loads the module.
*/ */
public override bool load () { public override bool load () {
module = GLib.Module.open (path, GLib.ModuleFlags.BIND_LAZY); module = GLib.Module.open (path, GLib.ModuleFlags.LAZY);
if (null == module) { if (null == module) {
message ("Module '%s' not found", path); stderr.printf("Cannot load module %s\n", path);
return false; return false;
} }
void * plugin_init = null; void * plugin_init = null;
if (! module.symbol ("plugin_init", out plugin_init)) { if (! module.symbol ("plugin_init", out plugin_init)) {
message ("No such symbol: plugin_init in module " + path); stderr.printf("No such symbol: plugin_init in %s\n", path);
return false; return false;
} }
@ -75,6 +75,69 @@ namespace GObject {
} }
} }
void sort_modules (Gee.ArrayList<Module> modules) {
modules.sort ((a, b) => {
var a_name = a.get_plugin_type ().name ();
var b_name = b.get_plugin_type ().name ();
if (a_name < b_name) return -1;
if (a_name > b_name) return 1;
return 0;
});
}
/**
* Loads modules in the specific directory.
*
* @param dir_path path to the directory.
* @param modules where to save list of modules.
*
* @return are the modules loaded correctly or not.
*/
public bool load_modules (string dir_path, ref Gee.ArrayList<Module>? modules) {
modules = new Gee.ArrayList<Module> ();
#if (WINDOWS)
var paths = new Gee.HashSet<string> ();
#endif
try {
var libPath = File.new_for_path (dir_path);
#if (WINDOWS)
for (var i = 0; i < 32; ++i) {
var saved_length = modules.size;
#endif
var lib_enumerator = libPath.enumerate_children (FileAttribute.STANDARD_NAME, 0, null);
FileInfo file_info = null;
while ((file_info = lib_enumerator.next_file (null)) != null) {
if (Regex.match_simple ("^.*\\.(so|dll)$", file_info.get_name ())) {
var path = GLib.Module.build_path (dir_path, file_info.get_name ());
#if (WINDOWS)
if (paths.contains(path)) continue;
#endif
var module = new Module (path);
if (module.load ()) {
modules.add (module);
#if (WINDOWS)
paths.add(path);
#endif
}
}
}
#if (WINDOWS)
if (modules.size == saved_length) break;
}
#endif
} catch (Error e) {
message (e.message);
return false;
}
sort_modules (modules);
return true;
}
/** /**
* Loads modules in the 2-depth directory tree path. * Loads modules in the 2-depth directory tree path.
* *
@ -83,12 +146,19 @@ namespace GObject {
* *
* @return are the modules loaded correctly or not. * @return are the modules loaded correctly or not.
*/ */
public bool load_modules (string dir_path, ref Gee.ArrayList<Module>? modules) { public bool load_modules_depth2 (string dir_path, ref Gee.ArrayList<Module>? modules) {
modules = new Gee.ArrayList<Module> (); modules = new Gee.ArrayList<Module> ();
#if (WINDOWS)
var paths = new Gee.HashSet<string> ();
#endif
try { try {
var libPath = File.new_for_path (dir_path); var libPath = File.new_for_path (dir_path);
#if (WINDOWS)
for (var i = 0; i < 32; ++i) {
var saved_length = modules.size;
#endif
var dir_enumerator = libPath.enumerate_children ("standard::*", var dir_enumerator = libPath.enumerate_children ("standard::*",
FileQueryInfoFlags.NOFOLLOW_SYMLINKS, null); FileQueryInfoFlags.NOFOLLOW_SYMLINKS, null);
FileInfo dir_info = null; FileInfo dir_info = null;
@ -100,25 +170,31 @@ namespace GObject {
while ((file_info = lib_enumerator.next_file (null)) != null) { while ((file_info = lib_enumerator.next_file (null)) != null) {
if (Regex.match_simple ("^.*\\.(so|dll)$", file_info.get_name ())) { if (Regex.match_simple ("^.*\\.(so|dll)$", file_info.get_name ())) {
var path = Path.build_path (Path.DIR_SEPARATOR_S, dir_path, dir_info.get_name ()); var path = Path.build_path (Path.DIR_SEPARATOR_S, dir_path, dir_info.get_name ());
var module = new Module (GLib.Module.build_path (path, file_info.get_name ())); path = GLib.Module.build_path (path, file_info.get_name ());
if (module.load ()) #if (WINDOWS)
if (paths.contains(path)) continue;
#endif
var module = new Module (path);
if (module.load ()) {
modules.add (module); modules.add (module);
#if (WINDOWS)
paths.add(path);
#endif
} }
} }
} }
} }
}
#if (WINDOWS)
if (modules.size == saved_length) break;
}
#endif
} catch (Error e) { } catch (Error e) {
message (e.message); message (e.message);
return false; return false;
} }
modules.sort ((a, b) => { sort_modules (modules);
var a_name = a.get_plugin_type ().name ();
var b_name = b.get_plugin_type ().name ();
if (a_name < b_name) return -1;
if (a_name > b_name) return 1;
return 0;
});
return true; return true;
} }

View File

@ -1,8 +0,0 @@
SET (LibName ${PROJECT_LOWERCASE_NAME}-iface)
FILE (GLOB_RECURSE LibSources RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} PluginInterface.vala)
SET (LibCustomVapis ${CMAKE_BINARY_DIR}/src/host-iface/${PROJECT_LOWERCASE_NAME}-host-iface-${MAJOR}.vapi)
SET (LibExtraSources ${PROJECT_SOURCE_DIR}/src/library_constructor.c)
SET (LibInstall ON)
SET (LibLinkLibs ${PROJECT_LOWERCASE_NAME}-host-iface)
INCLUDE_DIRECTORIES ("${CMAKE_BINARY_DIR}/src/host-iface")
INCLUDE (ValaLibCommonRules)

View File

@ -1,10 +1,6 @@
SET (LibName loader_test-iface) SET (LibName loader_test-iface)
FILE (GLOB_RECURSE LibSources RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} LoaderTestInterface.vala) FILE (GLOB_RECURSE LibSources RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} LoaderTestInterface.vala)
SET (LibCustomVapis ${CMAKE_BINARY_DIR}/src/plugin-iface/${PROJECT_LOWERCASE_NAME}-iface-${MAJOR}.vapi SET (LibCustomVapis ${CMAKE_BINARY_DIR}/src/iface/${PROJECT_LOWERCASE_NAME}-iface-${MAJOR}.vapi)
${CMAKE_BINARY_DIR}/src/host-iface/${PROJECT_LOWERCASE_NAME}-host-iface-${MAJOR}.vapi
)
SET (LibLinkLibs gobject-plugin-iface) SET (LibLinkLibs gobject-plugin-iface)
INCLUDE_DIRECTORIES ("${CMAKE_BINARY_DIR}/src/plugin-iface" INCLUDE_DIRECTORIES ("${CMAKE_BINARY_DIR}/src/iface")
"${CMAKE_BINARY_DIR}/src/host-iface"
)
INCLUDE (ValaLibCommonRules) INCLUDE (ValaLibCommonRules)

View File

@ -2,19 +2,16 @@ SET (BinName loader_test)
FILE (GLOB_RECURSE BinSources RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} LoaderTest.vala) FILE (GLOB_RECURSE BinSources RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} LoaderTest.vala)
SET (BinPackages gee-0.8 gio-2.0) SET (BinPackages gee-0.8 gio-2.0)
SET (BinCustomVapis ${CMAKE_BINARY_DIR}/src/loader/${PROJECT_LOWERCASE_NAME}-loader-${MAJOR}.vapi SET (BinCustomVapis ${CMAKE_BINARY_DIR}/src/loader/${PROJECT_LOWERCASE_NAME}-loader-${MAJOR}.vapi
${CMAKE_BINARY_DIR}/src/plugin-iface/${PROJECT_LOWERCASE_NAME}-iface-${MAJOR}.vapi ${CMAKE_BINARY_DIR}/src/iface/${PROJECT_LOWERCASE_NAME}-iface-${MAJOR}.vapi
${CMAKE_BINARY_DIR}/test/loader_test-iface/loader_test-iface-${MAJOR}.vapi ${CMAKE_BINARY_DIR}/test/loader_test-iface/loader_test-iface-${MAJOR}.vapi
${CMAKE_BINARY_DIR}/src/host-iface/${PROJECT_LOWERCASE_NAME}-host-iface-${MAJOR}.vapi
) )
SET (BinLinkLibs ${PROJECT_LOWERCASE_NAME}-loader SET (BinLinkLibs ${PROJECT_LOWERCASE_NAME}-loader
${PROJECT_LOWERCASE_NAME}-iface ${PROJECT_LOWERCASE_NAME}-iface
${PROJECT_LOWERCASE_NAME}-host-iface
loader_test-iface loader_test-iface
) )
INCLUDE_DIRECTORIES ("${CMAKE_BINARY_DIR}/src/loader" INCLUDE_DIRECTORIES ("${CMAKE_BINARY_DIR}/src/loader"
"${CMAKE_BINARY_DIR}/src/plugin-iface" "${CMAKE_BINARY_DIR}/src/iface"
"${CMAKE_BINARY_DIR}/test/loader_test-iface" "${CMAKE_BINARY_DIR}/test/loader_test-iface"
"${CMAKE_BINARY_DIR}/src/host-iface"
) )
INCLUDE (ValaBinCommonRules) INCLUDE (ValaBinCommonRules)

View File

@ -13,13 +13,13 @@ int main (string [] args) {
var h = new LoaderTestHost (); var h = new LoaderTestHost ();
GObject.Plugins.load_modules ( GObject.Plugins.load_modules_depth2 (
Path.build_path (Path.DIR_SEPARATOR_S, File.new_for_path ( Path.build_path (Path.DIR_SEPARATOR_S, File.new_for_path (
args[0]).get_parent ().get_parent ().get_path (), "test/plugins/typeA"), args[0]).get_parent ().get_parent ().get_path (), "test/plugins/typeA"),
ref type_a_modules ref type_a_modules
); );
GObject.Plugins.load_modules ( GObject.Plugins.load_modules_depth2 (
Path.build_path (Path.DIR_SEPARATOR_S, File.new_for_path ( Path.build_path (Path.DIR_SEPARATOR_S, File.new_for_path (
args[0]).get_parent ().get_parent ().get_path (), "test/plugins/typeB"), args[0]).get_parent ().get_parent ().get_path (), "test/plugins/typeB"),
ref type_b_modules ref type_b_modules

View File

@ -1,15 +1,13 @@
SET (PluginName type_a1) SET (LibName type_a1)
FILE (GLOB_RECURSE PluginSources RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} TypeA1.vala) SET (LibIsPlugin ON)
SET (PluginCustomVapis SET (LibNoApi ON)
${CMAKE_BINARY_DIR}/src/plugin-iface/${PROJECT_LOWERCASE_NAME}-iface-${MAJOR}.vapi FILE (GLOB_RECURSE LibSources RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} TypeA1.vala)
SET (LibCustomVapis
${CMAKE_BINARY_DIR}/src/iface/${PROJECT_LOWERCASE_NAME}-iface-${MAJOR}.vapi
${CMAKE_BINARY_DIR}/test/loader_test-iface/loader_test-iface-${MAJOR}.vapi ${CMAKE_BINARY_DIR}/test/loader_test-iface/loader_test-iface-${MAJOR}.vapi
${CMAKE_BINARY_DIR}/src/host-iface/${PROJECT_LOWERCASE_NAME}-host-iface-${MAJOR}.vapi
) )
SET (PluginLinkLibs gobject-plugin-iface loader_test-iface) SET (LibLinkLibs gobject-plugin-iface loader_test-iface)
INCLUDE_DIRECTORIES ("${CMAKE_BINARY_DIR}/src/plugin-iface" INCLUDE_DIRECTORIES ("${CMAKE_BINARY_DIR}/src/iface"
"${CMAKE_BINARY_DIR}/test/loader_test-iface" "${CMAKE_BINARY_DIR}/test/loader_test-iface"
"${CMAKE_BINARY_DIR}/src/host-iface"
) )
INCLUDE (ValaPluginCommonRules) INCLUDE (ValaLibCommonRules)
#INSTALL (TARGETS ${PluginName} DESTINATION lib/${PROJECT_LOWERCASE_NAME}-${MAJOR}/plugins/${PluginName})

View File

@ -25,11 +25,12 @@ public class TypeA1 : PluginTypeA {
public override void method_a () { public override void method_a () {
stdout.puts ("TypeA1.method_a () called\n"); stdout.puts ("TypeA1.method_a () called\n");
stdout.puts ("Call IHostLoaderTest.method_host () from TypeA1:\n "); stdout.puts ("Call IHostLoaderTest.method_host () from TypeA1:\n ");
(host as IHostLoaderTest).method_host (); var test = host as IHostLoaderTest;
if (test != null) test.method_host ();
} }
} }
[ModuleInit] [ModuleInit]
Type plugin_init (GLib.TypeModule type_module) { public Type plugin_init (GLib.TypeModule type_module) {
return typeof (TypeA1); return typeof (TypeA1);
} }

View File

@ -1,15 +1,13 @@
SET (PluginName type_a2) SET (LibName type_a2)
FILE (GLOB_RECURSE PluginSources RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} TypeA2.vala) SET (LibIsPlugin ON)
SET (PluginCustomVapis SET (LibNoApi ON)
${CMAKE_BINARY_DIR}/src/plugin-iface/${PROJECT_LOWERCASE_NAME}-iface-${MAJOR}.vapi FILE (GLOB_RECURSE LibSources RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} TypeA2.vala)
SET (LibCustomVapis
${CMAKE_BINARY_DIR}/src/iface/${PROJECT_LOWERCASE_NAME}-iface-${MAJOR}.vapi
${CMAKE_BINARY_DIR}/test/loader_test-iface/loader_test-iface-${MAJOR}.vapi ${CMAKE_BINARY_DIR}/test/loader_test-iface/loader_test-iface-${MAJOR}.vapi
${CMAKE_BINARY_DIR}/src/host-iface/${PROJECT_LOWERCASE_NAME}-host-iface-${MAJOR}.vapi
) )
SET (PluginLinkLibs gobject-plugin-iface loader_test-iface) SET (LibLinkLibs gobject-plugin-iface loader_test-iface)
INCLUDE_DIRECTORIES ("${CMAKE_BINARY_DIR}/src/plugin-iface" INCLUDE_DIRECTORIES ("${CMAKE_BINARY_DIR}/src/iface"
"${CMAKE_BINARY_DIR}/test/loader_test-iface" "${CMAKE_BINARY_DIR}/test/loader_test-iface"
"${CMAKE_BINARY_DIR}/src/host-iface"
) )
INCLUDE (ValaPluginCommonRules) INCLUDE (ValaLibCommonRules)
#INSTALL (TARGETS ${PluginName} DESTINATION lib/${PROJECT_LOWERCASE_NAME}-${MAJOR}/plugins/${PluginName})

View File

@ -28,6 +28,6 @@ public class TypeA2 : PluginTypeA {
} }
[ModuleInit] [ModuleInit]
Type plugin_init (GLib.TypeModule type_module) { public Type plugin_init (GLib.TypeModule type_module) {
return typeof (TypeA2); return typeof (TypeA2);
} }

View File

@ -1,15 +1,13 @@
SET (PluginName type_b1) SET (LibName type_b1)
FILE (GLOB_RECURSE PluginSources RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} TypeB1.vala) SET (LibIsPlugin ON)
SET (PluginCustomVapis SET (LibNoApi ON)
${CMAKE_BINARY_DIR}/src/plugin-iface/${PROJECT_LOWERCASE_NAME}-iface-${MAJOR}.vapi FILE (GLOB_RECURSE LibSources RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} TypeB1.vala)
SET (LibCustomVapis
${CMAKE_BINARY_DIR}/src/iface/${PROJECT_LOWERCASE_NAME}-iface-${MAJOR}.vapi
${CMAKE_BINARY_DIR}/test/loader_test-iface/loader_test-iface-${MAJOR}.vapi ${CMAKE_BINARY_DIR}/test/loader_test-iface/loader_test-iface-${MAJOR}.vapi
${CMAKE_BINARY_DIR}/src/host-iface/${PROJECT_LOWERCASE_NAME}-host-iface-${MAJOR}.vapi
) )
SET (PluginLinkLibs gobject-plugin-iface loader_test-iface) SET (LibLinkLibs gobject-plugin-iface loader_test-iface)
INCLUDE_DIRECTORIES ("${CMAKE_BINARY_DIR}/src/plugin-iface" INCLUDE_DIRECTORIES ("${CMAKE_BINARY_DIR}/src/iface"
"${CMAKE_BINARY_DIR}/test/loader_test-iface" "${CMAKE_BINARY_DIR}/test/loader_test-iface"
"${CMAKE_BINARY_DIR}/src/host-iface"
) )
INCLUDE (ValaPluginCommonRules) INCLUDE (ValaLibCommonRules)
#INSTALL (TARGETS ${PluginName} DESTINATION lib/${PROJECT_LOWERCASE_NAME}-${MAJOR}/plugins/${PluginName})

View File

@ -29,6 +29,6 @@ public class TypeB1 : PluginTypeB {
} }
[ModuleInit] [ModuleInit]
Type plugin_init (GLib.TypeModule type_module) { public Type plugin_init (GLib.TypeModule type_module) {
return typeof (TypeB1); return typeof (TypeB1);
} }

View File

@ -1,15 +1,13 @@
SET (PluginName type_b2) SET (LibName type_b2)
FILE (GLOB_RECURSE PluginSources RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} TypeB2.vala) SET (LibIsPlugin ON)
SET (PluginCustomVapis SET (LibNoApi ON)
${CMAKE_BINARY_DIR}/src/plugin-iface/${PROJECT_LOWERCASE_NAME}-iface-${MAJOR}.vapi FILE (GLOB_RECURSE LibSources RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} TypeB2.vala)
SET (LibCustomVapis
${CMAKE_BINARY_DIR}/src/iface/${PROJECT_LOWERCASE_NAME}-iface-${MAJOR}.vapi
${CMAKE_BINARY_DIR}/test/loader_test-iface/loader_test-iface-${MAJOR}.vapi ${CMAKE_BINARY_DIR}/test/loader_test-iface/loader_test-iface-${MAJOR}.vapi
${CMAKE_BINARY_DIR}/src/host-iface/${PROJECT_LOWERCASE_NAME}-host-iface-${MAJOR}.vapi
) )
SET (PluginLinkLibs gobject-plugin-iface loader_test-iface) SET (LibLinkLibs gobject-plugin-iface loader_test-iface)
INCLUDE_DIRECTORIES ("${CMAKE_BINARY_DIR}/src/plugin-iface" INCLUDE_DIRECTORIES ("${CMAKE_BINARY_DIR}/src/iface"
"${CMAKE_BINARY_DIR}/test/loader_test-iface" "${CMAKE_BINARY_DIR}/test/loader_test-iface"
"${CMAKE_BINARY_DIR}/src/host-iface"
) )
INCLUDE (ValaPluginCommonRules) INCLUDE (ValaLibCommonRules)
#INSTALL (TARGETS ${PluginName} DESTINATION lib/${PROJECT_LOWERCASE_NAME}-${MAJOR}/plugins/${PluginName})

View File

@ -29,6 +29,6 @@ public class TypeB2 : PluginTypeB {
} }
[ModuleInit] [ModuleInit]
Type plugin_init (GLib.TypeModule type_module) { public Type plugin_init (GLib.TypeModule type_module) {
return typeof (TypeB2); return typeof (TypeB2);
} }

@ -1 +1 @@
Subproject commit aa78f6d42c85f7f9a98a1a6273230a9775824fc7 Subproject commit 11c998aca2aa1b787286b336e579e5a4e31f471a