Beispiel #1
0
    def BuildObject(self, env, obj):
        if (not obj.option_['gen_cpp'] and not obj.option_['gen_php']
                and not obj.option_['gen_py']):
            print Util.BuildMessage(
                '%s: at least specify one generated '
                'language(gen_cpp,gen_php, gen_py)' % obj.name_, 'WARNING')
        source = [Path.GetAbsPath(x) for x in obj.sources_]
        if obj.option_['gen_cpp']:
            cpp_outdir = self._GetOutputDir(obj)
            cpp_sources = env.ThriftCppLibrary([],
                                               source,
                                               THRIFTOUTDIR=cpp_outdir)
            cpp_path = ['.']
            cpp_path.append(Path.GetOutputDir())
            cpp_path.append(Path.GetThriftOutPath())
            cpp_path.append(Path.AddBaseDir('third_part/boost/include'))
            cpp_path.append(Path.AddBaseDir('third_part/libevent'))
            cpp_path.append(Path.AddBaseDir('third_part/thrift/include'))

            target = Path.GetAbsRelativePath(obj.name_)
            cc_flags = env['CCFLAGS']
            cc_flags += " -Wno-return-type -DHAVE_NETINET_IN_H"
            print Util.BuildMessage(target)
            env.StaticLibrary(target=target,
                              source=cpp_sources,
                              CPPPATH=cpp_path,
                              CCFLAGS=cc_flags)

        if obj.option_['gen_php']:
            php_outdir = self._GetOutputDir(obj)
            php_sources = env.ThriftPhpLibrary([],
                                               source,
                                               THRIFTOUTDIR=php_outdir)

        if obj.option_['gen_py']:
            py_outdir = self._GetOutputDir(obj)
            target = []
            py_sources = env.ThriftPyLibrary(target,
                                             source,
                                             THRIFTOUTDIR=py_outdir)
Beispiel #2
0
 def BuildObject(self, env, obj):
     if (not obj.option_['gen_cpp'] and not obj.option_['gen_py']):
         print Util.BuildMessage(
             '%s: at least specify one generated '
             'language(gen_cpp, gen_py)' % obj.name_, 'WARNING')
     source = [Path.GetAbsPath(x) for x in obj.sources_]
     if obj.option_['gen_cpp']:
         cpp_source = env.ProtoCppLibrary([], source)
         cpp_path = Cpp.GetCppInclude(obj)
         target = Path.GetAbsRelativePath(obj.name_)
         env.StaticLibrary(target=target,
                           source=cpp_source,
                           CPPPATH=cpp_path)
     if obj.option_['gen_py']:
         py_source = env.ProtoPyLibrary([], source)