takashi kadono / Mbed OS Nucleo_446

Dependencies:   ssd1331

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers get_tools.py Source File

get_tools.py

00001 """
00002 Copyright (c) 2018, Arm Limited
00003 SPDX-License-Identifier: Apache-2.0
00004 
00005 Licensed under the Apache License, Version 2.0 (the "License");
00006 you may not use this file except in compliance with the License.
00007 You may obtain a copy of the License at
00008 
00009     http://www.apache.org/licenses/LICENSE-2.0
00010 
00011 Unless required by applicable law or agreed to in writing, software
00012 distributed under the License is distributed on an "AS IS" BASIS,
00013 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014 See the License for the specific language governing permissions and
00015 limitations under the License.
00016 
00017 
00018 GET UNIT TEST TOOLS
00019 """
00020 
00021 import platform
00022 
00023 from .utils import is_tool
00024 from .settings import MAKE_PROGRAMS, \
00025                       CXX_COMPILERS, \
00026                       C_COMPILERS, \
00027                       GCOV_PROGRAMS
00028 
00029 def _get_program(programs, default=None):
00030     if programs is None:
00031         programs = []
00032 
00033     for program in programs:
00034         if is_tool(program):
00035             return program
00036 
00037     return default
00038 
00039 def get_make_tool ():
00040     """
00041     Get make program
00042     """
00043 
00044     default_make = "mingw32-make" if (platform.system() == "Windows") \
00045                              else "make"
00046 
00047     return _get_program(MAKE_PROGRAMS, default=default_make)
00048 
00049 def get_cmake_tool ():
00050     """
00051     Get cmake program
00052     """
00053 
00054     return _get_program(["cmake"])
00055 
00056 def get_cxx_tool ():
00057     """
00058     Get C++ compiler
00059     """
00060 
00061     return _get_program(CXX_COMPILERS, "g++")
00062 
00063 def get_c_tool ():
00064     """
00065     Get C compiler
00066     """
00067 
00068     return _get_program(C_COMPILERS, "gcc")
00069 
00070 def get_gcov_program ():
00071     """
00072     Get gcov program
00073     """
00074 
00075     return _get_program(GCOV_PROGRAMS, "gcov")
00076 
00077 def get_gcovr_program ():
00078     """
00079     Get covr program
00080     """
00081 
00082     return _get_program(["gcovr"])