def build(conf, installdir, clean):
    buildenv.setup_env(installdir)
    installdir = installdir
    if not os.path.exists(installdir):
        os.makedirs(installdir)
        os.makedirs(os.path.join(installdir, 'bin'))
        os.makedirs(os.path.join(installdir, 'lib'))
        os.makedirs(os.path.join(installdir, 'include'))
    try:
        wd = os.path.join(buildenv.ROOT_DIR, 'build', 'tmp')
        if not os.path.exists(wd):
            os.makedirs(wd)

        if clean:
            for e in os.listdir(wd):
                p = os.path.join(wd, e)
                if os.path.isdir(p):
                    print('Removing temporary directory: ' + p)
                    shutil.rmtree(p)
            return 0

        prepend_common_envpaths(installdir)
        if conf.win and not build_zlib(wd, installdir, conf):
            return -1
        if not build_protobuf3(wd, installdir, conf):
            return -1
        if not build_boringssl(wd, installdir, conf):
            return -1
        if not build_grpc(wd, installdir, conf):
            return -1
        return 0
    except:
        print('ERROR')
        raise
示例#2
0
 def __init__(self, cc, cxx, shared, debug, jobs, installdir,
              thread_sanitizer, grpc):
     self.env = copy.deepcopy(os.environ)
     self.installdir = installdir
     buildenv.setup_env(self.installdir, self.env)
     self.win = platform.system() == 'Windows'
     self.make = ['nmake'] if self.win else ['ninja', '-j', '%d' % jobs]
     self.cc = cc
     self.cxx = cxx
     self.shared = shared
     self.debug = debug
     self.grpc = grpc
     self.thread_sanitizer = thread_sanitizer
     if self.thread_sanitizer:
         self.sanitizer_cflag = '-fsanitize=thread -O1'
         # self.sanitizer_cflag = ''
         self.sanitizer_cxxflag = '-fsanitize=thread -O1'
         self.sanitizer_ldflag = '-fsanitize=thread'
     else:
         self.sanitizer_cflag = ''
         self.sanitizer_cxxflag = ''
         self.sanitizer_ldflag = ''
     if self.win:
         logger.info('Platform is Windows')
         self.libprefix = ''
         self.libext = '.dll' if shared else '.lib'
         self.execext = '.exe'
     else:
         self.libprefix = 'lib'
         self.libext = '.so' if shared else '.a'
         self.execext = ''
def build(conf, installdir, clean):
  buildenv.setup_env(installdir)
  installdir = installdir
  if not os.path.exists(installdir):
    os.makedirs(installdir)
    os.makedirs(os.path.join(installdir, 'bin'))
    os.makedirs(os.path.join(installdir, 'lib'))
    os.makedirs(os.path.join(installdir, 'include'))
  try:
    wd = os.path.join(buildenv.ROOT_DIR, 'build', 'tmp')
    if not os.path.exists(wd):
      os.makedirs(wd)

    if clean:
      for e in os.listdir(wd):
        p = os.path.join(wd, e)
        if os.path.isdir(p):
          print('Removing temporary directory: ' + p)
          shutil.rmtree(p)
      return 0

    prepend_common_envpaths(installdir)
    if conf.win and not build_zlib(wd, installdir, conf):
      return -1
    if not build_protobuf3(wd, installdir, conf):
      return -1
    if not build_boringssl(wd, installdir, conf):
      return -1
    if not build_grpc(wd, installdir, conf):
      return -1
    return 0
  except:
    print('ERROR')
    raise
示例#4
0
def main(argv):
  default_conf = 'Debug' if os.path.basename(os.getcwd()) == 'Debug' else 'Release'
  p = argparse.ArgumentParser()
  p.add_argument('--configuration', '-C', default=default_conf)
  p.add_argument('--out', '-o', default=buildenv.DEFAULT_OUT, help='build directory path')
  args = p.parse_args(argv)
  buildenv.setup_env(os.path.join(buildenv.DEFAULT_DEPS, args.configuration))
  out = os.path.join(args.out, args.configuration)
  p = run_test_server(out)
  try:
    return run_client_test(out)
  finally:
    p.kill()
示例#5
0
def build(configuration, out, args, cmake_args):
    deps_dir = args.dependency_root or os.path.join(buildenv.DEFAULT_DEPS,
                                                    configuration)
    buildenv.setup_env(deps_dir)
    if not os.path.exists(out):
        os.makedirs(out)

    cmd = [
        'cmake',
        '-G%s' % args.generator,
        '-DCMAKE_BUILD_TYPE=%s' % configuration,
        '-DCMAKE_PREFIX_PATH=%s' % deps_dir,
        '-DProtobuf_DIR=%s/lib64/cmake' % deps_dir,
        '-DGRPC_ROOT=%s' % deps_dir,
    ]

    if args.qt5dir:
        cmd.extend([
            '-DQt5Core_DIR=%s/Qt5Core' % args.qt5dir,
            '-DQt5Qml_DIR=%s/Qt5Qml' % args.qt5dir,
            '-DQt5Quick_DIR=%s/Qt5Quick' % args.qt5dir,
            '-DQt5Test_DIR=%s/Qt5Test' % args.qt5dir,
            '-DQt5QuickTest_DIR=%s/Qt5QuickTest' % args.qt5dir,
        ])

    cc = args.cc or (args.clang and 'clang')
    cxx = args.cxx or (args.clang and 'clang++')
    blacklist = os.path.join(buildenv.ROOT_DIR, 'tsan-blacklist.txt')
    if cc:
        cmd.append('-DCMAKE_C_COMPILER=' + cc)
    if cxx:
        cmd.append('-DCMAKE_CXX_COMPILER=' + cxx)
    if args.tsan:
        cmd.append(
            '-DCMAKE_CXX_FLAGS=-fsanitize=thread -fsanitize-blacklist=%s -fPIC -O1'
            % blacklist)
        cmd.append('-DCMAKE_CXX_FLAGS_DEBUG=-O1 -g3')
        cmd.append('-DCMAKE_CXX_FLAGS_RELEASE=-g')
        cmd.append(
            '-DCMAKE_C_FLAGS=-fsanitize=thread -fsanitize-blacklist=%s -fPIC' %
            blacklist)
        cmd.append('-DCMAKE_C_FLAGS_DEBUG=-O1 -g3')
        cmd.append('-DCMAKE_C_FLAGS_RELEASE=-g')

    cmd.extend(cmake_args)
    cmd.append(buildenv.ROOT_DIR)

    print('Invoking cmake command: %s' % ' '.join(cmd))
    return subprocess.call(cmd, cwd=out)
示例#6
0
def main(argv):
    default_conf = 'Debug' if os.path.basename(
        os.getcwd()) == 'Debug' else 'Release'
    p = argparse.ArgumentParser()
    p.add_argument('--configuration', '-C', default=default_conf)
    p.add_argument('--out',
                   '-o',
                   default=buildenv.DEFAULT_OUT,
                   help='build directory path')
    args = p.parse_args(argv)
    buildenv.setup_env(os.path.join(buildenv.DEFAULT_DEPS, args.configuration))
    out = os.path.join(args.out, args.configuration)
    p = run_test_server(out)
    try:
        return run_client_test(out)
    finally:
        p.kill()
示例#7
0
def build(configuration, out, args, cmake_args):
    deps_dir = args.dependency_root or os.path.join(
        buildenv.DEFAULT_DEPS, configuration)
    buildenv.setup_env(deps_dir)
    if not os.path.exists(out):
        os.makedirs(out)

    cmd = [
        'cmake',
        '-G%s' % args.generator,
        '-DCMAKE_BUILD_TYPE=%s' % configuration,
        '-DCMAKE_PREFIX_PATH=%s' % deps_dir,
        '-DProtobuf_DIR=%s/lib64/cmake' % deps_dir,
        '-DGRPC_ROOT=%s' % deps_dir,
    ]

    if args.qt5dir:
        cmd.extend([
            '-DQt5Core_DIR=%s/Qt5Core' % args.qt5dir,
            '-DQt5Qml_DIR=%s/Qt5Qml' % args.qt5dir,
            '-DQt5Quick_DIR=%s/Qt5Quick' % args.qt5dir,
            '-DQt5Test_DIR=%s/Qt5Test' % args.qt5dir,
            '-DQt5QuickTest_DIR=%s/Qt5QuickTest' % args.qt5dir,
        ])

    cc = args.cc or (args.clang and 'clang')
    cxx = args.cxx or (args.clang and 'clang++')
    blacklist = os.path.join(buildenv.ROOT_DIR, 'tsan-blacklist.txt')
    if cc:
        cmd.append('-DCMAKE_C_COMPILER=' + cc)
    if cxx:
        cmd.append('-DCMAKE_CXX_COMPILER=' + cxx)
    if args.tsan:
        cmd.append('-DCMAKE_CXX_FLAGS=-fsanitize=thread -fsanitize-blacklist=%s -fPIC -O1' % blacklist)
        cmd.append('-DCMAKE_CXX_FLAGS_DEBUG=-O1 -g3')
        cmd.append('-DCMAKE_CXX_FLAGS_RELEASE=-g')
        cmd.append('-DCMAKE_C_FLAGS=-fsanitize=thread -fsanitize-blacklist=%s -fPIC' % blacklist)
        cmd.append('-DCMAKE_C_FLAGS_DEBUG=-O1 -g3')
        cmd.append('-DCMAKE_C_FLAGS_RELEASE=-g')

    cmd.extend(cmake_args)
    cmd.append(buildenv.ROOT_DIR)

    print('Invoking cmake command: %s' % ' '.join(cmd))
    return subprocess.call(cmd, cwd=out)
示例#8
0
def build(configuration, out, args, cmake_args):
    deps_dir = os.path.join(buildenv.DEFAULT_DEPS, configuration)
    buildenv.setup_env(deps_dir)
    if not os.path.exists(out):
        os.makedirs(out)

    libext = '.lib' if platform.system() == 'Windows' else '.so'
    exeext = '.exe' if platform.system() == 'Windows' else ''

    cmd = [
        'cmake',
        '-G%s' % args.generator,
        '-DCMAKE_BUILD_TYPE=%s' % configuration,
        '-DCMAKE_PREFIX_PATH=%s' % deps_dir,
        '-DPROTOBUF_PROTOC_LIBRARY=%s/lib/libprotoc%s' % (deps_dir, libext),
        '-DPROTOBUF_PROTOC_LIBRARY_DEBUG=%s/lib/libprotoc%s' %
        (deps_dir, libext),
        '-DPROTOBUF_LIBRARY=%s/lib/libprotobuf%s' % (deps_dir, libext),
        '-DPROTOBUF_LIBRARY_DEBUG=%s/lib/libprotobuf%s' % (deps_dir, libext),
        '-DPROTOBUF_INCLUDE_DIR=%s/include' % deps_dir,
        '-DPROTOBUF_PROTOC_EXECUTABLE=%s/bin/protoc%s' % (deps_dir, exeext),
        '-DGRPC_ROOT=%s' % deps_dir,
    ]

    if args.qt5dir:
        cmd.extend([
            '-DQt5Core_DIR=%s/Qt5Core' % args.qt5dir,
            '-DQt5Qml_DIR=%s/Qt5Qml' % args.qt5dir,
            '-DQt5Quick_DIR=%s/Qt5Quick' % args.qt5dir,
            '-DQt5Test_DIR=%s/Qt5Test' % args.qt5dir,
            '-DQt5QuickTest_DIR=%s/Qt5QuickTest' % args.qt5dir,
        ])

    cc = args.cc or (args.clang and 'clang')
    cxx = args.cxx or (args.clang and 'clang++')
    if cc:
        cmd.append('-DCMAKE_C_COMPILER=' + cc)
    if cxx:
        cmd.append('-DCMAKE_CXX_COMPILER=' + cxx)

    cmd.extend(cmake_args)
    cmd.append(buildenv.ROOT_DIR)

    print('Invoking cmake command: %s' % ' '.join(cmd))
    return subprocess.call(cmd, cwd=out)
示例#9
0
def build(configuration, out, args, cmake_args):
  deps_dir = os.path.join(buildenv.DEFAULT_DEPS, configuration)
  buildenv.setup_env(deps_dir)
  if not os.path.exists(out):
    os.makedirs(out)

  libext = '.lib' if platform.system() == 'Windows' else '.so'
  exeext = '.exe' if platform.system() == 'Windows' else ''

  cmd = [
    'cmake',
    '-G%s' % args.generator,
    '-DCMAKE_BUILD_TYPE=%s' % configuration,
    '-DCMAKE_PREFIX_PATH=%s' % deps_dir,
    '-DPROTOBUF_PROTOC_LIBRARY=%s/lib/libprotoc%s' % (deps_dir, libext),
    '-DPROTOBUF_PROTOC_LIBRARY_DEBUG=%s/lib/libprotoc%s' % (deps_dir, libext),
    '-DPROTOBUF_LIBRARY=%s/lib/libprotobuf%s' % (deps_dir, libext),
    '-DPROTOBUF_LIBRARY_DEBUG=%s/lib/libprotobuf%s' % (deps_dir, libext),
    '-DPROTOBUF_INCLUDE_DIR=%s/include' % deps_dir,
    '-DPROTOBUF_PROTOC_EXECUTABLE=%s/bin/protoc%s' % (deps_dir, exeext),
    '-DGRPC_ROOT=%s' % deps_dir,
  ]

  if args.qt5dir:
    cmd.extend([
      '-DQt5Core_DIR=%s/Qt5Core' % args.qt5dir,
      '-DQt5Qml_DIR=%s/Qt5Qml' % args.qt5dir,
      '-DQt5Quick_DIR=%s/Qt5Quick' % args.qt5dir,
      '-DQt5Test_DIR=%s/Qt5Test' % args.qt5dir,
      '-DQt5QuickTest_DIR=%s/Qt5QuickTest' % args.qt5dir,
    ])

  cc = args.cc or (args.clang and 'clang')
  cxx = args.cxx or (args.clang and 'clang++')
  if cc:
    cmd.append('-DCMAKE_C_COMPILER=' + cc)
  if cxx:
    cmd.append('-DCMAKE_CXX_COMPILER=' + cxx)

  cmd.extend(cmake_args)
  cmd.append(buildenv.ROOT_DIR)

  print('Invoking cmake command: %s' % ' '.join(cmd))
  return subprocess.call(cmd, cwd=out)
 def __init__(self, cc, cxx, shared, debug, jobs, installdir):
   self.env = copy.deepcopy(os.environ)
   self.installdir = installdir
   buildenv.setup_env(self.installdir, self.env)
   self.win = platform.system() == 'Windows'
   self.make = ['nmake'] if self.win else ['ninja', '-j', '%d' % jobs]
   self.cc = cc
   self.cxx = cxx
   self.shared = shared
   self.debug = debug
   if self.win:
     logger.info('Platform is Windows')
     self.libprefix = ''
     self.libext = '.dll' if shared else '.lib'
     self.execext = '.exe'
   else:
     self.libprefix = 'lib'
     self.libext = '.so' if shared else '.a'
     self.execext = ''
示例#11
0
 def __init__(self, cc, cxx, shared, debug, jobs, installdir):
     self.env = copy.deepcopy(os.environ)
     self.installdir = installdir
     buildenv.setup_env(self.installdir, self.env)
     self.win = platform.system() == 'Windows'
     self.make = ['nmake'] if self.win else ['ninja', '-j', '%d' % jobs]
     self.cc = cc
     self.cxx = cxx
     self.shared = shared
     self.debug = debug
     if self.win:
         logger.info('Platform is Windows')
         self.libprefix = ''
         self.libext = '.dll' if shared else '.lib'
         self.execext = '.exe'
     else:
         self.libprefix = 'lib'
         self.libext = '.so' if shared else '.a'
         self.execext = ''