From e0df15525dacdcb4954f15e0d646205d6d7abc9f Mon Sep 17 00:00:00 2001 From: opencollada-sebastian Date: Fri, 16 Oct 2009 08:18:02 +0000 Subject: [PATCH] scons buils scripts for linux port to gcc 4.3 --- COLLADABaseUtils/SConscript | 28 ++ .../include/Math/COLLADABUMathVector3.h | 2 +- COLLADAFramework/SConscript | 26 ++ .../include/COLLADAFWArrayPrimitiveType.h | 1 + COLLADASaxFrameworkLoader/SConscript | 46 +++ COLLADAStreamWriter/SConscript | 24 ++ COLLADAStreamWriter/include/COLLADASWBuffer.h | 1 + .../include/COLLADASWStreamWriter.h | 1 + COLLADAValidator/SConscript | 59 ++++ COLLADAValidator/include/Writer.h | 298 +++++++++--------- .../src/ValidationErrorHandler.cpp | 2 + COLLADAValidator/src/main.cpp | 15 +- Externals/LibXML/SConscript | 21 ++ Externals/MathMLSolver/SConscript | 27 ++ .../MathMLSolver/src/MathMLSymbolTable.cpp | 2 + Externals/UTF/SConscript | 24 ++ Externals/expat/SConscript | 23 ++ Externals/pcre/SConscript | 22 ++ Externals/pcre/include/config_linux.h | 40 +++ Externals/pcre/src/pcre_chartables.c | 8 +- Externals/pcre/src/pcre_compile.c | 8 +- Externals/pcre/src/pcre_exec.c | 8 +- Externals/pcre/src/pcre_globals.c | 8 +- Externals/pcre/src/pcre_newline.c | 8 +- Externals/pcre/src/pcre_tables.c | 8 +- Externals/pcre/src/pcre_try_flipped.c | 6 +- GeneratedSaxParser/SConscript | 42 +++ SConstruct | 125 +++++--- 28 files changed, 663 insertions(+), 220 deletions(-) create mode 100644 COLLADABaseUtils/SConscript create mode 100644 COLLADAFramework/SConscript create mode 100644 COLLADASaxFrameworkLoader/SConscript create mode 100644 COLLADAStreamWriter/SConscript create mode 100644 COLLADAValidator/SConscript create mode 100644 Externals/LibXML/SConscript create mode 100644 Externals/MathMLSolver/SConscript create mode 100644 Externals/UTF/SConscript create mode 100644 Externals/expat/SConscript create mode 100644 Externals/pcre/SConscript create mode 100644 Externals/pcre/include/config_linux.h create mode 100644 GeneratedSaxParser/SConscript diff --git a/COLLADABaseUtils/SConscript b/COLLADABaseUtils/SConscript new file mode 100644 index 000000000..d9bb25dca --- /dev/null +++ b/COLLADABaseUtils/SConscript @@ -0,0 +1,28 @@ + +Import('env') + +libName = 'OpenCOLLADABaseUtils' + + +srcDirs = [ 'src/', 'src/Math/'] + +variantDir = env['objDir'] + env['configurationBaseName'] + '/' +outputDir = env['libDir'] + env['configurationBaseName'] + '/' +targetPath = outputDir + libName + + +incDirs = ['include/', 'include/Math/', '../Externals/UTF/include/'] + +if not env['PCRENATIVE']: + incDirs += ['../Externals/pcre/include'] + + +src = [] +for srcDir in srcDirs: + src += [ variantDir + str(p) for p in Glob(srcDir + '*.cpp')] + VariantDir(variant_dir=variantDir + srcDir, src_dir=srcDir, duplicate=False) + +if env['SHAREDLIB']: + SharedLibrary(target=targetPath, source=src, CPPPATH=incDirs, CCFLAGS=env['CPPFLAGS']) +else: + StaticLibrary(target=targetPath, source=src, CPPPATH=incDirs, CCFLAGS=env['CPPFLAGS']) diff --git a/COLLADABaseUtils/include/Math/COLLADABUMathVector3.h b/COLLADABaseUtils/include/Math/COLLADABUMathVector3.h index d65d5e67e..93162fdbf 100644 --- a/COLLADABaseUtils/include/Math/COLLADABUMathVector3.h +++ b/COLLADABaseUtils/include/Math/COLLADABUMathVector3.h @@ -516,7 +516,7 @@ namespace COLLADABU Real dot = dotProduct( rhs ); Real angle_radian = acos( dot ); - return abs( angle_radian ) <= tolerance_radian; + return fabs( angle_radian ) <= tolerance_radian; } diff --git a/COLLADAFramework/SConscript b/COLLADAFramework/SConscript new file mode 100644 index 000000000..d279ad3a8 --- /dev/null +++ b/COLLADAFramework/SConscript @@ -0,0 +1,26 @@ + +Import('env') + +libName = 'OpenCOLLADAFramework' + + +srcDir = 'src/' + +variantDir = env['objDir'] + env['configurationBaseName'] + '/' +outputDir = env['libDir'] + env['configurationBaseName'] + '/' +targetPath = outputDir + libName + + +incDirs = ['include/', + '../COLLADABaseUtils/include/', + '../Externals/MathMLSolver/include/', + '../Externals/MathMLSolver/include/AST'] + +src = [ variantDir + str(p) for p in Glob(srcDir + '*.cpp')] +VariantDir(variant_dir=variantDir + srcDir, src_dir=srcDir, duplicate=False) + +if env['SHAREDLIB']: + SharedLibrary(target=targetPath, source=src, CPPPATH=incDirs, CCFLAGS=env['CPPFLAGS']) +else: + StaticLibrary(target=targetPath, source=src, CPPPATH=incDirs, CCFLAGS=env['CPPFLAGS']) + diff --git a/COLLADAFramework/include/COLLADAFWArrayPrimitiveType.h b/COLLADAFramework/include/COLLADAFWArrayPrimitiveType.h index 9a8cf29ac..2a53f48d6 100644 --- a/COLLADAFramework/include/COLLADAFWArrayPrimitiveType.h +++ b/COLLADAFramework/include/COLLADAFWArrayPrimitiveType.h @@ -15,6 +15,7 @@ for details please see LICENSE file or the website #include "COLLADAFWArray.h" #include #include +#include namespace COLLADAFW diff --git a/COLLADASaxFrameworkLoader/SConscript b/COLLADASaxFrameworkLoader/SConscript new file mode 100644 index 000000000..ab45e93b9 --- /dev/null +++ b/COLLADASaxFrameworkLoader/SConscript @@ -0,0 +1,46 @@ + +Import('env') + +libName = 'OpenCOLLADASaxFrameworkLoader' + + +srcDirs = [ 'src/', + 'src/generated14/', + 'src/generated15/'] + +variantDir = env['objDir'] + env['configurationBaseName'] + env['xmlParserConfName'] + env['validationConfName'] + '/' +outputDir = env['libDir'] + env['configurationBaseName'] + env['xmlParserConfName'] + env['validationConfName'] + '/' +targetPath = outputDir + libName + + +incDirs = [ 'include', + 'include/generated14', + 'include/generated15', + '../COLLADABaseUtils/include', + '../GeneratedSaxParser/include', + '../COLLADAFramework/include', + '../Externals/LibXML/include', + '../Externals/MathMLSolver/include', + '../Externals/MathMLSolver/include/AST'] + +if not env['PCRENATIVE']: + incDirs += ['../Externals/pcre/include'] + +src = [] +for srcDir in srcDirs: + src += [ variantDir + str(p) for p in Glob(srcDir + '*.cpp')] + VariantDir(variant_dir=variantDir + srcDir, src_dir=srcDir, duplicate=False) + +if (env['XMLPARSER'] == 'expat') or (env['XMLPARSER'] == 'expatnative'): + env['CPPFLAGS'] += ' -DGENERATEDSAXPARSER_XMLPARSER_EXPAT' +else: + env['CPPFLAGS'] += ' -DGENERATEDSAXPARSER_XMLPARSER_LIBXML' + +if not env['NOVALIDATION']: + env['CPPFLAGS'] += ' -DGENERATEDSAXPARSER_VALIDATION' + + +if env['SHAREDLIB']: + SharedLibrary(target=targetPath, source=src, CPPPATH=incDirs, CCFLAGS=env['CPPFLAGS']) +else: + StaticLibrary(target=targetPath, source=src, CPPPATH=incDirs, CCFLAGS=env['CPPFLAGS']) diff --git a/COLLADAStreamWriter/SConscript b/COLLADAStreamWriter/SConscript new file mode 100644 index 000000000..c7f9450e4 --- /dev/null +++ b/COLLADAStreamWriter/SConscript @@ -0,0 +1,24 @@ + +Import('env') + +libName = 'OpenCOLLADAStreamWriter' + + +srcDir = 'src/' + +variantDir = env['objDir'] + env['configurationBaseName'] + '/' +outputDir = env['libDir'] + env['configurationBaseName'] + '/' +targetPath = outputDir + libName + + +incDirs = ['include/', + '../COLLADABaseUtils/include/'] + +src = [ variantDir + str(p) for p in Glob(srcDir + '*.cpp')] +VariantDir(variant_dir=variantDir + srcDir, src_dir=srcDir, duplicate=False) + +if env['SHAREDLIB']: + SharedLibrary(target=targetPath, source=src, CPPPATH=incDirs, CCFLAGS=env['CPPFLAGS']) +else: + StaticLibrary(target=targetPath, source=src, CPPPATH=incDirs, CCFLAGS=env['CPPFLAGS']) + diff --git a/COLLADAStreamWriter/include/COLLADASWBuffer.h b/COLLADAStreamWriter/include/COLLADASWBuffer.h index 2ecc9ec9e..7ac142f49 100644 --- a/COLLADAStreamWriter/include/COLLADASWBuffer.h +++ b/COLLADAStreamWriter/include/COLLADASWBuffer.h @@ -15,6 +15,7 @@ #include "COLLADASWIBufferFlusher.h" +#include namespace COLLADASW { diff --git a/COLLADAStreamWriter/include/COLLADASWStreamWriter.h b/COLLADAStreamWriter/include/COLLADASWStreamWriter.h index 7dbea617a..896d18413 100644 --- a/COLLADAStreamWriter/include/COLLADASWStreamWriter.h +++ b/COLLADAStreamWriter/include/COLLADASWStreamWriter.h @@ -25,6 +25,7 @@ #include #include #include +#include #define WHITESPACESTRINGLENGTH 1000 diff --git a/COLLADAValidator/SConscript b/COLLADAValidator/SConscript new file mode 100644 index 000000000..7cfeba6f2 --- /dev/null +++ b/COLLADAValidator/SConscript @@ -0,0 +1,59 @@ + +Import('env') + +progName = 'OpenCOLLADAValidator' + + +srcDir = 'src/' + +variantDir = env['objDir'] + env['configurationBaseName'] + env['xmlParserConfName'] + env['validationConfName'] + '/' +outputDir = env['binDir'] + env['configurationBaseName'] + env['xmlParserConfName'] + env['validationConfName'] + '/' +targetPath = outputDir + progName + +incDirs = [ 'include', + '../COLLADABaseUtils/include', + '../COLLADAFramework/include', + '../COLLADASaxFrameworkLoader/include', + '../GeneratedSaxParser/include'] + +src = [ variantDir + str(p) for p in Glob(srcDir + '*.cpp')] +VariantDir(variant_dir=variantDir + srcDir, src_dir=srcDir, duplicate=False) + +libs = [ 'OpenCOLLADASaxFrameworkLoader', + 'MathMLSolver', + 'OpenCOLLADAFramework', + 'OpenCOLLADABaseUtils', + 'GeneratedSaxParser', + 'pcre', + 'UTF' ] + +libPath = [ '../COLLADABaseUtils/' + env['libDir'] + env['configurationBaseName'], + '../COLLADAFramework/' + env['libDir'] + env['configurationBaseName'], + '../Externals/MathMLSolver/' + env['libDir'] + env['configurationBaseName'], + '../Externals/UTF/' + env['libDir'] + env['configurationBaseName'], + '../COLLADASaxFrameworkLoader/' + env['libDir'] + env['configurationBaseName'] + env['xmlParserConfName'] + env['validationConfName'], + '../GeneratedSaxParser/' + env['libDir'] + env['configurationBaseName'] + env['xmlParserConfName'] ] + +if not env['PCRENATIVE']: + libPath += '../Externals/pcre/' + env['libDir'] + env['configurationBaseName'], + +if (env['XMLPARSER'] == 'expat') or (env['XMLPARSER'] == 'expatnative'): + env['CPPFLAGS'] += ' -DXMLPARSER_EXPAT' + libs += ['expat'] + if env['XMLPARSER'] == 'expat': + libPath += ['../Externals/expat/' + env['libDir'] + env['configurationBaseName']] +else: + env['CPPFLAGS'] += ' -DXMLPARSER_LIBXML' + if env['XMLPARSER'] == 'libxml': + libPath += ['../Externals/libxml/' + env['libDir'] + env['configurationBaseName']] + libs += ['xml'] + else: + libs += ['xml2'] + +if env['PG']: + linkFlags = ['-pg'] +else: + linkFlags = [] + +Program(target=targetPath, source=src, CPPPATH=incDirs, CCFLAGS=env['CPPFLAGS'], LIBS=libs, LIBPATH=libPath, LINKFLAGS=linkFlags) + diff --git a/COLLADAValidator/include/Writer.h b/COLLADAValidator/include/Writer.h index 6e5743ec3..fe4837665 100644 --- a/COLLADAValidator/include/Writer.h +++ b/COLLADAValidator/include/Writer.h @@ -10,155 +10,155 @@ namespace COLLADAFW class Formula; } - class Writer : public COLLADAFW::IWriter +class Writer : public COLLADAFW::IWriter +{ + // member declarations +private: + + // public function declarations +public: + Writer() : IWriter() {} + virtual ~Writer(){} + + /** This method will be called if an error in the loading process occurred and the loader cannot + continue to to load. The writer should undo all operations that have been performed. + @param errorMessage A message containing informations about the error that occurred. + */ + virtual void cancel(const COLLADAFW::String& errorMessage){} + + /** This is the method called. The writer hast to prepare to receive data.*/ + virtual void start(){} + + /** This method is called after the last write* method. No other methods will be called after this.*/ + virtual void finish(){} + + /** When this method is called, the writer must write the global document asset. + @return The writer should return true, if writing succeeded, false otherwise.*/ + virtual bool writeGlobalAsset ( const COLLADAFW::FileInfo* asset ) + { + return true; + } + + /** When this method is called, the writer must write the entire visual scene. + @return The writer should return true, if writing succeeded, false otherwise.*/ + virtual bool writeScene ( const COLLADAFW::Scene* scene ) + { + return true; + } + + /** When this method is called, the writer must write the entire visual scene. + @return The writer should return true, if writing succeeded, false otherwise.*/ + virtual bool writeVisualScene ( const COLLADAFW::VisualScene* visualScene ) + { + return true; + } + + /** When this method is called, the writer must handle all nodes contained in the + library nodes. + @return The writer should return true, if writing succeeded, false otherwise.*/ + virtual bool writeLibraryNodes ( const COLLADAFW::LibraryNodes* libraryNodes ) + { + return true; + } + + /** When this method is called, the writer must write the geometry. + @return The writer should return true, if writing succeeded, false otherwise.*/ + virtual bool writeGeometry ( const COLLADAFW::Geometry* geometry ) + { + return true; + } + + /** When this method is called, the writer must write the material. + @return The writer should return true, if writing succeeded, false otherwise.*/ + virtual bool writeMaterial( const COLLADAFW::Material* material ) + { + return true; + } + + /** When this method is called, the writer must write the effect. + @return The writer should return true, if writing succeeded, false otherwise.*/ + virtual bool writeEffect( const COLLADAFW::Effect* effect ) + { + return true; + } + + /** When this method is called, the writer must write the camera. + @return The writer should return true, if writing succeeded, false otherwise.*/ + virtual bool writeCamera( const COLLADAFW::Camera* camera ) + { + return true; + } + + /** When this method is called, the writer must write the image. + @return The writer should return true, if writing succeeded, false otherwise.*/ + virtual bool writeImage( const COLLADAFW::Image* image ) + { + return true; + } + + /** When this method is called, the writer must write the light. + @return The writer should return true, if writing succeeded, false otherwise.*/ + virtual bool writeLight( const COLLADAFW::Light* light ) { - // member declarations - private: - - // public function declarations - public: - Writer() : IWriter() {} - virtual ~Writer(){} - - /** This method will be called if an error in the loading process occurred and the loader cannot - continue to to load. The writer should undo all operations that have been performed. - @param errorMessage A message containing informations about the error that occurred. - */ - virtual void cancel(const COLLADAFW::String& errorMessage){} - - /** This is the method called. The writer hast to prepare to receive data.*/ - virtual void start(){} - - /** This method is called after the last write* method. No other methods will be called after this.*/ - virtual void finish(){} - - /** When this method is called, the writer must write the global document asset. - @return The writer should return true, if writing succeeded, false otherwise.*/ - virtual bool writeGlobalAsset ( const COLLADAFW::FileInfo* asset ) - { - return true; - } - - /** When this method is called, the writer must write the entire visual scene. - @return The writer should return true, if writing succeeded, false otherwise.*/ - virtual bool writeScene ( const COLLADAFW::Scene* scene ) - { - return true; - } - - /** When this method is called, the writer must write the entire visual scene. - @return The writer should return true, if writing succeeded, false otherwise.*/ - virtual bool writeVisualScene ( const COLLADAFW::VisualScene* visualScene ) - { - return true; - } - - /** When this method is called, the writer must handle all nodes contained in the - library nodes. - @return The writer should return true, if writing succeeded, false otherwise.*/ - virtual bool writeLibraryNodes ( const COLLADAFW::LibraryNodes* libraryNodes ) - { - return true; - } - - /** When this method is called, the writer must write the geometry. - @return The writer should return true, if writing succeeded, false otherwise.*/ - virtual bool writeGeometry ( const COLLADAFW::Geometry* geometry ) - { - return true; - } - - /** When this method is called, the writer must write the material. - @return The writer should return true, if writing succeeded, false otherwise.*/ - virtual bool writeMaterial( const COLLADAFW::Material* material ) - { - return true; - } - - /** When this method is called, the writer must write the effect. - @return The writer should return true, if writing succeeded, false otherwise.*/ - virtual bool writeEffect( const COLLADAFW::Effect* effect ) - { - return true; - } - - /** When this method is called, the writer must write the camera. - @return The writer should return true, if writing succeeded, false otherwise.*/ - virtual bool writeCamera( const COLLADAFW::Camera* camera ) - { - return true; - } - - /** When this method is called, the writer must write the image. - @return The writer should return true, if writing succeeded, false otherwise.*/ - virtual bool writeImage( const COLLADAFW::Image* image ) - { - return true; - } - - /** When this method is called, the writer must write the light. - @return The writer should return true, if writing succeeded, false otherwise.*/ - virtual bool writeLight( const COLLADAFW::Light* light ) - { - return true; - } - - /** Writes the animation. - @return True on succeeded, false otherwise.*/ - virtual bool writeAnimation( const COLLADAFW::Animation* animation ) - { - return true; - } - - /** When this method is called, the writer must write the AnimationList. - @return The writer should return true, if writing succeeded, false otherwise.*/ - virtual bool writeAnimationList( const COLLADAFW::AnimationList* animationList ) - { - return true; - } - - /** When this method is called, the writer must write the skin controller data. - @return The writer should return true, if writing succeeded, false otherwise.*/ - virtual bool writeSkinControllerData( const COLLADAFW::SkinControllerData* skinControllerData ) - { - return true; - } - - /** When this method is called, the writer must write the controller. - @return The writer should return true, if writing succeeded, false otherwise.*/ - virtual bool writeController( const COLLADAFW::Controller* controller ) - { - return true; - } - - /** When this method is called, the writer must write the formula. - @return The writer should return true, if writing succeeded, false otherwise.*/ - virtual bool writeFormulas( const COLLADAFW::Formulas* formulas ) - { - return true; - } - - /** When this method is called, the writer must write the formula. - @return The writer should return true, if writing succeeded, false otherwise.*/ - virtual bool writeFormula( const COLLADAFW::Formula* formulas ) - { - return true; - } - - /** When this method is called, the writer must write the kinematics scene. - @return The writer should return true, if writing succeeded, false otherwise.*/ - virtual bool writeKinematicsScene( const COLLADAFW::KinematicsScene* kinematicsScene ) - { - return true; - } - - // private function declarations - private: - /** Disable default copy ctor. */ - Writer( const Writer& pre ); - /** Disable default assignment operator. */ - const Writer& operator= ( const Writer& pre ); - - }; + return true; + } + + /** Writes the animation. + @return True on succeeded, false otherwise.*/ + virtual bool writeAnimation( const COLLADAFW::Animation* animation ) + { + return true; + } + + /** When this method is called, the writer must write the AnimationList. + @return The writer should return true, if writing succeeded, false otherwise.*/ + virtual bool writeAnimationList( const COLLADAFW::AnimationList* animationList ) + { + return true; + } + + /** When this method is called, the writer must write the skin controller data. + @return The writer should return true, if writing succeeded, false otherwise.*/ + virtual bool writeSkinControllerData( const COLLADAFW::SkinControllerData* skinControllerData ) + { + return true; + } + + /** When this method is called, the writer must write the controller. + @return The writer should return true, if writing succeeded, false otherwise.*/ + virtual bool writeController( const COLLADAFW::Controller* controller ) + { + return true; + } + + /** When this method is called, the writer must write the formula. + @return The writer should return true, if writing succeeded, false otherwise.*/ + virtual bool writeFormulas( const COLLADAFW::Formulas* formulas ) + { + return true; + } + + /** When this method is called, the writer must write the formula. + @return The writer should return true, if writing succeeded, false otherwise.*/ + virtual bool writeFormula( const COLLADAFW::Formula* formulas ) + { + return true; + } + + /** When this method is called, the writer must write the kinematics scene. + @return The writer should return true, if writing succeeded, false otherwise.*/ + virtual bool writeKinematicsScene( const COLLADAFW::KinematicsScene* kinematicsScene ) + { + return true; + } + + // private function declarations +private: +/** Disable default copy ctor. */ + Writer( const Writer& pre ); +/** Disable default assignment operator. */ + const Writer& operator= ( const Writer& pre ); + +}; #endif // ___WRITER_H__ diff --git a/COLLADAValidator/src/ValidationErrorHandler.cpp b/COLLADAValidator/src/ValidationErrorHandler.cpp index 31a28952a..2d13548d9 100644 --- a/COLLADAValidator/src/ValidationErrorHandler.cpp +++ b/COLLADAValidator/src/ValidationErrorHandler.cpp @@ -7,6 +7,8 @@ #include "GeneratedSaxParserParserError.h" +#include + //-------------------------------------------------------------------- ValidationErrorHandler::ValidationErrorHandler() : mHasHandledSaxParserError(false) diff --git a/COLLADAValidator/src/main.cpp b/COLLADAValidator/src/main.cpp index aac14f148..98c33e3d8 100644 --- a/COLLADAValidator/src/main.cpp +++ b/COLLADAValidator/src/main.cpp @@ -12,14 +12,19 @@ #include "COLLADAFWRoot.h" -#if defined(XMLPARSER_LIBXML) -const char* programName = "COLLADAValidator_LibXML.exe"; -#elif defined(XMLPARSER_EXPAT) -const char* programName = "COLLADAValidator_Expat.exe"; +#ifdef WIN32 +# if defined(XMLPARSER_LIBXML) + const char* programName = "COLLADAValidator_LibXML.exe"; +# elif defined(XMLPARSER_EXPAT) + const char* programName = "COLLADAValidator_Expat.exe"; +# else +# error "No prepocesser flag set to chose the xml parser to use" +# endif #else -# error "No prepocesser flag set to chose the xml parser to use" + const char* programName = "COLLADAValidator.exe"; #endif + bool hasHandledSaxParserError = false; bool hasHandledSaxFWLError = false; COLLADASaxFWL::COLLADAVersion version = COLLADASaxFWL::COLLADA_UNKNOWN; diff --git a/Externals/LibXML/SConscript b/Externals/LibXML/SConscript new file mode 100644 index 000000000..95c8305ef --- /dev/null +++ b/Externals/LibXML/SConscript @@ -0,0 +1,21 @@ + +Import('env') + +libName = 'xml' + +srcDir = './' + +variantDir = env['objDir'] + env['configurationBaseName'] + '/' +outputDir = env['libDir'] + env['configurationBaseName'] + '/' +targetPath = outputDir + libName + +incDirs = ['include/'] + +src = [ variantDir + str(p) for p in Glob('*.c') ] +VariantDir(variant_dir=variantDir, src_dir=srcDir, duplicate=False) + +if env['SHAREDLIB']: + SharedLibrary(target=targetPath, source=src, CPPPATH=incDirs, CCFLAGS=env['CPPFLAGS']) +else: + StaticLibrary(target=targetPath, source=src, CPPPATH=incDirs, CCFLAGS=env['CPPFLAGS']) + diff --git a/Externals/MathMLSolver/SConscript b/Externals/MathMLSolver/SConscript new file mode 100644 index 000000000..77b21840a --- /dev/null +++ b/Externals/MathMLSolver/SConscript @@ -0,0 +1,27 @@ + +Import('env') + +libName = 'MathMLSolver' + + +srcDirs = [ 'src/', + 'src/AST/'] + +variantDir = env['objDir'] + env['configurationBaseName'] + '/' +outputDir = env['libDir'] + env['configurationBaseName'] + '/' +targetPath = outputDir + libName + + +incDirs = [ 'include', + 'include/AST'] + +src = [] +for srcDir in srcDirs: + src += [ variantDir + str(p) for p in Glob(srcDir + '*.cpp')] + VariantDir(variant_dir=variantDir + srcDir, src_dir=srcDir, duplicate=False) + + +if env['SHAREDLIB']: + SharedLibrary(target=targetPath, source=src, CPPPATH=incDirs, CCFLAGS=env['CPPFLAGS']) +else: + StaticLibrary(target=targetPath, source=src, CPPPATH=incDirs, CCFLAGS=env['CPPFLAGS']) diff --git a/Externals/MathMLSolver/src/MathMLSymbolTable.cpp b/Externals/MathMLSolver/src/MathMLSymbolTable.cpp index 3edbf024b..670588bfb 100644 --- a/Externals/MathMLSolver/src/MathMLSymbolTable.cpp +++ b/Externals/MathMLSolver/src/MathMLSymbolTable.cpp @@ -3,6 +3,8 @@ #include "MathMLASTConstantExpression.h" #include "MathMLError.h" +#include + namespace MathML { //--------------------------------------------------------------------------------- diff --git a/Externals/UTF/SConscript b/Externals/UTF/SConscript new file mode 100644 index 000000000..7e7e437d3 --- /dev/null +++ b/Externals/UTF/SConscript @@ -0,0 +1,24 @@ + +Import('env') + +libName = 'UTF' + + +srcDirs = [ 'src/'] + +variantDir = env['objDir'] + env['configurationBaseName'] + '/' +outputDir = env['libDir'] + env['configurationBaseName'] + '/' +targetPath = outputDir + libName + + +incDirs = ['include/'] + +src = [] +for srcDir in srcDirs: + src += [ variantDir + str(p) for p in Glob(srcDir + '*.c')] + VariantDir(variant_dir=variantDir + srcDir, src_dir=srcDir, duplicate=False) + +if env['SHAREDLIB']: + SharedLibrary(target=targetPath, source=src, CPPPATH=incDirs, CCFLAGS=env['CPPFLAGS']) +else: + StaticLibrary(target=targetPath, source=src, CPPPATH=incDirs, CCFLAGS=env['CPPFLAGS']) diff --git a/Externals/expat/SConscript b/Externals/expat/SConscript new file mode 100644 index 000000000..a060d1ad6 --- /dev/null +++ b/Externals/expat/SConscript @@ -0,0 +1,23 @@ + +Import('env') + +libName = 'expat' + + +srcDir = 'lib/' + +variantDir = env['objDir'] + env['configurationBaseName'] + '/' +outputDir = env['libDir'] + env['configurationBaseName'] + '/' +targetPath = outputDir + libName + + +incDirs = ['include/'] + +src = [ variantDir + str(p) for p in Glob(srcDir + '*.c')] +VariantDir(variant_dir=variantDir + srcDir, src_dir=srcDir, duplicate=False) + +if env['SHAREDLIB']: + SharedLibrary(target=targetPath, source=src, CPPPATH=incDirs, CCFLAGS=env['CPPFLAGS']) +else: + StaticLibrary(target=targetPath, source=src, CPPPATH=incDirs, CCFLAGS=env['CPPFLAGS']) + diff --git a/Externals/pcre/SConscript b/Externals/pcre/SConscript new file mode 100644 index 000000000..672d97cf2 --- /dev/null +++ b/Externals/pcre/SConscript @@ -0,0 +1,22 @@ + +Import('env') + +libName = 'pcre' + + +srcDir = 'src/' + +variantDir = env['objDir'] + env['configurationBaseName'] + '/' +outputDir = env['libDir'] + env['configurationBaseName'] + '/' +targetPath = outputDir + libName + + +incDirs = ['include/'] + +src = [ variantDir + str(p) for p in Glob(srcDir + '*.c')] +VariantDir(variant_dir=variantDir + srcDir, src_dir=srcDir, duplicate=False) + +if env['SHAREDLIB']: + SharedLibrary(target=targetPath, source=src, CPPPATH=incDirs, CCFLAGS=env['CPPFLAGS']) +else: + StaticLibrary(target=targetPath, source=src, CPPPATH=incDirs, CCFLAGS=env['CPPFLAGS']) diff --git a/Externals/pcre/include/config_linux.h b/Externals/pcre/include/config_linux.h new file mode 100644 index 000000000..988011333 --- /dev/null +++ b/Externals/pcre/include/config_linux.h @@ -0,0 +1,40 @@ +/* #undef HAVE_DIRENT_H */ +#define HAVE_SYS_STAT_H 1 +#define HAVE_SYS_TYPES_H 1 +/* #undef HAVE_UNISTD_H */ +#define HAVE_WINDOWS_H 0 + +/* #undef HAVE_TYPE_TRAITS_H */ +/* #undef HAVE_BITS_TYPE_TRAITS_H */ + +/* #undef HAVE_BCOPY */ +#define HAVE_MEMMOVE 1 +#define HAVE_STRERROR 1 +/* #undef HAVE_STRTOLL */ +/* #undef HAVE_STRTOQ */ +#define HAVE__STRTOI64 1 + +#define PCRE_STATIC 1 + +/* #undef SUPPORT_UTF8 */ +/* #undef SUPPORT_UCP */ +/* #undef EBCDIC */ +/* #undef BSR_ANYCRLF */ +/* #undef NO_RECURSE */ + +#define HAVE_LONG_LONG 1 +#define HAVE_UNSIGNED_LONG_LONG 1 + +/* #undef SUPPORT_LIBBZ2 */ +/* #undef SUPPORT_LIBZ */ +/* #undef SUPPORT_LIBREADLINE */ + +#define NEWLINE 10 +#define POSIX_MALLOC_THRESHOLD 10 +#define LINK_SIZE 2 +#define MATCH_LIMIT 10000000 +#define MATCH_LIMIT_RECURSION MATCH_LIMIT + + +#define MAX_NAME_SIZE 32 +#define MAX_NAME_COUNT 10000 diff --git a/Externals/pcre/src/pcre_chartables.c b/Externals/pcre/src/pcre_chartables.c index 75ee6151b..3cfa7ebf7 100644 --- a/Externals/pcre/src/pcre_chartables.c +++ b/Externals/pcre/src/pcre_chartables.c @@ -20,12 +20,14 @@ and dead code stripping is activated. This leads to link errors. Pulling in the header ensures that the array gets flagged as "someone outside this compilation unit might reference this" and so it will always be supplied to the linker. */ -#if (defined(WIN64) || defined(WIN32)) -# include "config_win.h" +#if (defined(WIN64) || defined(WIN32)) +# include "config_win.h" #elif (defined(__APPLE__) || defined(OSMac_)) # include "config_mac.h" +#elif defined(__linux__) || defined(__linux) +# include "config_linux.h" #elif defined(HAVE_CONFIG_H) -# include "config.h" +# include "config.h" #endif #include "pcre_internal.h" diff --git a/Externals/pcre/src/pcre_compile.c b/Externals/pcre/src/pcre_compile.c index 4f28fadef..fe3a3c9d5 100644 --- a/Externals/pcre/src/pcre_compile.c +++ b/Externals/pcre/src/pcre_compile.c @@ -41,12 +41,14 @@ POSSIBILITY OF SUCH DAMAGE. /* This module contains the external function pcre_compile(), along with supporting internal functions that are not used by other modules. */ -#if (defined(WIN64) || defined(WIN32)) -# include "config_win.h" +#if (defined(WIN64) || defined(WIN32)) +# include "config_win.h" #elif (defined(__APPLE__) || defined(OSMac_)) # include "config_mac.h" +#elif defined(__linux__) || defined(__linux) +# include "config_linux.h" #elif defined(HAVE_CONFIG_H) -# include "config.h" +# include "config.h" #endif diff --git a/Externals/pcre/src/pcre_exec.c b/Externals/pcre/src/pcre_exec.c index 610f97d25..7b96af1ec 100644 --- a/Externals/pcre/src/pcre_exec.c +++ b/Externals/pcre/src/pcre_exec.c @@ -42,12 +42,14 @@ POSSIBILITY OF SUCH DAMAGE. pattern matching using an NFA algorithm, trying to mimic Perl as closely as possible. There are also some static supporting functions. */ -#if (defined(WIN64) || defined(WIN32)) -# include "config_win.h" +#if (defined(WIN64) || defined(WIN32)) +# include "config_win.h" #elif (defined(__APPLE__) || defined(OSMac_)) # include "config_mac.h" +#elif defined(__linux__) || defined(__linux) +# include "config_linux.h" #elif defined(HAVE_CONFIG_H) -# include "config.h" +# include "config.h" #endif diff --git a/Externals/pcre/src/pcre_globals.c b/Externals/pcre/src/pcre_globals.c index 26824825f..0fb800a84 100644 --- a/Externals/pcre/src/pcre_globals.c +++ b/Externals/pcre/src/pcre_globals.c @@ -46,12 +46,14 @@ indirection. These values can be changed by the caller, but are shared between all threads. However, when compiling for Virtual Pascal, things are done differently, and global variables are not used (see pcre.in). */ -#if (defined(WIN64) || defined(WIN32)) -# include "config_win.h" +#if (defined(WIN64) || defined(WIN32)) +# include "config_win.h" #elif (defined(__APPLE__) || defined(OSMac_)) # include "config_mac.h" +#elif defined(__linux__) || defined(__linux) +# include "config_linux.h" #elif defined(HAVE_CONFIG_H) -# include "config.h" +# include "config.h" #endif diff --git a/Externals/pcre/src/pcre_newline.c b/Externals/pcre/src/pcre_newline.c index 77e79de5d..277faef2d 100644 --- a/Externals/pcre/src/pcre_newline.c +++ b/Externals/pcre/src/pcre_newline.c @@ -47,12 +47,14 @@ and NLTYPE_ANY. The full list of Unicode newline characters is taken from http://unicode.org/unicode/reports/tr18/. */ -#if (defined(WIN64) || defined(WIN32)) -# include "config_win.h" +#if (defined(WIN64) || defined(WIN32)) +# include "config_win.h" #elif (defined(__APPLE__) || defined(OSMac_)) # include "config_mac.h" +#elif defined(__linux__) || defined(__linux) +# include "config_linux.h" #elif defined(HAVE_CONFIG_H) -# include "config.h" +# include "config.h" #endif diff --git a/Externals/pcre/src/pcre_tables.c b/Externals/pcre/src/pcre_tables.c index 6f4782745..89839480f 100644 --- a/Externals/pcre/src/pcre_tables.c +++ b/Externals/pcre/src/pcre_tables.c @@ -44,12 +44,14 @@ uses macros to change their names from _pcre_xxx to xxxx, thereby avoiding name clashes with the library. */ -#if (defined(WIN64) || defined(WIN32)) -# include "config_win.h" +#if (defined(WIN64) || defined(WIN32)) +# include "config_win.h" #elif (defined(__APPLE__) || defined(OSMac_)) # include "config_mac.h" +#elif defined(__linux__) || defined(__linux) +# include "config_linux.h" #elif defined(HAVE_CONFIG_H) -# include "config.h" +# include "config.h" #endif diff --git a/Externals/pcre/src/pcre_try_flipped.c b/Externals/pcre/src/pcre_try_flipped.c index a48ecc185..5cffc06c5 100644 --- a/Externals/pcre/src/pcre_try_flipped.c +++ b/Externals/pcre/src/pcre_try_flipped.c @@ -43,12 +43,14 @@ see if it was compiled with the opposite endianness. If so, it uses an auxiliary local function to flip the appropriate bytes. */ -#if (defined(WIN64) || defined(WIN32)) +#if (defined(WIN64) || defined(WIN32)) # include "config_win.h" #elif (defined(__APPLE__) || defined(OSMac_)) # include "config_mac.h" +#elif defined(__linux__) || defined(__linux) +# include "config_linux.h" #elif defined(HAVE_CONFIG_H) -# include "config.h" +# include "config.h" #endif diff --git a/GeneratedSaxParser/SConscript b/GeneratedSaxParser/SConscript new file mode 100644 index 000000000..447610198 --- /dev/null +++ b/GeneratedSaxParser/SConscript @@ -0,0 +1,42 @@ + +Import('env') + +libName = 'GeneratedSaxParser' + + +srcDir = 'src/' + +variantDir = env['objDir'] + env['configurationBaseName'] + env['xmlParserConfName']+ '/' +outputDir = env['libDir'] + env['configurationBaseName'] + env['xmlParserConfName']+ '/' +targetPath = outputDir + libName + + +incDirs = ['include/', + '../COLLADABaseUtils/include/'] + +src = [ variantDir + str(p) for p in Glob(srcDir + '*.cpp')] +VariantDir(variant_dir=variantDir + srcDir, src_dir=srcDir, duplicate=False) + +# set xml parser specitic settings +if (env['XMLPARSER'] == 'expat') or (env['XMLPARSER'] == 'expatnative'): + for f in src: + if f.endswith('GeneratedSaxParserLibxmlSaxParser.cpp'): + src.remove(f) +else: + for f in src: + if f.endswith('GeneratedSaxParserExpatSaxParser.cpp'): + src.remove(f) + +if env['XMLPARSER'] == 'expat': + incDirs += ['../Externals/expat/lib/'] +elif env['XMLPARSER'] == 'libxml': + incDirs += ['../Externals/LibXML/include/'] +elif env['XMLPARSER'] == 'libxmlnative': + incDirs += ['/usr/include/libxml2'] + + +if env['SHAREDLIB']: + SharedLibrary(target=targetPath, source=src, CPPPATH=incDirs, CCFLAGS=env['CPPFLAGS']) +else: + StaticLibrary(target=targetPath, source=src, CPPPATH=incDirs, CCFLAGS=env['CPPFLAGS']) + diff --git a/SConstruct b/SConstruct index 4d3382cb5..e03254e2d 100755 --- a/SConstruct +++ b/SConstruct @@ -1,45 +1,80 @@ -debug = True -expat = True - -builddir = 'scons-build' - -srcdir = ['COLLADABaseUtils/src', - 'COLLADABaseUtils/src/Math', - 'COLLADAStreamWriter/src', - 'COLLADAFramework/src', - 'COLLADASaxFrameworkLoader/src', - 'COLLADASaxFrameworkLoader/src/generated14', - 'COLLADASaxFrameworkLoader/src/generated15', - 'GeneratedSaxParser/src', - 'Externals/MathMLSolver/src', - 'Externals/MathMLSolver/src/AST', - 'Externals/UTF/src'] - -incdir = ['COLLADABaseUtils/include', - 'COLLADAStreamWriter/include', - 'COLLADAFramework/include', - 'COLLADASaxFrameworkLoader/include', - 'COLLADASaxFrameworkLoader/include/generated14', - 'COLLADASaxFrameworkLoader/include/generated15', - 'GeneratedSaxParser/include', - 'Externals/MathMLSolver/include', - 'Externals/MathMLSolver/include/AST', - 'Externals/UTF/include'] - -src = [] -for d in srcdir: - src += [builddir + '/' + str(p) for p in Glob(d + '/*.cpp') + Glob(d + '/*.c')] - BuildDir(build_dir=builddir + '/' + d, src_dir=d, duplicate=False) - -excl = ['COLLADASWSurface.cpp', 'MathMLASTFactory.cpp', 'GeneratedSaxParserLibxmlSaxParser.cpp' if expat else 'GeneratedSaxParserExpatSaxParser.cpp'] -for f in src: - for e in excl: - if f.endswith(e): - src.remove(f) - -ccflags = ['-DGENERATEDSAXPARSER_XMLPARSER_EXPAT' if expat else '-DGENERATEDSAXPARSER_XMLPARSER_LIBXML', '-fsigned-char'] - -if debug: - ccflags += ['-O0', '-g3', '-ggdb3', '-fno-inline'] - -Library(target='OpenCollada', source=src, CPPPATH=incdir, CCFLAGS=ccflags) +import platform #Requiered to detect the current plattform + + +Decider('MD5-timestamp') + + +# define the variables the user can set on the command line +vars = Variables('custom.py') +vars.Add(BoolVariable('RELEASE', 'Set to build for release', 0)) +vars.Add(BoolVariable('PG', 'Set to build with -pg set for gcc for profiling', 0)) +vars.Add(BoolVariable('SHAREDLIB', 'Set to build shared libraries instead of static ones (untested).', 0)) +vars.Add(BoolVariable('PCRENATIVE', +"""Set to build using the systems native pcre lib instead of the delivered lib. Uses same configuration dir for both configurations. +""", 1)) +vars.Add(EnumVariable('XMLPARSER', +"""Selects the xml parser to be used + libxml: Use libXML contained in OpenCOLLADA external sources + expat: Use expat contained in OpenCOLLADA external sources + libxmlNative: Use libXML deliverd with your OS. libXML and the corresponding development files need to be installed + expatNative: Use expat deliverd with your OS. expat and the corresponding development files need to be installed + +""" +, 'libxmlnative', allowed_values=('libxml', 'expat', 'libxmlnative', 'expatnative'), ignorecase=2)) +vars.Add(BoolVariable('NOVALIDATION', 'Set to disable shema validation in sax frame work loader', 0)) + +env=Environment( variables=vars ) +Help(vars.GenerateHelpText(env)) + +if env['RELEASE']: + configurationName = 'release' + env['CPPFLAGS'] = ' -O2 -DNDEBUG' +else: + configurationName = 'debug' + env['CPPFLAGS'] = ' -O0 -g3 -ggdb3 -fno-inline' + +if env['PG']: + configurationName += 'Pg' + env['CPPFLAGS'] += ' -pg' + +env['platformDir'] = env['PLATFORM'] + '/' +env['architectureDir'] = platform.machine() + '/' +env['configurationBaseName'] = env['platformDir'] + env['architectureDir'] + configurationName + +if (env['XMLPARSER'] == 'expat') or (env['XMLPARSER'] == 'expatnative'): + env['xmlParserConfName'] = 'expat' +else: + env['xmlParserConfName'] = 'libxml' + +if env['NOVALIDATION']: + env['validationConfName'] = 'Novalidation' +else: + env['validationConfName'] = '' + +env['objDir'] = 'obj/' +env['libDir'] = 'lib/' +env['binDir'] = 'bin/' + + +SConscript(['COLLADABaseUtils/SConscript'], exports = 'env') +SConscript(['Externals/MathMLSolver/SConscript'], exports = 'env') +SConscript(['Externals/UTF/SConscript'], exports = 'env') +if not env['PCRENATIVE']: + SConscript(['Externals/pcre/SConscript'], exports = 'env') + + +if env['XMLPARSER'] == 'expat': + SConscript(['Externals/expat/SConscript'], exports = 'env') +elif env['XMLPARSER'] == 'libxml': + SConscript(['Externals/LibXML/SConscript'], exports = 'env') + +SConscript(['COLLADAFramework/SConscript'], exports = 'env') + +SConscript(['GeneratedSaxParser/SConscript'], exports = 'env') +SConscript(['COLLADASaxFrameworkLoader/SConscript'], exports = 'env') +SConscript(['COLLADAStreamWriter/SConscript'], exports = 'env') + +SConscript(['COLLADAValidator/SConscript'], exports = 'env') + + +