Page MenuHomec4science

tamaas.py
No OneTemporary

File Metadata

Created
Sat, May 4, 03:55

tamaas.py

# -*- coding: utf-8 -*-
# @file
# @section LICENSE
#
# Copyright (©) 2016-19 EPFL (École Polytechnique Fédérale de Lausanne),
# Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
import os
from SCons.Errors import StopError
from SCons.Script import Configure
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++14"])
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