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)
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()})
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)
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'])
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()})
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)
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'])
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)
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)
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)
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)
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'])
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)
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'])
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'])
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)
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'])
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'])
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")
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)
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'])
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)
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)
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)
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")
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'])
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)
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'])
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)
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'])
def help(): print("""IOHprofiler framework bootstrap tool. Version %s Usage: do.py <command> <arguments> Available commands for users: build-c - Build C module build-python - Build Python modules run-c - Build and run example experiment in C run-python - Build and run example experiment in Python Available commands for developers: build - Build C and Python modules run - Run example experiments in C and Python """ % git_version(pep440=True))
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'])
def help(): print("""COCO framework bootstrap tool. Version %s Usage: do.py <command> <arguments> If you want to get going as quickly as possible do once python do.py run-<your-language> and python do.py install-postprocessing and you are all set. Available commands for users: build-c - Build C module build-java - Build Java module build-matlab - Build Matlab module build-matlab-sms - Build SMS-EMOA example in Matlab build-octave - Build Matlab module in Octave build-python - Build Python modules build-python2 - Build Python 2 modules build-python3 - Build Python 3 modules install-postprocessing - Install postprocessing (user-locally) run-c - Build and run example experiment in C run-java - Build and run example experiment in Java run-matlab - Build and run example experiment in MATLAB run-matlab-sms - Build and run SMS-EMOA on bbob-biobj suite in MATLAB run-octave - Build and run example experiment in Octave run-python - Build and install COCO module and run tests and the example experiment in Python, "no-tests" omits tests Available commands for developers: build - Build C, Java and Python modules run - Run example experiments in C, Java and Python silent cmd ... - Calls "do.py cmd ..." and remains silent if no error occurs verbose cmd ... - Calls "do.py cmd ..." and shows more output test - Test C, Java and Python modules run-sandbox-python - Run a Python script with installed COCO module Takes a single argument (name of Python script file) test-c - Build and run unit tests, integration tests and an example experiment test in C test-c-unit - Build and run unit tests in C test-c-integration - Build and run integration tests in C test-c-example - Build and run an example experiment test in C test-java - Build and run a test in Java test-python - Build and run minimal test of Python module test-python2 - Build and run minimal test of Python 2 module test-python3 - Build and run minimal test of Python 3 module test-octave - Build and run example experiment in Octave test-postprocessing - Runs some of the post-processing tests. test-postprocessing-all - Runs all of the post-processing tests. verify-postprocessing - Checks if the generated html is up-to-date. leak-check - Check for memory leaks in C install-preprocessing - Install preprocessing (user-locally) To build a release version which does not include debugging information in the amalgamations set the environment variable COCO_RELEASE to 'true'. """ % git_version(pep440=True))
def help(): print("""COCO framework bootstrap tool. Version %s Usage: do.py <command> <arguments> If you want to get going as quickly as possible do once python do.py run-<your-language> and python do.py install-postprocessing and you are all set. Available commands for users: build-c - Build C module build-java - Build Java module build-matlab - Build Matlab module build-matlab-sms - Build SMS-EMOA example in Matlab build-octave - Build Matlab module in Octave build-python - Build Python modules build-python2 - Build Python 2 modules build-python3 - Build Python 3 modules install-postprocessing - Install postprocessing (user-locally) run-c - Build and run example experiment in C run-java - Build and run example experiment in Java run-matlab - Build and run example experiment in MATLAB run-matlab-sms - Build and run SMS-EMOA on bbob-biobj suite in MATLAB run-octave - Build and run example experiment in Octave run-python - Build and install COCO module and run tests and the example experiment in Python, "no-tests" omits tests Available commands for developers: build - Build C, Java and Python modules run - Run example experiments in C, Java and Python silent cmd ... - Calls "do.py cmd ..." and remains silent if no error occurs verbose cmd ... - Calls "do.py cmd ..." and shows more output test - Test C, Java and Python modules run-sandbox-python - Run a Python script with installed COCO module Takes a single argument (name of Python script file) test-c - Build and run unit tests, integration tests and an example experiment test in C test-c-unit - Build and run unit tests in C test-c-integration - Build and run integration tests in C test-c-example - Build and run an example experiment test in C test-java - Build and run a test in Java test-python - Build and run minimal test of Python module test-python2 - Build and run minimal test of Python 2 module test-python3 - Build and run minimal test of Python 3 module test-octave - Build and run example experiment in Octave test-postprocessing - Runs some of the post-processing tests test-postprocessing-all - Runs all of the post-processing tests [needs access to the internet] verify-postprocessing - Checks if the generated html is up-to-date leak-check - Check for memory leaks in C install-preprocessing - Install preprocessing (user-locally) test-preprocessing - Runs preprocessing tests [needs access to the internet] To build a release version which does not include debugging information in the amalgamations set the environment variable COCO_RELEASE to 'true'. """ % git_version(pep440=True))
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)
def help(): print("""COCO framework bootstrap tool. Version %s Usage: do.py <command> <arguments> If you want to get going as quickly as possible do once python do.py run-<your-language> and python do.py install-postprocessing and you are all set. Available commands for users: build-c - Build C module build-java - Build Java module build-matlab - Build Matlab module build-matlab-sms - Build SMS-EMOA example in Matlab build-octave - Build Matlab module in Octave build-python - Build Python modules (see NOTE below) install-postprocessing - Install postprocessing (see NOTE below) run-c - Build and run example experiment in C run-java - Build and run example experiment in Java run-matlab - Build and run example experiment in MATLAB run-matlab-sms - Build and run SMS-EMOA on bbob-biobj suite in MATLAB run-octave - Build and run example experiment in Octave run-python - Build and install COCO module and then run the example experiment in Python. The optional parameter "and-test" also runs the tests of `coco_test.py` (see NOTE below) Available commands for developers: build - Build C, Java and Python modules (see NOTE below) run - Run example experiments in C, Java and Python (see NOTE below) silent cmd ... - Calls "do.py cmd ..." and remains silent if no error occurs verbose cmd ... - Calls "do.py cmd ..." and shows more output test - Test C, Java and Python modules (see NOTE below) run-sandbox-python - Run a Python script with installed COCO module Takes a single argument(name of Python script file) test-c - Build and run unit tests, integration tests and an example experiment test in C test-c-unit - Build and run unit tests in C test-c-integration - Build and run integration tests in C test-c-example - Build and run an example experiment test in C test-java - Build and run a test in Java test-python - Build and run minimal test of Python module test-octave - Build and run example experiment in Octave test-postprocessing - Runs some of the post-processing tests (see NOTE below) test-postprocessing-all - Runs all of the post-processing tests [needs access to the internet] (see NOTE below) test-suites - Runs regression test on all benchmark suites verify-postprocessing - Checks if the generated html is up-to-date (see NOTE below) leak-check - Check for memory leaks in C install-preprocessing - Install preprocessing (user-locally) (see NOTE below) test-preprocessing - Runs preprocessing tests [needs access to the internet] (see NOTE below) NOTE: These commands install Python packages to the global site packages by by default. This behavior can be modified by providing one of the following arguments. install-user - Installs under the user directory install-home=<dir> - Installs under the specified home directory To build a release version which does not include debugging information in the amalgamations set the environment variable COCO_RELEASE to 'true'. """ % git_version(pep440=True))