Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.2.2 #5

Merged
merged 63 commits into from
Dec 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
4526971
BUG: Fix C code in pywrapper.
MilanSkocic Sep 8, 2023
136c20d
ENH: Start implementing r797 region 1.
MilanSkocic Sep 8, 2023
c9ce9a1
ENH: Continue implementation of r797 region 1.
MilanSkocic Sep 10, 2023
23e4fa7
TST: Implement first test for region 1 r797.
MilanSkocic Sep 11, 2023
d13f7e3
ENH: Starting the coefficients for region 1 R797.
MilanSkocic Sep 11, 2023
4bbe11c
BUG: Fix C code in pywrapper.
MilanSkocic Sep 12, 2023
399eea0
TST: Fix values for T and P.
MilanSkocic Sep 12, 2023
e79613f
ENH: Added more coefficients for IJn in region 1.
MilanSkocic Sep 12, 2023
1055e7f
DOC: Continue doc for R797.
MilanSkocic Sep 16, 2023
30d44d3
ENH: Implemented the R283 report for critical values of H2O and D2O.
MilanSkocic Sep 20, 2023
95eb7ac
BLD: Switch to pyproject.toml
MilanSkocic Sep 22, 2023
f510aa5
DOC: Add B23 equation in doc.
MilanSkocic Sep 22, 2023
35cd868
DOC: Refractoring and add documentation for private functions in G704.
MilanSkocic Sep 24, 2023
07a8d3f
ENH: Add coefficient for region forward.
MilanSkocic Sep 24, 2023
9140e5a
FIX: Remove unused variables.
MilanSkocic Sep 29, 2023
bf9266c
BLD: Add build package dependency.
MilanSkocic Oct 16, 2023
269bb6f
BLD: Improve Makefile.
MilanSkocic Oct 17, 2023
d7c8b52
DOC: Update conf.py.
MilanSkocic Oct 29, 2023
c53a283
BLD: Update to configure.sh
MilanSkocic Oct 29, 2023
4b24495
DOC: Fix module name in doc.
MilanSkocic Nov 4, 2023
79c0ce0
Update pyproject.toml
MilanSkocic Nov 8, 2023
beac5fc
BLD: Add workflows CI
MilanSkocic Nov 15, 2023
311c14f
DOC: Add build badge.
MilanSkocic Nov 15, 2023
885a044
DOC: add both branches for badges.
MilanSkocic Nov 15, 2023
3ed25d2
BLD: Add test in Makefile.
MilanSkocic Nov 20, 2023
d072d2b
Merge branch 'dev' of https://github.com/MilanSkocic/iapws into dev
MilanSkocic Nov 20, 2023
6bf99e7
BLD: Add automatic detection of arch and version.
MilanSkocic Nov 23, 2023
c7cc944
BLD: Fix rule for test.
MilanSkocic Nov 23, 2023
0b71f31
BLD: Fix read option.
MilanSkocic Nov 23, 2023
6bf9180
BUG: Fix bash issue.
MilanSkocic Nov 24, 2023
7a81180
REL: Prepare new version.
MilanSkocic Nov 24, 2023
a723c7b
DOC: Add changelog for new release.
MilanSkocic Nov 24, 2023
448083e
DOC: Update online doc.
MilanSkocic Nov 24, 2023
a3a5556
ENH: Add r283 in pywrapper and in library.
MilanSkocic Nov 25, 2023
0c0c93b
ENH: Add IMPORT macro for windows support in R283.
MilanSkocic Nov 25, 2023
f7debb9
DOC: Add dcostrings for r283 C API.
MilanSkocic Nov 26, 2023
429e50a
DOC: Add r283 in doc.
MilanSkocic Nov 26, 2023
0da0f97
TST: Remove temporary tests for R797.
MilanSkocic Nov 27, 2023
c403d0f
BUG: Fix names in pywrapper for r283.
MilanSkocic Nov 27, 2023
ccf4b3e
TST: Add tests for R283 and minor refractoring for G704.
MilanSkocic Nov 27, 2023
53ab85e
BLD: Fix list of python extensions in setup file.
MilanSkocic Nov 27, 2023
28c591e
DOC: Fix header 2 markers.
MilanSkocic Nov 27, 2023
d239ab7
BLD: Add support for MINGW32.
MilanSkocic Nov 27, 2023
201501d
BLD: Fix missing extern declaration for header r283.
MilanSkocic Nov 27, 2023
fffb4e4
ENH: Add examples for R283.
MilanSkocic Nov 27, 2023
1659e11
DOC: Add documentation for R283.
MilanSkocic Nov 27, 2023
718c6e0
DOC: Add explanation for memory view.
MilanSkocic Nov 27, 2023
16afa60
DOC: Fix wrong link for fpm documentation.
MilanSkocic Nov 27, 2023
8420831
Merge branch 'dev' of https://github.com/MilanSkocic/iapws into dev
MilanSkocic Nov 27, 2023
956d819
BUG: Fix names for deleting in build.sh.
MilanSkocic Nov 29, 2023
5f1df89
DOC: Fix new field in FORD v7.
MilanSkocic Nov 30, 2023
968694e
TST: Add R283 tests and modular functions for tests in Fortran and C.
MilanSkocic Nov 30, 2023
2085fdd
TST: Add build_debug and test_debug target.
MilanSkocic Dec 1, 2023
8b3ebeb
BLD: Add atuomatic version generation.
MilanSkocic Dec 4, 2023
20d27db
ENH: Add automatic version generation.
MilanSkocic Dec 4, 2023
6dc2bf4
ENH: Remove executable.
MilanSkocic Dec 4, 2023
fd6e320
BLD: Generic Makefiles in subdirectories.
MilanSkocic Dec 5, 2023
a377c78
BLD: Modular build for pywrapper.
MilanSkocic Dec 6, 2023
3ef1c6f
BLD: Fix minor issues after testing on windows.
MilanSkocic Dec 7, 2023
98c325f
Merge branch 'dev' of https://github.com/MilanSkocic/iapws into dev
MilanSkocic Dec 7, 2023
83a8437
BUG: Remove line after conflicts.
MilanSkocic Dec 7, 2023
e400413
MAINT: Clean up setup.py.
MilanSkocic Dec 15, 2023
9b29257
DOC: Delete online doc before PR.
MilanSkocic Dec 17, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 73 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: CI

on:
push:
branches: [ "main", "dev" ]
pull_request:
branches: [ "main", "dev" ]

jobs:
linux:
runs-on: ubuntu-latest
steps:
- name: Gfortran
run: |
sudo update-alternatives \
--install /usr/bin/gcc gcc /usr/bin/gcc-10 100 \
--slave /usr/bin/gfortran gfortran /usr/bin/gfortran-10 \
--slave /usr/bin/gcov gcov /usr/bin/gcov-10
- name: Set FPM
uses: fortran-lang/setup-fpm@v5
with:
fpm-version: "v0.9.0"
- name: Gfortran version
run : gfortran --version
- name: Checkout
uses: actions/checkout@v4
- name: Compile
run: |
. ./configure.sh
make

macos:
runs-on: macos-latest
steps:
- name: Gfortran
run: |
brew reinstall gcc@10 gcc@13
- name: Set FPM
uses: fortran-lang/setup-fpm@v5
with:
fpm-version: "v0.9.0"
- name: Gfortran version
run : gfortran --version
- name: Checkout
uses: actions/checkout@v4
- name: Compile
run: |
. ./configure.sh
make

windows:
runs-on: windows-latest
defaults:
run:
shell: msys2 {0}
steps:
- name: MSYS2, Gfortran, fpm
uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
install: >-
mingw-w64-x86_64-gcc-fortran
mingw-w64-x86_64-fpm
git
make
- name: Gfortran version
run : gfortran --version
- name: Checkout
uses: actions/checkout@v4
- name: Compile
run: |
. ./configure.sh
make
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ __pycache__

.DS_Store

*generator*

pywrapper/pyiapws/*.h
pywrapper/pyiapws/*.a
pywrapper/pyiapws/*.dll
Expand Down
14 changes: 9 additions & 5 deletions INSTALL.rst
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
A Makefile is provided, which uses `fpm <https://fpm.fortran-lang.org/en/index.html>`_, for building the library.
A Makefile is provided, which uses `fpm <https://fpm.fortran-lang.org>`_, for building the library.

On windows, `msys2 <https://www.msys2.org>`_ needs to be installed.
On windows, `msys2 <https://www.msys2.org>`_ needs to be installed. The MSVC compiler is only necessary
for compiling the python wrapper.
Add the msys2 binary (usually C:\msys64\usr\bin) to the path in order to be able to use make.

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
chmod +x configure.sh
. ./configure.sh
make

Run tests

.. code-block:: bash

fpm test
make test

Install

Expand All @@ -34,4 +37,5 @@ If building the python wrapper is needed:
.. code-block:: bash

cd pywrapper
python setup.py bdist_wheel
make clean
make plat=(windows, linux or darwin)
78 changes: 59 additions & 19 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,51 +4,91 @@ else
install_dir=$(DEFAULT_INSTALL_DIR)
endif

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

all: $(LIBNAME)
all: clean $(LIBNAME)

$(LIBNAME): build copy_h copy_a shared copy_shared
$(LIBNAME): build copy_a shared copy_h copy_shared

build: clean
generator:
make -C srcgen generator

build: generator
fpm build --profile=release

build_debug: generator
fpm build --profile=debug

test: build
fpm test --profile=release

test_debug: build_debug
fpm test --profile=debug

example: build
fpm run --profile=release --example --all

example_debug: build_debug
fpm run --profile=debug --example --all

shared: shared_$(PLATFORM)

copy_shared: copy_shared_$(PLATFORM)

shared_linux:
gfortran -shared -o $(BUILD_DIR)/lib$(LIBNAME).so -Wl,--whole-archive $(BUILD_DIR)/lib$(LIBNAME).a -Wl,--no-whole-archive
$(FC) -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
$(FC) -dynamiclib -install_name @rpath/lib$(LIBNAME).dylib $(FPM_LDFLAGS) -o $(BUILD_DIR)/lib$(LIBNAME).dylib -Wl,-all_load $(BUILD_DIR)/lib$(LIBNAME).a

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
$(FC) -shared $(FPM_LDFLAGS) -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)
cp -f $(shell find ./build -type f -name lib$(LIBNAME).a) $(BUILD_DIR)
cp -f $(BUILD_DIR)/lib$(LIBNAME).a $(BUILD_DIR)/lib$(LIBNAME)-$(PLATFORM)-$(ARCH)-$(VERSION).a

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

copy_shared_linux:
cp -f $(BUILD_DIR)/lib$(LIBNAME).so $(BUILD_DIR)/lib$(LIBNAME)-$(PLATFORM)-$(ARCH)-$(VERSION).so
cp -f $(BUILD_DIR)/lib$(LIBNAME).so $(PYW_MOD_DIR)

copy_shared:
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
copy_shared_darwin:
cp $(BUILD_DIR)/lib$(LIBNAME).dylib $(BUILD_DIR)/lib$(LIBNAME)-$(PLATFORM)-$(ARCH)-$(VERSION).dylib
cp -f $(BUILD_DIR)/lib$(LIBNAME).dylib $(PYW_MOD_DIR)

copy_shared_windows:
cp -f $(BUILD_DIR)/lib$(LIBNAME).dll $(BUILD_DIR)/lib$(LIBNAME)-$(PLATFORM)-$(ARCH)-$(VERSION).dll
cp -f $(BUILD_DIR)/lib$(LIBNAME).dll.a $(BUILD_DIR)/lib$(LIBNAME)-$(PLATFORM)-$(ARCH)-$(VERSION).dll.a
cp -f $(BUILD_DIR)/lib$(LIBNAME).dll $(PYW_MOD_DIR)
cp -f $(BUILD_DIR)/lib$(LIBNAME).dll.a $(PYW_MOD_DIR)

clean:
fpm clean --all
rm -f src/*.mod
make -C srcgen clean
make -C $(PYW_MOD_DIR) clean

install: install_dirs install_$(PLATFORM)

install:
install_dirs:
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

install_linux:
cp -f $(BUILD_DIR)/lib$(LIBNAME).so $(install_dir)/lib

install_darwin:
cp -f $(BUILD_DIR)/lib$(LIBNAME).dylib $(install_dir)/lib

install_windows:
cp -f $(BUILD_DIR)/lib$(LIBNAME).dll.a $(install_dir)/lib
cp -f $(BUILD_DIR)/lib$(LIBNAME).dll $(install_dir)/bin

uninstall:
rm -f $(install_dir)/include/$(LIBNAME)*.h
Expand Down
7 changes: 6 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
.. |cidev| image:: https://github.com/MilanSkocic/iapws/actions/workflows/ci.yml/badge.svg?branch=dev
.. |cimain| image:: https://github.com/MilanSkocic/iapws/actions/workflows/ci.yml/badge.svg?branch=main

dev |cidev| / main |cimain|

Introduction
================

.. image:: ./media/logo-iapws.png
:width: 200

.. readme_inclusion_start

`ipaws` is a Fortran library providing the formulas for computing light and heavy water properties.
Expand Down
27 changes: 25 additions & 2 deletions configuration → configure.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
LIBNAME="iapws"

# environment variables
FC=gfortran
PYW_DIR="./pywrapper"
BUILD_DIR="./build"
INCLUDE_DIR="./include"
Expand All @@ -11,6 +12,22 @@ FPM_LDFLAGS="-static"
DEFAULT_INSTALL_DIR="$HOME/.local"
PLATFORM="linux"

IFS='-'
tmp=$(gcc -dumpmachine)
read -a tmp_arr <<< "$tmp"
ARCH="${tmp_arr[0]}"

IFS="="
while read -r line; do
# Reading line by line
if [[ $line == "version"* ]]
then
read -a tmp_arr <<< "$line"
VERSION=${tmp_arr[1]:2:5}
break
fi
done < "fpm.toml"

if [[ "$OSTYPE" == "msys" ]]; then
DEFAULT_INSTALL_DIR="${APPDATA//\\//}/local"
PLATFORM="windows"
Expand All @@ -31,14 +48,20 @@ export PYW_MOD_DIR
export BUILD_DIR
export INCLUDE_DIR
export PLATFORM
export ARCH
export VERSION
export FC

echo "OS TYPE=" $OSTYPE
echo "PLATFORM=" $PLATFORM
echo "ARCH=" $ARCH
echo "VERSION=" $VERSION
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
echo "BUILD DIR=" $BUILD_DIR
echo "INCLUDE_DIR=" $INCLUDE_DIR
echo "FC=" $FC
Loading