Commit Graph

72 Commits

Author SHA1 Message Date
Gustavo Jose de Sousa 31965689cb waf: persist implicit dependency information across clean
Implicit dependency scanning takes significant time and, since it doesn't
produce files, it's okay to keep the resulting information across clean
commands as long as the scanner is triggered again if there's need to. This
commit accomplishes that.

The advantage of this approach can be observed by the following timings when
building the group "bin":

 Method                                                         Time
 ------------------------------------------------------------------------
 Fully clean build                                              5m18.633s
 Clean build with scanning result persisted                     4m23.346s
 Clean build with ccache but non-persistent scan results        1m40.125s
 Clean build with scanning results persisted and with ccache      14.843s

While at it, move management of information persisted across clean commands to
a separate module.
2016-08-24 10:46:23 -03:00
Gustavo Jose de Sousa ef4fd0e2d3 waf: add --clean-all-sigs option
Explanation on the option help string.
2016-08-24 10:46:23 -03:00
Gustavo Jose de Sousa 0b7a98d40c waf: allow persisting tasks signatures across clean commands
That allows some time consuming tasks that don't really produce anything on the
file system to keep their signature after a clean command is issued.
2016-08-24 10:46:23 -03:00
Gustavo Jose de Sousa a98c42fef9 waf: define ap_groups in ardupilotwaf tool
That makes more sense, since that module is supposed to have basic Ardupilot
specific features. The root wscript should be a mere user of those features.
2016-08-24 10:46:23 -03:00
Gustavo Jose de Sousa b8e518a533 waf: use ap_library tool
That way we avoid recompiling source files that don't depend on vehicles.
Change notes:
- UTILITY_SOURCE_EXTS: moved to ap_library
- Task generators indexes: ap_library handles that now and in a better way
- Use of AP_STLIB_FEATURES: it doesn't make sense anymore, since the stlib
  taskgen has empty source list
- Flags and defines: passed down to ap_library through AP_LIBRARIES_OBJECTS_KW
- Set use='mavlink' in AP_LIBRARIES_OBJECTS_KW instead of calls to
  bld.ap_stlib().
2016-08-24 10:46:23 -03:00
Gustavo Jose de Sousa 2e1ac0de8d waf: make get_legacy_defines() "public"
That function will be used by an upcoming separate tool.
2016-08-01 22:04:16 -03:00
Gustavo Jose de Sousa f2dec971e7 waf: add "ap_" prefix to keywords "libraries" and "vehicle"
As an effort to keep things specific to ardupilot API in the build system
consistent and easy way to identify.
2016-08-01 22:04:16 -03:00
Andrew Tridgell db8bf48747 build: added AP_ICEngine to build 2016-07-25 10:06:03 +10:00
Andrew Tridgell 241b6edfcf Build: added AP_Button to build 2016-07-22 15:01:20 +10:00
Andrew Tridgell d25db426a3 waf: added AP_Module to the build 2016-07-14 13:39:47 +10:00
Gustavo Jose de Sousa afcabda21c waf: use better style for add_option() calls
Setting the "help" keyword argument may not fit in one line sometimes. This
patch adds the following convention to calls to add_option() in order to
address that issue in a better way:

    1) The "help" keyword must always be the last argument to be passed.

    2) If the help string is a literal string or a literal string with some
    operation (e.g. "%" operator) and setting the "help" keyword in the code
    doesn't fit a line (considering the limit of characters in a line), then
    the help string must be a triple-quoted string. That has the advantage of
    not having to have several "+" operations for long help strings. In that
    case, the help message must start on the next line and the closing
    triple-quotes must be on a separate line together with the closing
    parenthesis.

The requirement (1) makes it easier to make the style exception in (2)
acceptable.
2016-05-25 17:47:00 -03:00
Gustavo Jose de Sousa 64b8ec61c7 waf: set lib as output dir for static libraries 2016-05-25 17:47:00 -03:00
Gustavo Jose de Sousa 236a62f4b9 waf: create program_dir directory
There's an upcoming patch that moves all static libraries to
`build/<board>/lib/`. That way, the program directory won't be created
automatically by the build system and that will cause problems for PX4 builds,
since it builds ardupilot programs as static libraries and copies stuff to the
program directory.
2016-05-25 17:47:00 -03:00
Gustavo Jose de Sousa 4529028c8a waf: ardupilotwaf: ap_get_all_libraries: ignore non-directory files
Each library in ardupilot is a folder with the source in. That avoids build
failures when there are files in libraries/. That fixes #4099 ("waf doesn't
seem to like TAGS files") and #4093 ("sim_vehicle.py /w waf /w eclipse project
broken on Cygwin").

That problem can be reproduced by just creating a file in libraries/ and trying
to build with waf.

There should be a better way to confirm a path is an ardupilot library. That
can be done later.
2016-05-12 13:47:44 -03:00
Andrew Tridgell fcd7611248 waf: ensure we don't build a library twice 2016-05-10 14:21:43 +10:00
Andrew Tridgell 9653aae21f waf: fixed link of antennatracker on windows 2016-05-10 12:48:41 +10:00
Andrew Tridgell 5ef0c4d3fe waf: added AP_RPM to build 2016-05-10 12:20:44 +10:00
Andrew Tridgell d1a2749317 waf: fixed build for AP_Tuning 2016-05-07 18:34:11 +10:00
Lucas De Marchi 9e3ec3a16d waf: define git versions in a generated ap_version.h header 2016-05-06 13:11:28 -03:00
Lucas De Marchi 2c029ae1f9 waf: fix undef warnings in examples
Fix warnings like this:

<command-line>:0:21: warning: "APM_BUILD_DataFlash_test" is not defined [-Wundef]
/home/lucas/p/dronecode/ardupilot/libraries/AP_Vehicle/AP_Vehicle_Type.h:36:41: note: in expansion of macro ‘APM_BUILD_DIRECTORY’
 #define APM_BUILD_TYPE(type) ((type) == APM_BUILD_DIRECTORY)
                                         ^
These happen because we are trying to set APM_BUILD_DIRECTORY to undefined
values. We should rather default to the APM_BUILD_DIRECTORY ==
APM_BUILD_UNKNOWN
2016-05-04 08:58:37 -03:00
Lucas De Marchi 169c350e85 waf: rename AP_Config.h to ap_config.h
The usual name for this header is config.h, but that's already used by
vehicles. Using uppercase could give the impression this is a
file to be modified, but it's not. Use lowercase instead.
2016-04-05 21:06:25 -07:00
Ricardo de Almeida Gonzaga 5e45c9dfb0 waf: add cxx_checks tool
In order to start generating AP_Config header and detect
parameter such as the existence of cmath functions.
2016-04-05 20:44:15 -07:00
Gustavo Jose de Sousa b251d14778 waf: ardupilotwaf: allow multiple program groups for program
The program_dir defaults to the first group's name. That feature will be useful
for "copter" build command, which will build all frame types.
2016-03-26 15:43:08 -03:00
Gustavo Jose de Sousa 22b0b7e833 waf: ardupilotwaf: add program_dir option to ap_program()
That way we don't force other programs to be built on a directory of their
program group name. The directory name defaults to the program group.

We are separating those two concepts because of the upcoming support for
multiple groups for a program.
2016-03-26 15:43:08 -03:00
Gustavo Jose de Sousa 33fce2bfe5 waf: ardupilotwaf: add option --upload
That option can (and will by PX4) be used by platforms that support uploading
programs to a connected device.
2016-03-14 11:54:31 -03:00
Gustavo Jose de Sousa 0329cb14ed waf: ardupilotwaf: export program_name and program_group
Export those values to the task generators, so that other tools may use it.
2016-03-14 11:54:31 -03:00
Gustavo Jose de Sousa 45d1af8833 waf: ardupilotwaf: allow to build ap_program as a static library
In the upcoming build for PX4 boards, we will pass down the program a single
static library to PX4 Firmware's cmake build system. This patch is partially
providing a way to do that: the configuration for PX4 will define the
AP_PROGRAM_AS_STLIB environment variable.
2016-03-14 11:54:30 -03:00
Gustavo Jose de Sousa 32402b93af waf: ardupilotwaf: remove SITL from common libraries
Only SITL port uses it and using it for PX4 raises compilation errors.
2016-03-14 11:54:30 -03:00
Gustavo Jose de Sousa 03c067921e waf: ardupilotwaf: allow extra features for ap_program and ap_stlib
That allows tweak programs and static libraries builds for different
configurations.
2016-03-14 11:54:30 -03:00
Gustavo Jose de Sousa 12946db4dc waf: ardupilotwaf: remove common_features()
The function ap_program() was the only one that was using it, so let's just
inline it. Besides, the name was misleading, since the (only) feature added was
for programs instead of general task generators.
2016-03-14 11:54:30 -03:00
Gustavo Jose de Sousa 9c5593ef09 waf: ardupilotwaf: don't use common_features() unnecessarily
That function is already used in ap_program().
2016-03-14 11:54:30 -03:00
Gustavo Jose de Sousa 8734432196 waf: ardupilotwaf: don't use Node object for ap_program target
That will make platform specific naming be ignored. We use a string instead, to
let Waf tweak the target name correctly for us. The '#' prefix is to tell Waf
that the path is relative to bld.bldnode (instead of bld.path, which is the
default).
2016-02-27 03:13:08 -03:00
Gustavo Jose de Sousa 662e45fda2 waf: move --check-verbose option declaration
We move it to the correct "scope", that is, ardupilotwaf.py, where it's really
used.
2016-02-22 15:36:48 -03:00
Gustavo Jose de Sousa 8c4d4f3f2a waf: make options groups accessible for any tool
That allows options being declared where they're really used. Additionally, we
load ardupilotwaf after the other tools so that we can create our groups after
all non-ardupilot option groups are created. That makes our groups appear as
the last ones in the help message, which makes it easier to locate them.
2016-02-22 15:36:48 -03:00
Lucas De Marchi f0277cecb4 waf: ignore -Wundef for gtest
The gtest header uses lots of undefined macros, showing lots of warnings
if we enable -Wundef. Ideally we could use a #pragma to ignore the
warning only from the correct header, but this currently doesn't work
with g++ - see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53431

So for now we disable the warning completely when compiling gtest or any
test that uses its header.

Thanks Gustavo Sousa
2016-02-19 12:34:24 -02:00
Daniel Frenzel 970b171414 waf: remove AP_Limits from ignored libraries 2016-02-04 09:50:55 +09:00
Gustavo Jose de Sousa 05f4c8b5b1 waf: ardupilotwaf: reset LAST_IDX on every build
That is a workaround so that one can use `waf bin tests`, for example.  In our
context, the only restriction to the task generators creation is values defined
during configuration. Thus, ideally, the recursion and task generators creation
should be done only once for multiple build calls. We should do that in the
future.
2016-02-03 12:24:21 -02:00
Gustavo Jose de Sousa 8718f5be4f waf: ardupilotwaf: rename build_shortcut() to build_command()
Rationale:
 1. That function creates a separate build context class instead of just
    creating a wrapper for calling build (previous approach).
 2. The check command isn't a build shortcut since there's no way of calling it
    without using 'check' explicitly.
2016-02-01 14:08:39 -02:00
Gustavo Jose de Sousa 8be2db4d01 waf: ardupilotwaf: add parameter doc to build_shortcut()
That makes it possible to display meaningful information on the help message.
2016-02-01 14:08:38 -02:00
Gustavo Jose de Sousa c5c129d15f waf: ardupilotwaf: add parameter program_group_list to build_shortcut() 2016-02-01 14:08:38 -02:00
Gustavo Jose de Sousa a867dcdd07 waf: ardupilotwaf: make build_shortcut create build context class
Instead of just creating a wrapper. With that, the option targets is visible
only to that command instead of all commands in Options.commands.
2016-02-01 14:08:38 -02:00
Gustavo Jose de Sousa 5699bf04d0 waf: rename parameter blddestdir to program_group
It's a good idea to consolidate the idea that all programs belong to a group
that has it's own directory.
2016-02-01 14:08:32 -02:00
Gustavo Jose de Sousa b93c3d1772 waf: add option --program-group 2016-02-01 14:08:10 -02:00
Gustavo Jose de Sousa 53f22f4982 waf: fix legacy defines
The following fixes where applied:
 - Value for APM_BUILD_DIRECTORY must be prefixed with APM_BUILD_
 - Renamed parameter name to sketchname, so we differentiate the real program
   name from the legacy sketch name
 - Use directory name instead of program name as argument for
   _get_legacy_defines()
2016-01-22 20:14:57 -02:00
Gustavo Jose de Sousa c2e3f05dbf waf: ardupilotwaf: prefix build context methods with ap_
It helps to distinguish between things from waf and things from ardupilotwaf.
2016-01-22 20:10:29 -02:00
Gustavo Jose de Sousa 12cfe222eb waf: ardupilotwaf: decorate build methods with @conf
Bind functions used in wscripts to build context. Additionally, a new function
is created and also decorated with @conf, common_vehicle_libraries(), which
returns COMMON_VEHICLE_DEPENDENT_LIBRARIES.  This patch is a preparation for
making wscripts use methods bound to the build context instead of using them
directly from ardupilotwaf.
2016-01-22 20:10:28 -02:00
Gustavo Jose de Sousa cf432e8b3e waf: ardupilotwaf: rename vehicle_stlib to ap_stlib
That function is not only for vehicles.
2016-01-22 20:10:28 -02:00
Gustavo Jose de Sousa a35c0d48b0 waf: ardupilotwaf: rename program to ap_program
Make the rename so that there is no name clashes when defining it as a taskgen
method.
2016-01-22 20:10:28 -02:00
Gustavo Jose de Sousa 54d938e2c4 waf: fail the check if not all test programs succeed
So that integration with Travis work properly.
2016-01-19 00:21:15 -02:00
Lucas De Marchi d663a748f2 waf: fix blddestdir
The destination directory for binaries should be
<build_dir>/<board>/bin/ and not
<build_dir>/<board>/<where-wscript-file-is>/bin

The same reasoning can be applied for others: tools, examples, etc
should follow the same rule.

Before this patch, compiling for example ArduPlane for navio we would
have:

    [339/339] Linking build/navio/ArduPlane/bin/ArduPlane

And now we have:

    [339/339] Linking build/navio/bin/ArduPlane
2016-01-18 16:56:08 -02:00