Ejemplo n.º 1
0
def check_inline(cmd: Config) -> str:
    """Return the inline identifier (may be empty)."""
    body = textwrap.dedent("""
        #ifndef __cplusplus
        static %(inline)s int static_func (void)
        {
            return 0;
        }
        %(inline)s int nostatic_func (void)
        {
            return 0;
        }
        #endif
        int main(void) {
            int r1 = static_func();
            int r2 = nostatic_func();
            return r1 + r2;
        }
        """)

    for kw in ["inline", "__inline__", "__inline"]:
        st = cmd.try_compile(body % {"inline": kw}, None, None)
        if st:
            return kw

    return ""
Ejemplo n.º 2
0
def check_gcc_function_attribute(cmd: Config, attribute: str, name: str) -> bool:
    """Return True if the given function attribute is supported."""
    if is_gcc(cmd):
        pragma = '#pragma GCC diagnostic error "-Wattributes"'
    elif is_clang(cmd):
        pragma = '#pragma clang diagnostic error "-Wattributes"'
    else:
        pragma = ""

    body = (
        textwrap.dedent(
            """
        %s

        int %s %s(void*);

        int main(void)
        {
            return 0;
        }
        """
        )
        % (pragma, attribute, name)
    )
    if cmd.try_compile(body, None, None):
        return True
    else:
        return False
Ejemplo n.º 3
0
def check_gcc_intrinsic(cmd: Config, intrinsic: str, value: str) -> bool:
    """Return True if the given intrinsic is supported."""
    body = (textwrap.dedent("""
        int check(void) {
            return %s(%s);
        }

        int main(void)
        {
            return check();
        }
        """) % (intrinsic, value))
    if cmd.try_link(body, headers=["math.h"]):
        return True
    else:
        return False
Ejemplo n.º 4
0
              "for your distribution")
        # still try to build with usable defaults
        extra_include_dirs = ["/usr/include/qwt5", "/usr/include/qwt"]
        extra_libs = ["qwt", "cfitsio", "tiff"]

extra_include_dirs.extend(
    path.join(qt_inc_dir, subdir) for subdir in ['', 'QtCore', 'QtGui'])
extra_libs.extend(['QtCore', 'QtGui'])
extra_lib_dirs.append(qt_lib_dir)

sources = [
    cppfile for cppfile in os.listdir('.') if cppfile.startswith('lw_')
    and cppfile.endswith('.cpp') and cppfile != 'lw_main.cpp'
]

conf = CommandConfig(Distribution())

devfits = conf.check_header('fitsio.h', extra_include_dirs)
devtiff = conf.check_header('tiff.h', extra_include_dirs)
if not devfits or not devtiff:
    if not devfits:
        conf.warn("Please install developer files of the 'fitsio' library.")
    if not devtiff:
        conf.warn("Please install developer files of the 'tiff' library.")
    sys.exit(1)

setup(name='nicoslivewidget',
      version=get_git_version().lstrip('v'),
      ext_modules=[
          Extension(
              'nicoslivewidget',
Ejemplo n.º 5
0
def check_gcc_header(cmd: Config, header: str) -> bool:
    return cmd.check_header(
        header,
        include_dirs=get_python_header_include(),
    )