Skip to content

Commit 863c186

Browse files
committed
Integrated t8code as a submodule
1 parent 0b61246 commit 863c186

File tree

4 files changed

+55
-20
lines changed

4 files changed

+55
-20
lines changed

Makefile.am

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1-
ACLOCAL_AMFLAGS = -I config
1+
ACLOCAL_AMFLAGS = -I config @CMC_T8_AMFLAGS@
22

33
AM_CPPFLAGS = -I@includedir@ @CPPFLAGS@
4-
AM_CXXFLAGS = -std=c++2a -Wall -Wextra
4+
AM_CXXFLAGS = -std=c++2a
5+
#-Wall -Wextra
56
AM_LDFLAGS = -L@libdir@ @LDFLAGS@
67
AM_FCFLAGS = @FCFLAGS@
78

89
CLEANFILES =
910
DISTCLEANFILES =
1011
EXTRA_DIST =
11-
LDADD =
12+
LDADD =
1213
bin_PROGRAMS =
1314
nodist_include_HEADERS =
1415
include_HEADERS =
@@ -18,6 +19,9 @@ MODSOURCES =
1819
check_PROGRAMS =
1920
TESTS =
2021

22+
SUBDIRS = $(subdirs) $(subdirs_extra)
23+
DIST_SUBDIRS = $(SUBDIRS)
24+
2125
DISTCLEANFILES += src/cmc_ac_config.h
2226

2327
EXTRA_DIST += bootstrap

bootstrap

+8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
#! /bin/sh
22

3+
# Run the t8code bootstrap script if it has been initialized as a submodule
4+
if test -x "t8code/bootstrap" ; then
5+
echo "Running bootstrap in the t8code submodule"
6+
(cd t8code && ./bootstrap)
7+
fi
8+
9+
rm -rf autom4te.cache
10+
311
LIBTOOLIZE=`which glibtoolize 2>/dev/null`
412
if test ! -x "$LIBTOOLIZE" ; then LIBTOOLIZE=`which libtoolize` ; fi
513
if test ! -x "$LIBTOOLIZE" ; then echo "bootstrap requires libtoolize" ; exit 1 ; fi

configure.ac

+35-14
Original file line numberDiff line numberDiff line change
@@ -72,18 +72,6 @@ fi
7272
AM_CONDITIONAL([WITH_MODDIR], [test "x$withval" != xno])
7373
CMC_WITH_MODDIR="$withval"
7474

75-
# ==========================================================
76-
# Check if option with-t8code is given =====================
77-
AC_ARG_WITH([t8code],
78-
[AS_HELP_STRING([--with-t8code], [compile with t8code support])],,
79-
[withval=no])
80-
81-
if test "x$withval" != xno ; then
82-
AC_DEFINE([WITH_T8CODE], 1, [Define if t8code-linkage is enabled.])
83-
fi
84-
AM_CONDITIONAL([WITH_T8CODE], [test "x$withval" != xno])
85-
CMC_WITH_T8CODE="$withval"
86-
8775
# ==========================================================
8876
# Check if option with-netcdf is given =====================
8977
AC_ARG_WITH([netcdf],
@@ -96,6 +84,39 @@ fi
9684
AM_CONDITIONAL([WITH_NETCDF], [test "x$withval" != xno])
9785
CMC_WITH_NETCDF="$withval"
9886

87+
# ==========================================================
88+
# Check if option with-t8code is given =====================
89+
AC_ARG_WITH([t8code],
90+
[AS_HELP_STRING([--with-t8code], [compile with external t8code support])],,
91+
[withval=no])
92+
93+
CMC_LIB_ADD_T8_SUBMODULE=
94+
CMC_T8_CONFIG_AMFLAGS=
95+
CMC_T8_SC_P4EST_CPP_FLAGS=
96+
if test "x$withval" != xno ; then
97+
AC_DEFINE([WITH_T8CODE], 1, [Define if external t8code-linkage is enabled.])
98+
else
99+
# If the option is not given, we will use t8code as a submodule
100+
AX_SUBDIRS_CONFIGURE([t8code],
101+
[],[],[[--with-netcdf=no],[--enable-fortran=no],[--with-moddir=no]],[])
102+
AC_DEFINE([WITH_T8CODE], 1, [Define if internal t8code-linkage is enabled.])
103+
104+
CMC_T8_SC_P4EST_CPP_FLAGS+=" -I\$(top_srcdir)/t8code/src -It8code/config -It8code/src"
105+
CMC_T8_SC_P4EST_CPP_FLAGS+=" -I\$(top_srcdir)/t8code/sc/src -It8code/sc/config -It8code/sc/src"
106+
CMC_T8_SC_P4EST_CPP_FLAGS+=" -I\$(top_srcdir)/t8code/p4est/src -It8code/p4est/config -It8code/p4est/src"
107+
CMC_LIB_ADD_T8_SUBMODULE="\$(top_builddir)/t8code/src/libt8.la \$(top_builddir)/t8code/sc/src/libsc.la \$(top_builddir)/t8code/p4est/src/libp4est.la"
108+
CMC_T8_CONFIG_AMFLAGS="-I \$(top_srcdir)/t8code/config -I \$(top_srcdir)/t8code/sc/config -I \$(top_srcdir)/t8code/p4est/config"
109+
fi
110+
AC_SUBST(CMC_LDADD_T8_SUBMODULE, $CMC_LIB_ADD_T8_SUBMODULE)
111+
AC_SUBST(CMC_T8_AMFLAGS, $CMC_T8_CONFIG_AMFLAGS)
112+
AC_SUBST(CMC_T8_CPPFLAGS, $CMC_T8_SC_P4EST_CPP_FLAGS)
113+
114+
# In either case, we will have an available t8code
115+
AM_CONDITIONAL([WITH_T8CODE], [TRUE])
116+
117+
# We store the value seperately, because in case of an external t8code linkage,
118+
# its access has to be checked.
119+
CMC_WITH_T8CODE="$withval"
99120

100121
# ==========================================================
101122
# Check whether compilers have been set as environment
@@ -326,7 +347,7 @@ if test "x$CMC_WITH_T8CODE" != xno ; then
326347
AC_LANG_PUSH([C])
327348
AC_LINK_IFELSE([AC_LANG_PROGRAM(
328349
[[
329-
#include <t8_forest.h>
350+
#include <t8_forest/t8_forest.h>
330351
]],[[
331352
t8_forest_t forest;
332353
]])],
@@ -362,7 +383,7 @@ AC_DEFINE_UNQUOTED(LIBS, ["${LIBS}"], [Libraries])
362383
AC_PROG_INSTALL
363384

364385
# Initialize automake after all compilers and preprocessors have been found
365-
AM_INIT_AUTOMAKE([subdir-objects])
386+
AM_INIT_AUTOMAKE([parallel-tests subdir-objects])
366387

367388
# Initialize Libtool
368389
LT_INIT

src/Makefile.am

+5-3
Original file line numberDiff line numberDiff line change
@@ -101,14 +101,16 @@ endif
101101

102102
src_libcmc_la_CPPFLAGS = $(AM_CPPFLAGS)
103103
src_libcmc_la_LDFLAGS = $(AM_LDFLAGS)
104-
src_libcmc_la_LIBFLAGS = $(NETCDF_LIBFLAGS) $(T8CODE_LIBFLAGS)
105104
src_libcmc_la_CXXFLAGS = $(AM_CXXFLAGS)
106105
src_libcmc_la_CFLAGS = $(CMC_CFLAGS)
107106
if ENABLE_FORTRAN
108107
src_libcmc_la_FCFLAGS = $(AM_FCFLAGS)
109108
src_libcmc_la_FFLAGS = $(CMC_FFLAGS)
110109
endif
110+
src_libcmc_la_LIBFLAGS = $(NETCDF_LIBFLAGS) $(T8CODE_LIBFLAGS) @CMC_LDADD_T8_SUBMODULE@
111+
src_libcmc_la_LIBADD = @CMC_LDADD_T8_SUBMODULE@
112+
EXTRA_src_libcmc_la_DEPENDENCIES = @CMC_LDADD_T8_SUBMODULE@
111113

112-
LDADD += @top_builddir@/src/libcmc.la $(NETCDF_LIBFLAGS) $(T8CODE_LIBFLAGS)
114+
LDADD += @top_builddir@/src/libcmc.la @CMC_LDADD_T8_SUBMODULE@
113115

114-
AM_CPPFLAGS += -I@top_srcdir@/src
116+
AM_CPPFLAGS += -I@top_srcdir@/src @CMC_T8_CPPFLAGS@

0 commit comments

Comments
 (0)