[Development] QMAKE_EXTRA_COMPILERS does not work on Android in case the ANDROID_PACKAGE_SOURCE_DIR is empty

Denis Shienkov denis.shienkov at gmail.com
Fri Jan 12 16:22:56 CET 2018


Hi all.

I need to use a custom target to build of external shared library *.so,
with a custom build system (e.g. using the NDK directly) and to link with.

I faced with a strange behavior of QMAKE_EXTRA_COMPILERS on Android,
which is that the qmake does not creates a "compiler_foo_" target in
the output Makefile for my target if the ANDROID_PACKAGE_SOURCE_DIR is
not set. So, the desired build step does not called at all. O_O

E.g. I have following rules in the *.pro file:

  ...
  android {

      foo.name = Foo compiler
      foo.input = FOO
      foo.output = FOO_PATH

      # Build command.
      foo.commands = (custom build command)

      # Custom additional cleanup targets.
      foo.clean += (custom cleanup command)

      foo.CONFIG += target_predeps

      QMAKE_EXTRA_COMPILERS += foo

      # Add the generated library into the resulting apk.
      ANDROID_EXTRA_LIBS = $$GST_MODULE_PATH

  }
  ...

In this case I see in Makefile following:

  ...
  compiler_foo_make_all:
  compiler_foo_clean:
     (set of custom cleanup commands)
  ...

But, if I try to add any not empty ANDROID_PACKAGE_SOURCE_DIR
to the *.pro file:

  ...
  android {
      ANDROID_PACKAGE_SOURCE_DIR = <any value>

      ....
      ....
  }
  ...

then the resulting Makefile contains all what need:

  ...
  OBJECTS       = <FOO_PATH> ...
  ...
  compiler_gst_make_all: <FOO_PATH>
  compiler_gst_clean:
      (set of custom cleanup commands)
  ...
  <FOO_PATH>: foo
      (set of custom build commands)
  ...

How can I fix it? Because in a real project I will to use
the QMAKE_EXTRA_COMPILERS in a 'static library' template project,
which does not contains any Android's java sources and so on.

BR,
Denis



More information about the Development mailing list