Commit graph

34 commits

Author SHA1 Message Date
Colin Cross
fce532760f Support subtracting sources from globs
Support -file or -path/glob in file lists that contain globs to
subtract files from the resulting glob.  Also move source file
prefixing and handling into a common function.

Change-Id: Ib6d74ce22f53cae7348c4ba35b779976d90359a6
2015-04-08 15:19:30 -07:00
Colin Cross
1332b0035c Move config into common and provide helper
Using ctx.Config().(Config) everywhere is a mouthful, and it is
inefficient to do the type assertion.  Put the Config interface into
the context, and provide an AConfig() to return the Config already
converted to the right type.

Change-Id: I301a1fd7d2a005580aabca7866a37c5d42ad8c69
2015-04-08 15:19:24 -07:00
Colin Cross
8df14ac3f0 Add rpath to host executables
Host executables need rpath set so they can find their shared
libraries.

Change-Id: I297682d3266bb436af0f594e8164ee4b9e7ab234
2015-04-08 15:17:45 -07:00
Colin Cross
581c189988 Add yacc and lex support
Add support for yacc (.y or .yy) and lex (.l or .ll) files.  Also
tweak locations of .o files for normal and generated sources to
makes sure they don't collide.

Change-Id: I03172cddbdc022525bf392a81d72050406b8cdb3
2015-04-08 15:17:45 -07:00
Colin Cross
7d21c4430d Use @files for ld and ar
ld and ar command lines often end up larger than ARG_MAX, use Ninja's
rsp file support to automatically write the object files to a temporary
file and pass it in using @file support.

This isn't going to work on Darwin host builds, where the host
toolchains don't support @.

Change-Id: Ida2f4e114ab02df6967e863577fa324e197827d5
2015-04-02 14:48:55 -07:00
Colin Cross
577f6e4baf Fix ndk and stl compiling
Move ndk linking against libc and libm out of system shared libraries
so that static libraries that link against the ndk can depend on
libc and libm, which is required to get the ndk sysroot include path.
Also make ndk stl versions only apply to the device variant of
multi-target builds.

Change-Id: I6926541da17b9baf3aa7f811a839c3b65c5d804d
2015-03-27 18:24:14 -07:00
Colin Cross
28d76590f1 Use ContainsProperty to support default values
Instead of setting a string property to magic default value and then
checking for it later, call ctx.ContainsProperty to determine if it
was set.  Use the same method on the clang bool property, which
couldn't be set to a magic value.

blueprint's ModuleContext.ContainsProperty only works on a single
property, not on all arch variant properties -
ModuleContext.ContainsProperty("clang") will return false if
clang was not set but arch.arm.clang was set - so track which
properties were extended inside extendProperties, and override
ModuleContext.ContainsProperty in AndroidModuleContext to also
check the extended properties.

Change-Id: I03cbe71dc69344972e23d6c794da9be05e720c45
2015-03-27 17:54:50 -07:00
Colin Cross
1f8f234c33 Support cc_test_host
Support cc_test_host for gtest tests compiled for the host.

Change-Id: I632d2c211075ba9391d934609f1bf368459397e1
2015-03-27 15:58:24 -07:00
Colin Cross
4ae185c7ec Support for suffix property on binaries
The suffix property will modify the name of the resulting binary
by adding its value to the module name.

Change-Id: I188e97d4c88f26c060ba2ffbd37f832d701fe0cb
2015-03-27 15:58:24 -07:00
Colin Cross
bfae8859f2 Support prefix_symbols for linker
The linker needs to add __dl_ to the beginning of all of its symbols
to avoid conflicts.  Add support for a prefix_symbols property, and
insert an objcopy --prefix_symbols build step to produce the final
binary.

Change-Id: I70de7c830cd64305e5900c6de53efecea2e17c75
2015-03-27 15:58:24 -07:00
Colin Cross
ed4cf0b655 Refactor ccDynamic for static binaries
ccLibrary uses ccDynamic for linking shared libraries, but bypasses
it by calling directly into ccBase for static libraries.  Instead of
duplicating the same mess for ccBinary, rename ccDynamic to ccLinked
and add the logic for dealing with static or shared linkage.  This
also allows moving the stl logic out of ccBase and into ccLinked.

Change-Id: Idfa6d86de16911c8851f694d6ed92681c8939281
2015-03-27 15:57:49 -07:00
Dan Albert
be96168ee3 Add support for building NDK modules.
Change-Id: I2c5ede530e40a635e26ae45950580ef450e7dcc6
2015-03-26 21:58:12 -07:00
Colin Cross
21b9a2497a Refactor cc dependencies to avoid duplication
CC module dependencies need to be handled in both AndroidDynamicDependencies
and GenerateAndroidBuildActions.  Replace handling them in both with
splitting out individual functions to list each type of dependency,
and then call them from both AndroidDynamicDependencies and collectDeps
in GenerateAndroidBuildActions.

Change-Id: If8104f6ec4846a389a41ab599b1167bcf47b45b7
2015-03-25 13:49:24 -07:00
Colin Cross
f6566ed2ba Add new AndroidModuleContext helper functions
Add Host(), Device(), and Debug() to AndroidModuleContext to allow
build rule generators to easily determine build options.

Change-Id: Ib93a462cb45189399063f641b3a8df175db0592e
2015-03-25 11:33:08 -07:00
Colin Cross
97ba073833 Export cc types for art to inherit from
Art needs a custom module type in order to perform complicated
build logic like depending on environment variables and varying
cflags based on cpu variant.  Export enough of the types and
functions from cc for art_cc_library to inherit from cc_library.

While I'm touching every line, also rename the New* methods
to *Factory.

Change-Id: I7123aa47019c4ced7a1ab57c394225bc7844b5ea
2015-03-25 11:33:06 -07:00
Colin Cross
70b4059e3f Update import paths for changes to blueprint
Blueprint has been modified to include a canonical import path,
update soong to match.

Change-Id: If29d31afbf3bf2e6364961a66456fa5f8f738455
2015-03-23 12:57:34 -07:00
Colin Cross
62ec5f4eb3 Updates for building art
Add art and libnativehelper to the root Blueprints file, and
add a warning used by art to the clang unknown flags list.

Change-Id: If282413103fa20fa66422e4330fbabff61b66144
2015-03-21 00:40:20 +00:00
Colin Cross
6b29069d42 Allow cc_test to build a test per source file
Some cc_test modules want a test per source file, for example when
there is global state that needs to be reset between each test
suite, but no way to reset it.  Allow them to specify test_per_src: true,
which will cause a separate test to be built for each source file.

Change-Id: I3dbf1202fb070437cb0109f195dc11a6440061ee
2015-03-19 14:05:33 -07:00
Colin Cross
ed9f868f49 Fix exported include dirs
Exported include dirs were only being copied to the build flags
in ccDynamic.  Move the copy to after collectDeps is run so it
picks up the extra includes from all the overriden functions.

Also check exported include dirs of shared library dependencies
of static libraries.

Change-Id: Idb94277f88bbb10869e72011113df57f586274de
2015-03-19 10:51:41 -07:00
Colin Cross
efd8e48c4d Add sdk_version property
Add sdk_version property that will be used later for NDK builds.
For now, use it to determine if libnativehelper/include/nativehelper
should be added to the global include dirs.

Change-Id: I4e0f9b3f27c380b1ac28f163b1d2b43a46d7191c
2015-03-19 10:51:41 -07:00
Colin Cross
5049f02e60 Add gensrcs module type
gensrcs allows sources to be generated by a specified command.

Change-Id: I725086fcdcd72bfe6c07fb8903e7b520678a247f
2015-03-19 10:51:41 -07:00
Colin Cross
af19a29bb7 Add debug and release cflags
Add debug: { cflags: [...] } and release: { cflags: [...] }.
For now it always takes the release cflags, later a per-module
debug selector will allow using the debug cflags.

Change-Id: I40bc68267287db901e47e74983d0d61fda2b9367
2015-03-19 10:51:40 -07:00
Tim Kilbourn
5ccc730672 Fix path to gtest headers.
Change-Id: Ieb64c4439125e95aecc4200ac6f9ea3375b347e7
2015-03-19 10:15:22 -07:00
Dan Albert
c403f7ce6d Add support for cc_test.
This behaves slightly differently than it does in the make based build.

1. The make based build manually passes -DGTEST_OS_ANDROID (or
   whatever). gtest-port.h already has logic that does this, so it's a
   no-op.
2. Host libraries are named identically, rather than libgtest_host.

Change-Id: Ic40a1025c698611d202cb7c8ec45abd8fe130065
2015-03-18 23:39:02 -07:00
Tim Kilbourn
1a9bf268ad Add an instruction_set property to Arch
Used to allow switching between thumb and arm ISAs

Change-Id: I94aa83cee7179e83c97eedc32fd216965b626d33
2015-03-18 17:19:35 -07:00
Colin Cross
c472d57f57 Refactor cc compiling to shared ccBase and ccDynamic initialization
Refactor common code out of NewCC* to initialize the ccBase,
ccDynamic, and ccLibrary structures.  Also adds an enum for the
default multilib values.

Change-Id: Iaeffe86bf2568b6054be4ddcee725818af45e14f
2015-03-17 15:11:14 -07:00
Colin Cross
3075ad07e4 Add dependencies on late static libraries
Late static libraries were added to the build command line, but not
the implicit dependencies.

Change-Id: I20ed8be6ae1ec7c1b78f16a6d1da7d1535ff5cba
2015-03-17 10:47:08 -07:00
Colin Cross
a360e8b0fa Update clang flags for latest AOSP master
Change-Id: I492b5a4b87689f4eb95466fc92241a0f88415012
2015-03-16 16:22:52 -07:00
Colin Cross
6072ad4e9b Fix soname
-Wl,soname= was missing the .so extension

Change-Id: Ide5f2b22f5c37a20463a2314047560e501b95987
2015-03-16 16:22:52 -07:00
Colin Cross
bdd7b1c818 Add more missing clang flags
Add clangExtraCflags, clangExtraConlyflags, and clangExtraTargetCflags

Change-Id: I99a12ba3af43c2fcf97a1d96a0a32efd8d4bfde5
2015-03-16 16:22:52 -07:00
Colin Cross
77b00fa6f1 Add late static libraries for libgcc
libgcc has to be last on the command line, after -lc for libc.

Change-Id: I5c867cef59ca84e23ff5cea406da3ec3f261aa76
2015-03-16 16:22:52 -07:00
Colin Cross
13af54da2d Fix arm compile flags to match makefile build
Fix a few flags that don't match the makefile build flags in
build/core/combo/TARGET_linux-arm.mk

Change-Id: Ib951da32d7828aff17a32f10ba18ed678b3571de
2015-03-16 16:22:52 -07:00
Tim Kilbourn
f294814398 Add common cpp flags
Change-Id: Iba486b121e9a1b0c1761cf6402c61a0228105a5b
2015-03-16 15:50:11 -07:00
Colin Cross
3f40fa460d Add soong_build primary builder
Initial build logic for building android with soong.  It can build
a variety of C and C++ files for arm/arm64 and host.

Change-Id: I10eb37c2c2a50be6af1bb5fd568c0962b9476bf0
2015-03-13 20:28:16 -07:00