Library constructor from cmake/backbone/templates.

This commit is contained in:
Kolan Sh 2015-11-07 22:16:58 +03:00
parent 8682acaa15
commit 886bb5bdd1
5 changed files with 8 additions and 39 deletions

@ -1 +1 @@
Subproject commit 2c0df243a1518c857ae9db48281e9d489003bf63
Subproject commit 02f3a0f7d969534872799b45a95d3c5a6fef14c3

View File

@ -1,6 +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 (LibExtraSources ${PROJECT_SOURCE_DIR}/src/library_constructor.c)
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

@ -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; // warnings
return TRUE;
#endif
}

View File

@ -2,8 +2,10 @@ SET (LibName ${PROJECT_LOWERCASE_NAME}-loader)
FILE (GLOB_RECURSE LibSources RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} PluginLoader.vala)
SET (LibPackages gee-0.8 gmodule-2.0 gio-2.0)
SET (LibCustomVapis ${CMAKE_BINARY_DIR}/src/iface/${PROJECT_LOWERCASE_NAME}-iface-${MAJOR}.vapi)
SET (LibExtraSources ${PROJECT_SOURCE_DIR}/src/library_constructor.c)
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}")
SET (LibLinkLibs ${PROJECT_LOWERCASE_NAME}-iface gmodule-2.0)
INCLUDE_DIRECTORIES ("${CMAKE_BINARY_DIR}/src/iface")
INCLUDE (ValaLibCommonRules)

@ -1 +1 @@
Subproject commit bc270b7a0fdbbaec24dbd4af307bda242bed5c2b
Subproject commit d4e233ae72412f4dfef9b7c39ae7a1b6667fb446