This version of c2x is intended to be built with spglib
( https://github.com/atztogo/spglib/releases ), although it can be
built without it.

C2x should build straightforwardly with an ANSI C compiler on a
POSIX-compliant system, including Cygwin and MSYS2, as well as MacOS X
and most UNIXes.

The build of c2x itself is controlled by its Makefile. This can be edited,
and then one simply types "make" and the result should be an
executable in the current directory.

There are three options for spglib

1/ Compile without it. Not really recommended, as c2x will lose
some functionality. For this simply do not define SPGLIB in the
makefile (i.e. comment out references to "-DSPGLIB").

2/ Use a pre-installed system spglib. It should not be necessary to
set CPPFLAGS and LDFLAGS, for presumably the relevant header files and
library files will be found automatically. However, if spglib has been
built with OpenMP support, Windows users may need to add -fopenmp or
similar to LDFLAGS.

3/ Download and compile your own version of SPGLIB. This is how c2x is
developed. In this case one needs to build a static version of the
spglib library. Further notes on compiling spglib can be found at the
end of this file.

The only two files from spglib that c2x needs to build are
spglib.h and libsymspg.a. One approach is to copy them from the spglib
build tree to the c2x build tree (they are probably found as
src/spglib.h and src/.libs/libsymspg.a after building spglib), and
then set

CPPFLAGS=-I.
LDFLAGS=-L.

otherwise replace the above two dots with the path to the directory
containing the include file and the library respectively.

If one wishes to validate one's build of c2x, a basic test suite is
available at www.c2x.org.uk/downloads .

MJR 1/2017, 2/2019, 12/2022


Further notes on compiling spglib 2.0
=====================================

Download the version 2.0.2 with

curl -o spglib.zip -L https://github.com/spglib/spglib/archive/refs/tags/v2.0.2.zip

Unpack archive with

unzip spglib.zip

and change to its directory

cd spglib-2.0.2

If you have cmake, consider the instructions at
https://spglib.github.io/spglib/install.html

If you don't, or if you don't like cmake, then the following may work.

cd src
cp [c2x build directory]/Makefile.spglib Makefile
[if using spglib before 2.0, comment out MORE_OBJS lines as appropriate]
make
cp spglib.h libsymspg.a [c2x build directory]

If one uses the cmake method, spglib will be built with OpenMP
support, and then, for static linking, -fopenmp should be added to
LDFLAGS in the c2x Makefile.

Versions of spglib after 2.0.2 use an autogenerated version.h file,
which requires the use of cmake. So if using cmake one can download
more recent versions of spglib, such as 2.5.0.
