Verified Commit 372f63cb authored by Tobias WEBER's avatar Tobias WEBER
Browse files

more elaborate building options

parent 1e11a441
#
# MnSi dynamics module for Takin
# MnSi dynamics module for Takin and helper tools
# @author Tobias Weber <tweber@ill.fr>
# @date 2018-2020
# @license GPLv2 (see 'LICENSE' file)
#
CXX = g++
STRIP = strip
#STRIP = echo -e "Not stripping"
mingw_build = 0
debug_build = 0
strip_bins = 1
# -----------------------------------------------------------------------------
# setup
# -----------------------------------------------------------------------------
ifneq ($(mingw_build), 1)
CXX = g++
SYSINCS = -I/usr/local/include \
-I/usr/include/lapacke -I/usr/local/opt/lapack/include \
-I/usr/include/qt5 -I/usr/include/x86_64-linux-gnu/qt5/ \
#-I/home/tw/build/boost_1_73_0
LIBDIRS = -L/usr/local/opt/lapack/lib -L/usr/local/lib
LIBBOOSTSYS = -lboost_system
LIBBOOSTFILESYS = -lboost_filesystem
BIN_SUFFIX =
else
CXX = x86_64-w64-mingw32-g++
SYSINCS = -I/usr/x86_64-w64-mingw32/sys-root/mingw/include \
-I/usr/x86_64-w64-mingw32/sys-root/mingw/include/qt5
LIBDIRS = -L/usr/x86_64-w64-mingw32/sys-root/mingw/bin/
LIBBOOSTSYS = -lboost_system-x64
LIBBOOSTFILESYS = -lboost_filesystem-x64
BIN_SUFFIX = .exe
endif
ifneq ($(debug_build), 1)
OPT = -O2 #-march=native
ifeq ($(strip_bins), 1)
STRIP = strip
else
STRIP = echo -e "Not stripping"
endif
else
OPT = -g -ggdb
STRIP = echo -e "Not stripping"
endif
STD = -std=c++17
OPT = -O2 -march=native
LIBDEFS = -fPIC
DEFS = -DDEF_SKX_ORDER=7 -DDEF_HELI_ORDER=7 \
-DNO_MINIMISATION -DNO_REDEFINITIONS \
-D__HACK_FULL_INST__
INCS = -Isrc -Iext -Iext/takin -I/usr/local/include \
-I/usr/include/lapacke -I/usr/local/opt/lapack/include \
-I/usr/include/qt5 -I/usr/include/x86_64-linux-gnu/qt5/ \
#-I/home/tw/build/boost_1_73_0
LIBDIRS = -L/usr/local/opt/lapack/lib -L/usr/local/lib
LIBDEFS = -fPIC
INCS = -Isrc -Iext -Iext/takin $(SYSINCS)
# -----------------------------------------------------------------------------
# -----------------------------------------------------------------------------
# meta rules
# -----------------------------------------------------------------------------
.PHONY: all clean
......@@ -51,7 +95,7 @@ lib/skxmod.so: src/core/skx.o src/core/fp.o src/core/heli.o src/core/magsys.o sr
lib/skxmod_grid.so: src/takin/takin_grid.o ext/takin/tools/monteconvo/sqwbase.o ext/tlibs2/libs/log.o
@echo "Linking Takin grid module $@..."
$(CXX) $(STD) $(OPT) $(DEFS) $(LIBDIRS) $(LIBDEFS) -shared -o $@ $+ -lboost_system -lQt5Core
$(CXX) $(STD) $(OPT) $(DEFS) $(LIBDIRS) $(LIBDEFS) -shared -o $@ $+ $(LIBBOOSTSYS) -lQt5Core
$(STRIP) $@
# -----------------------------------------------------------------------------
......@@ -60,36 +104,36 @@ lib/skxmod_grid.so: src/takin/takin_grid.o ext/takin/tools/monteconvo/sqwbase.o
# tools
# -----------------------------------------------------------------------------
bin/genskx: src/takin/genskx.o src/core/skx.o src/core/magsys.o ext/tlibs2/libs/log.o
$(CXX) $(STD) $(OPT) $(DEFS) $(LIBDIRS) $(LIBDEFS) -o $@ $+ -lboost_filesystem -llapacke -lpthread
$(STRIP) $@
$(CXX) $(STD) $(OPT) $(DEFS) $(LIBDIRS) $(LIBDEFS) -o $@ $+ $(LIBBOOSTFILESYS) -llapacke -lpthread
$(STRIP) $@$(BIN_SUFFIX)
bin/merge: src/takin/merge.o
$(CXX) $(STD) $(OPT) $(DEFS) $(LIBDIRS) -o $@ $+ -lboost_system
$(STRIP) $@
$(CXX) $(STD) $(OPT) $(DEFS) $(LIBDIRS) -o $@ $+ $(LIBBOOSTSYS)
$(STRIP) $@$(BIN_SUFFIX)
bin/convert: src/takin/convert.o
$(CXX) $(STD) $(OPT) $(DEFS) $(LIBDIRS) -o $@ $+
$(STRIP) $@
$(STRIP) $@$(BIN_SUFFIX)
bin/dump: src/takin/dump.o
$(CXX) $(STD) $(OPT) $(DEFS) $(LIBDIRS) -o $@ $+
$(STRIP) $@
$(STRIP) $@$(BIN_SUFFIX)
bin/drawskx: src/calc/drawskx.o
$(CXX) $(STD) $(OPT) $(DEFS) $(LIBDIRS) -o $@ $+
$(STRIP) $@
$(STRIP) $@$(BIN_SUFFIX)
bin/dyn: src/calc/dyn.o src/core/skx.o src/core/fp.o src/core/heli.o src/core/magsys.o ext/tlibs2/libs/log.o
$(CXX) $(STD) $(OPT) $(DEFS) $(LIBDIRS) $(LIBDEFS) -o $@ $+ -llapacke -lpthread
$(STRIP) $@
$(STRIP) $@$(BIN_SUFFIX)
bin/weight: src/calc/weight.o src/core/skx.o src/core/fp.o src/core/heli.o src/core/magsys.o ext/tlibs2/libs/log.o
$(CXX) $(STD) $(OPT) $(DEFS) $(LIBDIRS) $(LIBDEFS) -o $@ $+ -llapacke -lpthread
$(STRIP) $@
$(STRIP) $@$(BIN_SUFFIX)
bin/weight_sum: src/calc/weight_sum.o src/core/skx.o src/core/fp.o src/core/heli.o src/core/magsys.o ext/tlibs2/libs/log.o
$(CXX) $(STD) $(OPT) $(DEFS) $(LIBDIRS) $(LIBDEFS) -o $@ $+ -llapacke -lpthread
$(STRIP) $@
$(STRIP) $@$(BIN_SUFFIX)
# -----------------------------------------------------------------------------
......@@ -98,11 +142,11 @@ bin/weight_sum: src/calc/weight_sum.o src/core/skx.o src/core/fp.o src/core/heli
# -----------------------------------------------------------------------------
bin/heliphase: src/calc/heliphase.cpp src/core/heli.cpp src/core/magsys.cpp ext/tlibs2/libs/log.cpp
$(CXX) $(STD) $(OPT) $(INCS) -DDEF_HELI_ORDER=4 -DNO_REDEFINITIONS -D__HACK_FULL_INST__ $(LIBDIRS) -o $@ $+ -lMinuit2 -llapacke -lgomp
$(STRIP) $@
$(STRIP) $@$(BIN_SUFFIX)
bin/skx_gs: src/calc/skx_gs.cpp src/core/skx.cpp src/core/heli.cpp src/core/magsys.cpp ext/tlibs2/libs/log.cpp
$(CXX) $(STD) $(OPT) $(INCS) -DDEF_SKX_ORDER=7 -DDEF_HELI_ORDER=7 -DNO_REDEFINITIONS -D__HACK_FULL_INST__ $(LIBDIRS) -o $@ $+ -lMinuit2 -llapacke -lgomp
$(STRIP) $@
$(STRIP) $@$(BIN_SUFFIX)
# -----------------------------------------------------------------------------
......
......@@ -12,7 +12,10 @@
#include <fstream>
#include <future>
#include <memory>
#include <pwd.h>
#ifndef __MINGW32__
#include <pwd.h>
#endif
using t_real = double;
using t_cplx = std::complex<t_real>;
......@@ -172,7 +175,9 @@ void calc_disp(char dyntype,
ofstr << "#\n";
ofstr << "# Date: " << tl2::epoch_to_str<t_real>(tl2::epoch<t_real>()) << "\n";
#ifndef __MINGW32__
ofstr << "# User: " << getpwuid(geteuid())->pw_name << "\n";
#endif
ofstr << "# Calculation time: " << timer.GetDur() << " s.\n";
ofstr << "# Skx order: " << DEF_SKX_ORDER << "\n";
if(dyntype == 'h')
......
......@@ -10,7 +10,6 @@
#include <fstream>
#include <future>
#include <pwd.h>
#include <boost/histogram.hpp>
namespace hist = boost::histogram;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment