forked from external/yambar
allow plugins to be compiled into the f00bar main binary
This commit is contained in:
parent
00679dbeeb
commit
0d591fe5a1
25 changed files with 400 additions and 72 deletions
|
@ -4,8 +4,16 @@ add_library(particle-sdk INTERFACE)
|
|||
target_compile_options(particle-sdk INTERFACE ${CAIRO_CFLAGS_OTHER})
|
||||
target_include_directories(particle-sdk INTERFACE ${CAIRO_INCLUDE_DIRS})
|
||||
|
||||
if (CORE_PLUGINS_AS_SHARED_LIBRARIES)
|
||||
set(lib_type MODULE)
|
||||
set(dynlist_lib_type SHARED)
|
||||
else ()
|
||||
set(lib_type STATIC)
|
||||
set(dynlist_lib_type STATIC)
|
||||
endif ()
|
||||
|
||||
# Only an exposable, not a particle. Used by a couple of modules
|
||||
add_library(dynlist SHARED dynlist.c dynlist.h)
|
||||
add_library(dynlist ${dynlist_lib_type} dynlist.c dynlist.h)
|
||||
target_link_libraries(dynlist PRIVATE particle-sdk)
|
||||
|
||||
set(CMAKE_SHARED_MODULE_PREFIX particle_)
|
||||
|
@ -13,10 +21,12 @@ set(CMAKE_SHARED_MODULE_PREFIX particle_)
|
|||
set(particles empty list map progress-bar ramp string)
|
||||
|
||||
foreach (particle ${particles})
|
||||
add_library(${particle} MODULE ${particle}.c)
|
||||
add_library(${particle} ${lib_type} ${particle}.c)
|
||||
target_link_libraries(${particle} particle-sdk)
|
||||
endforeach ()
|
||||
|
||||
target_link_libraries(string ${CAIRO_LIBRARIES})
|
||||
|
||||
install(TARGETS ${particles} dynlist DESTINATION lib/f00bar)
|
||||
if (CORE_PLUGINS_AS_SHARED_LIBRARIES)
|
||||
install(TARGETS ${particles} dynlist DESTINATION lib/f00bar)
|
||||
endif ()
|
||||
|
|
|
@ -40,13 +40,13 @@ empty_new(struct particle *common)
|
|||
}
|
||||
|
||||
struct particle *
|
||||
from_conf(const struct yml_node *node, struct particle *common)
|
||||
empty_from_conf(const struct yml_node *node, struct particle *common)
|
||||
{
|
||||
return empty_new(common);
|
||||
}
|
||||
|
||||
bool
|
||||
verify_conf(keychain_t *chain, const struct yml_node *node)
|
||||
empty_verify_conf(keychain_t *chain, const struct yml_node *node)
|
||||
{
|
||||
static const struct attr_info attrs[] = {
|
||||
PARTICLE_COMMON_ATTRS,
|
||||
|
@ -54,3 +54,12 @@ verify_conf(keychain_t *chain, const struct yml_node *node)
|
|||
|
||||
return conf_verify_dict(chain, node, attrs);
|
||||
}
|
||||
|
||||
#if defined(CORE_PLUGINS_AS_SHARED_LIBRARIES)
|
||||
|
||||
bool verify_conf(keychain_t *chain, const struct yml_node *node)
|
||||
__attribute__((weak, alias("empty_verify_conf")));
|
||||
struct deco *from_conf(const struct yml_node *node, struct particle *common)
|
||||
__attribute__((weak, alias("empty_from_conf")));
|
||||
|
||||
#endif
|
||||
|
|
|
@ -164,7 +164,7 @@ particle_list_new(struct particle *common,
|
|||
}
|
||||
|
||||
struct particle *
|
||||
from_conf(const struct yml_node *node, struct particle *common)
|
||||
list_from_conf(const struct yml_node *node, struct particle *common)
|
||||
{
|
||||
const struct yml_node *items = yml_get_value(node, "items");
|
||||
const struct yml_node *spacing = yml_get_value(node, "spacing");
|
||||
|
@ -192,7 +192,7 @@ from_conf(const struct yml_node *node, struct particle *common)
|
|||
}
|
||||
|
||||
bool
|
||||
verify_conf(keychain_t *chain, const struct yml_node *node)
|
||||
list_verify_conf(keychain_t *chain, const struct yml_node *node)
|
||||
{
|
||||
static const struct attr_info attrs[] = {
|
||||
{"items", true, &conf_verify_particle_list_items},
|
||||
|
@ -204,3 +204,12 @@ verify_conf(keychain_t *chain, const struct yml_node *node)
|
|||
|
||||
return conf_verify_dict(chain, node, attrs);
|
||||
}
|
||||
|
||||
#if defined(CORE_PLUGINS_AS_SHARED_LIBRARIES)
|
||||
|
||||
bool verify_conf(keychain_t *chain, const struct yml_node *node)
|
||||
__attribute__((weak, alias("list_verify_conf")));
|
||||
struct deco *from_conf(const struct yml_node *node, struct particle *common)
|
||||
__attribute__((weak, alias("list_from_conf")));
|
||||
|
||||
#endif
|
||||
|
|
|
@ -197,7 +197,7 @@ verify_map_values(keychain_t *chain, const struct yml_node *node)
|
|||
}
|
||||
|
||||
struct particle *
|
||||
from_conf(const struct yml_node *node, struct particle *common)
|
||||
map_from_conf(const struct yml_node *node, struct particle *common)
|
||||
{
|
||||
const struct yml_node *tag = yml_get_value(node, "tag");
|
||||
const struct yml_node *values = yml_get_value(node, "values");
|
||||
|
@ -228,7 +228,7 @@ from_conf(const struct yml_node *node, struct particle *common)
|
|||
}
|
||||
|
||||
bool
|
||||
verify_conf(keychain_t *chain, const struct yml_node *node)
|
||||
map_verify_conf(keychain_t *chain, const struct yml_node *node)
|
||||
{
|
||||
static const struct attr_info attrs[] = {
|
||||
{"tag", true, &conf_verify_string},
|
||||
|
@ -239,3 +239,12 @@ verify_conf(keychain_t *chain, const struct yml_node *node)
|
|||
|
||||
return conf_verify_dict(chain, node, attrs);
|
||||
}
|
||||
|
||||
#if defined(CORE_PLUGINS_AS_SHARED_LIBRARIES)
|
||||
|
||||
bool verify_conf(keychain_t *chain, const struct yml_node *node)
|
||||
__attribute__((weak, alias("map_verify_conf")));
|
||||
struct deco *from_conf(const struct yml_node *node, struct particle *common)
|
||||
__attribute__((weak, alias("map_from_conf")));
|
||||
|
||||
#endif
|
||||
|
|
|
@ -229,7 +229,7 @@ progress_bar_new(struct particle *common, const char *tag, int width,
|
|||
}
|
||||
|
||||
struct particle *
|
||||
from_conf(const struct yml_node *node, struct particle *common)
|
||||
progress_bar_from_conf(const struct yml_node *node, struct particle *common)
|
||||
{
|
||||
const struct yml_node *tag = yml_get_value(node, "tag");
|
||||
const struct yml_node *length = yml_get_value(node, "length");
|
||||
|
@ -256,7 +256,7 @@ from_conf(const struct yml_node *node, struct particle *common)
|
|||
}
|
||||
|
||||
bool
|
||||
verify_conf(keychain_t *chain, const struct yml_node *node)
|
||||
progress_bar_verify_conf(keychain_t *chain, const struct yml_node *node)
|
||||
{
|
||||
static const struct attr_info attrs[] = {
|
||||
{"tag", true, &conf_verify_string},
|
||||
|
@ -272,3 +272,12 @@ verify_conf(keychain_t *chain, const struct yml_node *node)
|
|||
|
||||
return conf_verify_dict(chain, node, attrs);
|
||||
}
|
||||
|
||||
#if defined(CORE_PLUGINS_AS_SHARED_LIBRARIES)
|
||||
|
||||
bool verify_conf(keychain_t *chain, const struct yml_node *node)
|
||||
__attribute__((weak, alias("progress_bar_verify_conf")));
|
||||
struct deco *from_conf(const struct yml_node *node, struct particle *common)
|
||||
__attribute__((weak, alias("progress_bar_from_conf")));
|
||||
|
||||
#endif
|
||||
|
|
|
@ -154,7 +154,7 @@ ramp_new(struct particle *common, const char *tag,
|
|||
}
|
||||
|
||||
struct particle *
|
||||
from_conf(const struct yml_node *node, struct particle *common)
|
||||
ramp_from_conf(const struct yml_node *node, struct particle *common)
|
||||
{
|
||||
const struct yml_node *tag = yml_get_value(node, "tag");
|
||||
const struct yml_node *items = yml_get_value(node, "items");
|
||||
|
@ -175,7 +175,7 @@ from_conf(const struct yml_node *node, struct particle *common)
|
|||
}
|
||||
|
||||
bool
|
||||
verify_conf(keychain_t *chain, const struct yml_node *node)
|
||||
ramp_verify_conf(keychain_t *chain, const struct yml_node *node)
|
||||
{
|
||||
static const struct attr_info attrs[] = {
|
||||
{"tag", true, &conf_verify_string},
|
||||
|
@ -185,3 +185,12 @@ verify_conf(keychain_t *chain, const struct yml_node *node)
|
|||
|
||||
return conf_verify_dict(chain, node, attrs);
|
||||
}
|
||||
|
||||
#if defined(CORE_PLUGINS_AS_SHARED_LIBRARIES)
|
||||
|
||||
bool verify_conf(keychain_t *chain, const struct yml_node *node)
|
||||
__attribute__((weak, alias("ramp_verify_conf")));
|
||||
struct deco *from_conf(const struct yml_node *node, struct particle *common)
|
||||
__attribute__((weak, alias("ramp_from_conf")));
|
||||
|
||||
#endif
|
||||
|
|
|
@ -135,7 +135,7 @@ string_new(struct particle *common, const char *text, size_t max_len)
|
|||
}
|
||||
|
||||
struct particle *
|
||||
from_conf(const struct yml_node *node, struct particle *common)
|
||||
string_from_conf(const struct yml_node *node, struct particle *common)
|
||||
{
|
||||
const struct yml_node *text = yml_get_value(node, "text");
|
||||
const struct yml_node *max = yml_get_value(node, "max");
|
||||
|
@ -147,7 +147,7 @@ from_conf(const struct yml_node *node, struct particle *common)
|
|||
}
|
||||
|
||||
bool
|
||||
verify_conf(keychain_t *chain, const struct yml_node *node)
|
||||
string_verify_conf(keychain_t *chain, const struct yml_node *node)
|
||||
{
|
||||
static const struct attr_info attrs[] = {
|
||||
{"text", true, &conf_verify_string},
|
||||
|
@ -157,3 +157,12 @@ verify_conf(keychain_t *chain, const struct yml_node *node)
|
|||
|
||||
return conf_verify_dict(chain, node, attrs);
|
||||
}
|
||||
|
||||
#if defined(CORE_PLUGINS_AS_SHARED_LIBRARIES)
|
||||
|
||||
bool verify_conf(keychain_t *chain, const struct yml_node *node)
|
||||
__attribute__((weak, alias("string_verify_conf")));
|
||||
struct deco *from_conf(const struct yml_node *node, struct particle *common)
|
||||
__attribute__((weak, alias("string_from_conf")));
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue