| 1 | # -*- Mode:Python -*- |
|---|
| 2 | |
|---|
| 3 | ########################################################################## |
|---|
| 4 | # # |
|---|
| 5 | # This file is part of AVANGO. # |
|---|
| 6 | # # |
|---|
| 7 | # Copyright 1997 - 2009 Fraunhofer-Gesellschaft zur Foerderung der # |
|---|
| 8 | # angewandten Forschung (FhG), Munich, Germany. # |
|---|
| 9 | # # |
|---|
| 10 | # AVANGO is free software: you can redistribute it and/or modify # |
|---|
| 11 | # it under the terms of the GNU Lesser General Public License as # |
|---|
| 12 | # published by the Free Software Foundation, version 3. # |
|---|
| 13 | # # |
|---|
| 14 | # AVANGO is distributed in the hope that it will be useful, # |
|---|
| 15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of # |
|---|
| 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # |
|---|
| 17 | # GNU General Public License for more details. # |
|---|
| 18 | # # |
|---|
| 19 | # You should have received a copy of the GNU Lesser General Public # |
|---|
| 20 | # License along with AVANGO. If not, see <http://www.gnu.org/licenses/>. # |
|---|
| 21 | # # |
|---|
| 22 | ########################################################################## |
|---|
| 23 | |
|---|
| 24 | import avango.build |
|---|
| 25 | import avango.build.oshelper |
|---|
| 26 | |
|---|
| 27 | avango.build.Environment.prepend_include_path(Dir('include').abspath) |
|---|
| 28 | avango.build.Environment.prepend_python_path(Dir('src/test_package').abspath) |
|---|
| 29 | avango.build.Environment.prepend_library_path(Dir('.').abspath) |
|---|
| 30 | avango.build.Environment.prepend_library_path(Dir('src/avango').abspath) |
|---|
| 31 | avango.build.Environment.prepend_library_path(Dir('src/avango/script').abspath) |
|---|
| 32 | avango_env = avango.build.PythonEnvironment() |
|---|
| 33 | avango_env.Append(LIBS=["avangoScript"]) |
|---|
| 34 | avango.build.add_library(avango_env, 'boost_python') |
|---|
| 35 | avango.build.add_library(avango_env, 'avango-core') |
|---|
| 36 | |
|---|
| 37 | Alias('all', Alias('python')) |
|---|
| 38 | Alias('check', Alias('check-python')) |
|---|
| 39 | Alias('install', Alias('install-python')) |
|---|
| 40 | |
|---|
| 41 | avango_script_library_files = Split(""" |
|---|
| 42 | src/avango/script/Init.cpp |
|---|
| 43 | src/avango/script/Types.cpp |
|---|
| 44 | src/avango/script/Update.cpp |
|---|
| 45 | src/avango/script/Script.cpp |
|---|
| 46 | """) |
|---|
| 47 | avango_lib_env = avango.build.Environment() |
|---|
| 48 | avango_lib_env.Append(CPPDEFINES='AV_PYTHON_LIBRARY') |
|---|
| 49 | avango.build.add_library(avango_lib_env, 'boost_python') |
|---|
| 50 | avango.build.add_library(avango_lib_env, 'avango-core') |
|---|
| 51 | avango_script_library = avango_lib_env.SharedLibrary("avangoScript", avango_script_library_files) |
|---|
| 52 | Alias('install-python', Install(avango.build.get_library_path(), avango_script_library)) |
|---|
| 53 | |
|---|
| 54 | avango_files = Split(""" |
|---|
| 55 | src/avango/_avango.cpp |
|---|
| 56 | src/avango/FieldContainer.cpp |
|---|
| 57 | src/avango/Field.cpp |
|---|
| 58 | src/avango/exceptions.cpp |
|---|
| 59 | src/avango/InputStream.cpp |
|---|
| 60 | src/avango/OutputStream.cpp |
|---|
| 61 | """) |
|---|
| 62 | |
|---|
| 63 | avango_python_files = Split(""" |
|---|
| 64 | src/avango/__init__.py |
|---|
| 65 | src/avango/_fieldcontainer.py |
|---|
| 66 | src/avango/_utility.py |
|---|
| 67 | src/avango/nodefactory.py |
|---|
| 68 | """) |
|---|
| 69 | |
|---|
| 70 | avango_module = avango_env.SharedLibrary("src/avango/_avango", avango_files) |
|---|
| 71 | Depends(avango_module, avango_python_files) |
|---|
| 72 | install_python_files = Install(avango.build.get_python_path('avango'), avango_python_files) |
|---|
| 73 | install_python_module = Install(avango.build.get_python_path('avango'), avango_module) |
|---|
| 74 | Alias('python', avango_module) |
|---|
| 75 | Alias('install-python', [install_python_files, install_python_module]) |
|---|
| 76 | |
|---|
| 77 | av_script_files = Split(""" |
|---|
| 78 | src/avango/script/_script.cpp |
|---|
| 79 | """) |
|---|
| 80 | av_script_python_files = Split(""" |
|---|
| 81 | src/avango/script/__init__.py |
|---|
| 82 | src/avango/script/_meta_script.py |
|---|
| 83 | src/avango/script/_container.py |
|---|
| 84 | """) |
|---|
| 85 | avango_script_env = avango_env.Clone() |
|---|
| 86 | av_script = avango_script_env.SharedLibrary("src/avango/script/_script", av_script_files) |
|---|
| 87 | Depends(av_script, avango_script_library) |
|---|
| 88 | Depends(av_script, av_script_python_files) |
|---|
| 89 | Install(avango.build.get_python_path('avango/script'), av_script_python_files) |
|---|
| 90 | Install(avango.build.get_python_path('avango/script'), av_script) |
|---|
| 91 | Alias('install-python', avango.build.get_python_path('avango/script')) |
|---|
| 92 | Alias('python', av_script) |
|---|
| 93 | |
|---|
| 94 | |
|---|
| 95 | # Build tests |
|---|
| 96 | local_env = avango.build.Environment() |
|---|
| 97 | avango.build.add_library(local_env, 'avango-core') |
|---|
| 98 | local_env.Append(CPPDEFINES=['AV_MOCKUP_LIBRARY']) |
|---|
| 99 | mockfieldcontainer = local_env.SharedLibrary("src/tests/MockFieldContainer.cpp") |
|---|
| 100 | |
|---|
| 101 | local_mock_env = avango_env.Clone() |
|---|
| 102 | local_mock_env.Prepend(LIBPATH=[Dir('src/tests').abspath]) |
|---|
| 103 | local_mock_env.Append(LIBS=['MockFieldContainer']) |
|---|
| 104 | mockfieldcontainer_python = local_mock_env.SharedLibrary("src/tests/_mockfieldcontainer.cpp") |
|---|
| 105 | Depends(mockfieldcontainer_python, mockfieldcontainer) |
|---|
| 106 | |
|---|
| 107 | test_package_dir = 'src/test_package/' |
|---|
| 108 | Install(test_package_dir+'avango/', avango_module) |
|---|
| 109 | Install(test_package_dir+'avango/script', av_script) |
|---|
| 110 | Install(test_package_dir+'tests/', mockfieldcontainer) |
|---|
| 111 | Install(test_package_dir+'tests/', mockfieldcontainer_python) |
|---|
| 112 | avango.build.install_python(test_package_dir+'avango/', avango_python_files) |
|---|
| 113 | avango.build.install_python(test_package_dir+'avango/script', av_script_python_files) |
|---|
| 114 | avango_python_test_files = Split(""" |
|---|
| 115 | src/tests/mock.py |
|---|
| 116 | src/tests/TestFieldContainer.py |
|---|
| 117 | src/tests/TestField.py |
|---|
| 118 | src/tests/TestUpdate.py |
|---|
| 119 | src/tests/TestScript.py |
|---|
| 120 | src/tests/TestNodefactory.py |
|---|
| 121 | src/tests/TestContainer.py |
|---|
| 122 | src/tests/TestUtility.py |
|---|
| 123 | src/tests/runtests.py |
|---|
| 124 | """) |
|---|
| 125 | avango_python_test_pkg_files = Split(""" |
|---|
| 126 | src/tests/apackage/__init__.py |
|---|
| 127 | src/tests/apackage/empty.py |
|---|
| 128 | """) |
|---|
| 129 | avango.build.install_python(test_package_dir+'tests/', avango_python_test_files) |
|---|
| 130 | avango.build.install_python(test_package_dir+'tests/apackage', avango_python_test_pkg_files) |
|---|
| 131 | |
|---|
| 132 | local_test_env = avango.build.TestEnvironment() |
|---|
| 133 | local_test_env.PrependENVPath(avango.build.get_library_search_path_env(), Dir('src/tests').abspath) |
|---|
| 134 | check = local_test_env.Alias('test-python', 'src/test_package/tests/runtests.pyc', 'python $SOURCE') |
|---|
| 135 | AlwaysBuild(check) |
|---|
| 136 | Alias('check-python', check) |
|---|
| 137 | local_test_env.Depends(check, test_package_dir) |
|---|
| 138 | |
|---|
| 139 | |
|---|
| 140 | SConscript('include/avango/python/SConscript') |
|---|
| 141 | SConscript('include/avango/python/script/SConscript') |
|---|
| 142 | |
|---|
| 143 | avango.build.make_vcproject(local_env, 'avango-python', 'python') |
|---|