merge buildsystem improvements

This commit is contained in:
Fischlurch 2008-01-27 03:58:24 +01:00
parent 398bed8d72
commit c3b1048fc4
20 changed files with 118 additions and 89 deletions

1
.gitignore vendored
View file

@ -3,6 +3,7 @@
*.tar.*
.[^.]*
*.os
*.gch
Buildhelper.pyc
optcache
Makefile.in

View file

@ -65,13 +65,14 @@ def setupBasicEnvironment():
, CCFLAGS='-Wall ' # -fdiagnostics-show-option
)
RegisterPrecompiledHeader_Builder(env)
handleNoBugSwitches(env)
appendCppDefine(env,'DEBUG','DEBUG', 'NDEBUG')
appendCppDefine(env,'OPENGL','USE_OPENGL')
appendVal(env,'ARCHFLAGS', 'CCFLAGS') # for both C and C++
appendVal(env,'OPTIMIZE', 'CCFLAGS', val=' -O3')
appendVal(env,'DEBUG', 'CCFLAGS', val=' -g')
appendVal(env,'DEBUG', 'CCFLAGS', val=' -ggdb')
prepareOptionsHelp(opts,env)
opts.Save(OPTIONSCACHEFILE, env)
@ -91,9 +92,13 @@ def appendVal(env,var,targetVar,val=None):
def handleNoBugSwitches(env):
""" set the build level for NoBug.
Release builds imply no DEBUG
wheras ALPHA and BETA require DEBUG
"""
level = env['BUILDLEVEL']
if level in ['ALPHA', 'BETA']:
if not env['DEBUG']:
print 'NoBug: ALPHA or BETA builds without DEBUG not possible, exiting.'
Exit(1)
env.Replace( DEBUG = 1 )
env.Append(CPPDEFINES = 'EBUG_'+level)
elif level == 'RELEASE':
@ -128,7 +133,7 @@ def defineCmdlineOptions():
def prepareOptionsHelp(opts,env):
prelude = """
USAGE: scons [-c] [OPTS] [key=val,...] [TARGETS]
USAGE: scons [-c] [OPTS] [key=val [key=val...]] [TARGETS]
Build and optionally install Cinelerra.
Without specifying any target, just the (re)build target will run.
Add -c to the commandline to clean up anything a given target would produce
@ -228,20 +233,26 @@ def defineBuildTargets(env, artifacts):
setup sub-environments with special build options if necessary.
We use a custom function to declare a whole tree of srcfiles.
"""
cinobj = ( srcSubtree(env,'$SRCDIR/backend')
+ srcSubtree(env,'$SRCDIR/proc')
+ srcSubtree(env,'$SRCDIR/common')
+ srcSubtree(env,'$SRCDIR/lib')
)
plugobj = srcSubtree(env,'$SRCDIR/plugin', isShared=True)
corelib = env.StaticLibrary('$BINDIR/core.la', cinobj)
core = env.StaticLibrary('$BINDIR/core.la', cinobj)
#core = cinobj # use this for linking directly
artifacts['cinelerra'] = env.Program('$BINDIR/cinelerra', ['$SRCDIR/main.cpp']+ corelib )
# use PCH to speed up building
precomp = env.PrecompiledHeader('$SRCDIR/pre')
env.Depends(cinobj, precomp)
artifacts['cinelerra'] = env.Program('$BINDIR/cinelerra', ['$SRCDIR/main.cpp']+ core )
artifacts['plugins'] = env.SharedLibrary('$BINDIR/cinelerra-plugin', plugobj)
# call subdir SConscript(s) for independent components
SConscript(dirs=[SRCDIR+'/tool'], exports='env artifacts')
SConscript(dirs=[TESTDIR], exports='env artifacts corelib')
SConscript(dirs=[TESTDIR], exports='env artifacts core')
@ -257,7 +268,8 @@ def definePostBuildTargets(env, artifacts):
allbu = env.Alias('allbuild', build+artifacts['testsuite'])
env.Default('build')
# additional files to be cleaned when cleaning 'build'
env.Clean ('build', [ 'scache.conf', '.sconf_temp', '.sconsign.dblite', 'config.log'])
env.Clean ('build', [ 'scache.conf', '.sconf_temp', '.sconsign.dblite', 'config.log' ])
env.Clean ('build', [ '$SRCDIR/pre.gch' ])
# Doxygen documentation
# Note: at the moment we only depend on Doxyfile

View file

@ -90,6 +90,25 @@ def globRootdirs(roots):
def RegisterPrecompiledHeader_Builder(env):
""" Registeres an Custom Builder for generating a precompiled Header.
Note you should define a dependency to the PCH file
"""
def genCmdline(source, target, env, for_signature):
return '$CXXCOM -x c++-header %s' % source[0]
def fixSourceDependency(target, source, env):
print "precompiled header: %s --> %s" % (source[0],target[0])
return (target, source)
gchBuilder = env.Builder( generator = genCmdline
, emitter = fixSourceDependency
, suffix = '.gch'
, src_suffix = '.hpp'
)
env.Append(BUILDERS = {'PrecompiledHeader' : gchBuilder})
def Tarball(env,location,dirs,suffix=''):
""" Custom Command: create Tarball of some subdirs
location: where to create the tar (optionally incl. filename.tar.gz)

View file

@ -25,12 +25,17 @@
#ifndef TESTHELPER_RUN_H
#define TESTHELPER_RUN_H
#include <vector>
#include <string>
#include "pre.hpp"
#include "nobugcfg.h"
#include "common/test/suite.hpp"
#include "common/util.hpp"
#include <vector>
#include <string>
namespace test
{

View file

@ -29,7 +29,6 @@
#include <cstring>
#include <algorithm>
#include "nobugcfg.h" ///////////////////TODO: just temporarily!!!!
namespace util

51
src/pre.hpp Normal file
View file

@ -0,0 +1,51 @@
/*
PRE.hpp - precompiled header collection
Copyright (C) CinelerraCV
2007, Christian Thaeter <ct@pipapo.org>
Hermann Vosseler <Ichthyostega@web.de>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/** @file pre.hpp
** Precompiled Header Collection.
** Assortment of standard util, error handling and basic lib-boost components,
** frequently used in conjunction. Precompiling these can speedup building
** significantly. When used, this header should be included prior to any other
** headers (and it needs to be compiled by gcc into a "pre.gch" file prior to
** building the object files including this header).
**
** @see mobject.hpp usage example
*/
#ifndef CINELERRA_PRE_HPP
#define CINELERRA_PRE_HPP
#include <string>
#include <vector>
#include <map>
#include <tr1/memory>
#include <boost/function.hpp>
#include <boost/format.hpp>
#include <boost/bind.hpp>
#include "cinelerra.h"
#endif /*CINELERRA_PRE_HPP*/

View file

@ -55,6 +55,8 @@
#define PROC_INTERFACE_ASSET_H
#include "pre.hpp"
#include "proc/asset/category.hpp"
#include "common/error.hpp"

View file

@ -21,6 +21,7 @@
* *****************************************************/
#include "pre.hpp"
#include "proc/assetmanager.hpp"
#include "proc/asset/media.hpp"
#include "proc/asset/clip.hpp"

View file

@ -24,6 +24,8 @@
#ifndef MOBJECT_MOBJECT_H
#define MOBJECT_MOBJECT_H
#include "pre.hpp"
#include <list>
#include <tr1/memory>

View file

@ -57,7 +57,7 @@
#ifndef MOBJECT_PLACEMENT_H
#define MOBJECT_PLACEMENT_H
#include "cinelerra.h"
#include "pre.hpp"
#include "proc/mobject/mobject.hpp"
#include "proc/mobject/session/locatingpin.hpp"
#include "proc/asset/port.hpp"

View file

@ -6,87 +6,32 @@
// 8/07 - how to control NOBUG??
// execute with NOBUG_LOG='ttt:TRACE' bin/try
// 1/08 - working out a static initialisation problem for Visitor (Tag creation)
// 1/08 - check 64bit longs
#include <nobug.h>
#include <iostream>
#include <limits>
using std::string;
using std::cout;
NOBUG_CPP_DEFINE_FLAG(test);
template<class TOOL> class Tag;
template<class TOOL, class TOOLImpl>
class TagTypeRef
{
public:
static Tag<TOOL> tag;
};
template<class TOOL>
class Tag
{
size_t tagID;
static size_t lastRegisteredID;
public:
Tag(size_t tt=0) : tagID(tt) {}
operator size_t() const { return tagID; }
template<class TOOLImpl>
static Tag<TOOL>&
get (TOOLImpl* const concreteTool=0)
{
INFO (test,"getTag");
Tag<TOOL>& t = TagTypeRef<TOOL,TOOLImpl>::tag;
if (!t)
t.tagID = ++Tag<TOOL>::lastRegisteredID;
return t;
}
};
/** storage for the Tag registry for each concrete tool */
template<class TOOL, class TOOLImpl>
Tag<TOOL> TagTypeRef<TOOL,TOOLImpl> ::tag (0);
template<class TOOL>
size_t Tag<TOOL>::lastRegisteredID (0);
class TT
{
};
class TI : public TT
{
};
class TII : public TT
{
};
int main (int argc, char* argv[])
{
NOBUG_INIT;
size_t xxx = Tag<TT>::get<TII>();
cout << "created Tag=" << xxx <<"\n";
cout << "created Tag=" << Tag<TT>::get<TI> () <<"\n";
int64_t lol (1);
cout << sizeof(lol)<< "\n";
cout << "long: "<< std::numeric_limits<long>::max()
<<" 64: " << std::numeric_limits<int64_t>::max()
<<"\n";
return 0;
}

View file

@ -7,7 +7,7 @@ from os import path
from Buildhelper import srcSubtree
from Buildhelper import globRootdirs
Import('env','artifacts','corelib')
Import('env','artifacts','core')
def testExecutable(env,tree, exeName=None, obj=None):
@ -24,7 +24,7 @@ def testExecutable(env,tree, exeName=None, obj=None):
obj = srcSubtree(env,tree) # use all sourcefiles found in subtree
if not exeName:
exeName = 'test-%s' % tree
return env.Program('#$BINDIR/'+exeName, obj + corelib)
return env.Program('#$BINDIR/'+exeName, obj + core)
def treatPluginTestcase(env):
@ -38,7 +38,7 @@ def treatPluginTestcase(env):
testplugin = ( env.SharedLibrary('#$BINDIR/.libs/example_plugin', oC, SHLIBPREFIX='')
+ env.SharedLibrary('#$BINDIR/.libs/example_plugin_cpp', oCPP, SHLIBPREFIX='')
)
testExe = env.Program('#$BINDIR/test-plugin', ['plugin/plugin_main.c'] + corelib)
testExe = env.Program('#$BINDIR/test-plugin', ['plugin/plugin_main.c'] + core)
env.Depends(testExe, testplugin)
return testExe
#-- it depentds (at the moment) on a specific isolated test-plugin,

View file

@ -36,7 +36,6 @@
#include "backend/mediaaccessmock.hpp"
#include "common/util.hpp"
#include "nobugcfg.h"
#include <iostream>
#include <vector>

View file

@ -26,7 +26,6 @@
#include "common/test/run.hpp"
//#include "common/util.hpp"
#include "nobugcfg.h"
//#include <boost/format.hpp>
#include <iostream>

View file

@ -21,7 +21,6 @@
* *****************************************************/
#include "nobugcfg.h"
#include "common/appconfig.hpp"

View file

@ -26,7 +26,6 @@
#include "common/test/run.hpp"
#include "common/util.hpp"
#include "nobugcfg.h"
#include <boost/lexical_cast.hpp>
#include <boost/format.hpp>

View file

@ -21,8 +21,6 @@
* *****************************************************/
#include "nobugcfg.h"
#include "common/test/run.hpp"
#include "common/util.hpp"

View file

@ -26,7 +26,6 @@
#include "common/test/run.hpp"
#include "common/singleton.hpp"
#include "common/util.hpp"
#include "nobugcfg.h"
#include <boost/lexical_cast.hpp>
#include <boost/format.hpp>

View file

@ -25,7 +25,6 @@
#include "common/test/run.hpp"
#include "common/singleton.hpp"
#include "common/util.hpp"
#include "nobugcfg.h"
#include <boost/lexical_cast.hpp>
#include <boost/format.hpp>

View file

@ -21,8 +21,6 @@
* *****************************************************/
#include "nobugcfg.h"
#include "common/test/run.hpp"
#include "common/cmdline.hpp"
#include "common/util.hpp"
@ -32,7 +30,6 @@
#include <boost/lambda/lambda.hpp>
using namespace boost::lambda;
using std::cout;
@ -41,6 +38,9 @@ namespace util
{
namespace test
{
using boost::lambda::_1;
using boost::lambda::var;
/** @test for util::Cmdline, wrapping various example cmdlines */