# -*- mode: python -*- Import([ 'env', 'serverJs', 'usev8', 'usemozjs', 'v8suffix', ]) env.Library( target='scripting_common', source=[ 'engine.cpp', 'utils.cpp', ], LIBDEPS=[ '$BUILD_DIR/mongo/base', '$BUILD_DIR/mongo/client/clientdriver', '$BUILD_DIR/mongo/shell/mongojs', '$BUILD_DIR/mongo/util/foundation', '$BUILD_DIR/mongo/util/md5', ], ) env.Library( target='bson_template_evaluator', source=[ "bson_template_evaluator.cpp", ], LIBDEPS=[ '$BUILD_DIR/mongo/base', ], ) env.CppUnitTest( target='bson_template_evaluator_test', source=[ 'bson_template_evaluator_test.cpp', ], LIBDEPS=[ 'bson_template_evaluator', ], ) env.Library( target='scripting_none', source=[ 'engine_none.cpp', ], LIBDEPS=[ 'bson_template_evaluator', 'scripting_common', ], ) if usev8: scriptingEnv = env.Clone() scriptingEnv.InjectThirdPartyIncludePaths(libraries=['v8']) scriptingEnv.Library( target='scripting', source=[ 'engine_v8' + v8suffix + '.cpp', 'v8' + v8suffix + '_db.cpp', 'v8' + v8suffix + '_utils.cpp', 'v8' + v8suffix + '_profiler.cpp', ], LIBDEPS=[ 'bson_template_evaluator', 'scripting_common', '$BUILD_DIR/third_party/shim_v8', '$BUILD_DIR/mongo/shell/mongojs', '$BUILD_DIR/mongo/db/service_context', ], ) elif usemozjs: scriptingEnv = env.Clone() scriptingEnv.InjectThirdPartyIncludePaths(libraries=['mozjs']) # TODO: get rid of all of this /FI and -include stuff and migrate to a shim # header we include in all of our files. if env.TargetOSIs('windows'): scriptingEnv.Append(CCFLAGS=[ '/FI', 'js-config.h', '/FI', 'js/RequiredDefines.h', ]) else: scriptingEnv.Append( CCFLAGS=[ '-include', 'js-config.h', '-include', 'js/RequiredDefines.h', '-Wno-invalid-offsetof', ], CXXFLAGS=[ '-Wno-non-virtual-dtor', ], ) scriptingEnv.Prepend(CPPDEFINES=[ 'JS_USE_CUSTOM_ALLOCATOR', 'STATIC_JS_API=1', ]) scriptingEnv.Library( target='scripting', source=[ 'mozjs/base.cpp', 'mozjs/bindata.cpp', 'mozjs/bson.cpp', 'mozjs/countdownlatch.cpp', 'mozjs/cursor.cpp', 'mozjs/dbcollection.cpp', 'mozjs/db.cpp', 'mozjs/dbpointer.cpp', 'mozjs/dbquery.cpp', 'mozjs/dbref.cpp', 'mozjs/engine.cpp', 'mozjs/exception.cpp', 'mozjs/global.cpp', 'mozjs/idwrapper.cpp', 'mozjs/implscope.cpp', 'mozjs/jscustomallocator.cpp', 'mozjs/jsstringwrapper.cpp', 'mozjs/jsthread.cpp', 'mozjs/maxkey.cpp', 'mozjs/minkey.cpp', 'mozjs/mongo.cpp', 'mozjs/nativefunction.cpp', 'mozjs/numberint.cpp', 'mozjs/numberlong.cpp', 'mozjs/object.cpp', 'mozjs/objectwrapper.cpp', 'mozjs/oid.cpp', 'mozjs/PosixNSPR.cpp', 'mozjs/proxyscope.cpp', 'mozjs/regexp.cpp', 'mozjs/timestamp.cpp', 'mozjs/valuereader.cpp', 'mozjs/valuewriter.cpp', ], LIBDEPS=[ 'bson_template_evaluator', 'scripting_common', '$BUILD_DIR/third_party/shim_mozjs', '$BUILD_DIR/mongo/shell/mongojs', '$BUILD_DIR/mongo/db/service_context', ], ) else: env.Library( target='scripting', source=[ ], LIBDEPS=[ 'scripting_none', ], ) env.Library( target='scripting_server', source=[ ], LIBDEPS=[ 'scripting' if serverJs else 'scripting_none', ], ) env.CppUnitTest( target='deadline_monitor_test', source=[ 'deadline_monitor_test.cpp', ], LIBDEPS=[ ], )