Skip to content

Commit

Permalink
Merge pull request #6 from MilanSkocic/dev
Browse files Browse the repository at this point in the history
0.8.2
  • Loading branch information
MilanSkocic authored Nov 27, 2023
2 parents 056e000 + 025fed3 commit ae5be84
Show file tree
Hide file tree
Showing 71 changed files with 18,910 additions and 19,158 deletions.
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
6 changes: 4 additions & 2 deletions INSTALL.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
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/en/index.html>`_,
for building the library.

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

Expand All @@ -8,7 +9,8 @@ Build: the configuration file will set all the environmental variables necessary

.. code-block:: bash
source configuration
chmod +x configure.sh
. ./configure.sh
make
Run tests
Expand Down
56 changes: 41 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ endif

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

all: $(LIBNAME)
all: generator $(LIBNAME)

generator:
make -C ./srcgen

$(LIBNAME): build copy_h copy_a shared copy_shared

Expand All @@ -15,40 +18,63 @@ build: clean

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

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
gfortran -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
gfortran -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_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)

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
test: all
fpm test --profile=release

clean:
fpm clean --all
rm -f src/*.mod

install:
install: install_dirs install_$(PLATFORM)

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
13 changes: 13 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
.. |cidev| image:: https://github.com/MilanSkocic/codata/actions/workflows/ci.yml/badge.svg?branch=dev
.. |cimain| image:: https://github.com/MilanSkocic/codata/actions/workflows/ci.yml/badge.svg?branch=main

dev |cidev| / main |cimain|

Description
==============

Expand All @@ -9,6 +14,14 @@ The raw codata are taken from http://physics.nist.gov/constants.

.. readme_inclusion_end
To use `codata` within your `fpm <https://github.com/fortran-lang/fpm>`_ project,
add the following to your `fpm.toml` file:

.. code-block::
[dependencies]
codata = { git="https://github.com/MilanSkocic/codata.git" }
Installation
================

Expand Down
4 changes: 2 additions & 2 deletions REQUIREMENTS.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
gcc>=9
gfortran>=9
gcc>=10
gfortran>=10
20 changes: 20 additions & 0 deletions configuration → configure.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,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,9 +47,13 @@ export PYW_MOD_DIR
export BUILD_DIR
export INCLUDE_DIR
export PLATFORM
export ARCH
export VERSION

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
Expand Down
Binary file not shown.
28 changes: 28 additions & 0 deletions docs/_sources/releases/0.8.2-notes.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
Codata 0.8.2 Release Note
============================

Summary
---------------

* No API changes.
* Improve Makefile for generating the source code at each compilation.
* Source generator rewritten in Fortran.
* Switch to pyproject.toml for the Python wrapper.
* Minor fixes in documentation.

Download
---------------

`Codata Releases <https://github.com/MilanSkocic/codata/releases>`_

`PYPI <https://pypi.org/project/pycodata>`_


Contributors
---------------
Milan Skocic

Commits
---------

**Full Changelog**: https://github.com/MilanSkocic/codata/compare/0.8.1...0.8.2
1 change: 1 addition & 0 deletions docs/_sources/releases/index.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Release Notes
.. toctree::
:maxdepth: 1

0.8.2-notes.rst
0.8.1-notes.rst
0.8.0-notes.rst
0.7.1-notes.rst
Expand Down
2 changes: 1 addition & 1 deletion docs/_static/documentation_options.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const DOCUMENTATION_OPTIONS = {
VERSION: '0.8.1',
VERSION: '0.8.2',
LANGUAGE: 'en',
COLLAPSE_INDEX: false,
BUILDER: 'html',
Expand Down
Loading

0 comments on commit ae5be84

Please sign in to comment.