Skip to content

Commit

Permalink
Merge pull request #4 from MilanSkocic/dev
Browse files Browse the repository at this point in the history
0.2.0
  • Loading branch information
MilanSkocic committed Jun 19, 2023
2 parents 2a97bad + 47b2f21 commit bac7409
Show file tree
Hide file tree
Showing 227 changed files with 22,523 additions and 2,752 deletions.
11 changes: 10 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,20 @@ dist/
*.obj
*.o
*.mod
*.a
*.dll
*.so

*.egg-info
__pycache__
*.so

.DS_Store

sphinx/doxygen/xml/
pywrapper/pyiapws/*.h
pywrapper/pyiapws/*.a
pywrapper/pyiapws/*.dll
pywrapper/pyiapws/*.dll.a
pywrapper/pyiapws/*.so
pywrapper/pyiapws/*.dylib
pywrapper/pyiapws/*.pyd
92 changes: 0 additions & 92 deletions CMakeLists.txt

This file was deleted.

83 changes: 37 additions & 46 deletions INSTALL.rst
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,46 +1,37 @@
Create build directory

.. code-block:: bash
$ mkdir build
$ d build
Generate a makefile

* On Unix-like OS:

.. code-block:: bash
cmake -G "Unix Makefiles" -S .. -DCMAKE_BUILD_TYPE=release -DCMAKE_INSTALL_PREFIX=/path/to/folder
* On windows with MSYS2:

.. code-block:: bash
cmake -G "Unix Makefiles" -S .. -DCMAKE_BUILD_TYPE=release -DCMAKE_INSTALL_PREFIX=/path/to/folder
* On windows with ifort and msvc:

.. code-block:: bash
cmake -G "NMake Makefiles" -S .. -DCMAKE_BUILD_TYPE=release -DCMAKE_INSTALL_PREFIX=/path/to/folder
Build

.. code-block:: bash
cmake --build .
Run tests

.. code-block:: bash
ctest
Install

.. code-block:: bash
cmake --install .
A Makefile is provided, which uses `fpm <https://fpm.fortran-lang.org/en/index.html>`_, for building the library.

On windows, `msys2 <https://www.msys2.org>`_ needs to be installed.

On Darwin, the `gcc <https://formulae.brew.sh/formula/gcc>`_ toolchain needs to be installed.

Build: the configuration file will set all the environmental variables necessary for the compilation

.. code-block:: bash
source configuration
make
Run tests

.. code-block:: bash
fpm test
Install

.. code-block:: bash
make install
Uninstall

.. code-block:: bash
make uninstall
If building the python wrapper is needed:

.. code-block:: bash
cd pywrapper
python setup.py bdist_wheel
60 changes: 60 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
ifneq ($(prefix), )
install_dir=$(prefix)
else
install_dir=$(DEFAULT_INSTALL_DIR)
endif

.PHONY: all clean install uninstall copy_h copy_a shared_linux shared_windows shared_darwin

all: $(LIBNAME)

$(LIBNAME): build copy_h copy_a shared copy_shared

build: clean
fpm build --profile=release

shared: shared_$(PLATFORM)

shared_linux:
gfortran -shared -o $(BUILD_DIR)/lib$(LIBNAME).so -Wl,--whole-archive $(BUILD_DIR)/lib$(LIBNAME).a -Wl,--no-whole-archive

shared_darwin:
gfortran -dynamiclib -install_name @rpath/lib$(LIBNAME).dylib -static-libgfortran -static-libquadmath -static-libgcc -o $(BUILD_DIR)/lib$(LIBNAME).dylib -Wl,-all_load $(BUILD_DIR)/lib$(LIBNAME).a -Wl,-noall_load

shared_windows:
gfortran -shared -static -o $(BUILD_DIR)/lib$(LIBNAME).dll -Wl,--out-implib=$(BUILD_DIR)/lib$(LIBNAME).dll.a,--export-all-symbols,--enable-auto-import,--whole-archive $(BUILD_DIR)/lib$(LIBNAME).a -Wl,--no-whole-archive

copy_a:
cp $(shell find ./build -type f -name lib$(LIBNAME).a) $(BUILD_DIR)

copy_h:
cp $(INCLUDE_DIR)/$(LIBNAME)*.h $(PYW_MOD_DIR)/

copy_shared: copy_a
cp -f $(BUILD_DIR)/lib$(LIBNAME).so $(PYW_MOD_DIR) | true
cp -f $(BUILD_DIR)/lib$(LIBNAME).dylib $(PYW_MOD_DIR) | true
cp -f $(BUILD_DIR)/lib$(LIBNAME).dll $(PYW_MOD_DIR) | true
cp -f $(BUILD_DIR)/lib$(LIBNAME).dll.a $(PYW_MOD_DIR) | true

clean:
fpm clean --all

install:
mkdir -p $(install_dir)/bin
mkdir -p $(install_dir)/include
mkdir -p $(install_dir)/lib
fpm install --prefix=$(install_dir)
cp -f ./include/*.h $(install_dir)/include
cp -f $(BUILD_DIR)/lib$(LIBNAME).so $(install_dir)/lib | true
cp -f $(BUILD_DIR)/lib$(LIBNAME).dylib $(install_dir)/lib | true
cp -f $(BUILD_DIR)/lib$(LIBNAME).dll.a $(install_dir)/lib | true
cp -f $(BUILD_DIR)/lib$(LIBNAME).dll $(install_dir)/bin | true

uninstall:
rm -f $(install_dir)/include/$(LIBNAME)*.h
rm -f $(install_dir)/include/$(LIBNAME)*.mod
rm -f $(install_dir)/lib/lib$(LIBNAME).a
rm -f $(install_dir)/lib/lib$(LIBNAME).so
rm -f $(install_dir)/lib/lib$(LIBNAME).dylib
rm -f $(install_dir)/lib/lib$(LIBNAME).dll.a
rm -f $(install_dir)/bin/lib$(LIBNAME).dll
6 changes: 1 addition & 5 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,7 @@ Introduction
.. readme_inclusion_start
`ipaws` is a Fortran library providing the formulas for computing light and heavy water properties.
It also provides a API for the C language. The formulations are taken from http://iapws.org.
A shared and a static library `libiapws` are compiled (f2008+) with the Fortran and C headers.
The static and shared libraries can be installed in order to be included in Fortran or C programs.

The compilation was tested on Linux (Debian), MacOS and Windows.
It also provides a API for the C language. The formulas are taken from http://iapws.org.

.. readme_inclusion_end
Expand Down
8 changes: 3 additions & 5 deletions REQUIREMENTS.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
gcc>=4.6 or msvc>=14

gfortran>=4.6 or ifort>=18

cmake>=3.10
gcc>=10.0
gfortran>=10.0
fpm>=0.7
2 changes: 0 additions & 2 deletions app/CMakeLists.txt

This file was deleted.

29 changes: 0 additions & 29 deletions app/config.c

This file was deleted.

13 changes: 0 additions & 13 deletions app/config.h.in

This file was deleted.

44 changes: 44 additions & 0 deletions configuration
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
LIBNAME="iapws"

# environment variables
PYW_DIR="./pywrapper"
BUILD_DIR="./build"
INCLUDE_DIR="./include"
PYW_MOD_DIR="$PYW_DIR/py$LIBNAME"
FPM_FFLAGS="-std=f2008 -pedantic -Wall -Wextra"
FPM_CFLAGS="-std=c11 -pedantic -Wall -Wextra"
FPM_LDFLAGS="-static"
DEFAULT_INSTALL_DIR="$HOME/.local"
PLATFORM="linux"

if [[ "$OSTYPE" == "msys" ]]; then
DEFAULT_INSTALL_DIR="${APPDATA//\\//}/local"
PLATFORM="windows"
fi

if [[ "$OSTYPE" == "darwin"* ]];then
FPM_LDFLAGS="-static-libgfortran -static-libquadmath -static-libgcc"
PLATFORM="darwin"
fi

export FPM_FFLAGS
export FPM_CFLAGS
export FPM_LDFLAGS
export DEFAULT_INSTALL_DIR
export LIBNAME
export PYW_DIR
export PYW_MOD_DIR
export BUILD_DIR
export INCLUDE_DIR
export PLATFORM

echo "OS TYPE=" $OSTYPE
echo "PLATFORM=" $PLATFORM
echo "DEFAULT INSTALL DIR=" $DEFAULT_INSTALL_DIR
echo "FPM_FLAGS=" $FPM_FFLAGS
echo "FPM_CFLAGS=" $FPM_CFLAGS
echo "FPM_LDFLAGS=" $FPM_LDFLAGS
echo "PYW DIR=" $PYW_DIR
echo "PYW MOD DIR=" $PYW_MOD_DIR
echo "BUILD DIR" $BUILD_DIR
echo "INCLUDE_DIR" $INCLUDE_DIR
Binary file modified docs/_downloads/c6590f1cb16fa3c0fab9a03d320b9284/iapws.pdf
Binary file not shown.
Binary file added docs/_images/g704_kd_D2O.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_images/g704_kd_H2O.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_images/g704_kh_D2O.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_images/g704_kh_H2O.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit bac7409

Please sign in to comment.