Page MenuHomec4science

tamaas.py
No OneTemporary

File Metadata

Created
Sat, Oct 19, 21:50

tamaas.py

# coding: utf-8
#
# @author Lucas Frérot <lucas.frerot@epfl.ch>
#
# @section LICENSE
#
# Copyright (©) 2017 EPFL (Ecole Polytechnique Fédérale de
# Lausanne) Laboratory (LSMS - Laboratoire de Simulation en Mécanique des
# Solides)
#
# Tamaas is free software: you can redistribute it and/or modify it under the
# terms of the GNU Lesser General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option) any
# later version.
#
# Tamaas 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 Lesser General Public License for more
# details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with Tamaas. If not, see <http://www.gnu.org/licenses/>.
import os
import SCons
from SCons.Errors import StopError
from SCons.Script import *
def generate(env):
"""Sets correct environement variables for Tamaas.
- 'TAMAAS_PATH' is the path to the build directory of Tamaas"""
if env.GetOption("clean"):
return
if 'TAMAAS_PATH' not in env:
raise StopError("Please set the 'TAMAAS_PATH' variable in your " +
"scons environment")
tm_path = env['TAMAAS_PATH']
include_dir = tm_path + '/src'
subdirs = "core model solvers bem surface percolation".split(" ")
include_dirs = [os.path.abspath(os.path.join(include_dir, x)) for x in subdirs]
lib_dir = include_dir
env.AppendUnique(CPPPATH = include_dirs)
env.AppendUnique(LIBPATH = [os.path.abspath(lib_dir)])
env.AppendUnique(RPATH = [os.path.abspath(lib_dir)])
env.AppendUnique(CXXFLAGS = ["-std=c++11"])
env.AppendUnique(CPPDEFINES=["THRUST_DEVICE_SYSTEM=THRUST_DEVICE_SYSTEM_OMP"])
env.AppendUnique(LIBS=['fftw3', 'fftw3_omp'])
conf = Configure(env)
if not conf.CheckLibWithHeader("Tamaas", "tamaas.hh", language="CXX"):
raise StopError(
"Tamaas not found in {}".format(os.path.abspath(tm_path)))
env['TAMAAS_PATH'] = os.path.abspath(tm_path)
env = conf.Finish()
def exists(env):
if 'TAMAAS_PATH' in env:
return True
return False

Event Timeline