Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F81074239
SConscript
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Wed, Sep 4, 02:13
Size
3 KB
Mime Type
text/x-python
Expires
Fri, Sep 6, 02:13 (2 d)
Engine
blob
Format
Raw Data
Handle
20456396
Attached To
rTAMAAS tamaas
SConscript
View Options
from __future__ import print_function
import os
from os.path import join, abspath, basename
# ------------------------------------------------------------------------------
def copyComStr(env, main):
if 'SHCXXCOMSTR' in main:
env['CXXCOMSTR'] = main['SHCXXCOMSTR']
if 'SHLINKCOMSTR' in main:
env['LINKCOMSTR'] = main['SHLINKCOMSTR']
# ------------------------------------------------------------------------------
def make_python_tests(env):
"""Copy python tests to build directory"""
test_env = env.Clone(
PRINT_CMD_LINE_FUNC=main_env['gen_print']("Copying", "red", main_env))
test_files = Split("""
run_tests.sh
test_hertz_pressure.py
test_westergaard.py
test_patch_westergaard.py
test_surface.py
test_autocorrelation.py
test_hertz_disp.py
test_hertz_kato.py
test_saturated_pressure.py
test_bem_grid.py
test_flood_fill.py
fftfreq.py
conftest.py
""")
src_dir = "#/tests"
build_dir = 'build-' + main_env['build_type'] + '/tests'
for file in test_files:
source = join(src_dir, file)
test_env.Command(file, source, Copy("$TARGET", "$SOURCE"))
# ------------------------------------------------------------------------------
def compile_google_test(env, gtest_path):
gtest_obj = env.Object('gtest.o', [join(gtest_path, "src/gtest-all.cc")])
env.StaticLibrary('gtest', gtest_obj)
# ------------------------------------------------------------------------------
def make_google_tests(env):
gtest_dir = Dir('#/third-party/googletest/googletest')
gtest_env = env.Clone(CPPPATH=[gtest_dir],
CXXFLAGS=['-pthread', '-isystem',
join(str(gtest_dir), "include")])
colors = env['COLOR_DICT']
if not env['verbose']:
gtest_env['ARCOMSTR'] = u'{}[Ar]{} $TARGET'.format(colors['purple'],
colors['end'])
gtest_env['RANLIBCOMSTR'] = u'{}[Randlib]{} $TARGET'.format(colors['purple'],
colors['end'])
gtest_env.Tool(gtest)
gtest_path = str(gtest_dir)
compile_google_test(gtest_env, gtest_path)
env.AppendUnique(LIBS=['Tamaas'],
CXXFLAGS=gtest_env['CXXFLAGS'])
google_test_files = Split("""
test_fft.cpp
test_grid.cpp
test_loop.cpp
test_model.cpp
""")
google_test_files += ['libgtest.a']
gtest_main = env.Object("gtest_main.o", 'tamaas_gtest_main.cc')
env.Program('test_gtest_all', google_test_files + [gtest_main])
# ------------------------------------------------------------------------------
def make_bare_tests(env):
env.Program("test_rough_surface.cpp")
# ------------------------------------------------------------------------------
Import('main_env')
# Setup of test environment
test_env = main_env.Clone()
test_env.AppendUnique(LIBS=['Tamaas'],
LIBPATH=[abspath('build-' + main_env['build_type'] + '/src')])
copyComStr(test_env, main_env)
# Building tests that do not require any third party
make_bare_tests(test_env)
if test_env['build_python']:
test_env.Tool(pybind11)
#test_env.AppendUnique(LIBS=['python3.6m'])
test_env.ParseConfig("{}-config --ldflags".format(test_env['py_exec']))
test_env['CCFLAGS'] = []
make_python_tests(test_env)
# Building google tests
if test_env['use_googletest']:
make_google_tests(test_env)
Event Timeline
Log In to Comment