aboutsummaryrefslogtreecommitdiff
path: root/libdino
diff options
context:
space:
mode:
Diffstat (limited to 'libdino')
-rw-r--r--libdino/CMakeLists.txt38
-rw-r--r--libdino/src/plugin/loader.vala18
-rw-r--r--libdino/src/settings.vala2
3 files changed, 34 insertions, 24 deletions
diff --git a/libdino/CMakeLists.txt b/libdino/CMakeLists.txt
index a2b47381..16454115 100644
--- a/libdino/CMakeLists.txt
+++ b/libdino/CMakeLists.txt
@@ -1,17 +1,11 @@
-find_package(Vala REQUIRED)
-find_package(PkgConfig REQUIRED)
-include(${VALA_USE_FILE})
-
-set(LIBDINO_PACKAGES
- gee-0.8
- glib-2.0
- gtk+-3.0
- gmodule-2.0
- sqlite3
+find_packages(LIBDINO_PACKAGES REQUIRED
+ Gee
+ GLib
+ GModule
+ GObject
+ GTK3
)
-pkg_check_modules(LIBDINO REQUIRED ${LIBDINO_PACKAGES})
-
vala_precompile(LIBDINO_VALA_C
SOURCES
src/application.vala
@@ -49,28 +43,27 @@ SOURCES
CUSTOM_VAPIS
"${CMAKE_BINARY_DIR}/exports/xmpp-vala.vapi"
"${CMAKE_BINARY_DIR}/exports/qlite.vapi"
+CUSTOM_DEPS
+ xmpp-vala
+ qlite
PACKAGES
${LIBDINO_PACKAGES}
GENERATE_VAPI
dino
GENERATE_HEADER
dino
-OPTIONS
- --target-glib=2.38
- ${GLOBAL_DEBUG_FLAGS}
- --thread
)
-set(CFLAGS ${VALA_CFLAGS} ${LIBDINO_CFLAGS})
-add_definitions(${CFLAGS})
+add_definitions(${VALA_CFLAGS})
add_library(libdino SHARED ${LIBDINO_VALA_C})
add_dependencies(libdino xmpp-vala-vapi qlite-vapi)
-target_link_libraries(libdino xmpp-vala qlite ${LIBDINO_LIBRARIES} -lm)
+target_link_libraries(libdino xmpp-vala qlite ${LIBDINO_PACKAGES} -lm)
set_target_properties(libdino PROPERTIES PREFIX "")
add_custom_target(dino-vapi
DEPENDS
${CMAKE_BINARY_DIR}/exports/dino.vapi
+ ${CMAKE_BINARY_DIR}/exports/dino.deps
)
add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/gschemas.compiled
@@ -83,4 +76,9 @@ DEPENDS
add_custom_target(dino-gsettings-schema-compiled
DEPENDS
${CMAKE_BINARY_DIR}/gschemas.compiled
-) \ No newline at end of file
+)
+
+install(TARGETS libdino ${TARGET_INSTALL})
+install(FILES ${CMAKE_BINARY_DIR}/exports/dino.vapi ${CMAKE_BINARY_DIR}/exports/dino.deps DESTINATION ${VAPI_INSTALL_DIR})
+install(FILES ${CMAKE_BINARY_DIR}/exports/dino.h DESTINATION ${INCLUDE_INSTALL_DIR})
+install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/data/dino.gschema.xml DESTINATION ${SHARE_INSTALL_PREFIX}/glib-2.0/schemas/) \ No newline at end of file
diff --git a/libdino/src/plugin/loader.vala b/libdino/src/plugin/loader.vala
index 42d7fa9b..8c633ef1 100644
--- a/libdino/src/plugin/loader.vala
+++ b/libdino/src/plugin/loader.vala
@@ -20,18 +20,30 @@ public class Loader : Object {
public Loader(string? exec_str = null) {
search_paths += Application.get_storage_dir();
- if (exec_str != null) {
- string exec_path = exec_str;
+ string? exec_path = exec_str;
+ if (exec_path != null) {
if (!exec_path.contains(Path.DIR_SEPARATOR_S)) {
exec_path = Environment.find_program_in_path(exec_str);
}
- if (exec_path[0:5] != "/usr") {
+ // TODO: more robust is detection if installed
+ if (!exec_path.has_prefix("/usr/")) {
search_paths += Path.get_dirname(exec_path);
}
}
foreach (string dir in Environment.get_system_data_dirs()) {
search_paths += Path.build_filename(dir, "dino");
}
+ if (exec_path != null) {
+ if (Path.get_basename(Path.get_dirname(exec_path)) == "bin") {
+ search_paths += Path.build_filename(Path.get_dirname(Path.get_dirname(exec_path)), "share", "dino");
+ }
+ }
+ }
+
+ public void print_search_paths() {
+ foreach (string prefix in search_paths) {
+ print(@"$prefix/plugins\n");
+ }
}
public RootInterface load(string name, Dino.Application app) throws Error {
diff --git a/libdino/src/settings.vala b/libdino/src/settings.vala
index 17177232..3700583b 100644
--- a/libdino/src/settings.vala
+++ b/libdino/src/settings.vala
@@ -20,7 +20,7 @@ public class Settings {
public static Settings instance() {
SettingsSchemaSource sss = SettingsSchemaSource.get_default();
- SettingsSchema schema = sss.lookup("org.dino-im", false);
+ SettingsSchema? schema = sss.lookup("org.dino-im", true);
return new Settings(new GLib.Settings.full(schema, null, null));
}
}