コード例 #1
0
def build():
  tmp_cwd = os.getcwd()
  bin_dir = get_bin_directory()

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

  if os.environ.get('TC_CI', '') == '1':
    print('  Note: building for CI. SIMD disabled.')
    cmake_ret = os.system('cmake .. -DTC_DISABLE_SIMD:BOOL=1')
  else:
    cmake_ret = os.system('cmake ..')
  if cmake_ret != 0:
    print('  Error: CMake failed.')
    exit(-1)

  import multiprocessing
  num_make_threads = min(20, multiprocessing.cpu_count())
  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_from_source():
    tmp_cwd = os.getcwd()
    bin_dir = get_bin_directory()

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

    if os.environ.get('TC_CI', '') == '1':
        print('  Note: building for CI. SIMD disabled.')
        cmake_ret = os.system('cmake .. -DTC_DISABLE_SIMD:BOOL=1')
    else:
        cmake_ret = os.system('cmake ..')
    if cmake_ret != 0:
        print('  Error: cmake failed.')
        exit(-1)

    make_ret = os.system('make -j8')
    if make_ret != 0:
        print('  Error: make failed.')
        exit(-1)

    os.chdir(tmp_cwd)
コード例 #3
0
    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)


if get_os_name() == 'osx':
    bin_dir = get_bin_directory()
    os.environ['DYLD_FALLBACK_LIBRARY_PATH'] = get_runtime_directory()
    if not os.path.exists(os.path.join(bin_dir, 'libtaichi_core.dylib')):
        build()
    tmp_cwd = os.getcwd()
    os.chdir(bin_dir)
    shutil.copy('libtaichi_core.dylib', 'taichi_core.so')
    sys.path.append(bin_dir)
    import taichi_core as tc_core
    os.chdir(tmp_cwd)
elif get_os_name() == 'linux':
    bin_dir = get_bin_directory()
    os.environ['LD_LIBRARY_PATH'] = '/usr/lib64/'
    if not os.path.exists(os.path.join(bin_dir, 'libtaichi_core.so')):
        build()
    tmp_cwd = os.getcwd()
コード例 #4
0
ファイル: util.py プロジェクト: MarcusRobbins/ripple
def get_core_shared_object():
    if is_release():
        directory = os.path.join(package_root(), 'lib')
    else:
        directory = get_bin_directory()
    return os.path.join(directory, 'libtaichi_core.so')
コード例 #5
0
import atexit
import os
import shutil
import sys

from taichi.misc.settings import get_output_directory, get_bin_directory, get_root_directory
from taichi.misc.util import get_os_name, get_unique_task_id

CREATE_SAND_BOX_ON_WINDOWS = True

if get_os_name() == 'osx':
    bin_dir = get_bin_directory() + '/'
    if os.path.exists(bin_dir + 'libtaichi_core.dylib'):
        tmp_cwd = os.getcwd()
        os.chdir(bin_dir)
        shutil.copy('libtaichi_core.dylib', 'taichi_core.so')
        sys.path.append(bin_dir)
        import taichi_core as tc_core

        os.chdir(tmp_cwd)
    else:
        assert False, "Library taichi_core doesn't exist."
elif get_os_name() == 'linux':
    bin_dir = get_bin_directory() + '/'
    os.environ['LD_LIBRARY_PATH'] = '/usr/lib64/'
    if os.path.exists(bin_dir + 'libtaichi_core.so'):
        tmp_cwd = os.getcwd()
        os.chdir(bin_dir)
        sys.path.append(bin_dir)
        shutil.copy('libtaichi_core.so', 'taichi_core.so')
        import taichi_core as tc_core