mirror of
https://github.com/Lurkki14/tuxclocker.git
synced 2025-02-25 18:55:24 -06:00
Add compile time definition for module path and remove rpath
This commit is contained in:
parent
2e113fcfaf
commit
a4cebd6b37
@ -9,6 +9,8 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Provide default
|
||||||
|
|
||||||
// Categories for modules.
|
// Categories for modules.
|
||||||
enum tc_module_category {
|
enum tc_module_category {
|
||||||
TC_CATEGORY_ASSIGNABLE,
|
TC_CATEGORY_ASSIGNABLE,
|
||||||
@ -16,9 +18,10 @@ enum tc_module_category {
|
|||||||
TC_CATEGORY_INTERFACE
|
TC_CATEGORY_INTERFACE
|
||||||
};
|
};
|
||||||
|
|
||||||
// REPLACE THIS WITH SOMETHING MORE ROBUST
|
// Default module path in case not defined
|
||||||
// Default path for modules
|
#ifndef TC_MODULE_PATH
|
||||||
#define TC_MODULE_PATH "/usr/lib/tuxclocker"
|
#define TC_MODULE_PATH "/usr/lib/tuxclocker/modules"
|
||||||
|
#endif
|
||||||
|
|
||||||
// Env variable name to load modules from in addition
|
// Env variable name to load modules from in addition
|
||||||
#define TC_MODULE_PATH_ENV "TC_MODULE_PATH"
|
#define TC_MODULE_PATH_ENV "TC_MODULE_PATH"
|
||||||
|
@ -9,18 +9,22 @@ tc_module_t *tc_module_find(enum tc_module_category category, const char *name)
|
|||||||
char mod_abs_path[128];
|
char mod_abs_path[128];
|
||||||
|
|
||||||
// Find the folder where the module should reside
|
// Find the folder where the module should reside
|
||||||
|
// TC_MODULE_PATH should be defined as an absolute path
|
||||||
switch (category) {
|
switch (category) {
|
||||||
case TC_CATEGORY_ASSIGNABLE:
|
case TC_CATEGORY_ASSIGNABLE:
|
||||||
snprintf(mod_abs_path, 128, "%s/%s", "assignable", name);
|
snprintf(mod_abs_path, 128, "%s/%s/%s", TC_MODULE_PATH, "assignable", name);
|
||||||
break;
|
break;
|
||||||
case TC_CATEGORY_INTERFACE:
|
case TC_CATEGORY_INTERFACE:
|
||||||
snprintf(mod_abs_path, 128, "%s/%s", "interface", name);
|
snprintf(mod_abs_path, 128, "%s/%s/%s", TC_MODULE_PATH, "interface", name);
|
||||||
|
// snprintf(mod_abs_path, 128, "/usr/lib/tuxclocker/modules/interface/%s", name);
|
||||||
|
//snprintf(mod_abs_path, 128, "%s", name);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
void *handle = tc_dlopen(mod_abs_path);
|
void *handle = tc_dlopen(mod_abs_path);
|
||||||
if (handle == NULL) {
|
if (handle == NULL) {
|
||||||
|
printf("%s\n", tc_dlerror());
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -30,5 +34,7 @@ tc_module_t *tc_module_find(enum tc_module_category category, const char *name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
tc_module_t **tc_module_find_all_from_category(enum tc_module_category category, uint16_t *count) {
|
tc_module_t **tc_module_find_all_from_category(enum tc_module_category category, uint16_t *count) {
|
||||||
|
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
posix_bin = executable('tuxclocker',
|
posix_bin = executable('tuxclocker',
|
||||||
'tuxclocker.c',
|
'tuxclocker.c',
|
||||||
include_directories : incdir,
|
include_directories : incdir,
|
||||||
link_with : libtuxclocker)
|
link_with : libtuxclocker,
|
||||||
|
install : true)
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
// Load an interface here
|
// Load an interface here
|
||||||
tc_module_t *mod = tc_module_find(TC_CATEGORY_INTERFACE, "/qt/libqt.so");
|
tc_module_t *mod = tc_module_find(TC_CATEGORY_INTERFACE, "libqt.so");
|
||||||
|
|
||||||
if (mod != NULL) {
|
if (mod != NULL) {
|
||||||
printf("successful load for %s\n", mod->name);
|
printf("successful load for %s\n", mod->name);
|
||||||
|
@ -4,9 +4,9 @@ libtuxclocker_posix_sources = ['lib/posix/module.c']
|
|||||||
|
|
||||||
libtuxclocker_posix_libs = [cc.find_library('dl')]
|
libtuxclocker_posix_libs = [cc.find_library('dl')]
|
||||||
|
|
||||||
# Posix library uses runpath for specifying module directory root
|
# Compile time definition for module path
|
||||||
|
module_path_def_template = '-DTC_MODULE_PATH="@0@/@1@/tuxclocker/modules"'
|
||||||
posix_rpath = get_option('libdir' ) + '/tuxclocker/modules'
|
module_path_def = module_path_def_template.format(get_option('prefix'), get_option('libdir'))
|
||||||
|
|
||||||
libtuxclocker = shared_library('libtuxclocker',
|
libtuxclocker = shared_library('libtuxclocker',
|
||||||
['lib/tc_assignable.c',
|
['lib/tc_assignable.c',
|
||||||
@ -14,8 +14,8 @@ libtuxclocker = shared_library('libtuxclocker',
|
|||||||
libtuxclocker_posix_sources],
|
libtuxclocker_posix_sources],
|
||||||
include_directories : incdir,
|
include_directories : incdir,
|
||||||
dependencies : libtuxclocker_posix_libs,
|
dependencies : libtuxclocker_posix_libs,
|
||||||
install_rpath : posix_rpath,
|
c_args : module_path_def,
|
||||||
link_args : '-Wl,--enable-new-dtags')
|
install : true)
|
||||||
|
|
||||||
subdir('modules')
|
subdir('modules')
|
||||||
subdir('main')
|
subdir('main')
|
||||||
|
@ -19,4 +19,6 @@ shared_library('qt',
|
|||||||
moc_files,
|
moc_files,
|
||||||
include_directories : [incdir, local_qt_incdirs],
|
include_directories : [incdir, local_qt_incdirs],
|
||||||
dependencies : qt5_dep,
|
dependencies : qt5_dep,
|
||||||
link_with : libtuxclocker)
|
link_with : libtuxclocker,
|
||||||
|
install_dir : get_option('libdir') / 'tuxclocker' / 'modules' / 'interface',
|
||||||
|
install : true)
|
||||||
|
@ -11,7 +11,7 @@ AssignableWidget::AssignableWidget(QWidget *parent) : QWidget(parent) {
|
|||||||
m_mainLayout->addWidget(m_splitter);
|
m_mainLayout->addWidget(m_splitter);
|
||||||
|
|
||||||
m_assignableTreeView = new QTreeView;
|
m_assignableTreeView = new QTreeView;
|
||||||
genAssignableTree(m_assignableTreeView);
|
//genAssignableTree(m_assignableTreeView);
|
||||||
m_splitter->addWidget(m_assignableTreeView);
|
m_splitter->addWidget(m_assignableTreeView);
|
||||||
|
|
||||||
m_assignableEditor = new AssignableEditor;
|
m_assignableEditor = new AssignableEditor;
|
||||||
|
Loading…
Reference in New Issue
Block a user