In 70360cb11, the ASM variable was moved to the x86-common file
even though the android build file didn't include neither
platform-arch.mk nor platform-x86-common.mk.
Instead of explicitly declaring ASM here, include platform-arch.mk
and remove setting of the flags that platform-arch.mk sets.
This is inspired by and based on a patch by Licai Guo.
This will make the normal C++ code not run on non-NEON devices at
all, making the runtime CPU feature detection pointless.
Adding -mfpu=neon to CFLAGS is not necessary, it's enough to
add it while building those individual .S files (via ASMFLAGS).
This doesn't build the actual demo apps that you can run on the
phone (not yet at least), but is useful for easily testing compilation
in different setups, and for building a precompiled static library for
use in external projects.
The USE_ASM variable is architecture independent now and only
controls whether assembly optimizations should be enabled in
the general sense, regardless of the target architecture.
This avoids coupling the architecture directly to the platform,
allowing building on e.g. linux on architectures other than x86,
without having to explicitly specify USE_ASM=No while building
on those.
Later this will also facilitate enabling assembly optimizations
where applicable, e.g. arm assembly on linux.
This allows building (and running) codec_unittest for android.
This explicitly needs to go at the end of the LDFLAGS, since both
this and -lgtest etc. are static libraries, and code in gtest
relies on the STL. Since this explicitly needs to be at the end,
a separate makefile variable is added for it.
This fixes building of gtest on msvc.
See e.g. http://stackoverflow.com/questions/8274588 for
more discussion on the matter.
This is only required on MSVC 2012 - gtest itself (in the cmake
files) adds -D_VARIADIC_MAX=10 to the build when building using
MSVC 2012, but we don't know the MSVC version at the make stage
here. Since the gtest tuple support isn't used at all, it's
simpler to just disable it altogether than to try to add
-D_VARIADIC_MAX=10.
The main purpose is to make sure that the build doesn't fail
if the build directory contains the gtest subdirectory, although
the unittests also could be run on a device.
One doesn't need to run the ndk-build command from within the
jni subdirectory, calling it from the project top level directory
works just as well.
Also remove an unnecessary step of cd ../../../.. at the end -
since all make commands are run in a subshell, we don't need to
restore the current working directory afterwards.
MSVC doesn't export any functions at all by default, contrary to
gcc which exports all global functions by default.
Doing the same for linux/OS X isn't too hard, but they use yet
two other, different syntaxes for the corresponding symbol file.
This is enabled for platforms/compilers that support the -MMD
option, which creates a dependency file named out.d when compiling
to a file named out.o, only including local, not system headers.
The additional -MP option adds phony targets for all included
headers, to avoid having make error out due to "no rule to make
target foo.h" if a header is renamed/removed.
This makes sure that all the right files are rebuilt if a header
is changed, avoiding the need for a full rebuild if only a few
files are affected.