示例#1
0
文件: util.py 项目: Funsom/taichi
def build():
  tmp_cwd = os.getcwd()
  bin_dir = get_build_directory()

  try:
    os.mkdir(bin_dir)
  except:
    pass
  os.chdir(bin_dir)

  flags = ' -DPYTHON_EXECUTABLE:FILEPATH="{}"'.format(sys.executable)

  print('Running cmake...')
  if is_ci():
    print('  Note: building for CI. SIMD disabled.')
    flags += ' -DTC_DISABLE_SIMD:BOOL=1'
  if get_os_name() == 'win':
    flags += ' -G "Visual Studio 15 Win64"'
  cmake_ret = os.system('cmake .. ' + flags)
  if cmake_ret != 0:
    print('  Error: CMake failed.')
    exit(-1)

  import multiprocessing
  print('Building taichi...')
  num_make_threads = min(20, multiprocessing.cpu_count())
  if get_os_name() == 'win':
    make_ret = os.system("msbuild /p:Configuration=Release /p:Platform=x64 /m taichi.sln")
  else:
    make_ret = os.system('make -j {}'.format(num_make_threads))
  if make_ret != 0:
    print('  Error: Build failed.')
    exit(-1)

  os.chdir(tmp_cwd)
示例#2
0
def build():
    tmp_cwd = os.getcwd()
    bin_dir = get_build_directory()

    try:
        os.mkdir(bin_dir)
    except:
        pass
    os.chdir(bin_dir)

    import multiprocessing
    print('Building taichi...')
    num_make_threads = min(20, multiprocessing.cpu_count())
    if get_os_name() == 'win':
        make_ret = os.system(
            "msbuild /p:Configuration=Release /p:Platform=x64 /m taichi.sln")
    else:
        make_ret = os.system('make -j {}'.format(num_make_threads))
    if make_ret != 0:
        print('  Error: Build failed.')
        exit(-1)

    os.chdir(tmp_cwd)