[cig-commits] commit: Adding the necessary changes to the build system to

Mercurial hg at geodynamics.org
Mon Nov 24 11:31:02 PST 2008


changeset:   100:cbf5fccf86e3
user:        LukeHodkinson
date:        Tue Jul 15 01:15:34 2008 +0000
files:       SConscript
description:
Adding the necessary changes to the build system to
permit static libraries and binaries to be built.
Still need to modify the plugin/module code to
stop it trying to load shared libraries during
construction.


diff -r fa9f2113abd6 -r cbf5fccf86e3 SConscript
--- a/SConscript	Thu Jun 12 00:40:37 2008 +0000
+++ b/SConscript	Tue Jul 15 01:15:34 2008 +0000
@@ -1,54 +1,57 @@ import os
 import os
 Import('env')
 
+#
+# Prepare the construction environment by copying the one we
+# were given.
 env = env.Copy()
-env.AppendUnique(CPPPATH=[env.get_build_path('include/PICellerator')])
+env.project_name = 'PICellerator'
+env.AppendUnique(CPPPATH=[env.get_build_path('include/' + env.project_name)])
+env.src_objs = []
+env.suite_hdrs = []
+env.suite_objs = []
 
-# Collect our inputs from the directory structure.
-bases = ['Voronoi', 'PopulationControl', 'Weights', 'MaterialPoints', 'Utils']
-src_objs = []
-suite_hdrs = []
-suite_objs = []
-for base in bases:
-    env.build_files(env.glob(base + '/src/*.def'), 'include/PICellerator/' + base)
-    env.build_headers(env.glob(base + '/src/*.h'), 'include/PICellerator/' + base)
-    src_objs += env.build_sources(env.glob(base + '/src/*.c'), 'PICellerator/' + base)
-    src_objs += env.build_metas(env.glob(base + '/src/*.meta'), 'PICellerator/' + base)
-    suite_hdrs += env.glob(base + '/tests/*Suite.h')
-    suite_objs += env.build_sources(env.glob(base + '/tests/*Suite.c'), 'PICellerator/' + base)
+#
+# Build standard stg directories.
+env.build_directory('Voronoi')
+env.build_directory('PopulationControl')
+env.build_directory('Weights')
+env.build_directory('MaterialPoints')
+env.build_directory('Utils')
 
+#
+# Need to handle libPICellerator differently.
 env.build_headers(env.glob('libPICellerator/src/*.h'), 'include/PICellerator')
-src_objs += env.build_sources(env.glob('libPICellerator/src/*.c'), 'PICellerator/libPICellerator')
-src_objs += env.build_sources(env.glob('libPICellerator/src/*.meta'), 'PICellerator/libPICellerator')
+env.src_objs += env.build_sources(env.glob('libPICellerator/src/*.c'), 'PICellerator/libPICellerator')
+env.src_objs += env.build_metas(env.glob('libPICellerator/src/*.meta'), 'PICellerator/libPICellerator')
 
-# Build library.
-if env['static_libraries']:
-    env.Library(env.get_build_path('lib/PICellerator'), src_objs)
+#
+# Build shared library.
 if env['shared_libraries']:
-    env.SharedLibrary(env.get_build_path('lib/PICellerator'), src_objs)
+    env.SharedLibrary(env.get_build_path('lib/PICellerator'), env.src_objs)
 
+#
 # Build toolbox.
+objs = env.build_sources(env.glob('libPICellerator/Toolbox/*.c'), 'PICellerator/libPICellerator/Toolbox')
+objs += env.build_metas(env.glob('libPICellerator/Toolbox/*.meta'), 'PICellerator/libPICellerator/Toolbox')
 if env['shared_libraries']:
-    objs = env.build_sources(env.glob('libPICellerator/Toolbox/*.c'),
-                             'PICellerator/libPICellerator/Toolbox')
-    objs += env.build_metas(env.glob('libPICellerator/Toolbox/*.meta'),
-                            'PICellerator/libPICellerator/Toolbox')
     env.SharedLibrary(env.get_target_name('lib/PICellerator_Toolboxmodule'), objs,
                       SHLIBPREFIX='',
                       LIBPREFIXES=env.make_list(env['LIBPREFIXES']) + [''],
                       LIBS=['PICellerator'] + env.get('LIBS', []))
+if env['static_libraries']:
+    env.src_objs += objs
 
-# Build plugins.
-if env['shared_libraries']:
-    plgn_bases = ['CalculateParticleDisplacement', 'MaterialCentroid']
-    for base in plgn_bases:
-        env.build_headers(env.glob('plugins/' + base + '/*.h'), 'include/PICellerator/' + base.split('/')[-1])
-        objs = env.build_sources(env.glob('plugins/' + base + '/*.c'), 'PICellerator/' + base)
-        name = 'PICellerator_' + base.split('/')[-1] + 'module'
-        env.SharedLibrary(env.get_build_path('lib/' + name), objs,
-                          SHLIBPREFIX='',
-                          LIBPREFIXES=env.make_list(env['LIBPREFIXES']) + [''],
-                          LIBS=['PICellerator'] + env.get('LIBS', []))
+#
+# Build plugins. Note that this must happen after the shared library
+# has been built.
+env.build_plugin('plugins/CalculateParticleDisplacement')
+env.build_plugin('plugins/MaterialCentroid')
+
+#
+# Build static library.
+if env['static_libraries']:
+    env.Library(env.get_build_path('lib/PICellerator'), env.src_objs)
 
 # Build unit test runner.
 env['PCURUNNERINIT'] = ''
@@ -60,10 +63,10 @@ env['PCURUNNERTEARDOWN'] = """PICellerat
    StgFEM_Finalise();
    StgDomain_Finalise();
    StGermain_Finalise();"""
-runner_src = env.PCUSuiteRunner(env.get_build_path('PICellerator/testPICellerator.c'), suite_hdrs)
+runner_src = env.PCUSuiteRunner(env.get_build_path('PICellerator/testPICellerator.c'), env.suite_hdrs)
 runner_obj = env.SharedObject(runner_src)
 env.Program(env.get_build_path('bin/testPICellerator'),
-            runner_obj + suite_objs,
+            runner_obj + env.suite_objs,
             LIBS=['PICellerator', 'pcu'] + env.get('LIBS', []))
 
 # Copy over XML files.



More information about the CIG-COMMITS mailing list