Beispiel #1
0
def prepare(root, config):
    # Test whether the main options are present
    if not config.has_option('Main', 'prefix'):
        raise Exception('prefix not defined')
    setDefaultConfigOption(config, 'Main', 'cc', 'gcc')
    setDefaultConfigOption(config, 'Main', 'cxx', 'g++')
    setDefaultConfigOption(config, 'Main', 'architecture', 'intel64')
    setDefaultConfigOption(config, 'Main', 'flags', "")
    setDefaultConfigOption(config, 'Main', 'libs', "")
    setDefaultConfigOption(config, 'Main', 'cflags', "")
    setDefaultConfigOption(config, 'Main', 'cxxflags', "")
    setDefaultConfigOption(config, 'Main', 'root_dir', root)
    setDefaultConfigOption(config, 'Main', 'build_jobs', "1")

    # Retrieve path to configuration file
    optfile = config.get('Main', 'optfile')

    # Retrieve build directory
    setDefaultConfigOption(config, 'Main', 'build_dir', root + '/build')
    build_dir = normalizePath(config, config.get('Main', 'build_dir'))
    # Set build directories for BEM++ and its dependencies
    config.set('Main', 'build_dir', build_dir)
    config.set('Bempp', 'build_dir', build_dir + '/bempp')
    config.set('Main', 'dependency_build_dir', build_dir + '/contrib')
    # Set
    config.set('Main', 'dependency_download_dir', root + '/installer/files')

    # Set default MKL/libs option
    setDefaultConfigOption(config, 'MKL', 'lib', "-lmkl_rt")

    # Set default MPI options

    setDefaultConfigOption(config, 'MPI', 'enable_mpi', 'false')
    setDefaultConfigOption(config, 'MPI', 'mpi_cxx_libs', '')
    setDefaultConfigOption(config, 'MPI', 'mpi_include_dir', '')
    enable_mpi = to_bool(config.get('MPI', 'enable_mpi'))

    if enable_mpi:
        mpi_include_dir = config.get('MPI', 'mpi_include_dir')
        cflags = config.get('Main', 'cflags')
        cxxflags = config.get('Main', 'cxxflags')
        config.set('Main', 'with_mpi', 'ON')
        config.set('Main', 'cflags', cflags + " -I" + mpi_include_dir)
        config.set('Main', 'cxxflags', cxxflags + " -I" + mpi_include_dir)
    else:
        config.set('MPI', 'with_mpi', 'OFF')

    # Set empty BLAS/Lapack options if none exist
    setDefaultConfigOption(config, 'BLAS', 'lib', "")
    setDefaultConfigOption(config, 'LAPACK', 'lib', "")

    # Add the correct architecture parameters
    cflags = config.get('Main', 'cflags')
    cxxflags = config.get('Main', 'cxxflags')

    arch = config.get('Main', 'architecture')
    if not arch in ['ia32', 'ia64', 'intel64']:
        raise Exception("Architecture '" + arch + "' is not supported. "
                        "Supported architectures: ia32, ia64, intel64.")

    if sys.platform.startswith('darwin'):
        if arch == 'intel64':
            param = '-arch x86_64'
        else:
            param = '-arch i386'
        config.set('Main', 'cflags', cflags + " " + param)
        config.set('Main', 'cxxflags', cxxflags + " " + param)
        setDefaultConfigOption(config, 'Main', 'optflags', '-O3 -march=core2')
    elif sys.platform.startswith('linux'):
        if arch == 'intel64' or arch == 'ia64':
            param = '-m64'
        else:
            param = '-m32'
        config.set('Main', 'cflags', cflags + " " + param)
        config.set('Main', 'cxxflags', cxxflags + " " + param)
        setDefaultConfigOption(config, 'Main', 'optflags', '-O3 -march=native')
    else:
        raise Exception("Platform '" + sys.platform + "' is not supported")

    # Add the correct Python options

    import numpy

    (py_exe, py_lib, py_include) = pythonInfo(config)
    setDefaultConfigOption(config, 'Python', 'exe', py_exe)
    setDefaultConfigOption(config, 'Python', 'lib', py_lib)
    setDefaultConfigOption(config, 'Python', 'include_dir', py_include)
    setDefaultConfigOption(config, 'Python', 'numpy_include_dir',
                           numpy.get_include())

    # Add the CMake configuration

    prefix = config.get('Main', 'prefix')
    setDefaultConfigOption(config,
                           "CMake",
                           "exe",
                           prefix + "/bempp/bin/cmake",
                           overwrite=True)
Beispiel #2
0
def prepare(root,config):
    # Test whether the main options are present
    if not config.has_option('Main','prefix'): raise Exception('prefix not defined')
    setDefaultConfigOption(config,'Main','cc','gcc')
    setDefaultConfigOption(config,'Main','cxx','g++')
    setDefaultConfigOption(config,'Main','architecture','intel64')
    setDefaultConfigOption(config,'Main','flags',"")
    setDefaultConfigOption(config,'Main','libs',"")
    setDefaultConfigOption(config,'Main','cflags',"")
    setDefaultConfigOption(config,'Main','cxxflags',"")
    setDefaultConfigOption(config,'Main','root_dir',root)
    setDefaultConfigOption(config,'Main','build_jobs',"1")

    # Retrieve path to configuration file
    optfile = config.get('Main','optfile')

    # Retrieve build directory
    setDefaultConfigOption(config,'Main','build_dir',root+'/build')
    build_dir = normalizePath(config, config.get('Main','build_dir'))
    # Set build directories for BEM++ and its dependencies
    config.set('Main','build_dir',build_dir)
    config.set('Bempp','build_dir',build_dir+'/bempp')
    config.set('Main','dependency_build_dir',build_dir+'/contrib')
    # Set
    config.set('Main','dependency_download_dir',root+'/installer/files')

    # Set default MKL/libs option
    setDefaultConfigOption(config,'MKL','lib',"-lmkl_rt")

    # Set default MPI options

    setDefaultConfigOption(config,'MPI','enable_mpi','false')
    setDefaultConfigOption(config,'MPI','mpi_cxx_libs','')
    setDefaultConfigOption(config,'MPI','mpi_include_dir','')
    enable_mpi = to_bool(config.get('MPI','enable_mpi'))

    if enable_mpi:
        mpi_include_dir = config.get('MPI','mpi_include_dir')
        cflags = config.get('Main','cflags')
        cxxflags = config.get('Main','cxxflags')
        config.set('Main','with_mpi','ON')
        if len(mpi_include_dir)>0:
	        config.set('Main','cflags',cflags+" -I"+mpi_include_dir)
	        config.set('Main','cxxflags',cxxflags+" -I"+mpi_include_dir)
    else:
        config.set('MPI','with_mpi','OFF')

 


    # Set empty BLAS/Lapack options if none exist
    setDefaultConfigOption(config,'BLAS','lib',"")
    setDefaultConfigOption(config,'LAPACK','lib',"")

    # Add the correct architecture parameters
    cflags = config.get('Main','cflags')
    cxxflags = config.get('Main','cxxflags')

    arch = config.get('Main','architecture')
    if not arch in ['ia32','ia64','intel64']:
        raise Exception("Architecture '"+arch+"' is not supported. "
                        "Supported architectures: ia32, ia64, intel64.")

    if sys.platform.startswith('darwin'):
        if arch=='intel64':
            param = '-arch x86_64'
        else:
            param = '-arch i386'
        config.set('Main','cflags',cflags+" "+param)
        config.set('Main','cxxflags',cxxflags+" "+param)
        setDefaultConfigOption(config,'Main','optflags','-O3 -march=core2')
    elif sys.platform.startswith('linux'):
        if arch=='intel64' or arch=='ia64':
            param = '-m64'
        else:
            param = '-m32'
        config.set('Main','cflags',cflags+" "+param)
        config.set('Main','cxxflags',cxxflags+" "+param)
        setDefaultConfigOption(config,'Main','optflags','-O3 -march=native')
    else:
        raise Exception("Platform '"+sys.platform+"' is not supported")

    # Add the correct Python options

    import numpy

    (py_exe,py_lib,py_include) = pythonInfo(config)
    setDefaultConfigOption(config,'Python','exe',py_exe)
    setDefaultConfigOption(config,'Python','lib',py_lib)
    setDefaultConfigOption(config,'Python','include_dir',py_include)
    setDefaultConfigOption(config,'Python','numpy_include_dir',numpy.get_include())


    # Check for OS X Mavericks
    have_mavericks = False
    plat = platform.system()
    if plat == 'Darwin':
        have_mavericks = True if platform.mac_ver()[0]=='10.9' else False
        # Add the CMake configuration

    if config.has_option('CMake','exe'):
        cmake_executable = tools.which(config.get('CMake','exe'))
        if cmake_executable is None:
            raise Exception("CMake command specified in [CMake] section not found.")
        tools.setDefaultConfigOption(config,'CMake','exe',cmake_executable,overwrite=True)
    else:
        # CMake must have been or will be  downloaded by the bootstrap mechanism
        cmake_executable = prefix+'/bempp/bin/cmake'
        if os.path.isfile(cmake_executable):
            tools.setDefaultConfigOption(config,'CMake','exe',cmake_executable,overwrite=True)
Beispiel #3
0
def prepare(root,config):
    # Test whether the main options are present
    if not config.has_option('Main','prefix'): raise Exception('prefix not defined')
    setDefaultConfigOption(config,'Main','cc','gcc')
    setDefaultConfigOption(config,'Main','cxx','g++')
    setDefaultConfigOption(config,'Main','architecture','intel64')
    setDefaultConfigOption(config,'Main','flags',"")
    setDefaultConfigOption(config,'Main','libs',"")
    setDefaultConfigOption(config,'Main','cflags',"")
    setDefaultConfigOption(config,'Main','cxxflags',"")
    setDefaultConfigOption(config,'Main','root_dir',root)
    setDefaultConfigOption(config,'Main','build_jobs',"1")

    # Retrieve path to configuration file
    optfile = config.get('Main','optfile')

    # Retrieve build directory
    setDefaultConfigOption(config,'Main','build_dir',root+'/build')
    build_dir = normalizePath(config, config.get('Main','build_dir'))
    # Set build directories for BEM++ and its dependencies
    config.set('Main','build_dir',build_dir)
    config.set('Bempp','build_dir',build_dir+'/bempp')
    config.set('Main','dependency_build_dir',build_dir+'/contrib')
    # Set
    config.set('Main','dependency_download_dir',root+'/installer/files')

    # Set default MKL/libs option
    setDefaultConfigOption(config,'MKL','lib',"-lmkl_rt")

    # Set default MPI options

    setDefaultConfigOption(config,'MPI','enable_mpi','false')
    setDefaultConfigOption(config,'MPI','mpi_cxx_libs','')
    setDefaultConfigOption(config,'MPI','mpi_include_dir','')
    enable_mpi = to_bool(config.get('MPI','enable_mpi'))

    if enable_mpi:
        mpi_include_dir = config.get('MPI','mpi_include_dir')
        cflags = config.get('Main','cflags')
        cxxflags = config.get('Main','cxxflags')
        config.set('Main','with_mpi','ON')
        if len(mpi_include_dir)>0:
	        config.set('Main','cflags',cflags+" -I"+mpi_include_dir)
	        config.set('Main','cxxflags',cxxflags+" -I"+mpi_include_dir)
    else:
        config.set('MPI','with_mpi','OFF')

 


    # Set empty BLAS/Lapack options if none exist
    setDefaultConfigOption(config,'BLAS','lib',"")
    setDefaultConfigOption(config,'LAPACK','lib',"")

    # Add the correct architecture parameters
    cflags = config.get('Main','cflags')
    cxxflags = config.get('Main','cxxflags')

    arch = config.get('Main','architecture')
    if not arch in ['ia32','ia64','intel64']:
        raise Exception("Architecture '"+arch+"' is not supported. "
                        "Supported architectures: ia32, ia64, intel64.")

    if sys.platform.startswith('darwin'):
        if arch=='intel64':
            param = '-arch x86_64'
        else:
            param = '-arch i386'
        config.set('Main','cflags',cflags+" "+param)
        config.set('Main','cxxflags',cxxflags+" "+param)
        setDefaultConfigOption(config,'Main','optflags','-O3 -march=core2')
    elif sys.platform.startswith('linux'):
        if arch=='intel64' or arch=='ia64':
            param = '-m64'
        else:
            param = '-m32'
        config.set('Main','cflags',cflags+" "+param)
        config.set('Main','cxxflags',cxxflags+" "+param)
        setDefaultConfigOption(config,'Main','optflags','-O3 -march=native')
    else:
        raise Exception("Platform '"+sys.platform+"' is not supported")

    # Add the correct Python options

    import numpy

    (py_exe,py_lib,py_include) = pythonInfo(config)
    setDefaultConfigOption(config,'Python','exe',py_exe)
    setDefaultConfigOption(config,'Python','lib',py_lib)
    setDefaultConfigOption(config,'Python','include_dir',py_include)
    setDefaultConfigOption(config,'Python','numpy_include_dir',numpy.get_include())

    # Add the CMake configuration

    prefix = config.get('Main','prefix')
    setDefaultConfigOption(config,"CMake","exe",prefix+"/bempp/bin/cmake",overwrite=True)