Exemple #1
0
    def __call__(self, build_ext):
        build_ext.distribution.has_c_libraries = self.has_c_libraries

        extension_base.Extension.__call__(self, build_ext)

        if self.static:
            self.libraries += ['resolv']
            self.extra_objects += [
                os.path.join(self.openzwave, 'libopenzwave.a')
            ]
            self.include_dirs += [
                os.path.join(self.openzwave, 'cpp', 'build', 'linux')
            ]
        else:
            import pyozw_pkgconfig

            self.libraries += ["openzwave"]
            extra = pyozw_pkgconfig.cflags('libopenzwave')
            if extra != '':
                for ssubstitute in ['', 'value_classes', 'platform']:
                    self.extra_compile_args += [
                        os.path.normpath(os.path.join(extra, ssubstitute))
                    ]

        self.report_config()
Exemple #2
0
    def system_context(self, ctx, static=False):
        #System specific section
        #~ os.environ["CC"] = "gcc"
        #~ os.environ["CXX"] = "g++"
        #~ os.environ["PKG_CONFIG_PATH"] = "PKG_CONFIG_PATH:/usr/local/lib/x86_64-linux-gnu/pkgconfig/"
        log.info("Found platform {0}".format(sys.platform))
        if static:
            ctx['include_dirs'] += [
                "{0}/cpp/src".format(self.openzwave),
                "{0}/cpp/src/value_classes".format(self.openzwave),
                "{0}/cpp/src/platform".format(self.openzwave) ]

        if sys.platform.startswith("win"):
            from pyozw_win import get_system_context
            get_system_context(ctx, self.os_options, openzwave=self.openzwave, static=static)

        elif sys.platform.startswith("cygwin"):
            if static:
                ctx['libraries'] += [ "udev", "stdc++",'resolv' ]
                ctx['extra_objects'] = [ "{0}/libopenzwave.a".format(self.openzwave) ]
                ctx['include_dirs'] += [ "{0}/cpp/build/linux".format(self.openzwave) ]
            else:
                import pyozw_pkgconfig
                ctx['libraries'] += [ "openzwave" ]
                extra = pyozw_pkgconfig.cflags('libopenzwave')
                if extra != '':
                    for ssubstitute in ['', 'value_classes', 'platform']:
                        ctx['extra_compile_args'] += [ os.path.normpath(os.path.join(extra, ssubstitute)) ]

        elif sys.platform.startswith("darwin") :
            ctx['extra_link_args'] += [ "-framework", "CoreFoundation", "-framework", "IOKit" ]
            ctx['extra_compile_args'] += [ "-stdlib=libc++", "-mmacosx-version-min=10.7" ]

            if static:
                ctx['extra_objects'] = [ "{0}/libopenzwave.a".format(self.openzwave) ]
                ctx['include_dirs'] += [ "{0}/cpp/build/mac".format(self.openzwave) ]
            else:
                import pyozw_pkgconfig
                ctx['libraries'] += [ "openzwave" ]
                extra = pyozw_pkgconfig.cflags('libopenzwave')
                if extra != '':
                    for ssubstitute in ['', 'value_classes', 'platform']:
                        ctx['extra_compile_args'] += [ os.path.normpath(os.path.join(extra, ssubstitute)) ]

        elif sys.platform.startswith("freebsd"):
            if static:
                ctx['libraries'] += [ "usb", "stdc++" ]
                ctx['extra_objects'] = [ "{0}/libopenzwave.a".format(self.openzwave) ]
                ctx['include_dirs'] += [ "{0}/cpp/build/linux".format(self.openzwave) ]
            else:
                import pyozw_pkgconfig
                ctx['libraries'] += [ "openzwave" ]
                extra = pyozw_pkgconfig.cflags('libopenzwave')
                if extra != '':
                    for ssubstitute in ['', 'value_classes', 'platform']:
                        ctx['extra_compile_args'] += [ os.path.normpath(os.path.join(extra, ssubstitute)) ]

        elif sys.platform.startswith("sunos"):
            if static:
                ctx['libraries'] += [ "usb-1.0", "stdc++",'resolv' ]
                ctx['extra_objects'] = [ "{0}/libopenzwave.a".format(self.openzwave) ]
                ctx['include_dirs'] += [ "{0}/cpp/build/linux".format(self.openzwave) ]
            else:
                import pyozw_pkgconfig
                ctx['libraries'] += [ "openzwave" ]
                extra = pyozw_pkgconfig.cflags('libopenzwave')
                if extra != '':
                    for ssubstitute in ['', 'value_classes', 'platform']:
                        ctx['extra_compile_args'] += [ os.path.normpath(os.path.join(extra, ssubstitute)) ]

        elif sys.platform.startswith("linux"):
            if static:
                ctx['libraries'] += [ "udev", "stdc++",'resolv' ]
                ctx['extra_objects'] = [ "{0}/libopenzwave.a".format(self.openzwave) ]
                ctx['include_dirs'] += [ "{0}/cpp/build/linux".format(self.openzwave) ]
            else:
                import pyozw_pkgconfig
                ctx['libraries'] += [ "openzwave" ]
                extra = pyozw_pkgconfig.cflags('libopenzwave')
                if extra != '':
                    for ssubstitute in ['', 'value_classes', 'platform']:
                        ctx['extra_compile_args'] += [ os.path.normpath(os.path.join(extra, ssubstitute)) ]

        else:
            # Unknown systemm
            raise RuntimeError("Can't detect plateform {0}".format(sys.platform))

        return ctx
Exemple #3
0
def system_context(ctx, openzwave=None, static=False):
    #System specific section
    #~ os.environ["CC"] = "gcc"
    #~ os.environ["CXX"] = "g++"
    #~ os.environ["PKG_CONFIG_PATH"] = "PKG_CONFIG_PATH:/usr/local/lib/x86_64-linux-gnu/pkgconfig/"
    log.info("Found platform {0}".format(sys.platform))
    if static:
        ctx['include_dirs'] += [
            "{0}/cpp/src".format(openzwave),
            "{0}/cpp/src/value_classes".format(openzwave),
            "{0}/cpp/src/platform".format(openzwave)
        ]
    if sys.platform.startswith("win"):
        ctx['libraries'] += ["setupapi", "msvcrt", "ws2_32", "dnsapi"]

        if static:
            ctx['extra_objects'] = [
                "{0}/cpp/build/windows/vs2010/Release/openzwave.lib".format(
                    openzwave)
            ]
            ctx['include_dirs'] += ["{0}/cpp/build/windows".format(openzwave)]
        else:
            import pyozw_pkgconfig
            ctx['libraries'] += ["openzwave"]
            extra = pyozw_pkgconfig.cflags('libopenzwave')
            if extra != '':
                for ssubstitute in ['/', '/value_classes/', '/platform/']:
                    ctx['extra_compile_args'] += [
                        extra.replace('//', ssubstitute)
                    ]

    elif sys.platform.startswith("cygwin"):
        if static:
            ctx['libraries'] += ["udev", "stdc++", 'resolv']
            ctx['extra_objects'] = ["{0}/libopenzwave.a".format(openzwave)]
            ctx['include_dirs'] += ["{0}/cpp/build/linux".format(openzwave)]
        else:
            import pyozw_pkgconfig
            ctx['libraries'] += ["openzwave"]
            extra = pyozw_pkgconfig.cflags('libopenzwave')
            if extra != '':
                for ssubstitute in ['/', '/value_classes/', '/platform/']:
                    ctx['extra_compile_args'] += [
                        extra.replace('//', ssubstitute)
                    ]

    elif sys.platform.startswith("darwin"):
        ctx['extra_link_args'] += [
            "-framework", "CoreFoundation", "-framework", "IOKit"
        ]
        ctx['extra_compile_args'] += [
            "-stdlib=libc++", "-mmacosx-version-min=10.7"
        ]

        if static:
            ctx['extra_objects'] = ["{0}/libopenzwave.a".format(openzwave)]
            ctx['include_dirs'] += ["{0}/cpp/build/mac".format(openzwave)]
        else:
            import pyozw_pkgconfig
            ctx['libraries'] += ["openzwave"]
            extra = pyozw_pkgconfig.cflags('libopenzwave')
            if extra != '':
                for ssubstitute in ['/', '/value_classes/', '/platform/']:
                    ctx['extra_compile_args'] += [
                        extra.replace('//', ssubstitute)
                    ]

    elif sys.platform.startswith("freebsd"):
        if static:
            ctx['libraries'] += ["usb", "stdc++"]
            ctx['extra_objects'] = ["{0}/libopenzwave.a".format(openzwave)]
            ctx['include_dirs'] += ["{0}/cpp/build/linux".format(openzwave)]
        else:
            import pyozw_pkgconfig
            ctx['libraries'] += ["openzwave"]
            extra = pyozw_pkgconfig.cflags('libopenzwave')
            if extra != '':
                for ssubstitute in ['/', '/value_classes/', '/platform/']:
                    ctx['extra_compile_args'] += [
                        extra.replace('//', ssubstitute)
                    ]

    elif sys.platform.startswith("sunos"):
        if static:
            ctx['libraries'] += ["udev", "stdc++", 'resolv']
            ctx['extra_objects'] = ["{0}/libopenzwave.a".format(openzwave)]
            ctx['include_dirs'] += ["{0}/cpp/build/linux".format(openzwave)]
        else:
            import pyozw_pkgconfig
            ctx['libraries'] += ["openzwave"]
            extra = pyozw_pkgconfig.cflags('libopenzwave')
            if extra != '':
                for ssubstitute in ['/', '/value_classes/', '/platform/']:
                    ctx['extra_compile_args'] += [
                        extra.replace('//', ssubstitute)
                    ]

    elif sys.platform.startswith("linux"):
        if static:
            ctx['libraries'] += ["udev", "stdc++", 'resolv']
            ctx['extra_objects'] = ["{0}/libopenzwave.a".format(openzwave)]
            ctx['include_dirs'] += ["{0}/cpp/build/linux".format(openzwave)]
        else:
            import pyozw_pkgconfig
            ctx['libraries'] += ["openzwave"]
            extra = pyozw_pkgconfig.cflags('libopenzwave')
            if extra != '':
                for ssubstitute in ['/', '/value_classes/', '/platform/']:
                    ctx['extra_compile_args'] += [
                        extra.replace('//', ssubstitute)
                    ]

    else:
        # Unknown systemm
        raise RuntimeError("Can't detect plateform {0}".format(sys.platform))

    return ctx