Commit Graph

45 Commits

Author SHA1 Message Date
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
Lucas De Marchi eb6c89d09c waf: use os.path.join() for joining paths
Use platform-neutral way in python to join path components to improve
readability. Both will work when passing down to waf's Node object, even
on Windows.
2016-01-18 16:56:08 -02:00
Gustavo Jose de Sousa 60abd4ff2f waf: don't differentiate taskgen names from targets for programs
waf's terminology might be a bit confusing regarding the word 'target'. As an
attribute for a task generator, it means the paths of the files supposed to be
built. As a command line option (--target), it means the list of names of the
task generators to be used in the build.

Before this commit, only vehicles programs had their task generators' target
parameter value different from the name parameter. Now, there's no distinction
between those two parameters for the case of programs.
2016-01-15 16:46:41 -02:00
Gustavo Jose de Sousa 2448ea1611 waf: ardupilotwaf: add function build_shortcut
That enable the easy creation of custom build commands with the purpose of
creating "shortcuts" for execution from command line.

For example, consider the following code fragment from a wscript:
```
copter = ardupilotwaf.build_shortcut(targets='ArduCopter')
```

With that, one can just issue `waf copter` instead of
`waf --target ArduCopter`.

The parameter target is made optional because more parameters might be added to
this function in the future.
2016-01-15 16:46:41 -02:00
Gustavo Jose de Sousa 0b8eff79af waf: remove extension from programs' names
Each platform has its own build directory, no extension is necessary.
2016-01-15 16:46:41 -02:00
Gustavo Jose de Sousa f4a6d13cef waf: make benchmarks and tests be placed in common directories
Benchmarks now go to `build/<board>/benchmarks/` and tests to
`build/<board>/tests/`. That's done by using ardupilotwaf.program() and passing
blddestdir and program_name.
2016-01-15 16:46:41 -02:00
Gustavo Jose de Sousa 59562ad693 waf: add option program_name to ardupilotwaf.program()
That allows one to set explictly the program name instead of getting it from
the current directory.
2016-01-15 16:46:41 -02:00
Gustavo Jose de Sousa 2ad91dc1bc waf: add option use_legacy_defines to ardupilotwaf.program()
This is to allow to use ardupilotwaf.program() for programs that don't need the
legacy defines.
2016-01-15 16:46:41 -02:00
Gustavo Jose de Sousa c933b94f4d waf: add shortcut function for examples build
The function example() calls program() passing blddestdir as 'examples'.
2016-01-15 16:46:41 -02:00
Gustavo Jose de Sousa e549d0a3eb waf: use blddestdir to define task generator name
The only exception is for binaries that go in 'bin', like vehicles.
That way, partial builds follow the rule:
 - If building a vehicle or some helper that goes into 'bin', just use the
   binary name as the argument for --target. Example: `waf --target
   ArduCopter`.
 - For other binaries, the name of the directory they are placed in must be
   used. Example: `waf --target tests/test_vectors`.
2016-01-15 16:46:41 -02:00
Gustavo Jose de Sousa a55d803638 waf: make program() use blddestdir param
That param defines where the binary will be saved in the build directory,
namely `build/<board>/<blddestdir>`. The default is 'bin', for binaries that are
to be shipped for installation.
2016-01-15 16:46:40 -02:00
Gustavo Jose de Sousa ce294e841c waf: ardupilotwaf: make vehicle_stlib pass **kw to bld.stlib
That allows users to pass more parameters to bld.stlib.
2016-01-15 07:28:48 +11:00
Gustavo Jose de Sousa e21d41afe3 waf: enable fully static linking
Some boards (e.g. bebop) require fully statically linked binaries.
2016-01-11 16:31:59 -02:00
Gustavo Jose de Sousa d6b4e98a88 waf: remove already fixed TODOs
The TODOs removed with this patch were already fixed. Below is the explanation
for each.

 - TODO: add support for unit tests.
    - Supported already added.

 - TODO: Check if we should simply use the signed 'waf' "binary" (after
   verifying it) instead of generating it ourselves from the sources.
    - We're using a submodule for waf.

 - TODO: evaluate if we need shortcut commands for the common targets
   (vehicles). currently using waf --targets=NAME the target name must contain
   the board extension so make it less convenient, maybe hook to support
   automatic filling this extension?
    - There's no need of adding the extension anymore.

 - TODO: Once HAL patches get in, need to filter out the HAL based on the
   bld.env.BOARD.
    - The board-specific HAL library folders is indicated in
      bld.env.AP_LIBRARIES.
2016-01-09 14:08:07 -02:00
Lucas De Marchi 09ebbac7ab waf: fix unsorted library
The list of libraries is maintained sorted to ease maintenance, avoid
repeating libraries, etc.
2015-12-30 10:42:20 -02:00
bugobliterator 57d2594bd7 Tools: add AP_AccelCal lib to waf library list 2015-12-29 10:46:35 -08:00
Lucas De Marchi a096703b06 Global: don't link with AP_Progmem
AP_Progmem is not used anymore.
2015-12-27 15:58:12 -02:00
Gustavo Jose de Sousa c4c9ce6a2a waf: ardupilotwaf: use name without board extention
If the attribute name is passed, then it is the one used to process the option
--target[s] of waf build. The board name should be used only in configuration
time. The build targets should be board/platform agnostic.

Now, instead of using `waf --target ArduCopter.sitl`, we use `waf --target
ArduCopter` and the binary continues named as "ArduCopter.sitl".
2015-12-10 10:40:37 +09:00
Gustavo Jose de Sousa 1e119c2182 waf: remove AP_ADC_AnalogSource from common libraries
That library was removed in a recent pull request. That PR was raised before
waf build system was integrated in the tree, that's why the fix just now.
2015-12-07 15:42:02 +09:00
Gustavo Jose de Sousa 2828f66a6a waf: enable writing and building benchmarks 2015-12-03 07:54:31 +11:00
Gustavo Jose de Sousa 6b4a6f5389 waf: use gtest for tests
It was implemented in such a way that gtest is required only if the user wants
to build and run tests. Initially we're considering all tests should be gtests.
We can change that assumption in the future if necessary.
2015-12-03 07:54:31 +11:00
Gustavo Jose de Sousa 8556b5dfb8 waf: add support to run (unit) tests
We're currently using the tests standard error for reporting tests. We can add
TAP later to integrate with other tools.

Additionally, this patch simplifies the exclude patterns passed to
collect_dirs_to_recurse.
2015-12-03 07:54:31 +11:00
Caio Marcelo de Oliveira Filho 6e7b73610d waf: add waf support 2015-12-03 07:54:30 +11:00