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> # @author Tobias Weber <tweber@ill.fr>
# @date 2018-2020 # @date 2018-2020
# @license GPLv2 (see 'LICENSE' file) # @license GPLv2 (see 'LICENSE' file)
# #
CXX = g++ mingw_build = 0
STRIP = strip debug_build = 0
#STRIP = echo -e "Not stripping" 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 STD = -std=c++17
OPT = -O2 -march=native LIBDEFS = -fPIC
DEFS = -DDEF_SKX_ORDER=7 -DDEF_HELI_ORDER=7 \ DEFS = -DDEF_SKX_ORDER=7 -DDEF_HELI_ORDER=7 \
-DNO_MINIMISATION -DNO_REDEFINITIONS \ -DNO_MINIMISATION -DNO_REDEFINITIONS \
-D__HACK_FULL_INST__ -D__HACK_FULL_INST__
INCS = -Isrc -Iext -Iext/takin -I/usr/local/include \ INCS = -Isrc -Iext -Iext/takin $(SYSINCS)
-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
# -----------------------------------------------------------------------------
# meta rules
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
.PHONY: all clean .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 ...@@ -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 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 $@..." @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) $@ $(STRIP) $@
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
...@@ -60,36 +104,36 @@ lib/skxmod_grid.so: src/takin/takin_grid.o ext/takin/tools/monteconvo/sqwbase.o ...@@ -60,36 +104,36 @@ lib/skxmod_grid.so: src/takin/takin_grid.o ext/takin/tools/monteconvo/sqwbase.o
# tools # tools
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
bin/genskx: src/takin/genskx.o src/core/skx.o src/core/magsys.o ext/tlibs2/libs/log.o 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 $(CXX) $(STD) $(OPT) $(DEFS) $(LIBDIRS) $(LIBDEFS) -o $@ $+ $(LIBBOOSTFILESYS) -llapacke -lpthread
$(STRIP) $@ $(STRIP) $@$(BIN_SUFFIX)
bin/merge: src/takin/merge.o bin/merge: src/takin/merge.o
$(CXX) $(STD) $(OPT) $(DEFS) $(LIBDIRS) -o $@ $+ -lboost_system $(CXX) $(STD) $(OPT) $(DEFS) $(LIBDIRS) -o $@ $+ $(LIBBOOSTSYS)
$(STRIP) $@ $(STRIP) $@$(BIN_SUFFIX)
bin/convert: src/takin/convert.o bin/convert: src/takin/convert.o
$(CXX) $(STD) $(OPT) $(DEFS) $(LIBDIRS) -o $@ $+ $(CXX) $(STD) $(OPT) $(DEFS) $(LIBDIRS) -o $@ $+
$(STRIP) $@ $(STRIP) $@$(BIN_SUFFIX)
bin/dump: src/takin/dump.o bin/dump: src/takin/dump.o
$(CXX) $(STD) $(OPT) $(DEFS) $(LIBDIRS) -o $@ $+ $(CXX) $(STD) $(OPT) $(DEFS) $(LIBDIRS) -o $@ $+
$(STRIP) $@ $(STRIP) $@$(BIN_SUFFIX)
bin/drawskx: src/calc/drawskx.o bin/drawskx: src/calc/drawskx.o
$(CXX) $(STD) $(OPT) $(DEFS) $(LIBDIRS) -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 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 $(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 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 $(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 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 $(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 ...@@ -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 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 $(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 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 $(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 @@ ...@@ -12,7 +12,10 @@
#include <fstream> #include <fstream>
#include <future> #include <future>
#include <memory> #include <memory>
#include <pwd.h>
#ifndef __MINGW32__
#include <pwd.h>
#endif
using t_real = double; using t_real = double;
using t_cplx = std::complex<t_real>; using t_cplx = std::complex<t_real>;
...@@ -172,7 +175,9 @@ void calc_disp(char dyntype, ...@@ -172,7 +175,9 @@ void calc_disp(char dyntype,
ofstr << "#\n"; ofstr << "#\n";
ofstr << "# Date: " << tl2::epoch_to_str<t_real>(tl2::epoch<t_real>()) << "\n"; ofstr << "# Date: " << tl2::epoch_to_str<t_real>(tl2::epoch<t_real>()) << "\n";
#ifndef __MINGW32__
ofstr << "# User: " << getpwuid(geteuid())->pw_name << "\n"; ofstr << "# User: " << getpwuid(geteuid())->pw_name << "\n";
#endif
ofstr << "# Calculation time: " << timer.GetDur() << " s.\n"; ofstr << "# Calculation time: " << timer.GetDur() << " s.\n";
ofstr << "# Skx order: " << DEF_SKX_ORDER << "\n"; ofstr << "# Skx order: " << DEF_SKX_ORDER << "\n";
if(dyntype == 'h') if(dyntype == 'h')
......
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
#include <fstream> #include <fstream>
#include <future> #include <future>
#include <pwd.h>
#include <boost/histogram.hpp> #include <boost/histogram.hpp>
namespace hist = boost::histogram; 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