diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a5e0cf6..a078b04 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,34 +16,55 @@ env: jobs: # - # Test project on Ubuntu with Intel ifx compiler + # Test project in various system configurations # - ubuntu-ifx: + fortuno-test: - runs-on: ubuntu-latest + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest] + compilers: [Intel, GNU] steps: - name: Check-out code uses: actions/checkout@v3 - - name: Setup Intel oneAPI + - name: Setup Intel compiler + if: ${{ contains(matrix.compilers, 'Intel') }} uses: rscohn2/setup-oneapi@v0 with: components: ifx - - name: Set compiler environment + - name: Setup Intel environment + if: ${{ contains(matrix.compilers, 'Intel') }} run: | + source /opt/intel/oneapi/setvars.sh + printenv >> ${GITHUB_ENV} echo "FC=ifx" >> ${GITHUB_ENV} echo "FPM_FC=ifx" >> ${GITHUB_ENV} + - name: Setup GNU compiler + if: ${{ contains(matrix.compilers, 'GNU') }} + uses: fortran-lang/setup-fortran@v1 + with: + compiler: gcc + version: 13 + + - name: Setup GNU environment + if: ${{ contains(matrix.compilers, 'GNU') }} + run: | + echo "FC=${{ env.FC }}" >> ${GITHUB_ENV} + echo "FPM_FC=${{ env.FC }}" >> ${GITHUB_ENV} + - name: Setup build tools run: | pip install cmake fpm meson ninja - name: Build Fortuno run: | - source /opt/intel/oneapi/setvars.sh cmake -B ${BUILD_DIR} -G Ninja -DCMAKE_INSTALL_PREFIX=${INSTALL_DIR} cmake --build ${BUILD_DIR} cmake --install ${BUILD_DIR} @@ -51,7 +72,6 @@ jobs: - name: Test CMake export run: | - source /opt/intel/oneapi/setvars.sh CMAKE_PREFIX_PATH=${INSTALL_DIR} cmake -B ${BUILD_DIR} -G Ninja test/export cmake --build ${BUILD_DIR} ${BUILD_DIR}/testapp @@ -59,27 +79,24 @@ jobs: - name: Test PkgConfig export run: | - source /opt/intel/oneapi/setvars.sh export LD_LIBRARY_PATH="${PWD}/${INSTALL_DIR}/lib:${LD_LIBRARY_PATH}" export PKG_CONFIG_PATH="${PWD}/${INSTALL_DIR}/lib/pkgconfig:${PKG_CONFIG_PATH}" cflags="$(pkg-config --cflags fortuno)" lflags="$(pkg-config --libs fortuno)" mkdir ${BUILD_DIR} pushd ${BUILD_DIR} - ifx ${cflags} ${lflags} -o testapp ../test/export/app/testapp.f90 + ${FC} ${cflags} -o testapp ../test/export/app/testapp.f90 ${lflags} ./testapp popd rm -rf ${BUILD_DIR} - name: Test fpm export run: | - source /opt/intel/oneapi/setvars.sh cd test/export fpm run testapp - name: Test meson PkgConfig export run: | - source /opt/intel/oneapi/setvars.sh export PKG_CONFIG_PATH="${PWD}/${INSTALL_DIR}/lib/pkgconfig:${PKG_CONFIG_PATH}" cd test/export meson setup -Dfortuno_subproject=false ${BUILD_DIR} @@ -89,7 +106,6 @@ jobs: - name: Test meson subproject export run: | - source /opt/intel/oneapi/setvars.sh FORTUNO_DIR=${PWD} GIT_REV=$(git rev-parse HEAD) cd test/export diff --git a/src/fortuno/argumentparser.f90 b/src/fortuno/argumentparser.f90 index ce180f4..1c792a8 100644 --- a/src/fortuno/argumentparser.f90 +++ b/src/fortuno/argumentparser.f90 @@ -130,6 +130,8 @@ subroutine argument_parser_parse_args(this, argumentvalues, logger, exitcode) allocate(argumentvalues%argvals(0)) allocate(posargs(0)) optionsallowed = .true. + + ! Process all arguments iarg = 0 argloop: do while (iarg < nargs) iarg = iarg + 1 @@ -183,10 +185,20 @@ subroutine argument_parser_parse_args(this, argumentvalues, logger, exitcode) return end associate end do argloop + + ! Check collected positional arguments associate (argdef => this%argdefs(nargdefs)) + ! If the last argdef was not an option, store all position arguments under this name if (.not. allocated(argdef%longopt) .and. argdef%shortopt == "") then - argumentvalues%argvals = [argumentvalues%argvals,& - & argument_value(name=argdef%name, argval=string_list(posargs))] + ! argumentvalues%argvals = [argumentvalues%argvals,& + ! & argument_value(name=argdef%name, argval=string_list(posargs))] + ! Workaround:gfortran:13.2 + block + class(*), allocatable :: tmp + tmp = string_list(posargs) + argumentvalues%argvals = [argumentvalues%argvals,& + & argument_value(name=argdef%name, argval=tmp)] + end block else if (size(posargs) > 1) then call logger%log_error("Superfluous positional arguments found") exitcode = 1