2021-05-28 13:36:39 +02:00
|
|
|
# TREXIO - TREX Input/Output library
|
|
|
|
#
|
|
|
|
# BSD 3-Clause License
|
|
|
|
#
|
|
|
|
# Copyright (c) 2020, TREX Center of Excellence
|
|
|
|
# All rights reserved.
|
|
|
|
#
|
|
|
|
# Redistribution and use in source and binary forms, with or without
|
|
|
|
# modification, are permitted provided that the following conditions are met:
|
|
|
|
#
|
|
|
|
# 1. Redistributions of source code must retain the above copyright notice, this
|
|
|
|
# list of conditions and the following disclaimer.
|
|
|
|
#
|
|
|
|
# 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
|
|
# this list of conditions and the following disclaimer in the documentation
|
|
|
|
# and/or other materials provided with the distribution.
|
|
|
|
#
|
|
|
|
# 3. Neither the name of the copyright holder nor the names of its
|
|
|
|
# contributors may be used to endorse or promote products derived from
|
|
|
|
# this software without specific prior written permission.
|
|
|
|
#
|
|
|
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
|
|
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
|
|
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
|
|
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
|
|
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
|
|
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
|
|
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
|
|
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
|
2021-06-22 16:04:25 +02:00
|
|
|
# =============== SETTINGS =============== #
|
|
|
|
|
2021-05-28 13:36:39 +02:00
|
|
|
ACLOCAL_AMFLAGS = -I m4
|
2021-06-02 18:45:05 +02:00
|
|
|
CLEANFILES = trexio.mod
|
2021-06-22 17:55:56 +02:00
|
|
|
BUILT_SOURCES = trexio.mod
|
2021-05-28 13:36:39 +02:00
|
|
|
|
|
|
|
VERSION_MAJOR = @VERSION_MAJOR@
|
|
|
|
VERSION_MINOR = @VERSION_MINOR@
|
|
|
|
VERSION_PATCH = @VERSION_PATCH@
|
|
|
|
|
|
|
|
SUBDIRS =
|
|
|
|
|
|
|
|
pkgconfigdir = $(libdir)/pkgconfig
|
|
|
|
pkgconfig_DATA = pkgconfig/trexio.pc
|
|
|
|
|
2021-06-22 16:04:25 +02:00
|
|
|
# =============== BUILD =============== #
|
2021-05-28 13:36:39 +02:00
|
|
|
|
|
|
|
trexio_h = $(srcdir)/include/trexio.h
|
|
|
|
trexio_f = $(srcdir)/include/trexio_f.f90
|
|
|
|
|
|
|
|
include_HEADERS = $(trexio_h) $(trexio_f)
|
|
|
|
|
|
|
|
AM_CPPFLAGS = -I$(srcdir)/src -I$(srcdir)/include
|
|
|
|
|
|
|
|
lib_LTLIBRARIES = src/libtrexio.la
|
|
|
|
|
|
|
|
|
|
|
|
SOURCES = \
|
2021-06-22 16:04:25 +02:00
|
|
|
$(trexio_h) \
|
|
|
|
src/trexio.c \
|
|
|
|
src/trexio_private.h \
|
|
|
|
src/trexio_s.h \
|
|
|
|
src/trexio_hdf5.c \
|
|
|
|
src/trexio_hdf5.h \
|
|
|
|
src/trexio_text.c \
|
|
|
|
src/trexio_text.h
|
2021-05-28 13:36:39 +02:00
|
|
|
|
|
|
|
ORG_FILES = \
|
|
|
|
src/templates_front/templator_front.org \
|
|
|
|
src/templates_text/templator_text.org \
|
|
|
|
src/templates_hdf5/templator_hdf5.org \
|
|
|
|
trex.org
|
|
|
|
|
|
|
|
|
|
|
|
src_libtrexio_la_SOURCES = $(SOURCES)
|
|
|
|
|
2021-06-22 16:04:25 +02:00
|
|
|
# =============== TESTS =============== #
|
2021-06-17 17:20:01 +02:00
|
|
|
|
|
|
|
TESTS_C = \
|
2021-06-22 16:04:25 +02:00
|
|
|
tests/open_hdf5 \
|
|
|
|
tests/open_text \
|
2021-06-17 17:20:01 +02:00
|
|
|
tests/io_num_hdf5 \
|
2021-06-21 12:55:16 +02:00
|
|
|
tests/io_num_text \
|
|
|
|
tests/io_dset_float_hdf5 \
|
|
|
|
tests/io_dset_float_text \
|
|
|
|
tests/io_dset_int_hdf5 \
|
|
|
|
tests/io_dset_int_text \
|
2021-07-28 10:19:45 +02:00
|
|
|
tests/io_safe_dset_float_hdf5 \
|
|
|
|
tests/io_safe_dset_float_text \
|
2021-06-21 12:55:16 +02:00
|
|
|
tests/io_str_hdf5 \
|
|
|
|
tests/io_str_text \
|
|
|
|
tests/io_dset_str_hdf5 \
|
|
|
|
tests/io_dset_str_text \
|
|
|
|
tests/overwrite_all_hdf5 \
|
|
|
|
tests/overwrite_all_text \
|
|
|
|
tests/io_all
|
2021-06-17 17:20:01 +02:00
|
|
|
|
|
|
|
TESTS_F = \
|
|
|
|
tests/test_f
|
|
|
|
|
2021-06-22 16:04:25 +02:00
|
|
|
TESTS = $(TESTS_C) $(TESTS_F)
|
2021-06-01 15:03:37 +02:00
|
|
|
check_PROGRAMS = $(TESTS)
|
2021-05-28 13:36:39 +02:00
|
|
|
|
2021-06-22 17:55:56 +02:00
|
|
|
# specify common LDADD options for all tests
|
2021-06-17 17:20:01 +02:00
|
|
|
LDADD = src/libtrexio.la
|
2021-06-22 14:46:39 +02:00
|
|
|
|
2021-06-22 16:04:25 +02:00
|
|
|
# in principal, specifying -no-install (see below) is not mandatory
|
|
|
|
# for the tests to compile and pass, but the produced test binaries differ
|
|
|
|
tests_open_hdf5_LDFLAGS = -no-install
|
|
|
|
tests_open_text_LDFLAGS = -no-install
|
2021-06-21 12:55:16 +02:00
|
|
|
tests_io_num_hdf5_LDFLAGS = -no-install
|
|
|
|
tests_io_num_text_LDFLAGS = -no-install
|
|
|
|
tests_io_dset_float_hdf5_LDFLAGS = -no-install
|
|
|
|
tests_io_dset_float_text_LDFLAGS = -no-install
|
|
|
|
tests_io_dset_int_hdf5_LDFLAGS = -no-install
|
|
|
|
tests_io_dset_int_text_LDFLAGS = -no-install
|
2021-07-28 10:19:45 +02:00
|
|
|
tests_io_safe_dset_float_hdf5_LDFLAGS = -no-install
|
|
|
|
tests_io_safe_dset_float_text_LDFLAGS = -no-install
|
2021-06-21 12:55:16 +02:00
|
|
|
tests_io_str_hdf5_LDFLAGS = -no-install
|
|
|
|
tests_io_str_text_LDFLAGS = -no-install
|
|
|
|
tests_io_dset_str_hdf5_LDFLAGS = -no-install
|
|
|
|
tests_io_dset_str_text_LDFLAGS = -no-install
|
|
|
|
tests_overwrite_all_hdf5_LDFLAGS = -no-install
|
|
|
|
tests_overwrite_all_text_LDFLAGS = -no-install
|
|
|
|
tests_io_all_LDFLAGS = -no-install
|
2021-06-17 17:20:01 +02:00
|
|
|
|
|
|
|
test_trexio_f = $(srcdir)/tests/trexio_f.f90
|
2021-05-28 13:36:39 +02:00
|
|
|
|
2021-06-04 18:14:45 +02:00
|
|
|
$(test_trexio_f): $(trexio_f)
|
2021-06-02 11:39:35 +02:00
|
|
|
cp $(trexio_f) $(test_trexio_f)
|
|
|
|
|
2021-06-22 17:55:56 +02:00
|
|
|
trexio.mod: tests/trexio_f.o
|
|
|
|
|
2021-06-17 17:20:01 +02:00
|
|
|
tests_test_f_SOURCES = $(test_trexio_f) tests/test_f.f90
|
2021-06-21 12:55:16 +02:00
|
|
|
tests_test_f_LDFLAGS = -no-install
|
2021-06-17 17:20:01 +02:00
|
|
|
|
2021-06-22 16:04:25 +02:00
|
|
|
clean-local:
|
|
|
|
-rm -rf -- *.dir/ *.h5
|
|
|
|
|
|
|
|
# =============== DOCUMENTATION =============== #
|
2021-06-02 18:45:05 +02:00
|
|
|
|
2021-06-18 12:04:03 +02:00
|
|
|
HTML_FILES = docs/trexio.css \
|
|
|
|
docs/index.html \
|
|
|
|
docs/Sparse.html \
|
|
|
|
docs/templator_hdf5.html \
|
|
|
|
docs/trex.html \
|
|
|
|
docs/README.html \
|
|
|
|
docs/templator_front.html \
|
|
|
|
docs/templator_text.html
|
|
|
|
|
|
|
|
htmldir = $(docdir)
|
|
|
|
dist_html_DATA = $(HTML_FILES)
|
|
|
|
|
|
|
|
$(HTML_FILES): docs/index.html
|
|
|
|
|
2021-06-22 16:04:25 +02:00
|
|
|
# =============== DEVELOPER MODE =============== #
|
2021-06-02 18:45:05 +02:00
|
|
|
|
2021-05-28 13:36:39 +02:00
|
|
|
if TREXIO_DEVEL
|
|
|
|
|
|
|
|
CLEANFILES += $(SOURCES) $(trexio_f) $(trexio_h)
|
|
|
|
|
2021-06-22 17:55:56 +02:00
|
|
|
BUILT_SOURCES += $(SOURCES) $(trexio_f) $(test_trexio_f)
|
2021-06-01 15:03:37 +02:00
|
|
|
|
2021-06-18 12:04:03 +02:00
|
|
|
|
2021-06-04 14:11:17 +02:00
|
|
|
$(SOURCES): $(trexio_f)
|
2021-05-28 13:36:39 +02:00
|
|
|
src/trexio.c: $(trexio_h)
|
|
|
|
|
2021-06-04 14:11:17 +02:00
|
|
|
$(trexio_f): $(ORG_FILES)
|
2021-05-28 13:36:39 +02:00
|
|
|
cd $(srcdir)/tools && ./build_trexio.sh
|
|
|
|
|
2021-06-22 16:04:25 +02:00
|
|
|
docs/index.html: $(ORG_FILES) $(srcdir)/src/README.org
|
2021-06-22 11:30:46 +02:00
|
|
|
cd $(srcdir)/tools && ./build_doc.sh
|
|
|
|
|
2021-05-28 13:36:39 +02:00
|
|
|
cppcheck: cppcheck.out
|
|
|
|
cat cppcheck.out
|
|
|
|
|
|
|
|
cppcheck.out: $(trexio_h)
|
|
|
|
cd src/ && \
|
|
|
|
cppcheck --addon=cert -q --error-exitcode=0 \
|
|
|
|
--enable=all \
|
|
|
|
--language=c --std=c99 -rp --platform=unix64 \
|
|
|
|
-I../include *.c *.h 2>../$@
|
|
|
|
|
2021-07-19 17:58:50 +02:00
|
|
|
|
2021-07-26 18:43:15 +02:00
|
|
|
python: src/_pytrexio*.so
|
2021-07-20 14:57:48 +02:00
|
|
|
|
2021-07-26 18:43:15 +02:00
|
|
|
python-test: src/test.py src/_pytrexio*.so
|
2021-07-20 14:57:48 +02:00
|
|
|
cd src/ && python3 test.py
|
|
|
|
$(RM) -r -- src/__pycache__
|
|
|
|
|
2021-07-28 10:30:23 +02:00
|
|
|
python-build: pyproject.toml setup.cfg
|
|
|
|
python3 -m build
|
|
|
|
|
|
|
|
python-release: pyproject.toml setup.cfg
|
|
|
|
python3 -m twine upload --repository testpypi dist/*
|
|
|
|
|
2021-07-26 18:43:15 +02:00
|
|
|
# Advanced compilation using Python-native distutils
|
|
|
|
#
|
|
|
|
# swig -python -threads pytrexio.i ----> Add thread support for all the interface
|
|
|
|
#
|
|
|
|
src/_pytrexio*.so: $(ORG_FILES) $(trexio_h) src/pytrexio.i
|
2021-07-20 11:40:13 +02:00
|
|
|
cp $(trexio_h) src/
|
2021-07-19 17:58:50 +02:00
|
|
|
cd src/ && \
|
2021-07-26 18:43:15 +02:00
|
|
|
swig -python -py3 -o pytrexio_wrap.c pytrexio.i && \
|
|
|
|
python3 setup.py build_ext --inplace --swig-opts="-modern"
|
2021-07-20 14:57:48 +02:00
|
|
|
$(RM) -- src/trexio.h
|
|
|
|
|
2021-07-26 18:43:15 +02:00
|
|
|
# Manual compilation of Python module
|
|
|
|
#
|
|
|
|
#src/_pytrexio.so: $(ORG_FILES) $(trexio_h) src/pytrexio.i
|
|
|
|
# cp $(trexio_h) src/
|
|
|
|
# cd src/ && \
|
|
|
|
# swig -python -py3 -o pytrexio_wrap.c pytrexio.i && \
|
|
|
|
# $(CC) $(CPPFLAGS) -I/usr/include/python3.8 -fPIC -Wno-discarded-qualifiers \
|
|
|
|
# -c trexio.c trexio_hdf5.c trexio_text.c pytrexio_wrap.c && \
|
|
|
|
# $(CC) -shared trexio.o trexio_hdf5.o trexio_text.o pytrexio_wrap.o \
|
|
|
|
# $(LDFLAGS) $(LIBS) -o _pytrexio.so
|
|
|
|
# $(RM) -- src/trexio.h
|
|
|
|
#
|
2021-07-19 17:58:50 +02:00
|
|
|
|
2021-07-26 18:43:15 +02:00
|
|
|
CLEANFILES += src/pytrexio_wrap.c src/pytrexio.py src/_pytrexio*.so
|
2021-07-19 17:58:50 +02:00
|
|
|
|
2021-07-28 10:30:23 +02:00
|
|
|
.PHONY: cppcheck python python-build python-test
|
2021-05-28 13:36:39 +02:00
|
|
|
|
|
|
|
endif
|
2021-06-17 17:20:01 +02:00
|
|
|
|