10
1
mirror of https://gitlab.com/scemama/QCaml.git synced 2024-07-17 08:30:22 +02:00
QCaml/qcaml/README.org

78 lines
1.7 KiB
Org Mode

#+TITLE: QCaml
#+SETUPFILE: https://fniessen.github.io/org-html-themes/org/theme-readtheorg.setup
#+name: synopsis
#+begin_src ocaml :export output raw
"Main QCaml entry point"
#+end_src
#+RESULTS: synopsis
: Main QCaml entry point
* Dune files :noexport:
Use [C-c C-c] on the code below to create the output for the dune files
#+header: :noweb yes
#+header: :var name=(file-name-directory buffer-file-name)
#+header: :var dune="lib/dune"
#+header: :var dunetest="test/dune"
#+header: :var dependencies=dependencies
#+begin_src python :exports none :results output none
name = name.split('/')[-2]
synopsis = """
<<synopsis>>
"""
dependencies = '\n '.join(map(lambda x: x[0], dependencies))
with open(dune,'w') as f:
f.write(f"""
(library
(name {name})
(public_name qcaml.{name})
(synopsis {synopsis} )
(libraries
{dependencies}
)
<<noimplementation>>
<<c-files>>
)
<<lex-yacc>>
""".replace("qcaml.qcaml","qcaml"))
with open(dunetest,'w') as f:
f.write(f"""
(library
(name test_{name})
(synopsis "Test for {name} library")
(libraries
alcotest
qcaml.{name}
)
)
""".replace("qcaml.qcaml","qcaml"))
#+end_src
#+name: dependencies
#+begin_src sh :output value
grep "public_name" ../*/lib/dune | grep -v "qcaml)" | cut -d ' ' -f 3 | tr ')' ' '
#+end_src
#+RESULTS: dependencies
| (libraries |
| qcaml.ao |
| qcaml.common |
| qcaml.gaussian |
| qcaml.gaussian_integrals |
| qcaml.linear_algebra |
| qcaml.mo |
| qcaml.operators |
| qcaml.particles |
| qcaml.perturbation |
| qcaml.simulation |
| ) |