Compiler options in .bp files.

30 views
Skip to first unread message

Vasile Robert

unread,
Nov 15, 2019, 10:01:11 AM11/15/19
to Android Building
Hello, everyone.
I'm trying to convert a makefile to a .bp file for Android Q and i'm facing some issues.

1) I'm not sure how to define a release version.
Previosly in makefile i would just write something along the lines of:

MY_RELEASE_VERSION := $(shell cd $(LOCAL_PATH); git describe --always --dirty)
DSW_VERSION= \"$(MY_RELEASE_VERSION)\" , which would be defined as a string like for example.  DSW_VERSION="project_specific_3_0"

Now i am able to use a cppflag in .bp with the DSW_VERSION , but i found no way to make the value of it to be taken like in the makefile.
Something like:
MY_RELEASE_VERSION = ["__builtin_func:shell cd <'LOCAL_PATH' unset>; git describe --always --dirty"]
CPPFLAGS = [
 "DSW_VERSION = "\"MY_RELEASE_VERSION"\",
]
Does not work.


Secondly i'm facing issues in defining a config variant, which in turn would devine a variable from the source code.
Something like this in .mk files:
LOCAL_CPPFLAGS +=$(TARGET_CONFIG)
With a ifdefine in the code that looks like this:
#if defined (TARGET_ONE)
    static const VAR   = 1;
#elif defined (TARGET_TWO)
    static const VAR     = 2; 

i tried in .bp appendind to the cppflags, something like : cppflags: MY_CPPFLAGS + TARGET_CONFIG, where MY_CPPFLAGS is a variable defined with all the flags needed.


Anyone can help me with those?
Reply all
Reply to author
Forward
0 new messages