aboutsummaryrefslogtreecommitdiffstats
path: root/cc/compiler.go
Commit message (Collapse)AuthorAgeFilesLines
* cflags for vendor variantsJiyong Park2017-08-101-0/+8
| | | | | | | | | | | | | | | | | | | | | | cflags that are only applied when building the vendor variant of a lib is now supported. This will be particularily useful when existing macro should be turned off for the vendor variant: cflags: ["-DENABLE_FEATURE_X"], target: { vendor: { cflags: ["-UENABLE_FEATURE_X"], }, }, Without this, the library author has to undef the macro inside the source code using __ANDROID_VNDK__, which is not desired especially for external projects. Bug: 64514237 Test: BOARD_VNDK_VERSION=current m -j libsqlite libsqlite.vendor Change-Id: Ib484b5b12e14ab776276a30ed2763dffadc9d642
* Support .rs and .fs files in cc_* module srcs listsColin Cross2017-05-051-0/+15
| | | | | | | Translate .rs and .fs files to .cpp files using llvm-rs-cc. Test: builds Change-Id: I242cea0d09c9985730a512cec7705c3f1479f4ed
* Remove -isystem frameworks/av/includeColin Cross2017-05-031-1/+0
| | | | | | | | | | | Remove the last -isystem for global include directory (besides bionic). Bug: 31751828 Test: builds Change-Id: I8f38332de8f0cffd5c56b9b5ebeacbaaf3a4faea Merged-In: I8f38332de8f0cffd5c56b9b5ebeacbaaf3a4faea (cherry picked from commit d13a457a45d8ebcdf4e248370078c5a5ff88fdcb)
* Check reused source files in hasSrcExtColin Cross2017-05-031-0/+8
| | | | | | | | | | | | | | | | hasSrcExt is used to determine extra flags and dependencies when generated files are used. If the generated files are being handled in a static library whose objects are reused in a shared library, the flags and dependencies still need to apply. Instead of clearing the source files in the shared library, move them to an OriginalSrcs property, and check that in hasSrcExt along with the Srcs property. Also pass extra exported include directories from the static library to the shared library. Bug: 37555583 Test: use protos in a cc_library Change-Id: I709779ec03b66b220b7bd58a1f6f0b9b5067d955
* Prepend arch variant include directoriesColin Cross2017-04-271-2/+2
| | | | | | | | Arch variant include directories should override existing include directories, add prepend_variant to the struct tags. Test: m -j checkbuild Change-Id: I4a758b42c19481f9496880d29dffea7836f613c5
* Pass -I to yasmColin Cross2017-04-271-2/+7
| | | | | | | | | external/libvpx needs -I flags to be propagated to yasm, but can't handle all the other global flags (like -no-exceptions). Add -I arguments to YasmFlags as well as GlobalFlags. Test: mega-device build of external/libvpx Change-Id: I1607211c34b031fae8ffc1bd558b26019965a696
* Split /system and /vendor modules, allow multi-installationDan Willemsen2017-04-111-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Nothing changes if BOARD_VNDK_VERSION isn't set. When the VNDK is enabled (BOARD_VNDK_VERSION in Make), this will split /system and /vendor modules into two different variant spaces that can't link to each other. There are a few interfaces between the two variant spaces: The `llndk_library` stubs will be available in the /vendor variant, but won't be installed, so at runtime the /system variant will be used. Setting `vendor_available: true` will split a module into both variants. The /system (or "core") variant will compile just like today. The /vendor ("vendor") variant will compile against everything else in the vendor space (so LL-NDK instead of libc/liblog/etc). There will be two copies of these libraries installed onto the final device. Since the available runtime interfaces for vendor modules may be reduced, and your dependencies may not expose their private interfaces, we allow the vendor variants to reduce their compilation set, and export a different set of headers: cc_library { name: "libfoo", srcs: ["common.cpp", "private_impl.cpp"], export_include_dirs: ["include"], target: { vendor: { export_include_dirs: ["include_vndk"], exclude_srcs: ["private_impl.cpp"], srcs: ["vendor_only.cpp"], }, }, } So the "core" variant would compile with both "common.cpp" and "private_impl.cpp", and export "include". The "vendor" variant would compile "common.cpp" and "vendor_only.cpp", and export "include_vndk". Bug: 36426473 Bug: 36079834 Test: out/soong/build.ninja, out/soong/Android- only changes due to _core addition and .llndk -> .vendor Test: attempt to compile with BOARD_VNDK_VERSION:=current Change-Id: Idef28764043bf6c33dc0d2e7e2026c38867ff769
* Add LLNDK support for the VNDKDan Willemsen2017-04-071-2/+7
| | | | | | | | | | | Instead of using the NDK headers and libraries, add LL-NDK specific headers and library stubs for VNDK users. This allows us to provide an expanded liblog interface. Test: aosp_arm; m -j Test: Enable BOARD_VNDK_VERSION on aosp_arm; m -j Test: Inspect out/soong/build.ninja before/after (w/o vndk) Change-Id: Ic85f07fa10c695b5baab10c41f5e0ad38700bf3d
* Fix include orderColin Cross2017-03-311-5/+5
| | | | | | | | | | | | Include order should be module includes, dependency exported includes, and then global includes. Module includes and global includes are computed during compileFlags, but dependency exported includes are not handled until later. Move the global includes into a new flags variable so that the dependency includes can be appended to the module includes. Test: m -j native Change-Id: Ifc3894f0a898a070d6da8eed4f4b9e8cc0cd2523
* Always use the standard OSX SDK toolsDan Willemsen2017-03-131-4/+1
| | | | | | | Instead of whatever happens to be in PATH. Test: port install gcc5; attempt to build host binaries Change-Id: If4af32596edd6fd3e459c3d574ab0ff495f236ff
* Add support for CMakefile generationFabien Sanglard2017-02-071-0/+13
| | | | | | Test: Manually generated CMakeLists.txt for gui/ui/aapt2. Change-Id: I7dedc300c1e50b8e39bc58091b650c0bbe2c62da
* Add c_std and cpp_std properties.Dan Albert2017-02-031-0/+21
| | | | | | Test: Checked showcommands ouput for each setting. Bug: None Change-Id: Ibe02352f19ca2777b9a419136270e5c4390f1149
* Support filegroupsColin Cross2016-12-171-0/+4
| | | | | | | | | | filegroup is a module that contains a list of files, and can be used to export files across package boundaries. filegroups (and genrules) can be referenced from srcs properties of other modules using the syntax ":module". Test: m -j Change-Id: I3d6fc4819c0b4225b474e0ad42f0d947f55a5961
* Pass DepsContext to dependency methodsColin Cross2016-12-131-1/+1
| | | | | | | | | Pass a DepsContext that embeds android.BottomUpMutatorContext instead of android.BaseContext so that dependency methods can directly add dependencies. Test: m -j Change-Id: Id4c157975d3d6f03efd99785d217bef486a76139
* Support aidl cpp generationDan Willemsen2016-12-051-0/+23
| | | | | | | | | Ideally we'd calculate the headers that are written here too, but I'll add that in a later change that actually enforces the generated header list. Test: mmma -j system/tools/aidl Change-Id: Ifd2e8e8ff444b0f67270fb5156e7bf7bceddb6be
* Support .asm files for assemblyColin Cross2016-12-021-0/+3
| | | | | Test: mmma -j external/libjpeg-turbo Change-Id: Id192dae5d74ecbf500fc668931c37f9b91d25ca4
* Add basic VNDK support in SoongDan Willemsen2016-11-281-3/+3
| | | | | | | | | | | | | | | | | | Export a list of libraries in the VNDK, which is currently empty. Take in Make's global BOARD_VNDK_VERSION, and use that as the SDK version for modules that specify use_vndk: true. Modules that use the vndk have some configuration as if they were building against the NDK (the absence of globally defined headers), but in other cases look like platform modules (using the platform libc++, for now). This change does not attempt to enforce any linking constraints, that will come in a later patch. Test: out/soong/build.ninja doesn't change Change-Id: I3be206b67015ac5177b7eef4a451c579e3dc903f
* Move global cppflags to the beginning of cppflagsColin Cross2016-11-221-3/+3
| | | | | | | | Global cppflags should come first so they can be overriden by module cppflags. Test: m -j checkbuild Change-Id: I3454370a6b35f37982b1e0de2e0ec52b54974a8a
* Support `sdk_version: "current"` for the NDK.Dan Albert2016-11-101-1/+5
| | | | | | | | | | | We need to fall back to the old CRT objects since we aren't generating those yet. Test: Created a test module using "current", checked that it linked the libs from current. Bug: None Change-Id: I5fe170d7b26154da8877672ac2acb7da0262fe38
* Add export_include_dirs to the local include pathDan Willemsen2016-11-071-4/+7
| | | | | | Bug: 32641232 Test: ./soong builds compared before/after Change-Id: If417a9f2278f42ffa524fccfd34f2b01a8cc9fb5
* Add proto property structColin Cross2016-11-031-1/+1
| | | | | | | | | | The ProtoProperties struct was not being added to the property struct list, preventing proto.type and proto.static properties from being set in Android.bp files. Bug: 32286026 Test: Add proto.type to system/extras/perfprofd/Android.bp, run soong Change-Id: I9a5b63ddd3e7a53881ddbfd381c42aa1b4c4f454
* Add yacc generated headers to the include pathDan Willemsen2016-11-021-4/+9
| | | | | Test: mmma -j system/tools/aidl Change-Id: I444c7f2b004877e027f67e36e016b528511e1a32
* Start using "struct Objects" to store object PathsDan Willemsen2016-10-311-5/+5
| | | | | | | | | So that we can represent other files that get generated along with the objects, like the gcno coverage information, and per-file clang-tidy runs. Test: Soong's build.ninja identical before/after Change-Id: I5c553a153c436d5403549f62c73fe79c5f101779
* Add support for .proto filesColin Cross2016-10-271-5/+20
| | | | | | | | | .proto files are translated to .pb.cc and .pb.h files, which are then compiled normally. Bug: 32286026 Test: mmma -j system/extras/perfprofd Change-Id: I538071424d667aacf35b4b8bfebe217f5f092726
* Simplify compileObjsColin Cross2016-10-271-15/+18
| | | | | | | | | None of the direct users of compileObjs were using any of its complexity (generated sources, excluded sources, extra sources). Move the complexity back in to baseCompiler.compile. Test: m -j Change-Id: I2e59d216682c00dd12a1395cf2448827d1c48023
* Allow disabling gnu extensionsColin Cross2016-10-181-0/+10
| | | | | | | | | Pass -std=c++14 instead of -std=gnu++14 (or whatever the current default is) when "gnu_extensions: false" is specified in the blueprints files. Bug: 32159540 Test: builds Change-Id: If206228a972129d9574bcf50ddff283b7e7d3fd7
* Consolidate -std flagsColin Cross2016-10-181-4/+13
| | | | | | | | Define the default -std values in global.go, export them in makevars.go, and use them in compiler.go. Test: builds Change-Id: Ia2ae01f63e182d0ad7f371e6d32184bff35a8897
* Consistently use -std=gnu99 for gcc as well as clang.Elliott Hughes2016-10-131-2/+1
| | | | | | | | | | This matters for C files that are also built for Windows. Previously they'd be compiled with -std=gnu99 for the host but [effectively] -std=gnu89 for Windows. Bug: http://b/32019064 Test: builds, and can build libcrypto_utils without a manual -std= line Change-Id: I9c5cc7832220b5c3d6a007ff10d076e26fd8c75d
* Ninja and shell escape command line flagsColin Cross2016-09-291-8/+12
| | | | | | | | | | | | | | Strings like cflags in Android.bp files are parsed by blueprint, written to build.ninja files, parsed by ninja, and then passed to /bin/sh -c. This had resulted in a combination of blueprint (\"), ninja ($$), and shell (\$) escaping being necessary. Update Soong to automatically handle ninja and shell escaping in cflags and ldflags. Bug: 31221587 Test: m -j Change-Id: Ibe087b2788b355b73c3225b5928870619a0a53bc
* Split CommonGlobalIncludes for system includesColin Cross2016-09-151-0/+1
| | | | | | | | Split CommonGlobalSystemIncludes out of CommonGlobalIncludes in preparation for moving global includes from -isystem to -I. Bug: 31492149 Change-Id: Ib935ea038cdbf9515dc2ab68d7fff924c370906a
* Refactor cc modules to use decorators instead of inheritanceColin Cross2016-08-051-2/+6
| | | | | | | | | For example , instead of trying to have libraryLinker inherit from baseLinker and libraryCompiler inherit from baseCompiler, create a single decorator object that wraps both baseLinker and baseCompiler. Test: Builds, no unexpected changes to build.ninja Change-Id: I2468adaea8466c203a240259ba5694b8b1df7a52
* Rename compiler, linker and installer methods to be uniqueColin Cross2016-08-011-4/+4
| | | | | | | | | compiler, linker, and installer interfaces may be implemented by a single decorator object, rename their methods to be unique to avoid the same method being called multiple times. Test: out/soong/build.ninja unchanged Change-Id: I1608c41cd68f614ba99c11bb9fcc7936f618d9aa
* Move toolchain and global variables into separate packageColin Cross2016-08-011-29/+30
| | | | | | Move all of the configuration into a cc/config package Change-Id: If56fc7242062ed1ce3cb297f78a1e0ef7537373c
* Separate cc.goColin Cross2016-07-291-0/+338
Split cc.go into files per module type, plus files for the compiler, linker, and installer stages. Change-Id: Id44c03f42fcd180950ccd008d4de0c144ea3597b