kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #38726
Re: grammar.c not found,
Hi,
It seems "make clean" might be the trigger here. The target for the
libeval grammar is done with CMake add_custom_command with an OUTPUT.
This means the output file will be cleaned on "make clean", but as the
grammar.c is not then regenerated by default, it will be missing until
checked out from Git.
Here's a patch to use add_custom_target instead. Any CMake wizards are
invited to criticise if I have misunderstood. At least from my tests,
"make clean" no longer removes grammar.c and the target can still be
used to (re)generate it.
Here's a bug report so we can tie back with the Fixes: line and find
this issue in future: https://bugs.launchpad.net/kicad/+bug/1809610
Cheers,
John
On Sun, Dec 23, 2018 at 1:27 AM Nick Østergaard <oe.nick@xxxxxxxxx> wrote:
>
> Hi Lachlan,
>
> Are you sure that your workspace is clean? I don't see any issues on
> any platform.
>
> Nick
>
> On Sat, 22 Dec 2018 at 06:53, Lachlan Audas <laudas1@xxxxxxxxx> wrote:
> >
> > Hi, just pull the lest-est developer build from git-hub for KiCad
> > and tried compiling it. But but get this Error, missing file "grammar.c"
> > >kicad-source-mirror/common/libeval/numeric_evaluator.cpp:36:21: fatal error: grammar.c: No such file or directory
> > #include "grammar.c"
> >
> > the 5.0.2 version has the file, but not the developers version
> > Any one else seen this ?
> >
> > Lachlan
> >
> > _______________________________________________
> > Mailing list: https://launchpad.net/~kicad-developers
> > Post to : kicad-developers@xxxxxxxxxxxxxxxxxxx
> > Unsubscribe : https://launchpad.net/~kicad-developers
> > More help : https://help.launchpad.net/ListHelp
>
> _______________________________________________
> Mailing list: https://launchpad.net/~kicad-developers
> Post to : kicad-developers@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help : https://help.launchpad.net/ListHelp
From 3ef61c3bcfa54163d311ab61bc217ae90b84fd0d Mon Sep 17 00:00:00 2001
From: John Beard <john.j.beard@xxxxxxxxx>
Date: Sun, 23 Dec 2018 21:18:15 +0000
Subject: [PATCH] Libeval: Use add_custom_target so grammar.c won't be cleaned
If you use add_custom_command to generate the grammar file,
it can be removed by "make clean". This then means the user will
need to get it back from Git, or regenerate it with Lemon.
Changing to add_custom_command removes the output file
from the clean list. The incantation to rebuild the grammar
remains the same: "make libeval_grammar", and it is still not
required to have lemon installed for a normal build.
Fixes: lp:1809610
* https://bugs.launchpad.net/kicad/+bug/1809610
---
common/libeval/CMakeLists.txt | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/common/libeval/CMakeLists.txt b/common/libeval/CMakeLists.txt
index 44ec1fbd2..359c978c6 100644
--- a/common/libeval/CMakeLists.txt
+++ b/common/libeval/CMakeLists.txt
@@ -24,20 +24,15 @@ find_program(LEMON lemon)
if( LEMON )
- macro( generate_lemon_grammar GRAMMAR_LEMON GRAMMAR_C )
- add_custom_command(
+ macro( generate_lemon_grammar TGT_NAME GRAMMAR_LEMON GRAMMAR_C )
+ add_custom_target( ${TGT_NAME}
DEPENDS ${GRAMMAR_LEMON}
- OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/${GRAMMAR_C}
COMMAND ${LEMON} -q ${GRAMMAR_LEMON}
COMMENT "Running Lemon on ${GRAMMAR_LEMON} -> ${GRAMMAR_C}"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
endmacro()
- generate_lemon_grammar( grammar.lemon grammar.c )
-
- add_custom_target(libeval_grammar
- DEPENDS grammar.c
- )
+ generate_lemon_grammar( libeval_grammar grammar.lemon grammar.c )
endif()
\ No newline at end of file
--
2.19.2
Follow ups
References