Commit a0ce6875 authored by Alvarez, Gonzalo's avatar Alvarez, Gonzalo
Browse files

configure.pl added

parent 52e2ee15
Loading
Loading
Loading
Loading
+156 −0
Original line number Diff line number Diff line
#
# Format of psiTag files is described in PsimagLite/scripts/PsiTag.pm
#
# PsimagLite support is needed by DMRG++
dependency PsimagLite = (
LDFLAGS = -L../../PsimagLite/lib -L../../../PsimagLite/lib -lpsimaglite
)

# Compiler to use. For clang++ see commented out line.
# Note that -mtune=native -march=native should not be
# used if you intend your executable to run in machines
# other than the one your are compiling on
compilerCPP GNU = CXX = g++ -frecord-gcc-switches

compilerCPP CLANG = CXX = clang++

compilerCPPOptions ansi = (

# We're using ansi C++
CPPFLAGS += -pedantic -std=c++11

# Enable warnings and treat warnings as errors
CPPFLAGS += -Wall -Wendif-labels

)

# Treat warnings as errors
# (hdf5 on Ubuntu does not pass this, so it's
# commented out by default now)
compilerCPPOptions Werror = CPPFLAGS += -Werror

# This enables additional debugging
compilerCPPOptions AdditionalDebugging = (
CPPFLAGS += -D_GLIBCXX_DEBUG # -D_GLIBCXX_PROFILE
)

# This makes the code use long instead of short integers
.= CPPFLAGS +=-DUSE_LONG

# This makes the code use float instead of double
.= CPPFLAGS += -DUSE_FLOAT

# This enables signals
.= CPPFLAGS +=-DUSE_SIGNALS

# This enables gsl support
dependency GSL = (
CPPFLAGS +=-DUSE_GSL
LDFLAGS += -lgsl -lgslcblas
)

# This enables the custom allocator (use only for debugging)
compilerCPPOptions USE_CUSTOM_ALLOCATOR = (
CPPFLAGS += -DUSE_CUSTOM_ALLOCATOR
)

# Disable KronUtil
compilerCPPOptions NotKronUtil = (
CPPFLAGS += -DDO_NOT_USE_KRON_UTIL
)

#Add directory to linker where libkronutil.a resides
linkerOptions KronUtil = (
LDFLAGS += -LKronUtil
)

#Enable SU(2)
#You will also need to run perl configure.pl production 0 1
#to rebuild the Makefile
.= CPPFLAGS += -DENABLE_SU2

#IoNg needs HDF5 libraries
dependency HDF5 = (
CPPFLAGS += -I/usr/include/hdf5/serial
LDFLAGS += -L/usr/lib/x86_64-linux-gnu/hdf5/serial/
LDFLAGS += -lhdf5_hl_cpp -lhdf5_cpp -lhdf5_hl -lhdf5
)

#This enables boost support that is needed for Ainur
dependency Boost = (
CPPFLAGS += -DUSE_BOOST
)

# This disables debugging
compilerCPPOptions NDEBUG = CPPFLAGS += -DNDEBUG

# Optimization level here
compilerCPPOptions Optimize3 = (
CPPFLAGS += -O3
)

# This enables partial debugging (make sure to comment out previous line)
compilerCPPOptions Symbols3 = (
CPPFLAGS +=   -g3
)

# Here add your lapack and blas libraries or say NO_LAPACK
dependency LAPACK = (
# If on MacOs please say LDFLAGS += -framework Accelerate
LDFLAGS += -llapack
)

dependency BLAS = (
LDFLAGS += -lblas
)

dependency pthreads = (
# Here add -lpthread if threading is needed and also 
# set -DUSE_PTHREADS below
LDFLAGS += -lpthread

# Enable pthreads
CPPFLAGS += -DUSE_PTHREADS
)

default flavor = production

default compiler = < compilerCPP GNU
group basics = (
< dependency PsimagLite
< default compiler
< compilerCPPOptions ansi
< dependency LAPACK
< dependency BLAS
< dependency Boost
STRIP_COMMAND = strip
)

flavor production = (
< group basics
< dependency pthreads
< compilerCPPOptions Optimize3
< compilerCPPOptions NDEBUG
)

flavor debug = (
< group basics
STRIP_COMMAND = true
< compilerCPPOptions Symbols3
< compilerCPPOptions Werror
)

flavor callgrind = (
< flavor debug
< compilerCPPOptions Optimize3
< compilerCPPOptions NDEBUG
)

flavor drd = (
< flavor debug
< dependency pthreads
)

flavor helgrind = < flavor drd

src/Makefile

deleted100644 → 0
+0 −49
Original line number Diff line number Diff line
# DO NOT EDIT!!! Changes will be lost. Modify Config.make instead
# This Makefile was written by configure.pl
# MPS++ by G.A.

include Config.make
CPPFLAGS += -I../../PsimagLite -I../../PsimagLite/src -IEngine
all: merapp srepToTikz tensorEval meranpp tensorBreakup

merapp: merapp.o
	$(CXX) merapp.o -o merapp $(LDFLAGS)

merapp.o: merapp.cpp  Makefile   Config.make
	$(CXX) $(CPPFLAGS) -c merapp.cpp

meranpp: meranpp.o
	$(CXX) meranpp.o -o meranpp $(LDFLAGS)

meranpp.o: meranpp.cpp  Makefile   Config.make
	$(CXX) $(CPPFLAGS) -c meranpp.cpp

srepToTikz: srepToTikz.o
	$(CXX) srepToTikz.o -o srepToTikz $(LDFLAGS)

srepToTikz.o: srepToTikz.cpp  Makefile   Config.make
	$(CXX) $(CPPFLAGS) -c srepToTikz.cpp

tensorEval: tensorEval.o
	$(CXX) tensorEval.o -o tensorEval $(LDFLAGS)

tensorEval.o: tensorEval.cpp Makefile   Config.make
	$(CXX) $(CPPFLAGS) -c  tensorEval.cpp

tensorBreakup: tensorBreakup.o
	$(CXX) $(CPPFLAGS) -o tensorBreakup tensorBreakup.o $(LDFLAGS)

tensorBreakup.o: tensorBreakup.cpp Makefile   Config.make
	$(CXX) $(CPPFLAGS) -c  tensorBreakup.cpp

../../PsimagLite/lib/libpsimaglite.a:
	$(MAKE) -f Makefile -C ../../PsimagLite/lib/

Makefile.dep: merapp.cpp
	$(CXX) $(CPPFLAGS) -MM merapp.cpp  srepToTikz.cpp tensorEval.cpp \
   meranpp.cpp tensorBreakup.cpp > Makefile.dep

clean: Makefile.dep
	rm -f core* merapp meranpp srepToTikz tensorEval *.o *.dep

include Makefile.dep

src/configure.pl

0 → 100755
+81 −0
Original line number Diff line number Diff line
#!/usr/bin/perl
=pod
Copyright (c) 2009-2018-2019, UT-Battelle, LLC
All rights reserved

[MERA++, Version 0.]

=cut
use warnings;
use strict;

use Getopt::Long qw(:config no_ignore_case);
use lib "../../PsimagLite/scripts";
use NewMake;
use lib ".";
use PsiTag;

my ($flavor, $lto) = (NewMake::noFlavor(), 0);
my $usage = "USAGE: $0 [-f flavor] [-lto] [-c config]\n";
my $config;

GetOptions('f=s' => \$flavor,
           'lto' => \$lto,
           'c=s' => \$config) or die "$usage\n";

my $gccdash = "";
if ($lto == 1) {
	$gccdash = "gcc-";
	$lto = "-flto";
} else {
	$lto = "";
}

my $basicConfig = "../TestSuite/inputs/ConfigBase.psiTag";
my @configFiles = NewMake::configFilesList($basicConfig, $config);
my %driver1 = (name => 'meranpp');
my %driver2 = (name => 'merapp');
my %driver3 = (name => 'srepToTikz');
my %driver4 = (name => 'tensorBreakup');
my %driver5 = (name => 'tensorEval');


my @drivers = (\%driver1, \%driver2, \%driver3, \%driver4, \%driver5);

my %args;
$args{"CPPFLAGS"} = $lto;
$args{"LDFLAGS"} = $lto;
$args{"flavor"} = $flavor;
$args{"code"} = "DMRG++";
$args{"configFiles"} = \@configFiles;
$args{"additional3"} = "GitRevision.h";
$args{"additional4"} = $args{"additional3"};

#system("./createGitRevision.pl GitRevision.h");

createMakefile(\@drivers, \%args);

sub createMakefile
{
	my ($drivers, $args) = @_;
	unlink("Makefile.dep");
	NewMake::backupMakefile();
	$args->{"additional3"} = "operator";

	my $fh;
	open($fh, ">", "Makefile") or die "Cannot open Makefile for writing: $!\n";

	NewMake::main($fh, $args, $drivers);
	local *FH = $fh;
print FH<<EOF;

#.PHONY: GitRevision.h

#GitRevision.h:
#	./createGitRevision.pl GitRevision.h

EOF

	close($fh);
	print STDERR "$0: File Makefile has been written\n";
}