Don't define DEBUG on non VS actions

DEBUG is unused by pyrogenesis and unconditionally adding it to defines
prevents building against a non debug version of spidermonkey. This will
allow building only one copy of spidermonkey, which can be trivially be
replaced with the other depending on needs independent of pyrogenesis
debug or release build.

This also allows to build either build configuration against system
spidermonkey, which obviously is either one build type or the other.
Requires a compilecheck until the pc file gets fixed upstream.

A comment in the spidermonkey build.sh says on FreeBSD spidermonkey
debug configuration doesn't even build and so pyrogenesis debug build
wasn't possible either.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
This commit is contained in:
Ralph Sennhauser 2024-10-27 20:06:39 +01:00
parent a3ce07c3bb
commit c497744548
2 changed files with 20 additions and 1 deletions

View file

@ -117,6 +117,16 @@ elseif os.istarget("linux") then
end
end
-- Test whether system mozjs is built with --enable-debug
-- The pc file doesn't specify the required -DDEBUG needed in that case
local mozjs_is_debug_build = false
if _OPTIONS["with-system-mozjs"] then
local _, errorCode = os.outputof(cc .. " $(pkg-config mozjs-91 --cflags) ./tests/mozdebug.c -o /dev/null")
if errorCode ~= 0 then
mozjs_is_debug_build = true
end
end
-- Set up the Workspace
workspace "pyrogenesis"
targetdir(rootdir.."/binaries/system")
@ -175,7 +185,7 @@ function project_set_build_flags()
debugenvs { "_NO_DEBUG_HEAP=1" }
end
filter "Debug"
filter { "Debug", "action:vs*" }
defines { "DEBUG" }
filter "Release"
@ -189,6 +199,10 @@ function project_set_build_flags()
filter { }
if mozjs_is_debug_build then
defines "DEBUG"
end
if _OPTIONS["gles"] then
defines { "CONFIG2_GLES=1" }
end

View file

@ -0,0 +1,5 @@
#include <js-config.h>
int main() {
return 0;
}