We currently are unable to build on MacOSX unless we give waf the
--check-cxx-compiler g++. Change the compiler order to search for
gcc/g++ first instead of clang/clang++.
Here we do the following:
1) Move the pkg-config check to boards.py so we only check of it for
linux boards
2) Use cfg.find_toolchain_program() if possible, for example, for AR
That's more correct than setting Waf environment variables:
(1) We don't need to worry about differences between OSes - the previous
implementation was actually broken for Windows because the program names in
the environment variables were missing the ".exe" extension.
(2) That looks better than looping over possible compiler names and running
the configuration transactionally multiple times.
check for the presence of libiio to enable the compilation of
the bebop rangefinder that needs it.
If the build remains static, there needs to be a rootfs that contains
the libiio.a file because it is not included in the debian package.
A solution can be to compile libiio and copy libiio.a in /usr/lib[/arch]
The find_realexec_path function was used for finding the toolchain path mostly
because of two reasons:
1) We couldn't really use CXX or CC variables because the user could set those
from the OS's environment and Waf wouldn't look for the executable file in
that case.
2) Our CI configuration sets up symlinks for ccache and find_realexec_path
works around that issue.
The bad side about using find_realexec_path() is that, besides working aroung
symlinks, it does the same thing that is done by Waf. This patch removes the
dependency for such a function by addressing each of the reasons above stated:
1) We create a local copy of os.environ and, if there's a variable with the
same name we are using, we remove it from the local copy.
2) As done before, we are looking for the cross ar program instead of gcc
program, since that is not used for ccache symlinks.
This is a better approach than checking command line options
--check-cxx-compiler and --check-c-compiler. Those values expect a list of
compilers to try instead of the compiler to use.
The benefits of this approach are:
- Allowing correct use of options --check-cxx-compiler and --check-c-compiler.
- Allowing user to pass CXX and CC environment variables, which is a common
way of selecting the compiler.
- Configuration is done *and committed* only for the specific compiler.
This is a better approach than checking command line options
--check-cxx-compiler and --check-c-compiler. Those values expect a list of
compilers to try instead of the compiler to use.
The benefits of this approach are:
- Allowing correct use of options --check-cxx-compiler and --check-c-compiler.
- Allowing user to pass CXX and CC environment variables, which is a common
way of selecting the compiler.
- Configuration is done *and committed* only for the specific compiler.
It makes more sense the toolchain Waf tool to be responsible of loading the
compilers. Furthermore, that allows toolchain tool to have control on doing
configuration before and after loading compiler tools.
- Use early return and reduce one indentation level.
- Set AR for both GNU compilers and clang just once and reduce redundancy.
- Reduce indentation level for clang-specific setup. There's no need to nest it
inside check if compilers are GNU or clang.