diff --git a/.github/workflows/test-build.yml b/.github/workflows/test-build.yml new file mode 100644 index 0000000..7d22a09 --- /dev/null +++ b/.github/workflows/test-build.yml @@ -0,0 +1,19 @@ +name: test-build + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: install dependencies + run: sudo apt-get install emacs + - name: make + run: make -C src/ diff --git a/README.md b/README.md index 7cafb1a..7d64383 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,7 @@ # qmckl + +![Build Status](https://github.com/TREX-CoE/qmckl/workflows/test-build/badge.svg?branch=main) + Quantum Monte Carlo Kernel Library. See the [Wiki](https://github.com/TREX-CoE/qmckl/wiki) for more information. diff --git a/src/Makefile b/src/Makefile index cd61181..293255a 100644 --- a/src/Makefile +++ b/src/Makefile @@ -4,17 +4,20 @@ CFLAGS= FC=gfortran FFLAGS= -SOURCE_FILES=$(wildcard *.org) +ORG_SOURCE_FILES=qmckl_context.org +OBJECT_FILES=$(patsubst %.org,%.o,$(ORG_SOURCE_FILES)) .PHONY: clean +all: $(OBJECT_FILES) + %.c %.h: %.org emacs --quick --no-init-file --batch --eval "(require 'org)" --eval '(org-babel-tangle-file "$^")' %.c %.h %_f.f90: %.org emacs --quick --no-init-file --batch --eval "(require 'org)" --eval '(org-babel-tangle-file "$^")' -%.o: %.c +%.o: %.c $(CC) $(CFLAGS) -c $*.c -o $*.o %.o: %.f90 diff --git a/src/qmckl_context.org b/src/qmckl_context.org index 0d7be0d..b24f7f0 100644 --- a/src/qmckl_context.org +++ b/src/qmckl_context.org @@ -1,6 +1,6 @@ # -*- mode: org -*- -#+TITLE: Context +#+TITLE: Context This file is written in C because it is more natural to express the context in C than in Fortran. @@ -17,7 +17,7 @@ C than in Fortran. is stored in the following data structure, which can't be seen outside of the library. - + #+BEGIN_SRC C :tangle qmckl_context.h #define QMCKL_DEFAULT_PRECISION 53 #define QMCKL_DEFAULT_RANGE 2 @@ -66,11 +66,11 @@ qmckl_context qmckl_context_create() { ** =qmckl_context_copy= #+BEGIN_SRC C :tangle qmckl_context.h -qmckl_context qmckl_context_copy(qmckl_context context); +qmckl_context qmckl_context_copy(const qmckl_context context); #+END_SRC #+BEGIN_SRC C :tangle qmckl_context.c -qmckl_context qmckl_context_copy(qmckl_context context) { +qmckl_context qmckl_context_copy(const qmckl_context context) { qmckl_context_struct* old_context; qmckl_context_struct* new_context; @@ -123,11 +123,11 @@ qmckl_context qmckl_context_destroy(qmckl_context context) { ** =qmckl_context_set_precision= #+BEGIN_SRC C :tangle qmckl_context.h -qmckl_context qmckl_context_set_precision(qmckl_context context, int precision); +qmckl_context qmckl_context_set_precision(const qmckl_context context, int precision); #+END_SRC #+BEGIN_SRC C :tangle qmckl_context.c -qmckl_context qmckl_context_set_precision(qmckl_context context, int precision) { +qmckl_context qmckl_context_set_precision(const qmckl_context context, int precision) { qmckl_context_struct* ctx; if (precision < 2) return (qmckl_context) 0; @@ -141,11 +141,11 @@ qmckl_context qmckl_context_set_precision(qmckl_context context, int precision) ** =qmckl_context_set_range= #+BEGIN_SRC C :tangle qmckl_context.h -qmckl_context qmckl_context_set_range(qmckl_context context, int range); +qmckl_context qmckl_context_set_range(const qmckl_context context, int range); #+END_SRC #+BEGIN_SRC C :tangle qmckl_context.c -qmckl_context qmckl_context_set_range(qmckl_context context, int range) { +qmckl_context qmckl_context_set_range(const qmckl_context context, int range) { qmckl_context_struct* ctx; if (range < 2) return (qmckl_context) 0; @@ -162,11 +162,11 @@ qmckl_context qmckl_context_set_range(qmckl_context context, int range) { ** =qmckl_context_get_precision= #+BEGIN_SRC C :tangle qmckl_context.h -int qmckl_context_get_precision(qmckl_context context); +int qmckl_context_get_precision(const qmckl_context context); #+END_SRC #+BEGIN_SRC C :tangle qmckl_context.c -int qmckl_context_get_precision(qmckl_context context) { +int qmckl_context_get_precision(const qmckl_context context) { qmckl_context_struct* ctx; ctx = (qmckl_context_struct*) context; return ctx->precision; @@ -176,11 +176,11 @@ int qmckl_context_get_precision(qmckl_context context) { ** =qmckl_context_get_range= #+BEGIN_SRC C :tangle qmckl_context.h -int qmckl_context_get_range(qmckl_context context); +int qmckl_context_get_range(const qmckl_context context); #+END_SRC #+BEGIN_SRC C :tangle qmckl_context.c -int qmckl_context_get_range(qmckl_context context) { +int qmckl_context_get_range(const qmckl_context context) { qmckl_context_struct* ctx; ctx = (qmckl_context_struct*) context; return ctx->range;