All of lore.kernel.org
 help / color / mirror / Atom feed
* how to load cmake args from git?
@ 2017-06-22  8:42 Adam Trhon
  2017-06-22 21:51 ` Burton, Ross
  0 siblings, 1 reply; 6+ messages in thread
From: Adam Trhon @ 2017-06-22  8:42 UTC (permalink / raw)
  To: Openembedded Core

I have a recipe that is configured by cmake. The cmake arguments are hardcoded
in the recipe and set using the EXTRA_OECMAKE variable. For various reasons, I
would like to have the arguments in a file in the project's upstream repository 
(it's mine as well) and load them.

I came up with this:

do_configure_prepend() {
    PACKAGECONFIG_CONFARGS =" ${PACKAGECONFIG_CONFARGS} $(cat ${S}/oe_arguments.txt) "
}

but I am not very happy about using PACKAGECONFIG_CONFARGS - it feels hacky, the
arguments are not shown in cmake fail log and it cannot handle argumetns containing
spaces. Is there a cleaner way to achieve this?

Thank you
Adam

-- 
Ing. Adam Trhoň, Software Engineer
Touchless Biometric Systems s.r.o. | 
Palackého třída 180/44 | 61200 Brno | CZECH REPUBLIC | 
Mobile: +42(0) 721 565 113 | tbs-biometrics.cz


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: how to load cmake args from git?
  2017-06-22  8:42 how to load cmake args from git? Adam Trhon
@ 2017-06-22 21:51 ` Burton, Ross
  2017-06-23 10:57   ` Adam Trhon
  0 siblings, 1 reply; 6+ messages in thread
From: Burton, Ross @ 2017-06-22 21:51 UTC (permalink / raw)
  To: Adam Trhon; +Cc: Openembedded Core

[-- Attachment #1: Type: text/plain, Size: 773 bytes --]

On 22 June 2017 at 09:42, Adam Trhon <adam.trhon@tbs-biometrics.com> wrote:

> but I am not very happy about using PACKAGECONFIG_CONFARGS - it feels
> hacky, the
> arguments are not shown in cmake fail log and it cannot handle argumetns
> containing
> spaces. Is there a cleaner way to achieve this?
>

Definitely don't use PACKAGECONFIG_CONFARGS: that has a well defined
meaning and use, and that isn't it.

I don't see why as you control the repository why can't you just set the
arguments in cmakelists, or the recipe itself?  Either they're useful
everywhere (cmakelists) or in OE builds (recipe).

Anyway, you could do something like this:

python() {
  d.appendVar("EXTRA_OECMAKE", " " +
open(d.expand("${S}/oe_arguments.txt")).read()
}

Ross

[-- Attachment #2: Type: text/html, Size: 1479 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: how to load cmake args from git?
  2017-06-22 21:51 ` Burton, Ross
@ 2017-06-23 10:57   ` Adam Trhon
  2017-06-23 12:53     ` Burton, Ross
  0 siblings, 1 reply; 6+ messages in thread
From: Adam Trhon @ 2017-06-23 10:57 UTC (permalink / raw)
  To: Burton, Ross; +Cc: Openembedded Core


On Thu, 22 Jun 2017 22:51:26 +0100
"Burton, Ross" <ross.burton@intel.com> wrote:

> On 22 June 2017 at 09:42, Adam Trhon <adam.trhon@tbs-biometrics.com> wrote:
> 
> > but I am not very happy about using PACKAGECONFIG_CONFARGS - it feels
> > hacky, the
> > arguments are not shown in cmake fail log and it cannot handle argumetns
> > containing
> > spaces. Is there a cleaner way to achieve this?
> >  
> 
> Definitely don't use PACKAGECONFIG_CONFARGS: that has a well defined
> meaning and use, and that isn't it.
> 
> I don't see why as you control the repository why can't you just set the
> arguments in cmakelists, or the recipe itself?  Either they're useful
> everywhere (cmakelists) or in OE builds (recipe).

The CMake options are maintained and used by upstream project developers
(I am one of them). Sometimes they change the options between
revisions, so it is difficult to maintain the argument list in the
recipe.

I also want to let the upstream project developers change some arguments
without touching the recipe (for automated builds).

> 
> Anyway, you could do something like this:
> 
> python() {
>   d.appendVar("EXTRA_OECMAKE", " " +
> open(d.expand("${S}/oe_arguments.txt")).read()
> }

According to documentation, this is expanded during recipe parsing. At
that time ${S}/oe_arguments.txt does not yet exits (it exists only after
do_unpack). I tried it and the build failed with python Exception:
FileNotFound. 

I tried

python do_setup_extra_oecmake() {                  
    d.appendVar("EXTRA_OECMAKE", " " + open(d.expand("${S}/oe_arguments.txt")).read())
    print("adding "+d.expand("${S}/oe_arguments.txt"))
}   
    
addtask do_setup_extra_oecmake after do_unpack before do_configure

but it did not work as well. The "adding.... " line is printed
correctly in log.do_setup_extra_oecmake, the file exists, but the
arguments in it are not used (I checked run.do_configure).

Thank you
Adam

> 
> Ross



-- 
Ing. Adam Trhoň, Software Engineer
Touchless Biometric Systems s.r.o. | 
Palackého třída 180/44 | 61200 Brno | CZECH REPUBLIC | 
Mobile: +42(0) 721 565 113 | tbs-biometrics.cz


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: how to load cmake args from git?
  2017-06-23 10:57   ` Adam Trhon
@ 2017-06-23 12:53     ` Burton, Ross
  2017-06-23 13:21       ` Adam Trhon
  0 siblings, 1 reply; 6+ messages in thread
From: Burton, Ross @ 2017-06-23 12:53 UTC (permalink / raw)
  To: Adam Trhon; +Cc: Openembedded Core

[-- Attachment #1: Type: text/plain, Size: 1000 bytes --]

On 23 June 2017 at 11:57, Adam Trhon <adam.trhon@tbs-biometrics.com> wrote:

> According to documentation, this is expanded during recipe parsing. At
> that time ${S}/oe_arguments.txt does not yet exits (it exists only after
> do_unpack). I tried it and the build failed with python Exception:
> FileNotFound.
>

Yes, good point. In m defence it was late. :)


> I tried
>
> python do_setup_extra_oecmake() {
>     d.appendVar("EXTRA_OECMAKE", " " + open(d.expand("${S}/oe_
> arguments.txt")).read())
>     print("adding "+d.expand("${S}/oe_arguments.txt"))
> }
>
> addtask do_setup_extra_oecmake after do_unpack before do_configure
>
> but it did not work as well. The "adding.... " line is printed
> correctly in log.do_setup_extra_oecmake, the file exists, but the
> arguments in it are not used (I checked run.do_configure).
>

Have a look at log.do_configure and verify what options are being passed.
I'm also assuming that you're using the cmake class here.

Ross

[-- Attachment #2: Type: text/html, Size: 1728 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: how to load cmake args from git?
  2017-06-23 12:53     ` Burton, Ross
@ 2017-06-23 13:21       ` Adam Trhon
  2017-07-05 13:59         ` Adam Trhon
  0 siblings, 1 reply; 6+ messages in thread
From: Adam Trhon @ 2017-06-23 13:21 UTC (permalink / raw)
  To: Burton, Ross; +Cc: Openembedded Core


On Fri, 23 Jun 2017 13:53:05 +0100
"Burton, Ross" <ross.burton@intel.com> wrote:

> On 23 June 2017 at 11:57, Adam Trhon <adam.trhon@tbs-biometrics.com> wrote:
> 
> > According to documentation, this is expanded during recipe parsing. At
> > that time ${S}/oe_arguments.txt does not yet exits (it exists only after
> > do_unpack). I tried it and the build failed with python Exception:
> > FileNotFound.
> >  
> 
> Yes, good point. In m defence it was late. :)
> 
> 
> > I tried
> >
> > python do_setup_extra_oecmake() {
> >     d.appendVar("EXTRA_OECMAKE", " " + open(d.expand("${S}/oe_
> > arguments.txt")).read())
> >     print("adding "+d.expand("${S}/oe_arguments.txt"))
> > }
> >
> > addtask do_setup_extra_oecmake after do_unpack before do_configure
> >
> > but it did not work as well. The "adding.... " line is printed
> > correctly in log.do_setup_extra_oecmake, the file exists, but the
> > arguments in it are not used (I checked run.do_configure).
> >  
> 
> Have a look at log.do_configure and verify what options are being passed.

I still have EXTRA_OECMAKE="..." in the recipe, the arguments from here
are being passed. But the arguments from oe_arguments.txt are not.

> I'm also assuming that you're using the cmake class here.

To be precise, I inherit cmake_qt5 class, which inherits cmake class.

Adam

> 
> Ross



-- 
Ing. Adam Trhoň, Software Engineer
Touchless Biometric Systems s.r.o. | 
Palackého třída 180/44 | 61200 Brno | CZECH REPUBLIC | 
Mobile: +42(0) 721 565 113 | tbs-biometrics.cz


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: how to load cmake args from git?
  2017-06-23 13:21       ` Adam Trhon
@ 2017-07-05 13:59         ` Adam Trhon
  0 siblings, 0 replies; 6+ messages in thread
From: Adam Trhon @ 2017-07-05 13:59 UTC (permalink / raw)
  To: Burton, Ross; +Cc: Openembedded Core


Finally we figured it out. When chaning EXTRA_OECMAKE with python
function, the function must not be registered like this:

addtask do_setup_extra_oecmake after do_patch before do_configure

but like this:

do_configure[prefuncs] += "do_setup_extra_oecmake"

I assume that as bitbake controls build task environment:

https://www.yoctoproject.org/docs/2.3/bitbake-user-manual/bitbake-user-manual.html#passing-information-into-the-build-task-environment

the changes of EXTRA_OECMAKE made in do_setup_extra_oecmake were not
propagated to do_configure.

Just for the completeness, how am I supposed to globally modify a
datastore variable from a python task?

Thank you
Adam


-- 
Ing. Adam Trhoň, Software Engineer
Touchless Biometric Systems s.r.o. | 
Palackého třída 180/44 | 61200 Brno | CZECH REPUBLIC | 
Mobile: +42(0) 721 565 113 | tbs-biometrics.cz


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-07-05 18:33 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-22  8:42 how to load cmake args from git? Adam Trhon
2017-06-22 21:51 ` Burton, Ross
2017-06-23 10:57   ` Adam Trhon
2017-06-23 12:53     ` Burton, Ross
2017-06-23 13:21       ` Adam Trhon
2017-07-05 13:59         ` Adam Trhon

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.