Exemplo n.º 1
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)
Exemplo n.º 2
0
def build_matlab():
    global release
    amalgamate(core_files + ['code-experiments/src/coco_runtime_r.c'],  'code-experiments/build/matlab/coco.c', release)
    copy_file('code-experiments/src/coco.h', 'code-experiments/build/matlab/coco.h')
    write_file(git_revision(), "code-experiments/build/matlab/REVISION")
    write_file(git_version(), "code-experiments/build/matlab/VERSION")
    run('code-experiments/build/matlab', ['octave', '-nodisplay', '-nosplash', '-r', 'setup, exit'])
Exemplo n.º 3
0
def build_matlab():
    global release
    amalgamate(core_files + ['src/coco_c_runtime.c'],  'build/matlab/coco.c', release)
    copy_file('src/coco.h', 'build/matlab/coco.h')
    write_file(hg_revision(), "build/matlab/REVISION")
    write_file(hg_version(), "build/matlab/VERSION")
    run('build/matlab', ['matlab', '-nodisplay', '-nosplash', '-r', 'setup, exit'])
Exemplo n.º 4
0
def build_matlab_sms():
    global release
    join = os.path.join
    source_folder = join('code-experiments', 'build', 'matlab')
    destination_folder = join('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)
    copy_file('code-experiments/src/coco.h', 'code-experiments/examples/bbob-biobj-matlab-smsemoa/coco.h')
    write_file(git_revision(), join(destination_folder, "REVISION"))
    write_file(git_version(), join(destination_folder, "VERSION"))
    files = ['cocoEvaluateFunction.c',
             'cocoObserver.c',
             'cocoObserverFree.c',
             'cocoProblemGetDimension.c',
             'cocoProblemGetEvaluations.c',
             'cocoProblemGetId.c',
             'cocoProblemGetLargestValuesOfInterest.c',
             'cocoProblemGetName.c',
             'cocoProblemGetNumberOfObjectives.c',
             'cocoProblemGetSmallestValuesOfInterest.c',
             'cocoProblemIsValid.c',
             'cocoSuite.c',
             'cocoSuiteFree.c',
             'cocoSuiteGetNextProblem.c']
    for file in files:
        copy_file(join(source_folder, file),
                  join(destination_folder, file))
    # compile
    run('code-experiments/examples/bbob-biobj-matlab-smsemoa', ['matlab', '-nodisplay', '-nosplash', '-r', 'setup, exit'])
Exemplo n.º 5
0
Arquivo: do.py Projeto: 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)
Exemplo n.º 6
0
Arquivo: do.py Projeto: 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)
Exemplo n.º 7
0
Arquivo: do.py Projeto: ysakanaka/coco
def run_octave():
    # remove the mex files for a clean compilation first
    print('CLEAN\tmex files from code-experiments/build/matlab/')
    for filename in glob.glob('code-experiments/build/matlab/*.mex*'):
        os.remove(filename)

    # Copy octave-coco.bat to the Octave folder under Windows to allow
    # calling Octave from command line without messing up the system.
    # Note that 'win32' stands for both Windows 32-bit and 64-bit.
    if 'win32' in sys.platform:
        print('SEARCH\tfor Octave folder from C:\\ (can take some time)')
        lookfor = 'octave.bat'
        for root, dirs, files in os.walk('C:\\'):
            if lookfor in files:
                break
        copy_file('code-experiments/build/matlab/octave_coco.bat.in', join(root, 'octave_coco.bat'))

    # amalgamate, copy, and build
    build_octave()
    if 'win32' in sys.platform:
        run('code-experiments/build/matlab',
            ['octave_coco.bat', '--no-gui', 'exampleexperiment.m'], verbose=_verbosity)
    else:
        run('code-experiments/build/matlab',
            ['octave', '--no-gui', 'exampleexperiment.m'], verbose=_verbosity)
Exemplo n.º 8
0
def build_c():
    global release
    amalgamate(core_files + ['code-experiments/src/coco_runtime_c.c'],  'code-experiments/build/c/coco.c', release)
    copy_file('code-experiments/src/coco.h', 'code-experiments/build/c/coco.h')
    copy_file('code-experiments/src/best_values_hyp.txt', 'code-experiments/build/c/best_values_hyp.txt')
    write_file(git_revision(), "code-experiments/build/c/REVISION")
    write_file(git_version(), "code-experiments/build/c/VERSION")
    make("code-experiments/build/c", "clean")
    make("code-experiments/build/c", "all")
Exemplo n.º 9
0
Arquivo: do.py Projeto: brockho/numbbo
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)
    copy_file('code-experiments/src/coco.h', 'code-experiments/build/matlab/coco.h')
    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'])
Exemplo n.º 10
0
Arquivo: do.py Projeto: NDManh/numbbo
def build_octave():
    """Builds example in build/matlab/ with GNU Octave but not the one in examples/."""
    
    global release
    amalgamate(core_files + ['code-experiments/src/coco_runtime_c.c'],  'code-experiments/build/matlab/coco.c', release)
    copy_file('code-experiments/src/coco.h', 'code-experiments/build/matlab/coco.h')
    write_file(git_revision(), "code-experiments/build/matlab/REVISION")
    write_file(git_version(), "code-experiments/build/matlab/VERSION")
    run('code-experiments/build/matlab', ['octave', '--no-gui', 'setup.m'])
Exemplo n.º 11
0
def build_c_mo():  # added for the multiobjective case
    global release
    amalgamate(core_files + ['src/coco_c_runtime.c'],  'build/c/mo/coco.c', release)
    copy_file('src/coco.h', 'build/c/mo/coco.h')
    # copy_file('src/bbob2009_testcases.txt', 'build/c/bbob2009_testcases.txt')
    write_file(hg_revision(), "build/c/mo/REVISION")
    write_file(hg_version(), "build/c/mo/VERSION")
    make("build/c/mo", "clean")
    make("build/c/mo", "all")
Exemplo n.º 12
0
def build_c():
    global release
    amalgamate(core_files + ['src/coco_c_runtime.c'],  'build/c/coco.c', release)
    copy_file('src/coco.h', 'build/c/coco.h')
    copy_file('src/bbob2009_testcases.txt', 'build/c/bbob2009_testcases.txt')
    write_file(hg_revision(), "build/c/REVISION")
    write_file(hg_version(), "build/c/VERSION")
    make("build/c", "clean")
    make("build/c", "all")
Exemplo n.º 13
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()})
Exemplo n.º 14
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'])
Exemplo n.º 15
0
Arquivo: do.py Projeto: brockho/numbbo
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')
    copy_file('code-experiments/src/coco.h', 'code-experiments/test/example-test/coco.h')
    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")
    make("code-experiments/test/example-test", "all")
Exemplo n.º 16
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()})
Exemplo n.º 17
0
Arquivo: do.py Projeto: brockho/numbbo
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)
    copy_file('code-experiments/src/coco.h', join(destination_folder, 'coco.h'))
    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'])
Exemplo n.º 18
0
def build_java():
    global release
    amalgamate(core_files + ['src/coco_c_runtime.c'],  'build/java/coco.c', release)
    copy_file('src/coco.h', 'build/java/coco.h')
    write_file(hg_revision(), "build/java/REVISION")
    write_file(hg_version(), "build/java/VERSION")
    run('build/java', ['javac', 'JNIinterface.java'])
    run('build/java', ['javah', 'JNIinterface'])
    run('build/java', ['gcc', '-I/System/Library/Frameworks/JavaVM.framework/Headers',
                       '-c', 'JNIinterface.c'])
    run('build/java', ['gcc', '-dynamiclib', '-o', 'libJNIinterface.jnilib',
                       'JNIinterface.o'])
    run('build/java', ['javac', 'Problem.java'])
    run('build/java', ['javac', 'Benchmark.java'])
    run('build/java', ['javac', 'demo.java'])
Exemplo n.º 19
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)
    copy_file('code-experiments/src/coco.h', 'code-experiments/build/matlab/coco.h')
    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'])
    else:
        run('code-experiments/build/matlab', ['octave', '--no-gui', 'setup.m'])
Exemplo n.º 20
0
Arquivo: do.py Projeto: brockho/numbbo
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)
    copy_file('code-experiments/src/coco.h', join(destination_folder, 'coco.h'))
    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'])   
Exemplo n.º 21
0
Arquivo: do.py Projeto: 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'])
Exemplo n.º 22
0
def build_matlab_sms():
    global release
    join = os.path.join
    source_folder = join('code-experiments', 'build', 'matlab')
    destination_folder = join('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)
    copy_file('code-experiments/src/coco.h', 'code-experiments/examples/bbob-biobj-matlab-smsemoa/coco.h')
    write_file(git_revision(), join(destination_folder, "REVISION"))
    write_file(git_version(), join(destination_folder, "VERSION"))
    for file in matlab_octave_wrapper_files:
        copy_file(join(source_folder, file),
                  join(destination_folder, file))
    # compile
    run('code-experiments/examples/bbob-biobj-matlab-smsemoa', ['matlab', '-nodisplay', '-nosplash', '-r', 'setup, exit'])
Exemplo n.º 23
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/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()})
Exemplo n.º 24
0
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')
    copy_file('code-experiments/src/coco.h', 'code-experiments/test/integration-test/coco.h')
    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")
    make("code-experiments/test/integration-test", "all")
Exemplo n.º 25
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)
Exemplo n.º 26
0
Arquivo: do.py Projeto: 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)
Exemplo n.º 27
0
Arquivo: do.py Projeto: 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'])
Exemplo n.º 28
0
def build_c_unit_tests():
    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):
        libraryPath = 'code-experiments/test/unit-test/lib/linux'
        fileName = 'libcmocka.so'
    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')
    copy_file('code-experiments/src/coco.h', 'code-experiments/test/unit-test/coco.h')
    make("code-experiments/test/unit-test", "clean")
    make("code-experiments/test/unit-test", "all")
Exemplo n.º 29
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)
Exemplo n.º 30
0
Arquivo: do.py Projeto: 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)
Exemplo n.º 31
0
def run_octave():
    # remove the mex files for a clean compilation first
    print('CLEAN\tmex files from code-experiments/build/matlab/')
    for filename in glob.glob('code-experiments/build/matlab/*.mex*'):
        os.remove(filename)

    # Copy octave-coco.bat to the Octave folder under Windows to allow
    # calling Octave from command line without messing up the system.    
    # Note that 'win32' stands for both Windows 32-bit and 64-bit.
    if ('win32' in sys.platform):
        print('SEARCH\tfor Octave folder from C:\\ (can take some time)')
        lookfor = 'octave.bat'
        for root, dirs, files in os.walk('C:\\'):
            if lookfor in files:
                break
        copy_file('code-experiments/build/matlab/octave_coco.bat.in', join(root, 'octave_coco.bat'))

    # amalgamate, copy, and build
    build_octave()
    if ('win32' in sys.platform):
        run('code-experiments/build/matlab', ['octave_coco.bat', '--no-gui', 'exampleexperiment.m'])
    else:
        run('code-experiments/build/matlab', ['octave', '--no-gui', 'exampleexperiment.m'])
Exemplo n.º 32
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)
    copy_file('code-experiments/src/coco.h', 'code-experiments/build/c/coco.h')
    copy_file('code-experiments/build/c/coco.c', 'code-experiments/examples/bbob2009-c-cmaes/coco.c')
    copy_file('code-experiments/build/c/coco.h', 'code-experiments/examples/bbob2009-c-cmaes/coco.h')
    write_file(git_revision(), "code-experiments/build/c/REVISION")
    write_file(git_version(), "code-experiments/build/c/VERSION")
    make("code-experiments/build/c", "clean")
    make("code-experiments/build/c", "all")
Exemplo n.º 33
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()})
Exemplo n.º 34
0
Arquivo: do.py Projeto: 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)
Exemplo n.º 35
0
Arquivo: do.py Projeto: 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)
Exemplo n.º 36
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'])
Exemplo n.º 37
0
def install_preprocessing():
    amalgamate(core_files + ['code-experiments/src/coco_runtime_c.c'],
               'code-preprocessing/archive-update/interface/coco.c', release)
    copy_file('code-experiments/src/coco.h', 'code-preprocessing/archive-update/interface/coco.h')
    python('code-preprocessing/archive-update', ['setup.py', 'install', '--user'])
Exemplo n.º 38
0
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)
    copy_file('code-experiments/src/coco.h', 'code-experiments/build/java/coco.h')
    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'])
    run('code-experiments/build/java', ['javah', 'CocoJNI'])

    # 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'])

            # 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'])

    # 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'])

    # 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'])
        run('code-experiments/build/java', ['gcc', '-I', jdkpath1, '-I', jdkpath2, '-o',
                                            'libCocoJNI.so', '-fPIC', '-shared', 'CocoJNI.c'])

    # 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'])
        run('code-experiments/build/java', ['gcc', '-dynamiclib', '-o', 'libCocoJNI.jnilib',
                                            'CocoJNI.o'])

    run('code-experiments/build/java', ['javac', 'Problem.java'])
    run('code-experiments/build/java', ['javac', 'Benchmark.java'])
    run('code-experiments/build/java', ['javac', 'Observer.java'])
    run('code-experiments/build/java', ['javac', 'Suite.java'])
    run('code-experiments/build/java', ['javac', 'ExampleExperiment.java'])
Exemplo n.º 39
0
def build_c_example_tests():
    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')
    copy_file('code-experiments/src/coco.h', 'code-experiments/test/example-test/coco.h')
    copy_file('code-experiments/src/best_values_hyp.txt', 'code-experiments/test/example-test/best_values_hyp.txt')
    copy_file('code-experiments/build/c/example_bbob2009.c', 'code-experiments/test/example-test/example_bbob2009.c')
    copy_file('code-experiments/build/c/example_biobj.c', 'code-experiments/test/example-test/example_biobj.c')
    copy_file('code-experiments/build/c/example_toy.c', 'code-experiments/test/example-test/example_toy.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")
    make("code-experiments/test/example-test", "all")
Exemplo n.º 40
0
def build_examples():
    build_c()
    copy_file('code-experiments/build/c/coco.c', 'code-experiments/examples/bbob2009-c-cmaes/coco.c')
    copy_file('code-experiments/build/c/coco.h', 'code-experiments/examples/bbob2009-c-cmaes/coco.h')