# Support latest version of SpiderMonkey

Add --with-spidermonkey-tip option to Premake

This was SVN commit r7230.
This commit is contained in:
Ykkrosh 2009-12-28 16:45:42 +00:00
parent 0765207641
commit 00409b9583
3 changed files with 34 additions and 5 deletions

View File

@ -68,6 +68,7 @@ end
-- which is unfortunately totally incompatible with our
-- library installation rules.
-- * depends: a table of external libraries that this library depends on
-- * defines: a table of symbols to define
extern_lib_defs = {
boost = {
unix_names = { "boost_signals-mt", "boost_filesystem-mt", "boost_system-mt" },
@ -175,10 +176,25 @@ extern_lib_defs = {
end
end
},
spidermonkey = {
spidermonkey =
options["with-spidermonkey-tip"] and
{
add_func = function()
tinsert(package.config["Debug" ].includepaths, libraries_dir.."spidermonkey-tip/include/debug")
tinsert(package.config["Testing"].includepaths, libraries_dir.."spidermonkey-tip/include/debug")
tinsert(package.config["Release"].includepaths, libraries_dir.."spidermonkey-tip/include/release")
tinsert(package.libpaths, libraries_dir.."spidermonkey-tip/lib")
tinsert(package.config["Debug" ].links, "mozjs-debug")
tinsert(package.config["Testing"].links, "mozjs-release")
tinsert(package.config["Release"].links, "mozjs-release")
end,
}
or -- SpiderMonkey 1.6
{
win_names = { "js32" },
unix_names = { "js" },
depends = { "nspr" }
depends = { "nspr" },
defines = { "JS_THREADSAFE" },
},
valgrind = {
},
@ -274,7 +290,11 @@ local function add_extern_lib(extern_lib, def)
if OS ~= "windows" then
suffix = ""
end
if def.defines then
tinsert(package.defines, def.defines)
end
-- OS X "Frameworks" need to be added in a special way to the link
-- i.e. by linkoptions += "-framework ..."
if OS == "macosx" and def.osx_frameworks then

View File

@ -7,6 +7,7 @@ addoption("outpath", "Location for generated project files")
addoption("without-tests", "Disable generation of test projects")
addoption("without-pch", "Disable generation and usage of precompiled headers")
addoption("with-valgrind", "Enable using valgrind for debugging functionality")
addoption("with-spidermonkey-tip", "Use SpiderMonkey from mozilla-central tip instead of the 1.6 release")
use_dcdt = false -- disable it since it's a non-Free library
@ -121,6 +122,8 @@ function package_set_build_flags()
-- PremakeWiki says with-symbols and optimize are automatically set for
-- Debug and Release builds, respectively. doesn't happen though, so do it manually.
package.config["Debug"].defines = { "DEBUG" }
package.config["Testing"].buildflags = { "no-runtime-checks" }
package.config["Testing"].defines = { "TESTING" }
@ -208,6 +211,11 @@ function package_set_build_flags()
end
end
-- To use our local SpiderMonkey library, it needs to be part of the runtime dynamic linker
-- path. So try to add the cwd (assuming it'll be binaries/system/) with -rpath
-- (TODO: is this a sane way to do it?)
tinsert(package.linkoptions, {"-Wl,-rpath=."})
tinsert(package.buildoptions, {
-- Hide symbols in dynamic shared objects by default, for efficiency and for equivalence with
-- Windows - they should be exported explicitly with __attribute__ ((visibility ("default")))
@ -851,6 +859,9 @@ end
function setup_atlas_frontend_package (package_name)
package_create(package_name, "winexe")
package_add_extern_libs({
"spidermonkey",
})
local source_root = "../../../source/tools/atlas/AtlasFrontends/"
package.files = {

View File

@ -43,8 +43,6 @@
# define XP_UNIX
#endif
#define JS_THREADSAFE
#include <js/jsapi.h>
#ifndef NDEBUG