From bc0e47b6c237ac32d714a3588345c8583a10297f Mon Sep 17 00:00:00 2001 From: Alexis Montoison <35051714+amontoison@users.noreply.github.com> Date: Thu, 13 Jun 2024 00:05:03 -0400 Subject: [PATCH] Add a meson build system --- .cirrus.yml | 48 ++++++++ .github/workflows/meson.yml | 115 +++++++++++++++++++ .travis.yml | 68 ----------- install_modules.py | 27 +++++ meson.build | 197 ++++++++++++++++++++++++++++++++ meson_options.txt | 14 +++ src/algencan/meson.build | 2 + src/bobyqa/meson.build | 2 + src/cg_descent/meson.build | 4 + src/cgplus/meson.build | 2 + src/cobyla/meson.build | 2 + src/curvi/meson.build | 2 + src/derchk/meson.build | 1 + src/dfo/meson.build | 3 + src/directsearch/meson.build | 2 + src/e04nqf/meson.build | 2 + src/filtersd/meson.build | 2 + src/filtersqp/meson.build | 2 + src/gen77/meson.build | 2 + src/gen90/meson.build | 2 + src/genc/meson.build | 2 + src/gsl/meson.build | 1 + src/highs/meson.build | 2 + src/hrb/meson.build | 1 + src/ipopt/meson.build | 2 + src/knitro/meson.build | 1 + src/la04/meson.build | 2 + src/lbfgs/meson.build | 2 + src/lbfgsb/meson.build | 2 + src/lincoa/meson.build | 2 + src/loqo/meson.build | 1 + src/minos/meson.build | 2 + src/newuoa/meson.build | 2 + src/nitsol/meson.build | 2 + src/nlpqlp/meson.build | 2 + src/nomad/meson.build | 1 + src/npsol/meson.build | 2 + src/osqp/meson.build | 2 + src/pds/meson.build | 2 + src/pennlp/meson.build | 2 + src/praxis/meson.build | 2 + src/ql/meson.build | 2 + src/qplib/meson.build | 1 + src/ral_nlls/meson.build | 2 + src/ral_nlls/ral_nlls_dummy.F90 | 1 - src/snopt/meson.build | 2 + src/spg/meson.build | 2 + src/sqic/meson.build | 2 + src/stats/meson.build | 1 + src/stenmin/meson.build | 2 + src/tao/meson.build | 2 + src/tenmin/meson.build | 2 + src/tools/cutest_delegate.f90 | 111 ++++++++++++++++++ src/tools/meson.build | 96 ++++++++++++++++ src/tron/meson.build | 2 + src/uncmin/meson.build | 2 + src/vf13/meson.build | 2 + src/worhp/meson.build | 1 + version | 1 - 59 files changed, 700 insertions(+), 70 deletions(-) create mode 100644 .cirrus.yml create mode 100644 .github/workflows/meson.yml delete mode 100644 .travis.yml create mode 100644 install_modules.py create mode 100644 meson.build create mode 100644 meson_options.txt create mode 100644 src/algencan/meson.build create mode 100644 src/bobyqa/meson.build create mode 100644 src/cg_descent/meson.build create mode 100644 src/cgplus/meson.build create mode 100644 src/cobyla/meson.build create mode 100644 src/curvi/meson.build create mode 100644 src/derchk/meson.build create mode 100644 src/dfo/meson.build create mode 100644 src/directsearch/meson.build create mode 100644 src/e04nqf/meson.build create mode 100644 src/filtersd/meson.build create mode 100644 src/filtersqp/meson.build create mode 100644 src/gen77/meson.build create mode 100644 src/gen90/meson.build create mode 100644 src/genc/meson.build create mode 100644 src/gsl/meson.build create mode 100644 src/highs/meson.build create mode 100644 src/hrb/meson.build create mode 100644 src/ipopt/meson.build create mode 100644 src/knitro/meson.build create mode 100644 src/la04/meson.build create mode 100644 src/lbfgs/meson.build create mode 100644 src/lbfgsb/meson.build create mode 100644 src/lincoa/meson.build create mode 100644 src/loqo/meson.build create mode 100644 src/minos/meson.build create mode 100644 src/newuoa/meson.build create mode 100644 src/nitsol/meson.build create mode 100644 src/nlpqlp/meson.build create mode 100644 src/nomad/meson.build create mode 100644 src/npsol/meson.build create mode 100644 src/osqp/meson.build create mode 100644 src/pds/meson.build create mode 100644 src/pennlp/meson.build create mode 100644 src/praxis/meson.build create mode 100644 src/ql/meson.build create mode 100644 src/qplib/meson.build create mode 100644 src/ral_nlls/meson.build delete mode 120000 src/ral_nlls/ral_nlls_dummy.F90 create mode 100644 src/snopt/meson.build create mode 100644 src/spg/meson.build create mode 100644 src/sqic/meson.build create mode 100644 src/stats/meson.build create mode 100644 src/stenmin/meson.build create mode 100644 src/tao/meson.build create mode 100644 src/tenmin/meson.build create mode 100644 src/tools/cutest_delegate.f90 create mode 100644 src/tools/meson.build create mode 100644 src/tron/meson.build create mode 100644 src/uncmin/meson.build create mode 100644 src/vf13/meson.build create mode 100644 src/worhp/meson.build delete mode 100644 version diff --git a/.cirrus.yml b/.cirrus.yml new file mode 100644 index 0000000..d305f22 --- /dev/null +++ b/.cirrus.yml @@ -0,0 +1,48 @@ +task: + matrix: + - name: Meson / freebsd/gcc-12/Int32 + freebsd_instance: + image: freebsd-13-3-release-amd64 + env: + - INT64: "false" + - name: Meson / freebsd/gcc-12/Int64 + freebsd_instance: + image: freebsd-13-3-release-amd64 + env: + - INT64: "true" + - name: Meson / macos-silicon/gcc-14/Int32 + macos_instance: + image: ghcr.io/cirruslabs/macos-ventura-base:latest + env: + - INT64: "false" + - name: Meson / macos-silicon/gcc-14/Int64 + macos_instance: + image: ghcr.io/cirruslabs/macos-ventura-base:latest + env: + - INT64: "true" + dependencies_script: | + echo $(uname) + if [ "$(uname)" = "FreeBSD" ]; then + pkg install -y py39-pip meson bash gcc12 + else + brew install python meson gcc@14 + fi + configure_script: | + if [ "$(uname -s)" = "FreeBSD" ]; then + FC=gfortran12 CC=gcc12 CXX=g++12 meson setup builddir -Dcutest_int64=${INT64} \ + -Dquadruple=true \ + --prefix=${CIRRUS_WORKING_DIR}/../meson + else + FC=gfortran-14 CC=gcc-14 CXX=g++-14 meson setup builddir -Dcutest_int64=${INT64} \ + -Dquadruple=true \ + --prefix=${CIRRUS_WORKING_DIR}/../meson + fi + build_script: | + meson compile -C builddir + install_script: | + meson install -C builddir + test_script: | + meson test -C builddir + on_failure: + log_artifacts: + path: builddir/meson-logs/*log.txt diff --git a/.github/workflows/meson.yml b/.github/workflows/meson.yml new file mode 100644 index 0000000..ae8a55a --- /dev/null +++ b/.github/workflows/meson.yml @@ -0,0 +1,115 @@ +name: Meson +on: + push: + branches: + - master + pull_request: + types: [opened, synchronize, reopened] +jobs: + build: + name: ${{ matrix.os }}/${{ matrix.compiler }}-v${{ matrix.version }}/Int${{ matrix.int }} + strategy: + fail-fast: false + matrix: + os: [windows-latest, ubuntu-latest, macos-13] + arch: ['x64'] + version: ['11'] + int: ['32', '64'] + include: + - compiler: gcc + - os: ubuntu-latest + compiler: intel-classic + version: '2021.10' + int: '32' + - os: ubuntu-latest + compiler: intel-classic + version: '2021.10' + int: '64' + - os: windows-latest + compiler: intel + version: '2023.2' + int: '32' + - os: windows-latest + compiler: intel + version: '2023.2' + int: '64' + - os: ubuntu-latest + compiler: intel + version: '2023.2' + int: '32' + - os: ubuntu-latest + compiler: intel + version: '2023.2' + int: '64' + # - os: ubuntu-latest + # compiler: nvidia-hpc + # version: '24.05' + runs-on: ${{ matrix.os }} + steps: + - name: Check out CUTEST + uses: actions/checkout@v4 + + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: '3.11' + + - name: Install Meson and Ninja + run: pip install meson ninja + + - name: Set the environment variables CUTEST + shell: bash + run: echo "CUTEST=$GITHUB_WORKSPACE" >> $GITHUB_ENV + + - name: Install compilers + uses: fortran-lang/setup-fortran@main + with: + compiler: ${{ matrix.compiler }} + version: ${{ matrix.version }} + + # Uncomment this section to obtain ssh access to VM + # - name: Setup tmate session + # if: matrix.os == 'macos-13' + # uses: mxschmitt/action-tmate@v3 + + - name: Setup CUTEST + shell: bash + run: | + INT64="false" + if [[ "${{matrix.int}}" == "64" ]]; then + INT64="true" + fi + meson setup builddir --buildtype=debug \ + --prefix=$GITHUB_WORKSPACE/cutest \ + -Dquadruple=true \ + -Dcutest_int64=$INT64 + + - name: Build CUTEST + shell: bash + run: | + meson compile -C builddir + - uses: actions/upload-artifact@v3 + if: failure() + with: + name: ${{ matrix.os }}_${{ matrix.compiler }}-v${{ matrix.version }}_Int${{ matrix.int }}_meson-log.txt + path: builddir/meson-logs/meson-log.txt + + - name: Install CUTEST + shell: bash + run: | + meson install -C builddir + - uses: actions/upload-artifact@v3 + if: failure() + with: + name: ${{ matrix.os }}_${{ matrix.compiler }}-v${{ matrix.version }}_Int${{ matrix.int }}_install-log.txt + path: builddir/meson-logs/install-log.txt + + - name: Test CUTEST + shell: bash + run: | + meson test -C builddir + - uses: actions/upload-artifact@v3 + if: failure() + with: + name: ${{ matrix.os }}_${{ matrix.compiler }}-v${{ matrix.version }}_Int${{ matrix.int }}_testlog.txt + path: builddir/meson-logs/testlog.txt diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index afe0047..0000000 --- a/.travis.yml +++ /dev/null @@ -1,68 +0,0 @@ -language: bash - -os: - - linux - - osx - -sudo: required - -branches: - only: - - master - -notifications: - email: false - -env: - - SIFDECODE_VERSION=2.0.0 - - SIFDECODE_VERSION=master - -before_install: - - export ARCHDEFS_VERSION=2.0.2 - - if [[ $TRAVIS_OS_NAME == "linux" ]]; then sudo apt-get update -qq; sudo apt-get install -qq wget gfortran libblas-dev liblapack-dev; fi - - if [[ $TRAVIS_OS_NAME == "osx" ]]; then brew update; brew cask uninstall oclint; brew install gcc; fi - - mkdir -p $HOME/archdefs - - cd $HOME/archdefs - - wget https://github.com/ralna/ARCHDefs/archive/v$ARCHDEFS_VERSION.tar.gz - - export ARCHDEFS=$HOME/archdefs/ARCHDefs-$ARCHDEFS_VERSION - - tar xvf v$ARCHDEFS_VERSION.tar.gz - - mkdir -p $HOME/sifdecode - - cd $HOME/sifdecode - - if [[ $SIFDECODE_VERSION == "master" ]]; then - git clone https://github.com/ralna/SIFDecode.git; - export SIFDECODE=$HOME/sifdecode/SIFDecode; - else - wget https://github.com/ralna/SIFDecode/archive/v$SIFDECODE_VERSION.tar.gz; - export SIFDECODE=$HOME/sifdecode/SIFDecode-$SIFDECODE_VERSION; - tar xvf v$SIFDECODE_VERSION.tar.gz; - fi - - cd $SIFDECODE - - if [[ $TRAVIS_OS_NAME == "linux" ]]; then printf "6\n2\n4\n" > sifdecode.input; fi - - if [[ $TRAVIS_OS_NAME == "osx" ]]; then printf "13\n2\n" > sifdecode.input; fi - - printf "nny" >> sifdecode.input - - ./install_sifdecode < sifdecode.input - - if [[ $TRAVIS_OS_NAME == "linux" ]]; then export MYARCH=pc64.lnx.gfo; fi - - if [[ $TRAVIS_OS_NAME == "osx" ]]; then export MYARCH=mac64.osx.gfo; fi - - export CUTEST=$TRAVIS_BUILD_DIR - - export MASTSIF=$SIFDECODE/sif - - if [[ -a .git/shallow ]]; then git fetch --unshallow; fi - -install: - - cd $TRAVIS_BUILD_DIR - - if [[ $TRAVIS_OS_NAME == "linux" ]]; then printf "6\n2\n4\n2\n7\n" > cutest.input; fi - - if [[ $TRAVIS_OS_NAME == "osx" ]]; then printf "13\n2\n2\n5\n" > cutest.input; fi - - printf "nnydy" >> cutest.input - - ./install_cutest < cutest.input - -script: - - ./bin/runcutest -p gen77 -param NN=10 -D LUBRIFC.SIF - - ./bin/runcutest -p genc - - ./bin/runcutest -p gen90 - - ./bin/runcutest -p stats - - ./bin/runcutest --single -p gen77 - - ./bin/runcutest --single -p genc - - ./bin/runcutest --single -p gen90 - - ./bin/runcutest --single -p stats - - ./bin/runcutest -p gen77 -b -lblas -K -llapack -D ROSENBR - - ./bin/runcutest -p gen77 -lblas -D ROSENBR - diff --git a/install_modules.py b/install_modules.py new file mode 100644 index 0000000..4932cee --- /dev/null +++ b/install_modules.py @@ -0,0 +1,27 @@ +#!/usr/bin/env python3 +# Initially proposed by Sebastian Ehlert (@awvwgk) +from os import environ, listdir, makedirs, walk +from os.path import join, isdir, exists +from sys import argv +from shutil import copy + +build_dir = environ["MESON_BUILD_ROOT"] +if "MESON_INSTALL_DESTDIR_PREFIX" in environ: + install_dir = environ["MESON_INSTALL_DESTDIR_PREFIX"] +else: + install_dir = environ["MESON_INSTALL_PREFIX"] + +include_dir = "modules" +module_dir = join(install_dir, include_dir) + +modules = [] +# finds $build_dir/**/*.mod and $build_dir/**/*.smod +for root, dirs, files in walk(build_dir): + modules += [join(root, f) for f in files if f.endswith(".mod") or f.endswith(".smod")] + +if not exists(module_dir): + makedirs(module_dir) + +for mod in modules: + print("Installing", mod, "to", module_dir) + copy(mod, module_dir) diff --git a/meson.build b/meson.build new file mode 100644 index 0000000..c67e8c4 --- /dev/null +++ b/meson.build @@ -0,0 +1,197 @@ +project( + 'CUTEst', + 'fortran', 'c', + version: '2024.6.12', + meson_version: '>= 0.61.0', + default_options: [ + 'buildtype=release', + 'libdir=lib', + 'default_library=static', + 'warning_level=0', + ], +) + +cc = meson.get_compiler('c') +fc = meson.get_compiler('fortran') +fc_compiler = find_program(fc.cmd_array()) + +# Options +install_modules = get_option('modules') +build_quadruple = get_option('quadruple') +cutest_int64 = get_option('cutest_int64') + +libcutest_src = [] +libcutest_f_src = [] +libcutest_c_src = [] +libcutest_delegate_src = [] + +cutest_binaries = [] +cutest_tests = [] + +cutest_c_binaries = [] +cutest_c_tests = [] + +libcutest_include = [] +libcutest_include += include_directories('include') + +# Sources +# subdir('src/algencan') # needs algencan_ +# subdir('src/bobyqa') # needs bobyqa_ +# subdir('src/cg_descent') # needs cg_descent_ +# subdir('src/cgplus') # needs cgfam_ +# subdir('src/cobyla') # needs cobyla_ +# subdir('src/curvi') # needs curvih_, curvif_, curvig_ +subdir('src/derchk') +# subdir('src/dfo') # needs dfo_ +# subdir('src/directsearch') # needs nm_, pattrn_, smd_, shh_ +# subdir('src/e04nqf') # needs e04npf_, e04nrf_, e04nqf_ +# subdir('src/filtersd') # needs filtersd_ +# subdir('src/filtersqp') # needs readpar_, readscale_, filtersqp_ +# subdir('src/gen77') # ? +# subdir('src/gen90') # ? +# subdir('src/genc') # ? +# subdir('src/gsl') # needs +# subdir('src/highs') # needs Fortran module highs_fortran_api +subdir('src/hrb') +# subdir('src/ipopt') # needs ipcreate_, ipsolve_, ipfree_ +# subdir('src/knitro') # needs KN_get_release, KN_new, ... +# subdir('src/la04') # needs mc49ad_, la04id_, la04ad_ +# subdir('src/lbfgs') # needs lbfgs_ +# subdir('src/lbfgsb') # needs setulb_ +# subdir('src/lincoa') # needs lincoa_ +# subdir('src/loqo') # needs openlp, nlsetup, solvelp +# subdir('src/matlab') # --- not supported by build system --- +# subdir('src/minos') # needs m1open_, mispec_, minoss_ +# subdir('src/newuoa') # needs newuoa_ +# subdir('src/nitsol') # needs nitsol_, ... +# subdir('src/nlpqlp') # needs nlpqlp_ +subdir('src/nomad') +# subdir('src/npsol') # needs npfile_, npoptn_, npsol_ +# subdir('src/octave') # --- not supported by build system --- +# subdir('src/osqp') # needs osqp.h +# subdir('src/pds') # needs search_, getss_, pds_, result_ +# subdir('src/pennlp') # needs pennlpf_ +# subdir('src/praxis') # needs praxis_ +# subdir('src/ql') # needs ql_ +subdir('src/qplib') +# subdir('src/ral_nlls') # needs the Fortran module RAL_NLLS_precision +# subdir('src/snopt') # needs sninit_, snspec_, snoptb_ +# subdir('src/spg') # needs spg_ +# subdir('src/sqic') # needs crd2spr_, crd2spr_, crd2spr_, ctsqic_ +subdir('src/stats') +# subdir('src/stenmin') # needs stumcd_ +# subdir('src/tao') # needs petsc/finclude/petsctao.h and Fortran module petsctao +# subdir('src/tenmin') # needs tensor_ +# subdir('src/test') +subdir('src/tools') +# subdir('src/tron') # needs dnrm2_, dgpnrm2_ +# subdir('src/uncmin') # needs optif9_ +# subdir('src/vf13') # needs vf13ad_ +# subdir('src/worhp') # needs worhp.h + +# Preprocessing +if fc.get_id() == 'intel-cl' or fc.get_id() == 'intel-llvm-cl' + output_generator = '/Fi:@OUTPUT@' +else + output_generator = ['-o', '@OUTPUT@'] +endif + +pp_options = [] +pp_flag = [] +if fc.get_id() == 'gcc' + pp_flag += '-cpp' + pp_options += ['-cpp', '-E'] +elif fc.get_id() == 'intel' or fc.get_id() == 'intel-llvm' + pp_flag += '-fpp' + pp_options += ['-fpp', '-P'] +elif fc.get_id() == 'intel-cl' or fc.get_id() == 'intel-llvm-cl' + pp_flag += '/fpp' + pp_options += ['/fpp', '/P'] +elif fc.get_id() == 'nagfor' + pp_flag += '-fpp' + pp_options += ['-fpp', '-F'] +elif fc.get_id() == 'nvidia_hpc' + pp_flag += '-Mcpp' + pp_options += ['-Mcpp', '-F'] +endif +if cutest_int64 + pp_options += '-DINTEGER_64' +endif + +# Library libcutest_single or libcutest_single_64 +libcutest_single_name = 'cutest_single' +if cutest_int64 + libcutest_single_name += '_64' +endif + +gen_single = generator(fc_compiler, + output : 'single_@BASENAME@.f90', + arguments : pp_options + '-DREAL_32' + + ['-I', '@CURRENT_SOURCE_DIR@/include', '@INPUT@'] + + output_generator) + +pp_sources_single = [gen_single.process(libcutest_src)] + +libcutest_single = library(libcutest_single_name, + sources : pp_sources_single + libcutest_c_src, + include_directories : libcutest_include, + install : true) + +# Library libcutest_double or libcutest_double_64 +libcutest_double_name = 'cutest_double' +if cutest_int64 + libcutest_double_name += '_64' +endif + +gen_double = generator(fc_compiler, + output : 'double_@BASENAME@.f90', + arguments : pp_options + + ['-I', '@CURRENT_SOURCE_DIR@/include', '@INPUT@'] + + output_generator) + +pp_sources_double = [gen_double.process(libcutest_src)] + +libcutest_double = library(libcutest_double_name, + sources : pp_sources_double + libcutest_c_src, + include_directories : libcutest_include, + install : true) + +# Library libcutest_quadruple or libcutest_quadruple_64 +if build_quadruple + libcutest_quadruple_name = 'cutest_quadruple' + if cutest_int64 + libcutest_quadruple_name += '_64' + endif + + gen_quadruple = generator(fc_compiler, + output : 'quadruple_@BASENAME@.f90', + arguments : pp_options + '-DREAL_128' + + ['-I', '@CURRENT_SOURCE_DIR@/include', '@INPUT@'] + + output_generator) + + pp_sources_quadruple = [gen_quadruple.process(libcutest_src)] + + libcutest_quadruple = library(libcutest_quadruple_name, + sources : pp_sources_quadruple + libcutest_c_src, + include_directories : libcutest_include, + install : true) +endif + +# Binaries +# if get_option('default_library') == 'shared' +# foreach binary: cutest_binaries + cutest_c_binaries +# binname = binary[0] +# binfile = binary[1] +# executable(binname, +# sources : binfile, +# include_directories : libcutest_include, +# link_with : libcutest_double, +# install : true) +# endforeach +# endif + +# Fortran modules +if install_modules + script_modules = files('install_modules.py') + meson.add_install_script(script_modules) +endif diff --git a/meson_options.txt b/meson_options.txt new file mode 100644 index 0000000..5e0be91 --- /dev/null +++ b/meson_options.txt @@ -0,0 +1,14 @@ +option('modules', + type : 'boolean', + value : true, + description : 'option to install Fortran modules') + +option('quadruple', + type : 'boolean', + value : false, + description : 'option to compile CUTEst with quadruple precision') + +option('cutest_int64', + type : 'boolean', + value : false, + description : 'option to compile CUTEst with 64-bit integer') diff --git a/src/algencan/meson.build b/src/algencan/meson.build new file mode 100644 index 0000000..c0e812b --- /dev/null +++ b/src/algencan/meson.build @@ -0,0 +1,2 @@ +cutest_binaries += [['algencan_main', files('algencan_main.F')]] +cutest_tests += [['algencan_test', files('algencan_test.F')]] diff --git a/src/bobyqa/meson.build b/src/bobyqa/meson.build new file mode 100644 index 0000000..b93a6cc --- /dev/null +++ b/src/bobyqa/meson.build @@ -0,0 +1,2 @@ +cutest_binaries += [['bobyqa_main', files('bobyqa_main.F90')]] +cutest_tests += [['bobyqa_test', files('bobyqa_test.F90')]] diff --git a/src/cg_descent/meson.build b/src/cg_descent/meson.build new file mode 100644 index 0000000..05451ca --- /dev/null +++ b/src/cg_descent/meson.build @@ -0,0 +1,4 @@ +cutest_binaries += [['cg_descent_main', files('cg_descent_main.F')]] +cutest_tests += [['cg_descent_test', files('cg_descent_test.F')]] +cutest_c_binaries += [['cg_descent_main_c', files('cg_descent_main.c')]] +cutest_c_tests += [['cg_descent_test_c', files('cg_descent_test.c')]] diff --git a/src/cgplus/meson.build b/src/cgplus/meson.build new file mode 100644 index 0000000..d75959c --- /dev/null +++ b/src/cgplus/meson.build @@ -0,0 +1,2 @@ +cutest_binaries += [['cgplus_main', files('cgplus_main.F')]] +cutest_tests += [['cgplus_test', files('cgplus_test.F')]] diff --git a/src/cobyla/meson.build b/src/cobyla/meson.build new file mode 100644 index 0000000..14b47fc --- /dev/null +++ b/src/cobyla/meson.build @@ -0,0 +1,2 @@ +cutest_binaries += [['cobyla_main', files('cobyla_main.F90')]] +cutest_tests += [['cobyla_test', files('cobyla_test.F90')]] diff --git a/src/curvi/meson.build b/src/curvi/meson.build new file mode 100644 index 0000000..a7f5c54 --- /dev/null +++ b/src/curvi/meson.build @@ -0,0 +1,2 @@ +cutest_binaries += [['curvi_main', files('curvi_main.F90')]] +cutest_tests += [['curvi_test', files('curvi_test.F90')]] diff --git a/src/derchk/meson.build b/src/derchk/meson.build new file mode 100644 index 0000000..58acc0f --- /dev/null +++ b/src/derchk/meson.build @@ -0,0 +1 @@ +cutest_c_binaries += [['derchk_main_c', files('derchk_main.c')]] diff --git a/src/dfo/meson.build b/src/dfo/meson.build new file mode 100644 index 0000000..60f34f4 --- /dev/null +++ b/src/dfo/meson.build @@ -0,0 +1,3 @@ +cutest_binaries += [['dfo_main', files('dfo_main.F90')]] +cutest_tests += [['dfo_test', files('dfo_test.F90')]] + diff --git a/src/directsearch/meson.build b/src/directsearch/meson.build new file mode 100644 index 0000000..401b1df --- /dev/null +++ b/src/directsearch/meson.build @@ -0,0 +1,2 @@ +cutest_binaries += [['directsearch_main', files('directsearch_main.F90')]] +cutest_tests += [['directsearch_test', files('directsearch_test.F90')]] diff --git a/src/e04nqf/meson.build b/src/e04nqf/meson.build new file mode 100644 index 0000000..58cd0b2 --- /dev/null +++ b/src/e04nqf/meson.build @@ -0,0 +1,2 @@ +cutest_binaries += [['e04nqf_main', files('e04nqf_main.F90')]] +cutest_tests += [['e04nqf_test', files('e04nqf_test.F90')]] diff --git a/src/filtersd/meson.build b/src/filtersd/meson.build new file mode 100644 index 0000000..66cbe61 --- /dev/null +++ b/src/filtersd/meson.build @@ -0,0 +1,2 @@ +cutest_binaries += [['filtersd_main', files('filtersd_main.F')]] +cutest_tests += [['filtersd_test', files('filtersd_test.F')]] diff --git a/src/filtersqp/meson.build b/src/filtersqp/meson.build new file mode 100644 index 0000000..cd36905 --- /dev/null +++ b/src/filtersqp/meson.build @@ -0,0 +1,2 @@ +cutest_binaries += [['filtersqp_main', files('filtersqp_main.F')]] +cutest_tests += [['filtersqp_test', files('filtersqp_test.F')]] diff --git a/src/gen77/meson.build b/src/gen77/meson.build new file mode 100644 index 0000000..284d28b --- /dev/null +++ b/src/gen77/meson.build @@ -0,0 +1,2 @@ +libcutest_f_src += files('gen77.F') +cutest_binaries += [['gen77_main', files('gen77_main.F')]] diff --git a/src/gen90/meson.build b/src/gen90/meson.build new file mode 100644 index 0000000..ea93f74 --- /dev/null +++ b/src/gen90/meson.build @@ -0,0 +1,2 @@ +libcutest_src += files('gen90.F90') +cutest_binaries += [['gen90_main', files('gen90_main.F90')]] diff --git a/src/genc/meson.build b/src/genc/meson.build new file mode 100644 index 0000000..f2b7203 --- /dev/null +++ b/src/genc/meson.build @@ -0,0 +1,2 @@ +libcutest_c_src += files('genc.c') +cutest_c_binaries += [['genc_main', files('genc_main.c')]] diff --git a/src/gsl/meson.build b/src/gsl/meson.build new file mode 100644 index 0000000..d1572b2 --- /dev/null +++ b/src/gsl/meson.build @@ -0,0 +1 @@ +cutest_c_binaries += [['gsl_main_c', files('gsl_main.c')]] diff --git a/src/highs/meson.build b/src/highs/meson.build new file mode 100644 index 0000000..f750c3a --- /dev/null +++ b/src/highs/meson.build @@ -0,0 +1,2 @@ +cutest_binaries += [['ighs_main', files('highs_main.F90')]] +cutest_tests += [['highs_test', files('highs_test.F90')]] diff --git a/src/hrb/meson.build b/src/hrb/meson.build new file mode 100644 index 0000000..65131f7 --- /dev/null +++ b/src/hrb/meson.build @@ -0,0 +1 @@ +cutest_binaries += [['hrb_main', files('hrb_main.F90')]] diff --git a/src/ipopt/meson.build b/src/ipopt/meson.build new file mode 100644 index 0000000..ae7df2c --- /dev/null +++ b/src/ipopt/meson.build @@ -0,0 +1,2 @@ +cutest_binaries += [['ipopt_main', files('ipopt_main.F')]] +cutest_tests += [['ipopt_test', files('ipopt_test.F')]] diff --git a/src/knitro/meson.build b/src/knitro/meson.build new file mode 100644 index 0000000..5239fa4 --- /dev/null +++ b/src/knitro/meson.build @@ -0,0 +1 @@ +cutest_c_binaries += [['knitro_main_c', files('knitro_main.c')]] diff --git a/src/la04/meson.build b/src/la04/meson.build new file mode 100644 index 0000000..290ead2 --- /dev/null +++ b/src/la04/meson.build @@ -0,0 +1,2 @@ +cutest_binaries += [['la04_main', files('la04_main.F')]] +cutest_tests += [['la04_test', files('la04_test.F')]] diff --git a/src/lbfgs/meson.build b/src/lbfgs/meson.build new file mode 100644 index 0000000..8295f9b --- /dev/null +++ b/src/lbfgs/meson.build @@ -0,0 +1,2 @@ +cutest_binaries += [['lbfgs_main', files('lbfgs_main.F')]] +cutest_tests += [['lbfgs_test', files('lbfgs_test.F')]] diff --git a/src/lbfgsb/meson.build b/src/lbfgsb/meson.build new file mode 100644 index 0000000..b697341 --- /dev/null +++ b/src/lbfgsb/meson.build @@ -0,0 +1,2 @@ +cutest_binaries += [['lbfgsb_main', files('lbfgsb_main.F')]] +cutest_tests += [['lbfgsb_test', files('lbfgsb_test.F')]] diff --git a/src/lincoa/meson.build b/src/lincoa/meson.build new file mode 100644 index 0000000..13d1089 --- /dev/null +++ b/src/lincoa/meson.build @@ -0,0 +1,2 @@ +cutest_binaries += [['lincoa_main', files('lincoa_main.F90')]] +cutest_tests += [['lincoa_test', files('lincoa_test.F90')]] diff --git a/src/loqo/meson.build b/src/loqo/meson.build new file mode 100644 index 0000000..ffc924d --- /dev/null +++ b/src/loqo/meson.build @@ -0,0 +1 @@ +cutest_c_binaries += [['loqo_main_c', files('loqo_main.c')]] diff --git a/src/minos/meson.build b/src/minos/meson.build new file mode 100644 index 0000000..c4b5585 --- /dev/null +++ b/src/minos/meson.build @@ -0,0 +1,2 @@ +cutest_binaries += [['minos_main', files('minos_main.F')]] +cutest_tests += [['minos_test', files('minos_test.F')]] diff --git a/src/newuoa/meson.build b/src/newuoa/meson.build new file mode 100644 index 0000000..ab7c481 --- /dev/null +++ b/src/newuoa/meson.build @@ -0,0 +1,2 @@ +cutest_binaries += [['newuoa_main', files('newuoa_main.F90')]] +cutest_tests += [['newuoa_test', files('newuoa_test.F90')]] diff --git a/src/nitsol/meson.build b/src/nitsol/meson.build new file mode 100644 index 0000000..a187b4a --- /dev/null +++ b/src/nitsol/meson.build @@ -0,0 +1,2 @@ +cutest_binaries += [['nitsol_main', files('nitsol_main.F')]] +cutest_tests += [['nitsol_test', files('nitsol_test.F')]] diff --git a/src/nlpqlp/meson.build b/src/nlpqlp/meson.build new file mode 100644 index 0000000..99d18ef --- /dev/null +++ b/src/nlpqlp/meson.build @@ -0,0 +1,2 @@ +cutest_binaries += [['nlpqlp_main', files('nlpqlp_main.F')]] +cutest_tests += [['nlpqlp_test', files('nlpqlp_test.F')]] diff --git a/src/nomad/meson.build b/src/nomad/meson.build new file mode 100644 index 0000000..1d14d00 --- /dev/null +++ b/src/nomad/meson.build @@ -0,0 +1 @@ +cutest_c_binaries += [['nomad_main_c', files('nomad_main.c')]] diff --git a/src/npsol/meson.build b/src/npsol/meson.build new file mode 100644 index 0000000..6c23392 --- /dev/null +++ b/src/npsol/meson.build @@ -0,0 +1,2 @@ +cutest_binaries += [['npsol_main', files('npsol_main.F')]] +cutest_tests += [['npsol_test', files('npsol_test.F')]] diff --git a/src/osqp/meson.build b/src/osqp/meson.build new file mode 100644 index 0000000..c149ab3 --- /dev/null +++ b/src/osqp/meson.build @@ -0,0 +1,2 @@ +cutest_c_binaries += [['osqp_main_c', files('osqp_main.c')]] +cutest_c_tests += [['osqp_test_c', files('osqp_test.c')]] diff --git a/src/pds/meson.build b/src/pds/meson.build new file mode 100644 index 0000000..0132f17 --- /dev/null +++ b/src/pds/meson.build @@ -0,0 +1,2 @@ +cutest_binaries += [['pds_main', files('pds_main.F')]] +cutest_tests += [['pds_test', files('pds_test.F')]] diff --git a/src/pennlp/meson.build b/src/pennlp/meson.build new file mode 100644 index 0000000..97d3860 --- /dev/null +++ b/src/pennlp/meson.build @@ -0,0 +1,2 @@ +cutest_binaries += [['pennlp_main', files('pennlp_main.F')]] +cutest_tests += [['pennlp_test', files('pennlp_test.F')]] diff --git a/src/praxis/meson.build b/src/praxis/meson.build new file mode 100644 index 0000000..14ac8e1 --- /dev/null +++ b/src/praxis/meson.build @@ -0,0 +1,2 @@ +cutest_binaries += [['praxis_main', files('praxis_main.F')]] +cutest_tests += [['praxis_test', files('praxis_test.F')]] diff --git a/src/ql/meson.build b/src/ql/meson.build new file mode 100644 index 0000000..f4ad779 --- /dev/null +++ b/src/ql/meson.build @@ -0,0 +1,2 @@ +cutest_binaries += [['ql_main', files('ql_main.F')]] +cutest_tests += [['ql_test', files('ql_test.F')]] diff --git a/src/qplib/meson.build b/src/qplib/meson.build new file mode 100644 index 0000000..6771c04 --- /dev/null +++ b/src/qplib/meson.build @@ -0,0 +1 @@ +cutest_binaries += [['qplib_main', files('qplib_main.F90')]] diff --git a/src/ral_nlls/meson.build b/src/ral_nlls/meson.build new file mode 100644 index 0000000..3dd44ae --- /dev/null +++ b/src/ral_nlls/meson.build @@ -0,0 +1,2 @@ +cutest_binaries += [['ral_nlls_main', files('ral_nlls_main.F90')]] +cutest_tests += [['ral_nlls_test', files('ral_nlls_test.F90')]] diff --git a/src/ral_nlls/ral_nlls_dummy.F90 b/src/ral_nlls/ral_nlls_dummy.F90 deleted file mode 120000 index fd10aa3..0000000 --- a/src/ral_nlls/ral_nlls_dummy.F90 +++ /dev/null @@ -1 +0,0 @@ -ral_nlls_test.F90 \ No newline at end of file diff --git a/src/snopt/meson.build b/src/snopt/meson.build new file mode 100644 index 0000000..edec9d3 --- /dev/null +++ b/src/snopt/meson.build @@ -0,0 +1,2 @@ +cutest_binaries += [['snopt_main', files('snopt_main.F')]] +cutest_tests += [['snopt_test', files('snopt_test.F')]] diff --git a/src/spg/meson.build b/src/spg/meson.build new file mode 100644 index 0000000..ae90ae3 --- /dev/null +++ b/src/spg/meson.build @@ -0,0 +1,2 @@ +cutest_binaries += [['spg_main', files('spg_main.F')]] +cutest_tests += [['spg_test', files('spg_test.F')]] diff --git a/src/sqic/meson.build b/src/sqic/meson.build new file mode 100644 index 0000000..46f6192 --- /dev/null +++ b/src/sqic/meson.build @@ -0,0 +1,2 @@ +cutest_binaries += [['sqic_main', files('sqic_main.F90')]] +cutest_tests += [['sqic_test', files('sqic_test.F90')]] diff --git a/src/stats/meson.build b/src/stats/meson.build new file mode 100644 index 0000000..18ada54 --- /dev/null +++ b/src/stats/meson.build @@ -0,0 +1 @@ +cutest_binaries += [['stats_main', files('stats_main.F90')]] diff --git a/src/stenmin/meson.build b/src/stenmin/meson.build new file mode 100644 index 0000000..1c0c911 --- /dev/null +++ b/src/stenmin/meson.build @@ -0,0 +1,2 @@ +cutest_binaries += [['stenmin_main', files('stenmin_main.F')]] +cutest_tests += [['stenmin_test', files('stenmin_test.F')]] diff --git a/src/tao/meson.build b/src/tao/meson.build new file mode 100644 index 0000000..6fee7e4 --- /dev/null +++ b/src/tao/meson.build @@ -0,0 +1,2 @@ +cutest_binaries += [['tao_main', files('tao_main.F90')]] +# 'tao_main.F'? diff --git a/src/tenmin/meson.build b/src/tenmin/meson.build new file mode 100644 index 0000000..69bddce --- /dev/null +++ b/src/tenmin/meson.build @@ -0,0 +1,2 @@ +cutest_binaries += [['tenmin_main', files('tenmin_main.F')]] +cutest_tests += [['tenmin_test', files('tenmin_test.F')]] diff --git a/src/tools/cutest_delegate.f90 b/src/tools/cutest_delegate.f90 new file mode 100644 index 0000000..f477c2b --- /dev/null +++ b/src/tools/cutest_delegate.f90 @@ -0,0 +1,111 @@ +#ifdef REAL_32 +#define cutest_delegate_r cutest_delegate_s +#define LOAD_ROUTINE_NAME "load_routines_s_" +#define ELFUN_BIND_NAME "elfun_s_" +#define GROUP_BIND_NAME "group_s_" +#define RANGE_BIND_NAME "range_s_" +#elif REAL_128 +#define cutest_delegate_r cutest_delegate_q +#define LOAD_ROUTINE_NAME "load_routines_q" +#define ELFUN_BIND_NAME "elfun_q_" +#define GROUP_BIND_NAME "group_q_" +#define RANGE_BIND_NAME "range_q_" +#else +#define cutest_delegate_r cutest_delegate_d +#define LOAD_ROUTINE_NAME "load_routines_" +#define ELFUN_BIND_NAME "elfun_" +#define GROUP_BIND_NAME "group_" +#define RANGE_BIND_NAME "range_" +#endif + +module cutest_delegate_r + use, intrinsic :: iso_c_binding + implicit none + + ! Interface pour dlopen + interface + function dlopen(name, mode) bind(C, name="dlopen") + use iso_c_binding, only: c_ptr, c_int, c_char + type(c_ptr) :: dlopen + character(kind=c_char), dimension(*) :: name + integer(kind=c_int) :: mode + end function dlopen + end interface + + ! Interface pour dlsym + interface + function dlsym(handle, symbol) bind(C, name="dlsym") + use iso_c_binding, only: c_funptr, c_ptr, c_char + type(c_funptr) :: dlsym + type(c_ptr), value :: handle + character(kind=c_char), dimension(*) :: symbol + end function dlsym + end interface + + ! Constantes pour les modes d'ouverture de bibliothèques + integer, parameter :: RTLD_LAZY = 1 + + ! Handles pour les fonctions externes + type(c_ptr) :: lib_handle + type(c_funptr) :: ptr_elfun + type(c_funptr) :: ptr_group + type(c_funptr) :: ptr_range + + ! Pointeurs de procédure pour les fonctions externes + procedure(), pointer :: fun_elfun => null() + procedure(), pointer :: fun_group => null() + procedure(), pointer :: fun_range => null() + +contains + + ! Routine pour charger les routines depuis la bibliothèque dynamique + subroutine load_routines(libname) bind(C, name=LOAD_ROUTINE_NAME) + use iso_c_binding + implicit none + character(kind=c_char), dimension(*), intent(in) :: libname + + ! Charge la bibliothèque dynamique + lib_handle = dlopen(libname, RTLD_LAZY) + if (.not. c_associated(lib_handle)) then + stop "Unable to load library" + end if + + ! Récupère les adresses des fonctions + ptr_elfun = dlsym(lib_handle, "elfun"//c_null_char) + ptr_group = dlsym(lib_handle, "group"//c_null_char) + ptr_range = dlsym(lib_handle, "range"//c_null_char) + + ! Associe les pointeurs de procédure Fortran avec les adresses obtenues + call c_f_procpointer(ptr_elfun, fun_elfun) + call c_f_procpointer(ptr_group, fun_group) + call c_f_procpointer(ptr_range, fun_range) + end subroutine load_routines + + ! Routine pour appeler la fonction elfun + subroutine elfun() bind(C, name=ELFUN_BIND_NAME) + if (associated(fun_elfun)) then + call fun_elfun() + else + print *, "Error: fun_elfun is not associated." + end if + end subroutine elfun + + ! Routine pour appeler la fonction group + subroutine group() bind(C, name=GROUP_BIND_NAME) + if (associated(fun_group)) then + call fun_group() + else + print *, "Error: fun_group is not associated." + end if + end subroutine group + + ! Routine pour appeler la fonction range + subroutine range() bind(C, name=RANGE_BIND_NAME) + if (associated(fun_range)) then + call fun_range() + else + print *, "Error: fun_range is not associated." + end if + end subroutine range + +end module cutest_delegate_r diff --git a/src/tools/meson.build b/src/tools/meson.build new file mode 100644 index 0000000..9bbcb75 --- /dev/null +++ b/src/tools/meson.build @@ -0,0 +1,96 @@ +libcutest_c_src += files('ccutest.c') + +libcutest_src += files('ccfg.F90', + 'ccfsg.F90', + 'cchprods.F90', + 'cchprodsp.F90', + 'ccifg.F90', + 'ccifsg.F90', + 'cconst.F90', + 'cdh.F90', + 'cdhc.F90', + 'cdhj.F90', + 'cdimchp.F90', + 'cdimen.F90', + 'cdimohp.F90', + 'cdimse.F90', + 'cdimsg.F90', + 'cdimsh.F90', + 'cdimsj.F90', + 'ceh.F90', + 'cfn.F90', + 'cgr.F90', + 'cgrdh.F90', + 'chcprod.F90', + 'chjprod.F90', + 'chprod.F90', + 'cidh.F90', + 'cifn.F90', + 'cigr.F90', + 'cisgr.F90', + 'cisgrp.F90', + 'cish.F90', + 'cjprod.F90', + 'clfg.F90', + 'cnames.F90', + 'cnoobj.F90', + 'cofg.F90', + 'cofsg.F90', + 'cohprods.F90', + 'cohprodsp.F90', + 'connames.F90', + 'creport.F90', + 'csetup.F90', + 'csgr.F90', + 'csgreh.F90', + 'csgrp.F90', + 'csgrsh.F90', + 'csgrshp.F90', + 'csh.F90', + 'cshc.F90', + 'cshcprod.F90', + 'cshj.F90', + 'cshp.F90', + 'cshprod.F90', + 'csjp.F90', + 'csjprod.F90', + 'cstats.F90', + 'cterminate.F90', + 'cutest.F90', + 'cvartype.F90', + 'fortran_ops.F90', + 'interface.F90', + 'kinds.F90', + 'lqp.F90', + 'newthread.F90', + 'pname.F90', + 'problem.F90', + 'probname.F90', + 'readin.F90', + 'timings.F90', + 'ubandh.F90', + 'udh.F90', + 'udimen.F90', + 'udimse.F90', + 'udimsh.F90', + 'ueh.F90', + 'ufn.F90', + 'ugr.F90', + 'ugrdh.F90', + 'ugreh.F90', + 'ugrsh.F90', + 'uhprod.F90', + 'unames.F90', + 'uofg.F90', + 'ureport.F90', + 'usetup.F90', + 'ush.F90', + 'ushp.F90', + 'ushprod.F90', + 'uterminate.F90', + 'uvartype.F90', + 'varnames.F90') + +if get_option('default_library') == 'shared' + libcutest_src += files('cutest_delegate.f90') +endif diff --git a/src/tron/meson.build b/src/tron/meson.build new file mode 100644 index 0000000..60dc55d --- /dev/null +++ b/src/tron/meson.build @@ -0,0 +1,2 @@ +cutest_binaries += [['tron_main', files('tron_main.F')]] +cutest_tests += [['tron_test', files('tron_test.F')]] diff --git a/src/uncmin/meson.build b/src/uncmin/meson.build new file mode 100644 index 0000000..dda3acc --- /dev/null +++ b/src/uncmin/meson.build @@ -0,0 +1,2 @@ +cutest_binaries += [['uncmin_main', files('uncmin_main.F90')]] +cutest_tests += [['uncmin_test', files('uncmin_test.F90')]] diff --git a/src/vf13/meson.build b/src/vf13/meson.build new file mode 100644 index 0000000..d2ce40c --- /dev/null +++ b/src/vf13/meson.build @@ -0,0 +1,2 @@ +cutest_binaries += [['vf13_main', files('vf13_main.F')]] +cutest_tests += [['vf13_test', files('vf13_test.F')]] diff --git a/src/worhp/meson.build b/src/worhp/meson.build new file mode 100644 index 0000000..c99f62b --- /dev/null +++ b/src/worhp/meson.build @@ -0,0 +1 @@ +cutest_c_binaries += [['worhp_main', files('worhp_main.c')]] diff --git a/version b/version deleted file mode 100644 index 7ef0658..0000000 --- a/version +++ /dev/null @@ -1 +0,0 @@ -* CUTEst version 1.10000 (17/Jun/2013 12:30 GMT)