Esempio n. 1
0
File: do.py Progetto: ysakanaka/coco
def build_c_unit_tests():
    """ Builds unit tests in C """
    library_path = 'code-experiments/test/unit-test/lib'
    library_dir = ''
    file_name = ''
    if 'win32' in sys.platform:
        file_name = 'cmocka.dll'
        if '64' in platform.machine():
            library_dir = 'win64'
        elif ('32' in platform.machine()) or ('x86' in platform.machine()):
            if 'cygwin' in os.environ['PATH']:
                library_dir = 'win32_cygwin'
            else:
                library_dir = 'win32_mingw'
    elif 'linux' in sys.platform:
        file_name = 'libcmocka.so'
        if 'Ubuntu' in platform.linux_distribution():
            library_dir = 'linux_ubuntu'
        elif 'Fedora' in platform.linux_distribution():
            library_dir = 'linux_fedora'
    elif 'darwin' in sys.platform:  # Mac
        library_dir = 'macosx'
        file_name = 'libcmocka.dylib'

    if len(library_dir) > 0:
        copy_file(os.path.join(library_path, library_dir, file_name),
                  os.path.join('code-experiments/test/unit-test', file_name))
    copy_file('code-experiments/build/c/coco.c', 'code-experiments/test/unit-test/coco.c')
    expand_file('code-experiments/src/coco.h', 'code-experiments/test/unit-test/coco.h',
                {'COCO_VERSION': git_version(pep440=True)})
    make("code-experiments/test/unit-test", "clean", verbose=_build_verbosity)
    make("code-experiments/test/unit-test", "all", verbose=_build_verbosity)
Esempio n. 2
0
def install_postprocessing():
    global release
    expand_file(join('code-postprocessing', 'setup.py.in'),
                join('code-postprocessing', 'setup.py'),
                {'COCO_VERSION': git_version(pep440=True)})
    # copy_tree('code-postprocessing/latex-templates', 'code-postprocessing/bbob_pproc/latex-templates')
    python('code-postprocessing', ['setup.py', 'install', '--user'])
Esempio n. 3
0
def build_c_unit_tests():
    """ Builds unit tests in C """
    copy_file('code-experiments/build/c/coco.c', 'code-experiments/test/unit-test/coco.c')
    expand_file('code-experiments/src/coco.h', 'code-experiments/test/unit-test/coco.h',
                {'COCO_VERSION': git_version(pep440=True)})
    make("code-experiments/test/unit-test", "clean", verbose=_build_verbosity)
    make("code-experiments/test/unit-test", "all", verbose=_build_verbosity)
Esempio n. 4
0
def install_postprocessing():
    global release
    expand_file(join('code-postprocessing', 'setup.py.in'),
                join('code-postprocessing', 'setup.py'),
                {'COCO_VERSION': git_version(pep440=True)})
    # copy_tree('code-postprocessing/latex-templates', 'code-postprocessing/cocopp/latex-templates')
    python('code-postprocessing', ['setup.py', 'install', '--user'], verbose=verbosity)
Esempio n. 5
0
File: do.py Progetto: numbbo/coco
def build_c_unit_tests():
    """ Builds unit tests in C """
    libraryPath = '';
    fileName = ''
    if ('win32' in sys.platform):
        fileName = 'cmocka.dll'
        if '64' in platform.machine():
            libraryPath = 'code-experiments/test/unit-test/lib/win64'
        elif ('32' in platform.machine()) or ('x86' in platform.machine()):
            if 'cygwin' in os.environ['PATH']:
                libraryPath = 'code-experiments/test/unit-test/lib/win32_cygwin'
            else:
                libraryPath = 'code-experiments/test/unit-test/lib/win32_mingw'
    elif ('linux' in sys.platform):
        fileName = 'libcmocka.so'
        if 'Ubuntu' in platform.linux_distribution():
            libraryPath = 'code-experiments/test/unit-test/lib/linux_ubuntu'
        elif 'Fedora' in platform.linux_distribution():
            libraryPath = 'code-experiments/test/unit-test/lib/linux_fedora'
    elif ('darwin' in sys.platform):  # Mac
        libraryPath = 'code-experiments/test/unit-test/lib/macosx'
        fileName = 'libcmocka.dylib'

    if (len(libraryPath) > 0):
        copy_file(os.path.join(libraryPath, fileName),
                  os.path.join('code-experiments/test/unit-test', fileName))
    copy_file('code-experiments/build/c/coco.c', 'code-experiments/test/unit-test/coco.c')
    expand_file('code-experiments/src/coco.h', 'code-experiments/test/unit-test/coco.h',
                {'COCO_VERSION': git_version(pep440=True)})
    make("code-experiments/test/unit-test", "clean", verbose=verbosity)
    make("code-experiments/test/unit-test", "all", verbose=verbosity)
Esempio n. 6
0
File: do.py Progetto: brockho/numbbo
def _prep_python():
    global release
    amalgamate(core_files + ['code-experiments/src/coco_runtime_c.c'],  'code-experiments/build/python/cython/coco.c', 
               release)
    copy_file('code-experiments/src/coco.h', 'code-experiments/build/python/cython/coco.h')
    copy_file('code-experiments/src/bbob2009_testcases.txt', 'code-experiments/build/python/bbob2009_testcases.txt')
    copy_file('code-experiments/build/python/README.md', 'code-experiments/build/python/README.txt')
    expand_file('code-experiments/build/python/setup.py.in', 'code-experiments/build/python/setup.py',
                {'COCO_VERSION': git_version(pep440=True)}) # hg_version()})
Esempio n. 7
0
def install_postprocessing():
    ''' Installs the COCO postprocessing as python module. '''
    global RELEASE
    expand_file(join('code-postprocessing', 'setup.py.in'),
                join('code-postprocessing', 'setup.py'),
                {'COCO_VERSION': git_version(pep440=True)})
    # copy_tree('code-postprocessing/latex-templates', 'code-postprocessing/cocopp/latex-templates')
    python('code-postprocessing', ['setup.py', 'install', '--user'],
           verbose=_verbosity)
Esempio n. 8
0
def _prep_python():
    global release
    amalgamate(core_files + ['src/coco_c_runtime.c'],  'build/python/cython/coco.c', 
               release)
    copy_file('src/coco.h', 'build/python/cython/coco.h')
    copy_file('src/bbob2009_testcases.txt', 'build/python/bbob2009_testcases.txt')
    expand_file('build/python/README.in', 'build/python/README',
                {'COCO_VERSION': hg_version()})
    expand_file('build/python/setup.py.in', 'build/python/setup.py',
                {'COCO_VERSION': hg_version()})
Esempio n. 9
0
File: do.py Progetto: ysakanaka/coco
def install_postprocessing(package_install_option = []):
    ''' Installs the COCO postprocessing as python module. '''
    global RELEASE
    expand_file(join('code-postprocessing', 'setup.py.in'),
                join('code-postprocessing', 'setup.py'),
                {'COCO_VERSION': git_version(pep440=True)})
    # copy_tree('code-postprocessing/latex-templates', 'code-postprocessing/cocopp/latex-templates')
    python('code-postprocessing', ['setup.py', 'install']
           + package_install_option, verbose=_verbosity,
           custom_exception_handler=install_error)
Esempio n. 10
0
def build_r():
    global release
    copy_tree('build/r/skel', 'build/r/pkg')
    amalgamate(core_files + ['src/coco_r_runtime.c'],  'build/r/pkg/src/coco.c',
               release)
    copy_file('src/coco.h', 'build/r/pkg/src/coco.h')
    expand_file('build/r/pkg/DESCRIPTION.in', 'build/r/pkg/DESCRIPTION',
                {'COCO_VERSION': hg_version()})  # FIXME: it seems that this doesn't work, because it writes '0.0.789' instead of 0.0.789
    rscript('build/r/', ['tools/roxygenize'])
    run('build/r', ['R', 'CMD', 'build', 'pkg'])
Esempio n. 11
0
File: do.py Progetto: numbbo/coco
def build_matlab():
    """Builds MATLAB example in build/matlab/ but not the one in examples/."""

    global release
    amalgamate(core_files + ['code-experiments/src/coco_runtime_matlab.c'], 'code-experiments/build/matlab/coco.c',
               release, {"COCO_VERSION": git_version(pep440=True)})
    expand_file('code-experiments/src/coco.h', 'code-experiments/build/matlab/coco.h',
                {'COCO_VERSION': git_version(pep440=True)})
    write_file(git_revision(), "code-experiments/build/matlab/REVISION")
    write_file(git_version(), "code-experiments/build/matlab/VERSION")
    run('code-experiments/build/matlab', ['matlab', '-nodisplay', '-nosplash', '-r', 'setup, exit'], verbose=verbosity)
Esempio n. 12
0
File: do.py Progetto: numbbo/coco
def build_c_integration_tests():
    """ Builds integration tests in C """
    copy_file('code-experiments/build/c/coco.c', 'code-experiments/test/integration-test/coco.c')
    expand_file('code-experiments/src/coco.h', 'code-experiments/test/integration-test/coco.h',
                {'COCO_VERSION': git_version(pep440=True)})
    copy_file('code-experiments/src/bbob2009_testcases.txt',
              'code-experiments/test/integration-test/bbob2009_testcases.txt')
    copy_file('code-experiments/src/bbob2009_testcases2.txt',
              'code-experiments/test/integration-test/bbob2009_testcases2.txt')
    make("code-experiments/test/integration-test", "clean", verbose=verbosity)
    make("code-experiments/test/integration-test", "all", verbose=verbosity)
Esempio n. 13
0
def build_matlab():
    """Builds MATLAB example in build/matlab/ but not the one in examples/."""

    global release
    amalgamate(core_files + ['code-experiments/src/coco_runtime_matlab.c'], 'code-experiments/build/matlab/coco.c',
               release, {"COCO_VERSION": git_version(pep440=True)})
    expand_file('code-experiments/src/coco.h', 'code-experiments/build/matlab/coco.h',
                {'COCO_VERSION': git_version(pep440=True)})
    write_file(git_revision(), "code-experiments/build/matlab/REVISION")
    write_file(git_version(), "code-experiments/build/matlab/VERSION")
    run('code-experiments/build/matlab', ['matlab', '-nodisplay', '-nosplash', '-r', 'setup, exit'], verbose=verbosity)
Esempio n. 14
0
def _prep_python():
    global release
    amalgamate(core_files + ['code-experiments/src/coco_runtime_c.c'], 'code-experiments/build/python/cython/coco.c',
               release, {"COCO_VERSION": git_version(pep440=True)})
    expand_file('code-experiments/src/coco.h', 'code-experiments/build/python/cython/coco.h',
                {'COCO_VERSION': git_version(pep440=True)})
    copy_file('code-experiments/src/bbob2009_testcases.txt', 'code-experiments/build/python/bbob2009_testcases.txt')
    copy_file('code-experiments/src/bbob2009_testcases2.txt', 'code-experiments/build/python/bbob2009_testcases2.txt')
    copy_file('code-experiments/build/python/README.md', 'code-experiments/build/python/README.txt')
    expand_file('code-experiments/build/python/setup.py.in', 'code-experiments/build/python/setup.py',
                {'COCO_VERSION': git_version(pep440=True)})  # hg_version()})
Esempio n. 15
0
File: do.py Progetto: ysakanaka/coco
def build_c_integration_tests():
    """ Builds integration tests in C """
    copy_file('code-experiments/build/c/coco.c',
              'code-experiments/test/integration-test/coco.c')
    expand_file('code-experiments/src/coco.h',
                'code-experiments/test/integration-test/coco.h',
                {'COCO_VERSION': git_version(pep440=True)})
    copy_file('code-experiments/src/bbob2009_testcases.txt', 'code-experiments/test/integration-test/bbob2009_testcases.txt')
    copy_file('code-experiments/src/bbob2009_testcases2.txt', 'code-experiments/test/integration-test/bbob2009_testcases2.txt')
    make("code-experiments/test/integration-test", "clean", verbose=_build_verbosity)
    make("code-experiments/test/integration-test", "all", verbose=_build_verbosity)
Esempio n. 16
0
def install_preprocessing():
    global release
    expand_file(join('code-preprocessing/archive-update', 'setup.py.in'),
                join('code-preprocessing/archive-update', 'setup.py'),
                {'COCO_VERSION': git_version(pep440=True)})
    build_python()
    amalgamate(core_files + ['code-experiments/src/coco_runtime_c.c'],
               'code-preprocessing/archive-update/interface/coco.c', release,
               {"COCO_VERSION": git_version(pep440=True)})
    expand_file('code-experiments/src/coco.h', 'code-preprocessing/archive-update/interface/coco.h',
                {'COCO_VERSION': git_version(pep440=True)})
    python('code-preprocessing/archive-update', ['setup.py', 'install', '--user'], verbose=verbosity)
Esempio n. 17
0
File: do.py Progetto: numbbo/coco
def install_preprocessing():
    global release
    expand_file(join('code-preprocessing/archive-update', 'setup.py.in'),
                join('code-preprocessing/archive-update', 'setup.py'),
                {'COCO_VERSION': git_version(pep440=True)})
    build_python()
    amalgamate(core_files + ['code-experiments/src/coco_runtime_c.c'],
               'code-preprocessing/archive-update/interface/coco.c', release,
               {"COCO_VERSION": git_version(pep440=True)})
    expand_file('code-experiments/src/coco.h', 'code-preprocessing/archive-update/interface/coco.h',
                {'COCO_VERSION': git_version(pep440=True)})
    python('code-preprocessing/archive-update', ['setup.py', 'install', '--user'], verbose=verbosity)
Esempio n. 18
0
def _prep_python():
    global RELEASE
    amalgamate(CORE_FILES + ['code-experiments/src/IOHprofiler_runtime_c.c'],
               'code-experiments/build/python/cython/IOHprofiler.c',
               RELEASE, {"IOHprofiler_VERSION": git_version(pep440=True)})
    expand_file('code-experiments/src/IOHprofiler.h',
                'code-experiments/build/python/cython/IOHprofiler.h',
                {'IOHprofiler_VERSION': git_version(pep440=True)})
    copy_file('code-experiments/build/python/README.md',
              'code-experiments/build/python/README.txt')
    expand_file('code-experiments/build/python/setup.py.in',
                'code-experiments/build/python/setup.py',
                {'IOHprofiler_VERSION': git_version(pep440=True)})  # hg_version()})
Esempio n. 19
0
def amalgamate(source_files, destination_file, release=False, replace_dict=None):
    print("AML\t%s -> %s" % (str(source_files), destination_file))
    amalgator = Amalgator(destination_file, release)
    for filename in source_files:
        amalgator.process_file(filename)
    amalgator.finish()
    if replace_dict:
        # Replace strings in the destination file
        from shutil import copyfile
        from os import remove
        copyfile(destination_file, destination_file+'.in')
        expand_file(destination_file+'.in', destination_file, replace_dict)
        remove(destination_file+'.in')
Esempio n. 20
0
def amalgamate(source_files, destination_file, release=False, replace_dict=None):
    print("AML\t%s -> %s" % (str(source_files), destination_file))
    amalgator = Amalgator(destination_file, release)
    for filename in source_files:
        amalgator.process_file(filename)
    amalgator.finish()
    if replace_dict:
        # Replace strings in the destination file
        from shutil import copyfile
        from os import remove
        copyfile(destination_file, destination_file + '.in')
        expand_file(destination_file + '.in', destination_file, replace_dict)
        remove(destination_file + '.in')
Esempio n. 21
0
def _prep_python():
    global release
    amalgamate(core_files + ['code-experiments/src/coco_runtime_c.c'],  'code-experiments/build/python/cython/coco.c', 
               release)
    copy_file('code-experiments/src/coco.h', 'code-experiments/build/python/cython/coco.h')
    copy_file('code-experiments/src/best_values_hyp.txt', 'code-experiments/build/python/best_values_hyp.txt')
    copy_file('code-experiments/src/bbob2009_testcases.txt', 'code-experiments/build/python/bbob2009_testcases.txt')
    expand_file('code-experiments/build/python/README.in', 'code-experiments/build/python/README',
                {'COCO_VERSION': git_version()}) # hg_version()})
    expand_file('code-experiments/build/python/setup.py.in', 'code-experiments/build/python/setup.py',
                {'COCO_VERSION': git_version()}) # hg_version()})
    if 'darwin' in sys.platform:
        run('code-experiments/build/python/cython', ['cython', 'interface.pyx'])
Esempio n. 22
0
File: do.py Progetto: ysakanaka/coco
def install_preprocessing(package_install_option = []):
    global RELEASE
    expand_file(join('code-preprocessing/archive-update', 'setup.py.in'),
                join('code-preprocessing/archive-update', 'setup.py'),
                {'COCO_VERSION': git_version(pep440=True)})
    build_python(package_install_option = package_install_option)
    amalgamate(CORE_FILES + ['code-experiments/src/coco_runtime_c.c'],
               'code-preprocessing/archive-update/interface/coco.c', RELEASE,
               {"COCO_VERSION": git_version(pep440=True)})
    expand_file('code-experiments/src/coco.h', 'code-preprocessing/archive-update/interface/coco.h',
                {'COCO_VERSION': git_version(pep440=True)})
    python('code-preprocessing/archive-update',
           ['setup.py', 'install'] + package_install_option,
           verbose=_verbosity, custom_exception_handler=install_error)
Esempio n. 23
0
def build_c_example_tests():
    """ Builds an example experiment test in C """
    if os.path.exists('code-experiments/test/example-test'):
        shutil.rmtree('code-experiments/test/example-test')
        time.sleep(1)  # Needed to avoid permission errors for os.makedirs
    os.makedirs('code-experiments/test/example-test')
    copy_file('code-experiments/build/c/coco.c', 'code-experiments/test/example-test/coco.c')
    expand_file('code-experiments/src/coco.h', 'code-experiments/test/example-test/coco.h',
                {'COCO_VERSION': git_version(pep440=True)})
    copy_file('code-experiments/build/c/example_experiment.c',
              'code-experiments/test/example-test/example_experiment.c')
    copy_file('code-experiments/build/c/Makefile.in', 'code-experiments/test/example-test/Makefile.in')
    copy_file('code-experiments/build/c/Makefile_win_gcc.in', 'code-experiments/test/example-test/Makefile_win_gcc.in')
    make("code-experiments/test/example-test", "clean", verbose=verbosity)
    make("code-experiments/test/example-test", "all", verbose=verbosity)
Esempio n. 24
0
File: do.py Progetto: numbbo/coco
def build_c_example_tests():
    """ Builds an example experiment test in C """
    if os.path.exists('code-experiments/test/example-test'):
        shutil.rmtree('code-experiments/test/example-test')
        time.sleep(1)  # Needed to avoid permission errors for os.makedirs
    os.makedirs('code-experiments/test/example-test')
    copy_file('code-experiments/build/c/coco.c', 'code-experiments/test/example-test/coco.c')
    expand_file('code-experiments/src/coco.h', 'code-experiments/test/example-test/coco.h',
                {'COCO_VERSION': git_version(pep440=True)})
    copy_file('code-experiments/build/c/example_experiment.c',
              'code-experiments/test/example-test/example_experiment.c')
    copy_file('code-experiments/build/c/Makefile.in', 'code-experiments/test/example-test/Makefile.in')
    copy_file('code-experiments/build/c/Makefile_win_gcc.in', 'code-experiments/test/example-test/Makefile_win_gcc.in')
    make("code-experiments/test/example-test", "clean", verbose=verbosity)
    make("code-experiments/test/example-test", "all", verbose=verbosity)
Esempio n. 25
0
def build_c():
    """ Builds the C source code """
    global RELEASE
    amalgamate(CORE_FILES + ['code-experiments/src/profiler/IOHprofiler_runtime_c.c'],
               'code-experiments/build/c/IOHprofiler.c', RELEASE,
               {"IOHprofiler_VERSION": git_version(pep440=True)})
    expand_file('code-experiments/src/profiler/IOHprofiler.h', 'code-experiments/build/c/profiler/IOHprofiler.h',
                {"IOHprofiler_VERSION": git_version(pep440=True)})
    write_file(git_revision(), "code-experiments/build/c/REVISION")
    write_file(git_version(), "code-experiments/build/c/VERSION")
    if 11 < 3:
        python('code-experiments/build/c', ['make.py', 'clean'], verbose=_verbosity)
        python('code-experiments/build/c', ['make.py', 'all'], verbose=_verbosity)
    else:
        make("code-experiments/build/c", "clean", verbose=_verbosity)
        make("code-experiments/build/c", "all", verbose=_verbosity)
Esempio n. 26
0
File: do.py Progetto: ysakanaka/coco
def build_matlab_sms():
    """Builds the SMS-EMOA in MATLAB """
    global RELEASE
    destination_folder = 'code-experiments/examples/bbob-biobj-matlab-smsemoa'
    # amalgamate and copy files
    amalgamate(CORE_FILES + ['code-experiments/src/coco_runtime_matlab.c'],
               join(destination_folder, 'coco.c'), RELEASE,
               {"COCO_VERSION": git_version(pep440=True)})
    expand_file('code-experiments/src/coco.h', join(destination_folder, 'coco.h'),
                {'COCO_VERSION': git_version(pep440=True)})
    for f in MATLAB_FILES:
        copy_file(join('code-experiments/build/matlab/', f), join(destination_folder, f))
    write_file(git_revision(), join(destination_folder, "REVISION"))
    write_file(git_version(), join(destination_folder, "VERSION"))
    copy_file('code-experiments/build/matlab/cocoCall.c', join(destination_folder, 'cocoCall.c'))
    # compile
    run(destination_folder, ['matlab', '-nodisplay', '-nosplash', '-r', 'setup, exit'])
Esempio n. 27
0
def build_octave():
    """Builds example in build/matlab/ with GNU Octave."""

    global release
    amalgamate(core_files + ['code-experiments/src/coco_runtime_c.c'],
               'code-experiments/build/matlab/coco.c', release,
               {"COCO_VERSION": git_version(pep440=True)})
    expand_file('code-experiments/src/coco.h', 'code-experiments/build/matlab/coco.h',
                {'COCO_VERSION': git_version(pep440=True)})
    write_file(git_revision(), "code-experiments/build/matlab/REVISION")
    write_file(git_version(), "code-experiments/build/matlab/VERSION")

    # make sure that under Windows, run_octave has been run at least once
    # before to provide the necessary octave_coco.bat file     
    if ('win32' in sys.platform):
        run('code-experiments/build/matlab', ['octave_coco.bat', '--no-gui', 'setup.m'], verbose=verbosity)
    else:
        run('code-experiments/build/matlab', ['octave', '--no-gui', 'setup.m'], verbose=verbosity)
Esempio n. 28
0
File: do.py Progetto: numbbo/coco
def build_c():
    """ Builds the C source code """
    global release
    amalgamate(core_files + ['code-experiments/src/coco_runtime_c.c'], 'code-experiments/build/c/coco.c', release,
               {"COCO_VERSION": git_version(pep440=True)})
    expand_file('code-experiments/src/coco.h', 'code-experiments/build/c/coco.h',
                {"COCO_VERSION": git_version(pep440=True)})
    copy_file('code-experiments/build/c/coco.c', 'code-experiments/examples/bbob2009-c-cmaes/coco.c')
    expand_file('code-experiments/build/c/coco.h', 'code-experiments/examples/bbob2009-c-cmaes/coco.h',
                {'COCO_VERSION': git_version(pep440=True)})
    write_file(git_revision(), "code-experiments/build/c/REVISION")
    write_file(git_version(), "code-experiments/build/c/VERSION")
    if 11 < 3:
        python('code-experiments/build/c', ['make.py', 'clean'], verbose=verbosity)
        python('code-experiments/build/c', ['make.py', 'all'], verbose=verbosity)
    else:
        make("code-experiments/build/c", "clean", verbose=verbosity)
        make("code-experiments/build/c", "all", verbose=verbosity)
Esempio n. 29
0
File: do.py Progetto: numbbo/coco
def build_octave():
    """Builds example in build/matlab/ with GNU Octave."""

    global release
    amalgamate(core_files + ['code-experiments/src/coco_runtime_c.c'],
               'code-experiments/build/matlab/coco.c', release,
               {"COCO_VERSION": git_version(pep440=True)})
    expand_file('code-experiments/src/coco.h', 'code-experiments/build/matlab/coco.h',
                {'COCO_VERSION': git_version(pep440=True)})
    write_file(git_revision(), "code-experiments/build/matlab/REVISION")
    write_file(git_version(), "code-experiments/build/matlab/VERSION")

    # make sure that under Windows, run_octave has been run at least once
    # before to provide the necessary octave_coco.bat file     
    if ('win32' in sys.platform):
        run('code-experiments/build/matlab', ['octave_coco.bat', '--no-gui', 'setup.m'], verbose=verbosity)
    else:
        run('code-experiments/build/matlab', ['octave', '--no-gui', 'setup.m'], verbose=verbosity)
Esempio n. 30
0
File: do.py Progetto: numbbo/coco
def build_matlab_sms():
    """Builds the SMS-EMOA in MATLAB """
    global release
    join = os.path.join
    destination_folder = 'code-experiments/examples/bbob-biobj-matlab-smsemoa'
    # amalgamate and copy files
    amalgamate(core_files + ['code-experiments/src/coco_runtime_matlab.c'],
               join(destination_folder, 'coco.c'), release,
               {"COCO_VERSION": git_version(pep440=True)})
    expand_file('code-experiments/src/coco.h', join(destination_folder, 'coco.h'),
                {'COCO_VERSION': git_version(pep440=True)})
    for f in matlab_files:
        copy_file(join('code-experiments/build/matlab/', f), join(destination_folder, f))
    write_file(git_revision(), join(destination_folder, "REVISION"))
    write_file(git_version(), join(destination_folder, "VERSION"))
    copy_file('code-experiments/build/matlab/cocoCall.c', join(destination_folder, 'cocoCall.c'))
    # compile
    run(destination_folder, ['matlab', '-nodisplay', '-nosplash', '-r', 'setup, exit'])
Esempio n. 31
0
def build_c():
    """ Builds the C source code """
    global release
    amalgamate(core_files + ['code-experiments/src/coco_runtime_c.c'], 'code-experiments/build/c/coco.c', release,
               {"COCO_VERSION": git_version(pep440=True)})
    expand_file('code-experiments/src/coco.h', 'code-experiments/build/c/coco.h',
                {"COCO_VERSION": git_version(pep440=True)})
    copy_file('code-experiments/build/c/coco.c', 'code-experiments/examples/bbob2009-c-cmaes/coco.c')
    expand_file('code-experiments/build/c/coco.h', 'code-experiments/examples/bbob2009-c-cmaes/coco.h',
                {'COCO_VERSION': git_version(pep440=True)})
    write_file(git_revision(), "code-experiments/build/c/REVISION")
    write_file(git_version(), "code-experiments/build/c/VERSION")
    if 11 < 3:
        python('code-experiments/build/c', ['make.py', 'clean'], verbose=verbosity)
        python('code-experiments/build/c', ['make.py', 'all'], verbose=verbosity)
    else:
        make("code-experiments/build/c", "clean", verbose=verbosity)
        make("code-experiments/build/c", "all", verbose=verbosity)
Esempio n. 32
0
File: do.py Progetto: ysakanaka/coco
def build_octave_sms():
    """Builds the SMS-EMOA in Octave """
    global RELEASE
    destination_folder = 'code-experiments/examples/bbob-biobj-matlab-smsemoa'
    # amalgamate and copy files
    amalgamate(CORE_FILES + ['code-experiments/src/coco_runtime_c.c'],
               join(destination_folder, 'coco.c'), RELEASE,
               {"COCO_VERSION": git_version(pep440=True)})
    expand_file('code-experiments/src/coco.h', join(destination_folder, 'coco.h'),
                {'COCO_VERSION': git_version(pep440=True)})
    for f in MATLAB_FILES:
        copy_file(join('code-experiments/build/matlab/', f), join(destination_folder, f))
    write_file(git_revision(), join(destination_folder, "REVISION"))
    write_file(git_version(), join(destination_folder, "VERSION"))
    copy_file('code-experiments/build/matlab/cocoCall.c', join(destination_folder, 'cocoCall.c'))
    # compile
    if 'win32' in sys.platform:
        run(destination_folder, ['octave_coco.bat', '--no-gui', 'setup.m'])
    else:
        run(destination_folder, ['octave', '--no-gui', 'setup.m'])
Esempio n. 33
0
File: do.py Progetto: numbbo/coco
def build_octave_sms():
    """Builds the SMS-EMOA in Octave """
    global release
    join = os.path.join
    destination_folder = 'code-experiments/examples/bbob-biobj-matlab-smsemoa'
    # amalgamate and copy files
    amalgamate(core_files + ['code-experiments/src/coco_runtime_c.c'],
               join(destination_folder, 'coco.c'), release,
               {"COCO_VERSION": git_version(pep440=True)})
    expand_file('code-experiments/src/coco.h', join(destination_folder, 'coco.h'),
                {'COCO_VERSION': git_version(pep440=True)})
    for f in matlab_files:
        copy_file(join('code-experiments/build/matlab/', f), join(destination_folder, f))
    write_file(git_revision(), join(destination_folder, "REVISION"))
    write_file(git_version(), join(destination_folder, "VERSION"))
    copy_file('code-experiments/build/matlab/cocoCall.c', join(destination_folder, 'cocoCall.c'))
    # compile
    if ('win32' in sys.platform):
        run(destination_folder, ['octave_coco.bat', '--no-gui', 'setup.m'])
    else:
        run(destination_folder, ['octave', '--no-gui', 'setup.m'])
Esempio n. 34
0
File: do.py Progetto: numbbo/coco
def build_java():
    """ Builds the example experiment in Java """
    global release
    amalgamate(core_files + ['code-experiments/src/coco_runtime_c.c'], 'code-experiments/build/java/coco.c', release,
               {"COCO_VERSION": git_version(pep440=True)})
    expand_file('code-experiments/src/coco.h', 'code-experiments/build/java/coco.h',
                {'COCO_VERSION': git_version(pep440=True)})
    write_file(git_revision(), "code-experiments/build/java/REVISION")
    write_file(git_version(), "code-experiments/build/java/VERSION")
    run('code-experiments/build/java', ['javac', 'CocoJNI.java'], verbose=verbosity)
    run('code-experiments/build/java', ['javah', 'CocoJNI'], verbose=verbosity)

    # Finds the path to the headers jni.h and jni_md.h (platform-dependent)
    # and compiles the CocoJNI library (compiler-dependent). So far, only
    # the following cases are covered:

    # 1. Windows with Cygwin (both 64-bit)
    # Note that 'win32' stands for both Windows 32-bit and 64-bit.
    # Since platform 'cygwin' does not work as expected, we need to look for it in the PATH.
    if ('win32' in sys.platform) and ('cygwin' in os.environ['PATH']):
        jdkpath = check_output(['where', 'javac'], stderr=STDOUT,
                               env=os.environ, universal_newlines=True)
        jdkpath1 = jdkpath.split("bin")[0] + 'include'
        jdkpath2 = jdkpath1 + '\\win32'

        if ('64' in platform.machine()):
            run('code-experiments/build/java', ['x86_64-w64-mingw32-gcc', '-I', jdkpath1, '-I',
                                                jdkpath2, '-shared', '-o', 'CocoJNI.dll',
                                                'CocoJNI.c'], verbose=verbosity)

            # 2. Windows with Cygwin (both 32-bit)
        elif ('32' in platform.machine()) or ('x86' in platform.machine()):
            run('code-experiments/build/java', ['i686-w64-mingw32-gcc', '-Wl,--kill-at', '-I',
                                                jdkpath1, '-I', jdkpath2, '-shared', '-o',
                                                'CocoJNI.dll', 'CocoJNI.c'], verbose=verbosity)

    # 3. Windows without Cygwin
    elif ('win32' in sys.platform) and ('cygwin' not in os.environ['PATH']):
        jdkpath = check_output(['where', 'javac'], stderr=STDOUT,
                               env=os.environ, universal_newlines=True)
        jdkpath1 = jdkpath.split("bin")[0] + 'include'
        jdkpath2 = jdkpath1 + '\\win32'
        run('code-experiments/build/java', ['gcc', '-Wl,--kill-at', '-I', jdkpath1, '-I', jdkpath2,
                                            '-shared', '-o', 'CocoJNI.dll', 'CocoJNI.c'], verbose=verbosity)

    # 4. Linux
    elif ('linux' in sys.platform):
        jdkpath = check_output(['locate', 'jni.h'], stderr=STDOUT,
                               env=os.environ, universal_newlines=True)
        jdkpath1 = jdkpath.split("jni.h")[0]
        jdkpath2 = jdkpath1 + '/linux'
        run('code-experiments/build/java', ['gcc', '-I', jdkpath1, '-I', jdkpath2, '-c',
                                            'CocoJNI.c'], verbose=verbosity)
        run('code-experiments/build/java', ['gcc', '-I', jdkpath1, '-I', jdkpath2, '-o',
                                            'libCocoJNI.so', '-fPIC', '-shared', 'CocoJNI.c'], verbose=verbosity)

    # 5. Mac
    elif ('darwin' in sys.platform):
        jdkversion = check_output(['javac', '-version'], stderr=STDOUT,
                                  env=os.environ, universal_newlines=True)
        jdkversion = jdkversion.split()[1]
        jdkpath = '/System/Library/Frameworks/JavaVM.framework/Headers'
        jdkpath1 = '/Library/Java/JavaVirtualMachines/jdk' + jdkversion + '.jdk/Contents/Home/include'
        jdkpath2 = jdkpath1 + '/darwin'
        run('code-experiments/build/java', ['gcc', '-I', jdkpath, '-I', jdkpath1, '-I', jdkpath2, '-c', 'CocoJNI.c'],
            verbose=verbosity)
        run('code-experiments/build/java', ['gcc', '-dynamiclib', '-o', 'libCocoJNI.jnilib',
                                            'CocoJNI.o'], verbose=verbosity)

    run('code-experiments/build/java', ['javac', 'Problem.java'], verbose=verbosity)
    run('code-experiments/build/java', ['javac', 'Benchmark.java'], verbose=verbosity)
    run('code-experiments/build/java', ['javac', 'Observer.java'], verbose=verbosity)
    run('code-experiments/build/java', ['javac', 'Suite.java'], verbose=verbosity)
    run('code-experiments/build/java', ['javac', 'ExampleExperiment.java'], verbose=verbosity)
Esempio n. 35
0
File: do.py Progetto: ysakanaka/coco
def build_java():
    """ Builds the example experiment in Java """
    global RELEASE
    amalgamate(CORE_FILES + ['code-experiments/src/coco_runtime_c.c'],
               'code-experiments/build/java/coco.c', RELEASE,
               {"COCO_VERSION": git_version(pep440=True)})
    expand_file('code-experiments/src/coco.h', 'code-experiments/build/java/coco.h',
                {'COCO_VERSION': git_version(pep440=True)})
    write_file(git_revision(), "code-experiments/build/java/REVISION")
    write_file(git_version(), "code-experiments/build/java/VERSION")
    run('code-experiments/build/java', ['javac', 'CocoJNI.java'], verbose=_verbosity)
    run('code-experiments/build/java', ['javah', 'CocoJNI'], verbose=_verbosity)

    # Finds the path to the headers jni.h and jni_md.h (platform-dependent)
    # and compiles the CocoJNI library (compiler-dependent). So far, only
    # the following cases are covered:

    # 1. Windows with Cygwin (both 64-bit)
    # Note that 'win32' stands for both Windows 32-bit and 64-bit.
    # Since platform 'cygwin' does not work as expected, we need to look for it in the PATH.
    if ('win32' in sys.platform) and ('cygwin' in os.environ['PATH']):
        jdkpath = check_output(['where', 'javac'], stderr=STDOUT,
                               env=os.environ, universal_newlines=True)
        jdkpath1 = jdkpath.split("bin")[0] + 'include'
        jdkpath2 = jdkpath1 + '\\win32'

        if '64' in platform.machine():
            run('code-experiments/build/java', ['x86_64-w64-mingw32-gcc', '-I', jdkpath1, '-I',
                                                jdkpath2, '-shared', '-o', 'CocoJNI.dll',
                                                'CocoJNI.c'], verbose=_verbosity)

            # 2. Windows with Cygwin (both 32-bit)
        elif '32' in platform.machine() or 'x86' in platform.machine():
            run('code-experiments/build/java', ['i686-w64-mingw32-gcc', '-Wl,--kill-at', '-I',
                                                jdkpath1, '-I', jdkpath2, '-shared', '-o',
                                                'CocoJNI.dll', 'CocoJNI.c'], verbose=_verbosity)

    # 3. Windows without Cygwin
    elif ('win32' in sys.platform) and ('cygwin' not in os.environ['PATH']):
        jdkpath = check_output(['where', 'javac'], stderr=STDOUT,
                               env=os.environ, universal_newlines=True)
        jdkpath1 = jdkpath.split("bin")[0] + 'include'
        jdkpath2 = jdkpath1 + '\\win32'
        run('code-experiments/build/java',
            ['gcc', '-Wl,--kill-at', '-I', jdkpath1, '-I', jdkpath2,
             '-shared', '-o', 'CocoJNI.dll', 'CocoJNI.c'],
            verbose=_verbosity)

    # 4. Linux
    elif 'linux' in sys.platform:
        jdkpath = check_output(['locate', 'jni.h'], stderr=STDOUT,
                               env=os.environ, universal_newlines=True)
        jdkpath1 = jdkpath.split("jni.h")[0]
        jdkpath2 = jdkpath1 + '/linux'
        run('code-experiments/build/java',
            ['gcc', '-I', jdkpath1, '-I', jdkpath2, '-c', 'CocoJNI.c'],
            verbose=_verbosity)
        run('code-experiments/build/java',
            ['gcc', '-I', jdkpath1, '-I', jdkpath2, '-o',
             'libCocoJNI.so', '-fPIC', '-shared', 'CocoJNI.c'],
            verbose=_verbosity)

    # 5. Mac
    elif 'darwin' in sys.platform:
        jdkversion = check_output(['javac', '-version'], stderr=STDOUT,
                                  env=os.environ, universal_newlines=True)
        jdkversion = jdkversion.split()[1]
        jdkpath = '/System/Library/Frameworks/JavaVM.framework/Headers'
        jdkpath1 = ('/Library/Java/JavaVirtualMachines/jdk' +
                    jdkversion + '.jdk/Contents/Home/include')
        jdkpath2 = jdkpath1 + '/darwin'
        run('code-experiments/build/java',
            ['gcc', '-I', jdkpath, '-I', jdkpath1, '-I', jdkpath2, '-c', 'CocoJNI.c'],
            verbose=_verbosity)
        run('code-experiments/build/java',
            ['gcc', '-dynamiclib', '-o', 'libCocoJNI.jnilib', 'CocoJNI.o'],
            verbose=_verbosity)

    run('code-experiments/build/java', ['javac', 'Problem.java'], verbose=_verbosity)
    run('code-experiments/build/java', ['javac', 'Benchmark.java'], verbose=_verbosity)
    run('code-experiments/build/java', ['javac', 'Observer.java'], verbose=_verbosity)
    run('code-experiments/build/java', ['javac', 'Suite.java'], verbose=_verbosity)
    run('code-experiments/build/java', ['javac', 'ExampleExperiment.java'], verbose=_verbosity)