Page MenuHomec4science

SConscript
No OneTemporary

File Metadata

Created
Wed, May 1, 11:50

SConscript

# -*- 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/>.
from __future__ import print_function
from os.path import abspath
from SCons.Script import Import, Split, Copy
Import('main_env')
# Pybind11 wrapper
env_pybind = main_env.Clone(SHLIBPREFIX='')
env_pybind.Tool(pybind11)
pybind_sources = Split("""
tamaas_module.cpp
wrap/core.cpp
wrap/percolation.cpp
wrap/surface.cpp
wrap/model.cpp
wrap/solvers.cpp
wrap/test_features.cpp
""")
if main_env['CXX'] != 'icpc':
pybind_sources += ["wrap/bem.cpp"]
env_pybind.AppendUnique(CPPDEFINES="LEGACY_BEM")
# Building the pybind library
tamaas_wrap = env_pybind.SharedLibrary(
target='tamaas/_tamaas',
source=pybind_sources,
LIBS=['Tamaas'],
RPATH=[abspath('../src')]
)
# For some reason link happens too early
Import('libTamaas')
env_pybind.Depends(tamaas_wrap, libTamaas)
# Copying the __init__.py file with extra python classes
copy_env = env_pybind.Clone(
PRINT_CMD_LINE_FUNC=main_env['gen_print']("Copying", "red", main_env))
copy_env.Command(Dir('tamaas'), Dir('#python/tamaas'), Copy("$TARGET", "$SOURCE"))
copy_env.Command('setup.py', '#python/setup.py', Copy("$TARGET", "$SOURCE"))
# Cleaning the tamaas python package
main_env.Execute(Delete('tamaas'))

Event Timeline