# encoding: utf-8
"""
Compile-time configuration for yade.

Template file is processed by cmake to create the actual configuration at build-time.
"""
import os,datetime,os.path
import shutil
prefix='${runtimePREFIX}' if 'YADE_PREFIX' not in os.environ else os.environ['YADE_PREFIX']
suffix='${SUFFIX}'

libPATH='${LIBRARY_OUTPUT_PATH}'
if (libPATH[1:] == '{LIBRARY_OUTPUT_PATH}'): libPATH='lib'

libDir=os.path.abspath(prefix+'/'+libPATH+'/yade${SUFFIX}')
if "XDG_CONFIG_HOME" in os.environ.keys():
	confDir=os.path.join(os.environ['XDG_CONFIG_HOME'],'yade${SUFFIX}')
else:
	confDir=os.path.join(os.environ['HOME'],'.config','yade${SUFFIX}')
oldConfDir=os.path.join(os.environ['HOME'],'.yade${SUFFIX}')
if os.path.exists(oldConfDir):
	print('\033[93m'+"Note: moving yade config dir from ",oldConfDir," to ",confDir,'\033[0m')
	shutil.move(oldConfDir,confDir)
libstdcxx='${libstdcxx}'
highPrecisionBits         =${REAL_PRECISION_BITS}
highPrecisionDecimalPlaces=${REAL_DECIMAL_PLACES}
highPrecisionMpmath       =${MPMATH_IS_USED}
highPrecisionName         ='${REAL_PREC_NAME}'

features='${CONFIGURED_FEATS}'.split(' ')
if (features[0]==''): features=features[1:]

revision='${realVersion}'
version='${version}'
sourceRoot='${sourceRoot}'

# project metadata
metadata=dict(
	short_desc='open-source platform for dynamic computations',
	long_desc='Extensible open-source framework for discrete numerical models, focused on Discrete Element Method. The computation parts are written in c++ using flexible object model, allowing independent implementation of new algorithms and interfaces. Python is used for rapid and concise scene construction, simulation control, postprocessing and debugging.\n\n\n\nSee http://www.yade-dem.org/ for documentation and http://www.launchpad.net/yade for the project itself.\n\nThis is version %s with features %s.'%(version,','.join(features)),
	author='Yade Developers Team',
	website='http://www.yade-dem.org',
	author_contact='http://www.launchpad.net/~yade-dev and https://gitlab.com/yade-dev/trunk/project_members',
	mailinglist='yade-users@lists.launchpad.net',
	bugtracker='https://gitlab.com/yade-dev/trunk/issues',
	copyright='© 2003--%s'%(datetime.date.today().year),
	license='''This program is free software; you can redistribute it and/or modify 
it under the terms of the GNU General Public License as published 
by the Free Software Foundation; either version 2 of the License, 
or (at your option) any later version.

This program is distributed in the hope that it will be useful, 
but WITHOUT ANY WARRANTY; without even the implied warranty of 
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
GNU General Public License for more details.

You should have received a copy of the GNU General Public License 
along with this program; if not, write to the Free Software 
Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
MA 02111-1307 USA.
''',
)

