10
0
mirror of https://gitlab.com/scemama/EZFIO.git synced 2024-12-22 04:13:34 +01:00

Works with ninja

This commit is contained in:
Anthony Scemama 2015-06-01 16:12:05 +02:00
parent 425ed281c2
commit 5313cd9e41
14 changed files with 157 additions and 4100 deletions

4
Bash/ezfio.sh Normal file
View File

@ -0,0 +1,4 @@
#!/bin/bash
# TODO

View File

@ -39,11 +39,12 @@ Create an empty directory for your project and unpack the ``EZFIO.tar.gz`` file
$ ls
EZFIO/
Get into the ``EZFIO`` directory and run:
Get into the ``EZFIO`` directory and set up your compiling options:
.. code-block:: bash
$ ./configure
$ cp make.config.example make.config
$ vim make.config
Now, configure the library to produce the desired suboutines. Get into
the ``config`` directory and create a new file ``test.config``

3929
configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -1,145 +0,0 @@
# EZFIO is an automatic generator of I/O libraries
# Copyright (C) 2009 Anthony SCEMAMA, CNRS
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Anthony Scemama
# LCPQ - IRSAMC - CNRS
# Universite Paul Sabatier
# 118, route de Narbonne
# 31062 Toulouse Cedex 4
# scemama@irsamc.ups-tlse.fr
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
VERSION=[`. version ; echo $VERSION`]
AC_SUBST([VERSION])
AC_REVISION([$Revision: $VERSION $])
AC_PREREQ([2.50])
AC_INIT([EZFIO Library Generator], [], [scemama@irsamc.ups-tlse.fr],[ezfio],[http://ezfio.sourceforge.net])
AC_SYS_LONG_FILE_NAMES
ROOT=`pwd`
AC_SUBST([ROOT])
AC_CONFIG_SRCDIR([src/run.irp.f])
AC_CONFIG_FILES([make.config])
AC_PREFIX_DEFAULT([./])
STATIC_LIB=$ROOT/lib/libezfio.a
AC_PROG_RANLIB
# Test Fortran
# ------------
AC_LANG([Fortran])
AC_PROG_FC([ifort gfortran],[Fortran 90])
AC_PROG_FC_C_O
AC_FC_SRCEXT([F90])
AC_FC_FREEFORM
# Test Python
# ------------
AC_CHECK_PROG([PYTHON],[python],[yes],[no])
if [[ "$PYTHON" = no ]] ; then
AC_MSG_ERROR([Please install Python.])
fi
# Test Ninja
# -----------
if [[ -z "$NINJA" ]] ; then
AC_CHECK_PROG([NINJA],[ninja],[yes],[no])
if [[ "$NINJA" = no ]] ; then
NINJA=
fi
fi
AC_SUBST[[NINJA]]
# Test AR
# -------
if [[ -z "$AR" ]] ; then
AC_CHECK_PROG([AR],[ar],[yes],[no])
if [[ "$AR" = no ]] ; then
AC_MSG_ERROR([ar not found.])
fi
AR=ar
fi
AC_SUBST([AR])
# Test Gzip and zcat
# ------------------
if [[ -z "$HAS_GZIP" ]] ; then
AC_CHECK_PROG([GZIP],[gzip],[yes],[no])
if [[ "$GZIP" = no ]] ; then
HAS_GZIP="-DNO_GZIP"
fi
AC_CHECK_PROG([ZCAT],[zcat],[yes],[no])
if [[ "$ZCAT" = no ]] ; then
HAS_GZIP="-DNO_GZIP"
fi
AC_CHECK_PROG([MKFIFO],[mkfifo],[yes],[no])
if [[ "$MKFIFO" = no ]] ; then
HAS_GZIP="-DNO_GZIP"
fi
fi
AC_SUBST([HAS_GZIP])
# Test IRPF90
# ------------
if [[ -z "$IRPF90" ]] ; then
AC_CHECK_PROG([IRPF90],[irpf90],[yes],[no])
if [[ "$IRPF90" = no ]] ; then
AC_MSG_ERROR([Please install IRPF90:\nhttp://irpf90.ups-tlse.fr])
fi
IRPF90=`which irpf90`
fi
AC_SUBST([IRPF90])
if [[ -z "$FCFLAGS" ]] ; then
case $FC in
ifort*)
FCFLAGS="-O2 -g -ip"
STATIC_FC="-static-intel -static-libgcc -static"
;;
gfortran*)
FCFLAGS="-O2 -g -ffree-line-length-none"
STATIC_FC="-static-libgcc -static"
;;
esac
fi
# Write make.config
LIB="$STATIC_LIB"
FCFLAGS="$FCFLAGS $STATIC_FC"
AC_SUBST([LIB])
# Done
#-----
AC_OUTPUT

6
make.config.example Normal file
View File

@ -0,0 +1,6 @@
IRPF90 = irpf90
FC = gfortran -ffree-line-length-none -fPIC
FCFLAGS= -O2
RANLIB = ranlib
AR = ar
NINJA = ninja

View File

@ -1,6 +0,0 @@
IRPF90 = @IRPF90@ @HAS_GZIP@
FC = @FC@ -fPIC
FCFLAGS= @FCFLAGS@
RANLIB = @RANLIB@
AR = @AR@
NINJA = @NINJA@

View File

@ -22,10 +22,8 @@
# 31062 Toulouse Cedex 4
# scemama@irsamc.ups-tlse.fr
DEFAULT_TARGET: python
DEFAULT_TARGET: all
../make.config:
make -C .. make.config
include ../make.config
export
@ -36,25 +34,23 @@ irpf90.make: $(wildcard *.irp.f) ../config/*
include ../version
.PHONY: python static
.PHONY: static all
static: ../lib/libezfio_irp.a ../lib/libezfio.a
all: static
../lib/libezfio.a: $(OBJ1)
- bash -c "[[ -e ../libezfio.a ]] && rm ../lib/libezfio.a"
static: ../lib/libezfio.a ../lib/libezfio_irp.a
../lib/libezfio.a: IRPF90_temp/irpf90.a
rm -f ../lib/libezfio.a
$(AR) cru ../lib/libezfio.a $(OBJ1)
$(RANLIB) ../lib/libezfio.a
../lib/libezfio_irp.a: ../lib/libezfio.a
rm -f ../lib/libezfio_irp.a
cp ../lib/libezfio.a ../lib/libezfio_irp.a
$(AR) dv ../lib/libezfio_irp.a irp_stack.irp.o
$(RANLIB) ../lib/libezfio_irp.a
test: static
ifort -o $@ IRPF90_temp/run.irp.F90 -L../lib/ -lezfio
python: static
cat ezfio-head.py libezfio_groups-gen.py libezfio_util-gen.py ezfio-tail.py > ../Python/ezfio.py
ezfio.py: python
$(FC) -o $@ IRPF90_temp/run.irp.F90 -L../lib/ -lezfio

89
src/create_bash.py Executable file
View File

@ -0,0 +1,89 @@
#!/usr/bin/env python
# EZFIO is an automatic generator of I/O libraries
# Copyright (C) 2009 Anthony SCEMAMA, CNRS
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Anthony Scemama
# LCPQ - IRSAMC - CNRS
# Universite Paul Sabatier
# 118, route de Narbonne
# 31062 Toulouse Cedex 4
# scemama@irsamc.ups-tlse.fr
import re
from read_config import groups
from groups_templates import *
from f_types import t_short, f2ocaml
import os
import sys
def run():
head = []
tail = []
file = open("../version","r")
v = file.readline()
file.close()
v = v.split('=')[1].strip()
l = os.getcwd().replace('/src','')
head += ["""let version = "%s";;"""%(v),
"""let library = "%s";;"""%(l)]
for group in groups.keys():
for var,type,dims,command in groups[group]:
if command is not "":
continue
dims_py = str(dims)
for g in groups.keys():
dims_py = dims_py.replace(g,'self.'+g)
var = var.lower()
group = group.lower()
strdims = tuple(map(lambda x: '('+str(x)+')',dims))
strdims = str(strdims).replace("'","")
if len(dims) == 1:
strdims = strdims[:-2]+")"
dim_max = strdims[1:-1].replace(',','*')
type_set = type
if type.lower().startswith('character'):
type_set = 'character*(*)'
d = { 'type_short': f2ocaml[t_short(type)],
'type': type,
'type_set': type_set,
'var': var,
'group': group,
'dims': strdims}
if dims == ():
tail += ['let get_%(group)s_%(var)s () = read_%(type_short)s "%(group)s" "%(var)s";;' %(d),
'let set_%(group)s_%(var)s = write_%(type_short)s "%(group)s" "%(var)s" ;;' %(d) ,
'let has_%(group)s_%(var)s () = has "%(group)s" "%(var)s" ;;' %(d) ]
else:
tail += ['let get_%(group)s_%(var)s () = read_%(type_short)s_array "%(group)s" "%(var)s";;' %(d),
'let set_%(group)s_%(var)s = write_%(type_short)s_array "%(group)s" "%(var)s";;' %(d) ,
'let has_%(group)s_%(var)s () = has_array "%(group)s" "%(var)s" ;;' %(d) ]
file = open('ezfio.ml','r')
template = file.read()
file.close()
template = template.replace("(*$HEAD*)",'\n'.join(head))
template = template.replace("(*$TAIL*)",'\n'.join(tail))
file = open('../Ocaml/ezfio.ml','w')
file.write(template)
file.close()

31
src/create_python.py Executable file
View File

@ -0,0 +1,31 @@
#!/bin/bash
# EZFIO is an automatic generator of I/O libraries
# Copyright (C) 2009 Anthony SCEMAMA, CNRS
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Anthony Scemama
# LCPQ - IRSAMC - CNRS
# Universite Paul Sabatier
# 118, route de Narbonne
# 31062 Toulouse Cedex 4
# scemama@irsamc.ups-tlse.fr
def run():
with open('../Python/ezfio.py','w') as out:
for f in "ezfio-head.py libezfio_groups-gen.py libezfio_util-gen.py ezfio-tail.py".split():
with open(f,'r') as inp:
out.write(inp.read())

View File

@ -148,3 +148,6 @@ file_py.close()
import create_ocaml
create_ocaml.run()
import create_python
create_python.run()

View File

@ -89,7 +89,7 @@ end subroutine
subroutine ezfio_free_%(group)s_%(var)s()
implicit none
BEGIN_DOC
! Frees the memory for %(group)s/%(var)
! Frees the memory for %(group)s/%(var)s
END_DOC
FREE %(group)s_%(var)s
end
@ -149,7 +149,7 @@ end subroutine
subroutine ezfio_free_%(group)s_%(var)s()
implicit none
BEGIN_DOC
! Frees the memory for %(group)s/%(var)
! Frees the memory for %(group)s/%(var)s
END_DOC
FREE %(group)s_%(var)s
end
@ -175,7 +175,7 @@ end
subroutine ezfio_free_%(group)s_%(var)s()
implicit none
BEGIN_DOC
! Frees the memory for %(group)s/%(var)
! Frees the memory for %(group)s/%(var)s
END_DOC
FREE %(group)s_%(var)s
end
@ -226,7 +226,7 @@ end subroutine
subroutine ezfio_free_%(group)s_%(var)s()
implicit none
BEGIN_DOC
! Frees the memory for %(group)s/%(var)
! Frees the memory for %(group)s/%(var)s
END_DOC
FREE %(group)s_%(var)s
end

View File

@ -237,6 +237,10 @@ end
template_no_logical = """
integer function n_count_%(type_short)s(array,isize,val)
implicit none
BEGIN_DOC
! Count number of elements of array of type %(type)s
END_DOC
%(type)s, intent(in) :: array(*)
integer, intent(in) :: isize
%(type)s, intent(in) :: val

View File

@ -23,6 +23,9 @@
! scemama@irsamc.ups-tlse.fr
program run
BEGIN_DOC
! Test run
END_DOC
! Leave this empty
end

View File

@ -1 +1 @@
VERSION=1.2.2
VERSION=1.3.0