I’m using KiCad 5.1.5 on Debian 10.3. The propposed patch in:
Isn’t enough for me. I proppose the following patch:
--- a/kicad/lib-render.c
+++ b/kicad/lib-render.c
@@ -716,6 +716,9 @@
const struct comp *comp;
const struct comp_alias *alias;
+ char *lib_sep = strchr(name, ':');
+ if (lib_sep) *lib_sep ='_';
+
for (comp = lib->comps; comp; comp = comp->next) {
if (!strcmp(comp->name, name))
return comp;
--- a/kicad/pro.c
+++ b/kicad/pro.c
@@ -50,6 +50,19 @@
}
}
+static void add_lib(struct file_names *fn, char *s)
+{
+ char *dot;
+
+ fn->n_libs++;
+ fn->libs = realloc_type_n(fn->libs, const char *, fn->n_libs);
+ dot = strrchr(s, '.');
+ if (!dot || strcmp(dot, ".lib")) {
+ s = realloc_size(s, strlen(s) + 5);
+ strcat(s, ".lib");
+ }
+ fn->libs[fn->n_libs - 1] = s;
+}
static bool pro_parse_line(const struct file *file,
void *user, const char *line)
@@ -79,18 +92,7 @@
break;
case pro_libs:
if (sscanf(line, "LibName%*u=%ms", &s) == 1) {
- char *dot;
-
- pro->fn->n_libs++;
- pro->fn->libs = realloc_type_n(pro->fn->libs,
- const char *, pro->fn->n_libs);
- dot = strrchr(s, '.');
- if (!dot || strcmp(dot, ".lib")) {
- s = realloc_size(s, strlen(s) + 5);
- strcat(s, ".lib");
- }
- pro->fn->libs[pro->fn->n_libs - 1] = s;
- error(" adding lib: %s",s);
+ add_lib(pro->fn, s);
return 1;
}
break;
@@ -129,6 +131,20 @@
return NULL;
}
+ // Add the project cache
+ assert(pro.fn->pro);
+ {
+ char *s, *dot;
+ int l = strlen(pro.fn->pro);
+
+ s = (char *)malloc(l + 10 + 1);
+ memcpy(s, pro.fn->pro, l + 1);
+ dot = strrchr(s, '.');
+ assert(!strcmp(dot, ".pro"));
+ strcpy(dot, "-cache.lib");
+ add_lib(pro.fn, s);
+ }
+
if (!pro.fn->sch) {
char *s, *dot;
This patch does two things:
- It forces the load of the project cache (in order to get all the eeshow functionality you must include the cache in the git repo)
- It converts modern KiCad component names from LIBRARY:COMPONENT to the format used by the cache: LIBRARY_COMPONENT
With this patch you don’t need to:
- Specify extra libraries in the command line
- Edit the project to add the used libraries
As long as the cache file is updated you’ll get all the components.