Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SCons: Dump construction environment to a file #37248

Merged
merged 1 commit into from
Jun 10, 2020
Merged

SCons: Dump construction environment to a file #37248

merged 1 commit into from
Jun 10, 2020

Conversation

Xrayez
Copy link
Contributor

@Xrayez Xrayez commented Mar 23, 2020

A new methods.dump(env) is added to dump the construction environment used by SCons to build Godot to a .scons_env.json. The file can be used for debugging purposes and any external tool.

Features/benefits

Example output

scons platform=windows target=release_debug bits=64 module_arkit_enabled=no module_assimp_enabled=no module_bmp_enabled=no module_bullet_enabled=no module_camera_enabled=no module_csg_enabled=no module_dds_enabled=no module_enet_enabled=no module_etc_enabled=no module_gdnative_enabled=no module_gridmap_enabled=no module_hdr_enabled=no module_jsonrpc_enabled=no module_mbedtls_enabled=no module_mobile_vr_enabled=no module_opensimplex_enabled=no module_opus_enabled=no module_pvr_enabled=no module_recast_enabled=no module_squish_enabled=no module_tga_enabled=no module_theora_enabled=no module_tinyexr_enabled=no module_upnp_enabled=no module_vhacd_enabled=no module_vorbis_enabled=no module_webm_enabled=no module_webp_enabled=no module_webrtc_enabled=no module_websocket_enabled=no module_xatlas_unwrap_enabled=no

Produces:

.scons_env.json
{
    "SCANNERS": [
        "<<non-serializable: Base>>"
    ],
    "CONFIGUREDIR": "#/.sconf_temp",
    "CONFIGURELOG": "#/config.log",
    "CPPSUFFIXES": [
        ".c",
        ".C",
        ".cxx",
        ".cpp",
        ".c++",
        ".cc",
        ".h",
        ".H",
        ".hxx",
        ".hpp",
        ".hh",
        ".F",
        ".fpp",
        ".FPP",
        ".m",
        ".mm",
        ".S",
        ".spp",
        ".SPP",
        ".sx"
    ],
    "DSUFFIXES": [
        ".d"
    ],
    "ENV": "<<non-serializable: _Environ>>",
    "IDLSUFFIXES": [
        ".idl",
        ".IDL"
    ],
    "_concat": "<<non-serializable: function>>",
    "_defines": "<<non-serializable: function>>",
    "_stripixes": "<<non-serializable: function>>",
    "_LIBFLAGS": "${_concat(LIBLINKPREFIX, LIBS, LIBLINKSUFFIX, __env__)}",
    "_LIBDIRFLAGS": "$( ${_concat(LIBDIRPREFIX, LIBPATH, LIBDIRSUFFIX, __env__, RDirs, TARGET, SOURCE)} $)",
    "_CPPINCFLAGS": "$( ${_concat(INCPREFIX, CPPPATH, INCSUFFIX, __env__, RDirs, TARGET, SOURCE)} $)",
    "_CPPDEFFLAGS": "${_defines(CPPDEFPREFIX, CPPDEFINES, CPPDEFSUFFIX, __env__)}",
    "__libversionflags": "<<non-serializable: function>>",
    "__SHLIBVERSIONFLAGS": "${__libversionflags(__env__,\"SHLIBVERSION\",\"_SHLIBVERSIONFLAGS\")}",
    "__LDMODULEVERSIONFLAGS": "${__libversionflags(__env__,\"LDMODULEVERSION\",\"_LDMODULEVERSIONFLAGS\")}",
    "__DSHLIBVERSIONFLAGS": "${__libversionflags(__env__,\"DSHLIBVERSION\",\"_DSHLIBVERSIONFLAGS\")}",
    "TEMPFILE": "<<non-serializable: type>>",
    "TEMPFILEARGJOIN": "\r\n",
    "Dir": "<<non-serializable: Variable_Method_Caller>>",
    "Dirs": "<<non-serializable: Variable_Method_Caller>>",
    "File": "<<non-serializable: Variable_Method_Caller>>",
    "RDirs": "<<non-serializable: Variable_Method_Caller>>",
    "PLATFORM": "win32",
    "OBJPREFIX": "",
    "OBJSUFFIX": ".windows.opt.tools.64.obj",
    "SHOBJPREFIX": "$OBJPREFIX",
    "SHOBJSUFFIX": "$OBJSUFFIX",
    "PROGPREFIX": "",
    "PROGSUFFIX": ".windows.opt.tools.64.exe",
    "LIBPREFIX": "",
    "LIBSUFFIX": ".windows.opt.tools.64.lib",
    "SHLIBPREFIX": "",
    "SHLIBSUFFIX": ".windows.opt.tools.64.dll",
    "LIBPREFIXES": [
        "$LIBPREFIX"
    ],
    "LIBSUFFIXES": [
        "$LIBSUFFIX",
        ".lib"
    ],
    "PSPAWN": "<<non-serializable: function>>",
    "SPAWN": "<<non-serializable: function>>",
    "SHELL": "C:\\WINDOWS\\System32\\cmd.exe",
    "TEMPFILEPREFIX": "@",
    "MAXLINELENGTH": 2048,
    "ESCAPE": "<<non-serializable: function>>",
    "HOST_OS": "win32",
    "HOST_ARCH": "x86_64",
    "TARGET_OS": null,
    "TARGET_ARCH": "amd64",
    "TOOLS": [
        "default",
        "mslink",
        "msvc",
        "gfortran",
        "masm",
        "mslib",
        "dmd",
        "msvs",
        "midl",
        "filesystem",
        "jar",
        "javac",
        "rmic",
        "tar",
        "zip",
        "textfile",
        "msvc",
        "mssdk"
    ],
    "WIXCANDLE": "candle.exe",
    "WIXLIGHT": "light.exe",
    "SHLINK": "$LINK",
    "SHLINKFLAGS": "<<non-serializable: CLVar>>",
    "_SHLINK_TARGETS": "<<non-serializable: function>>",
    "_SHLINK_SOURCES": "<<non-serializable: function>>",
    "SHLINKCOM": "<<non-serializable: ListAction>>",
    "SHLIBEMITTER": [
        "<<non-serializable: function>>"
    ],
    "LDMODULEEMITTER": [
        "<<non-serializable: function>>"
    ],
    "LINK": "link",
    "LINKFLAGS": [
        "/nologo",
        "/SUBSYSTEM:CONSOLE",
        "/OPT:REF",
        "/DEBUG",
        "winmm.lib",
        "dsound.lib",
        "kernel32.lib",
        "ole32.lib",
        "oleaut32.lib",
        "user32.lib",
        "gdi32.lib",
        "IPHLPAPI.lib",
        "Shlwapi.lib",
        "wsock32.lib",
        "Ws2_32.lib",
        "shell32.lib",
        "advapi32.lib",
        "dinput8.lib",
        "dxguid.lib",
        "imm32.lib",
        "bcrypt.lib",
        "Avrt.lib",
        "dwmapi.lib",
        "cfgmgr32.lib",
        "opengl32.lib",
        "/STACK:8388608"
    ],
    "_PDB": "<<non-serializable: function>>",
    "LINKCOM": "<<non-serializable: ListAction>>",
    "PROGEMITTER": [
        "<<non-serializable: function>>"
    ],
    "LIBDIRPREFIX": "/LIBPATH:",
    "LIBDIRSUFFIX": "",
    "LIBLINKPREFIX": "",
    "LIBLINKSUFFIX": "$LIBSUFFIX",
    "WIN32DEFPREFIX": "",
    "WIN32DEFSUFFIX": ".def",
    "WIN32_INSERT_DEF": 0,
    "WINDOWSDEFPREFIX": "${WIN32DEFPREFIX}",
    "WINDOWSDEFSUFFIX": "${WIN32DEFSUFFIX}",
    "WINDOWS_INSERT_DEF": "${WIN32_INSERT_DEF}",
    "WIN32EXPPREFIX": "",
    "WIN32EXPSUFFIX": ".exp",
    "WINDOWSEXPPREFIX": "${WIN32EXPPREFIX}",
    "WINDOWSEXPSUFFIX": "${WIN32EXPSUFFIX}",
    "WINDOWSSHLIBMANIFESTPREFIX": "",
    "WINDOWSSHLIBMANIFESTSUFFIX": "${SHLIBSUFFIX}.manifest",
    "WINDOWSPROGMANIFESTPREFIX": "",
    "WINDOWSPROGMANIFESTSUFFIX": "${PROGSUFFIX}.manifest",
    "REGSVRACTION": "<<non-serializable: FunctionAction>>",
    "REGSVR": "C:\\WINDOWS\\System32\\regsvr32",
    "REGSVRFLAGS": "/s ",
    "REGSVRCOM": "$REGSVR $REGSVRFLAGS ${TARGET.windows}",
    "WINDOWS_EMBED_MANIFEST": 0,
    "MT": "mt",
    "MTFLAGS": "<<non-serializable: CLVar>>",
    "MTEXECOM": "-$MT $MTFLAGS -manifest ${TARGET}.manifest $_MANIFEST_SOURCES -outputresource:$TARGET;1",
    "MTSHLIBCOM": "-$MT $MTFLAGS -manifest ${TARGET}.manifest $_MANIFEST_SOURCES -outputresource:$TARGET;2",
    "_MANIFEST_SOURCES": null,
    "MSVC_VERSION": "14.1",
    "MSVS_VERSION": "14.1",
    "MSVS": {},
    "MSVC_SETUP_RUN": true,
    "LDMODULE": "$SHLINK",
    "LDMODULEPREFIX": "$SHLIBPREFIX",
    "LDMODULESUFFIX": "$SHLIBSUFFIX",
    "LDMODULEFLAGS": "$SHLINKFLAGS",
    "_LDMODULE_TARGETS": "<<non-serializable: function>>",
    "_LDMODULE_SOURCES": "<<non-serializable: function>>",
    "LDMODULECOM": "<<non-serializable: ListAction>>",
    "CCPDBFLAGS": "<<non-serializable: CLVar>>",
    "CCPCHFLAGS": "<<non-serializable: CLVar>>",
    "_MSVC_OUTPUT_FLAG": "<<non-serializable: function>>",
    "_CCCOMCOM": "$CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS $CCPCHFLAGS $CCPDBFLAGS",
    "CC": "cl",
    "CCFLAGS": "<<non-serializable: CLVar>>",
    "CFLAGS": "<<non-serializable: CLVar>>",
    "CCCOM": "${TEMPFILE(\"$CC $_MSVC_OUTPUT_FLAG /c $CHANGED_SOURCES $CFLAGS $CCFLAGS $_CCCOMCOM\",\"$CCCOMSTR\")}",
    "SHCC": "$CC",
    "SHCCFLAGS": "<<non-serializable: CLVar>>",
    "SHCFLAGS": "<<non-serializable: CLVar>>",
    "SHCCCOM": "${TEMPFILE(\"$SHCC $_MSVC_OUTPUT_FLAG /c $CHANGED_SOURCES $SHCFLAGS $SHCCFLAGS $_CCCOMCOM\",\"$SHCCCOMSTR\")}",
    "CXX": "$CC",
    "CXXFLAGS": "<<non-serializable: CLVar>>",
    "CXXCOM": "${TEMPFILE(\"$CXX $_MSVC_OUTPUT_FLAG /c $CHANGED_SOURCES $CXXFLAGS $CCFLAGS $_CCCOMCOM\",\"$CXXCOMSTR\")}",
    "SHCXX": "$CXX",
    "SHCXXFLAGS": "<<non-serializable: CLVar>>",
    "SHCXXCOM": "${TEMPFILE(\"$SHCXX $_MSVC_OUTPUT_FLAG /c $CHANGED_SOURCES $SHCXXFLAGS $SHCCFLAGS $_CCCOMCOM\",\"$SHCXXCOMSTR\")}",
    "CPPDEFPREFIX": "/D",
    "CPPDEFSUFFIX": "",
    "INCPREFIX": "/I",
    "INCSUFFIX": "",
    "STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME": 1,
    "RC": "rc",
    "RCFLAGS": "<<non-serializable: CLVar>>",
    "RCSUFFIXES": [
        ".rc",
        ".rc2"
    ],
    "RCCOM": "$RC $_CPPDEFFLAGS $_CPPINCFLAGS $RCFLAGS /fo$TARGET $SOURCES",
    "LEXUNISTD": "<<non-serializable: CLVar>>",
    "CFILESUFFIX": ".c",
    "CXXFILESUFFIX": ".cc",
    "PCHPDBFLAGS": "",
    "PCHCOM": "$CXX /Fo${TARGETS[1]} $CXXFLAGS $CCFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS /c $SOURCES /Yc$PCHSTOP /Fp${TARGETS[0]} $CCPDBFLAGS $PCHPDBFLAGS",
    "FORTRANSUFFIXES": [
        ".f",
        ".for",
        ".ftn",
        ".F",
        ".FOR",
        ".FTN",
        ".fpp",
        ".FPP",
        ".f77",
        ".F77",
        ".f90",
        ".F90",
        ".f95",
        ".F95",
        ".f03",
        ".F03",
        ".f08",
        ".F08"
    ],
    "FORTRANFLAGS": "<<non-serializable: CLVar>>",
    "SHFORTRANFLAGS": "<<non-serializable: CLVar>>",
    "INCFORTRANPREFIX": "-I",
    "INCFORTRANSUFFIX": "",
    "_FORTRANINCFLAGS": "$( ${_concat(INCFORTRANPREFIX, FORTRANPATH, INCFORTRANSUFFIX, __env__, RDirs, TARGET, SOURCE)} $)",
    "FORTRANCOM": "$FORTRAN -o $TARGET -c $FORTRANFLAGS $_FORTRANINCFLAGS $_FORTRANMODFLAG $SOURCES",
    "FORTRANPPCOM": "$FORTRAN -o $TARGET -c $FORTRANFLAGS $CPPFLAGS $_CPPDEFFLAGS $_FORTRANINCFLAGS $_FORTRANMODFLAG $SOURCES",
    "SHFORTRANCOM": "$SHFORTRAN -o $TARGET -c $SHFORTRANFLAGS $_FORTRANINCFLAGS $_FORTRANMODFLAG $SOURCES",
    "SHFORTRANPPCOM": "$SHFORTRAN -o $TARGET -c $SHFORTRANFLAGS $CPPFLAGS $_CPPDEFFLAGS $_FORTRANINCFLAGS $_FORTRANMODFLAG $SOURCES",
    "FORTRANMODPREFIX": "",
    "FORTRANMODSUFFIX": ".mod",
    "FORTRANMODDIR": "",
    "FORTRANMODDIRPREFIX": "-J",
    "FORTRANMODDIRSUFFIX": "",
    "_FORTRANMODFLAG": "$( ${_concat(FORTRANMODDIRPREFIX, FORTRANMODDIR, FORTRANMODDIRSUFFIX, __env__, RDirs, TARGET, SOURCE)} $)",
    "F77FLAGS": "<<non-serializable: CLVar>>",
    "SHF77FLAGS": "<<non-serializable: CLVar>>",
    "INCF77PREFIX": "-I",
    "INCF77SUFFIX": "",
    "_F77INCFLAGS": "$( ${_concat(INCF77PREFIX, F77PATH, INCF77SUFFIX, __env__, RDirs, TARGET, SOURCE)} $)",
    "F77COM": "$F77 -o $TARGET -c $F77FLAGS $_F77INCFLAGS $SOURCES",
    "F77PPCOM": "$F77 -o $TARGET -c $F77FLAGS $CPPFLAGS $_CPPDEFFLAGS $_F77INCFLAGS $SOURCES",
    "SHF77COM": "$SHF77 -o $TARGET -c $SHF77FLAGS $_F77INCFLAGS $SOURCES",
    "SHF77PPCOM": "$SHF77 -o $TARGET -c $SHF77FLAGS $CPPFLAGS $_CPPDEFFLAGS $_F77INCFLAGS $SOURCES",
    "F90FLAGS": "<<non-serializable: CLVar>>",
    "SHF90FLAGS": "<<non-serializable: CLVar>>",
    "INCF90PREFIX": "-I",
    "INCF90SUFFIX": "",
    "_F90INCFLAGS": "$( ${_concat(INCF90PREFIX, F90PATH, INCF90SUFFIX, __env__, RDirs, TARGET, SOURCE)} $)",
    "F90COM": "$F90 -o $TARGET -c $F90FLAGS $_F90INCFLAGS $_FORTRANMODFLAG $SOURCES",
    "F90PPCOM": "$F90 -o $TARGET -c $F90FLAGS $CPPFLAGS $_CPPDEFFLAGS $_F90INCFLAGS $_FORTRANMODFLAG $SOURCES",
    "SHF90COM": "$SHF90 -o $TARGET -c $SHF90FLAGS $_F90INCFLAGS $_FORTRANMODFLAG $SOURCES",
    "SHF90PPCOM": "$SHF90 -o $TARGET -c $SHF90FLAGS $CPPFLAGS $_CPPDEFFLAGS $_F90INCFLAGS $_FORTRANMODFLAG $SOURCES",
    "F95FLAGS": "<<non-serializable: CLVar>>",
    "SHF95FLAGS": "<<non-serializable: CLVar>>",
    "INCF95PREFIX": "-I",
    "INCF95SUFFIX": "",
    "_F95INCFLAGS": "$( ${_concat(INCF95PREFIX, F95PATH, INCF95SUFFIX, __env__, RDirs, TARGET, SOURCE)} $)",
    "F95COM": "$F95 -o $TARGET -c $F95FLAGS $_F95INCFLAGS $_FORTRANMODFLAG $SOURCES",
    "F95PPCOM": "$F95 -o $TARGET -c $F95FLAGS $CPPFLAGS $_CPPDEFFLAGS $_F95INCFLAGS $_FORTRANMODFLAG $SOURCES",
    "SHF95COM": "$SHF95 -o $TARGET -c $SHF95FLAGS $_F95INCFLAGS $_FORTRANMODFLAG $SOURCES",
    "SHF95PPCOM": "$SHF95 -o $TARGET -c $SHF95FLAGS $CPPFLAGS $_CPPDEFFLAGS $_F95INCFLAGS $_FORTRANMODFLAG $SOURCES",
    "F03FLAGS": "<<non-serializable: CLVar>>",
    "SHF03FLAGS": "<<non-serializable: CLVar>>",
    "INCF03PREFIX": "-I",
    "INCF03SUFFIX": "",
    "_F03INCFLAGS": "$( ${_concat(INCF03PREFIX, F03PATH, INCF03SUFFIX, __env__, RDirs, TARGET, SOURCE)} $)",
    "F03COM": "$F03 -o $TARGET -c $F03FLAGS $_F03INCFLAGS $_FORTRANMODFLAG $SOURCES",
    "F03PPCOM": "$F03 -o $TARGET -c $F03FLAGS $CPPFLAGS $_CPPDEFFLAGS $_F03INCFLAGS $_FORTRANMODFLAG $SOURCES",
    "SHF03COM": "$SHF03 -o $TARGET -c $SHF03FLAGS $_F03INCFLAGS $_FORTRANMODFLAG $SOURCES",
    "SHF03PPCOM": "$SHF03 -o $TARGET -c $SHF03FLAGS $CPPFLAGS $_CPPDEFFLAGS $_F03INCFLAGS $_FORTRANMODFLAG $SOURCES",
    "F08FLAGS": "<<non-serializable: CLVar>>",
    "SHF08FLAGS": "<<non-serializable: CLVar>>",
    "INCF08PREFIX": "-I",
    "INCF08SUFFIX": "",
    "_F08INCFLAGS": "$( ${_concat(INCF08PREFIX, F08PATH, INCF08SUFFIX, __env__, RDirs, TARGET, SOURCE)} $)",
    "F08COM": "$F08 -o $TARGET -c $F08FLAGS $_F08INCFLAGS $_FORTRANMODFLAG $SOURCES",
    "F08PPCOM": "$F08 -o $TARGET -c $F08FLAGS $CPPFLAGS $_CPPDEFFLAGS $_F08INCFLAGS $_FORTRANMODFLAG $SOURCES",
    "SHF08COM": "$SHF08 -o $TARGET -c $SHF08FLAGS $_F08INCFLAGS $_FORTRANMODFLAG $SOURCES",
    "SHF08PPCOM": "$SHF08 -o $TARGET -c $SHF08FLAGS $CPPFLAGS $_CPPDEFFLAGS $_F08INCFLAGS $_FORTRANMODFLAG $SOURCES",
    "SHFORTRAN": "$FORTRAN",
    "FORTRAN": "gfortran",
    "F77": "gfortran",
    "SHF77": "$F77",
    "F90": "gfortran",
    "SHF90": "$F90",
    "F95": "gfortran",
    "SHF95": "$F95",
    "F03": "gfortran",
    "SHF03": "$F03",
    "F08": "gfortran",
    "SHF08": "$F08",
    "AS": "ml",
    "ASFLAGS": "<<non-serializable: CLVar>>",
    "ASPPFLAGS": "$ASFLAGS",
    "ASCOM": "$AS $ASFLAGS /c /Fo$TARGET $SOURCES",
    "ASPPCOM": "$CC $ASPPFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS /c /Fo$TARGET $SOURCES",
    "AR": "lib",
    "ARFLAGS": "<<non-serializable: CLVar>>",
    "ARCOM": "${TEMPFILE('$AR $ARFLAGS /OUT:$TARGET $SOURCES','$ARCOMSTR')}",
    "DC": "dmd",
    "DCOM": "$DC $_DINCFLAGS $_DVERFLAGS $_DDEBUGFLAGS $_DFLAGS -c -of$TARGET $SOURCES",
    "_DINCFLAGS": "${_concat(DINCPREFIX, DPATH, DINCSUFFIX, __env__, RDirs, TARGET, SOURCE)}",
    "_DVERFLAGS": "${_concat(DVERPREFIX, DVERSIONS, DVERSUFFIX, __env__)}",
    "_DDEBUGFLAGS": "${_concat(DDEBUGPREFIX, DDEBUG, DDEBUGSUFFIX, __env__)}",
    "_DFLAGS": "${_concat(DFLAGPREFIX, DFLAGS, DFLAGSUFFIX, __env__)}",
    "SHDC": "$DC",
    "SHDCOM": "$DC $_DINCFLAGS $_DVERFLAGS $_DDEBUGFLAGS $_DFLAGS -c -fPIC -of$TARGET $SOURCES",
    "DPATH": [
        "#/"
    ],
    "DFLAGS": [],
    "DVERSIONS": [],
    "DDEBUG": [],
    "DINCPREFIX": "-I",
    "DINCSUFFIX": "",
    "DVERPREFIX": "-version=",
    "DVERSUFFIX": "",
    "DDEBUGPREFIX": "-debug=",
    "DDEBUGSUFFIX": "",
    "DFLAGPREFIX": "-",
    "DFLAGSUFFIX": "",
    "DFILESUFFIX": ".d",
    "DLINK": "$DC",
    "DLINKFLAGS": "<<non-serializable: CLVar>>",
    "DLINKCOM": "$DLINK -of$TARGET $DLINKFLAGS $__DRPATH $SOURCES $_DLIBDIRFLAGS $_DLIBFLAGS",
    "SHDLINK": "$DC",
    "SHDLINKFLAGS": "<<non-serializable: CLVar>>",
    "SHDLINKCOM": "$DLINK -of$TARGET $SHDLINKFLAGS $__SHDLIBVERSIONFLAGS $__DRPATH $SOURCES $_DLIBDIRFLAGS $_DLIBFLAGS",
    "DLIBLINKPREFIX": "",
    "DLIBLINKSUFFIX": ".lib",
    "_DLIBFLAGS": "${_stripixes(DLIBLINKPREFIX, LIBS, DLIBLINKSUFFIX, LIBPREFIXES, LIBSUFFIXES,  __env__)}",
    "DLIBDIRPREFIX": "-L-L",
    "DLIBDIRSUFFIX": "",
    "_DLIBDIRFLAGS": "${_concat(DLIBDIRPREFIX, LIBPATH, DLIBDIRSUFFIX, __env__, RDirs, TARGET, SOURCE)}",
    "DLIB": "lib",
    "DLIBCOM": "$DLIB $_DLIBFLAGS -c $TARGET $SOURCES $_DLIBFLAGS",
    "DLIBFLAGPREFIX": "-",
    "DLIBFLAGSUFFIX": "",
    "DRPATHPREFIX": "-L-rpath=",
    "DRPATHSUFFIX": "",
    "_DRPATH": "${_concat(DRPATHPREFIX, RPATH, DRPATHSUFFIX, __env__)}",
    "_SHDLIBVERSIONFLAGS": "$SHDLIBVERSIONFLAGS -L-soname=$_SHDLIBSONAME",
    "_SHDLIBSONAME": "${DShLibSonameGenerator(__env__,TARGET)}",
    "DShLibSonameGenerator": "<<non-serializable: _LibSonameGenerator>>",
    "SHDLIBVERSION": "$SHLIBVERSION",
    "SHDLIBVERSIONFLAGS": [],
    "MSVSPROJECTCOM": "<<non-serializable: FunctionAction>>",
    "MSVSSOLUTIONCOM": "<<non-serializable: FunctionAction>>",
    "MSVSSCONSCRIPT": "<<non-serializable: File>>",
    "MSVSSCONS": "\"C:\\Users\\Xrayez\\AppData\\Local\\Programs\\Python\\Python36-32\\python.exe\" -c \"from os.path import join; import sys; sys.path = [ join(sys.prefix, 'Lib', 'site-packages', 'scons-3.1.2'), join(sys.prefix, 'scons-3.1.2'), join(sys.prefix, 'Lib', 'site-packages', 'scons'), join(sys.prefix, 'scons') ] + sys.path; import SCons.Script; SCons.Script.main()\"",
    "MSVSSCONSFLAGS": "-C \"${MSVSSCONSCRIPT.dir.get_abspath()}\" -f ${MSVSSCONSCRIPT.name}",
    "MSVSSCONSCOM": "$MSVSSCONS $MSVSSCONSFLAGS",
    "MSVSBUILDCOM": "$MSVSSCONSCOM \"$MSVSBUILDTARGET\"",
    "MSVSREBUILDCOM": "$MSVSSCONSCOM \"$MSVSBUILDTARGET\"",
    "MSVSCLEANCOM": "$MSVSSCONSCOM -c \"$MSVSBUILDTARGET\"",
    "MSVSENCODING": "utf-8",
    "GET_MSVSPROJECTSUFFIX": "<<non-serializable: function>>",
    "GET_MSVSSOLUTIONSUFFIX": "<<non-serializable: function>>",
    "MSVSPROJECTSUFFIX": "${GET_MSVSPROJECTSUFFIX}",
    "MSVSSOLUTIONSUFFIX": "${GET_MSVSSOLUTIONSUFFIX}",
    "SCONS_HOME": null,
    "MIDL": "MIDL.EXE",
    "MIDLFLAGS": "<<non-serializable: CLVar>>",
    "MIDLCOM": "$MIDL $MIDLFLAGS /tlb ${TARGETS[0]} /h ${TARGETS[1]} /iid ${TARGETS[2]} /proxy ${TARGETS[3]} /dlldata ${TARGETS[4]} $SOURCE 2> NUL",
    "COPYSTR": "Copy file(s): \"$SOURCES\" to \"$TARGETS\"",
    "JAVASUFFIX": ".java",
    "JAR": "jar",
    "JARFLAGS": "<<non-serializable: CLVar>>",
    "_JARFLAGS": "<<non-serializable: function>>",
    "_JARMANIFEST": "<<non-serializable: function>>",
    "_JARSOURCES": "<<non-serializable: function>>",
    "_JARCOM": "$JAR $_JARFLAGS $TARGET $_JARMANIFEST $_JARSOURCES",
    "JARCOM": "${TEMPFILE('$_JARCOM','$JARCOMSTR')}",
    "JARSUFFIX": ".jar",
    "JAVAINCLUDES": [
        "C:\\Program Files\\Java\\jdk-12.0.1\\include",
        "C:\\Program Files\\Java\\jdk-12.0.1\\include\\win32"
    ],
    "JAVAC": "javac",
    "JAVACFLAGS": "<<non-serializable: CLVar>>",
    "JAVABOOTCLASSPATH": [],
    "JAVACLASSPATH": [],
    "JAVASOURCEPATH": [],
    "_javapathopt": "<<non-serializable: type>>",
    "_JAVABOOTCLASSPATH": "${_javapathopt(\"-bootclasspath\", \"JAVABOOTCLASSPATH\")} ",
    "_JAVACLASSPATH": "${_javapathopt(\"-classpath\", \"JAVACLASSPATH\")} ",
    "_JAVASOURCEPATH": "${_javapathopt(\"-sourcepath\", \"JAVASOURCEPATH\", \"_JAVASOURCEPATHDEFAULT\")} ",
    "_JAVASOURCEPATHDEFAULT": "${TARGET.attributes.java_sourcedir}",
    "_JAVACCOM": "$JAVAC $JAVACFLAGS $_JAVABOOTCLASSPATH $_JAVACLASSPATH -d ${TARGET.attributes.java_classdir} $_JAVASOURCEPATH $SOURCES",
    "JAVACCOM": "${TEMPFILE('$_JAVACCOM','$JAVACCOMSTR')}",
    "JAVACLASSSUFFIX": ".class",
    "RMIC": "rmic",
    "RMICFLAGS": "<<non-serializable: CLVar>>",
    "RMICCOM": "$RMIC $RMICFLAGS -d ${TARGET.attributes.java_lookupdir} -classpath ${SOURCE.attributes.java_classdir} ${SOURCES.attributes.java_classname}",
    "TAR": "tar",
    "TARFLAGS": "<<non-serializable: CLVar>>",
    "TARCOM": "$TAR $TARFLAGS -f $TARGET $SOURCES",
    "TARSUFFIX": ".tar",
    "ZIP": "zip",
    "ZIPFLAGS": "<<non-serializable: CLVar>>",
    "ZIPCOM": "<<non-serializable: FunctionAction>>",
    "ZIPCOMPRESSION": 8,
    "ZIPSUFFIX": ".zip",
    "ZIPROOT": "<<non-serializable: CLVar>>",
    "LINESEPARATOR": "\n",
    "TEXTFILEPREFIX": "",
    "TEXTFILESUFFIX": ".txt",
    "SUBSTFILEPREFIX": "",
    "SUBSTFILESUFFIX": "",
    "x86_libtheora_opt_gcc": false,
    "x86_libtheora_opt_vc": false,
    "arch": "",
    "bits": "64",
    "p": "",
    "platform": "windows",
    "target": "release_debug",
    "optimize": "speed",
    "tools": true,
    "use_lto": false,
    "use_precise_math_checks": false,
    "deprecated": true,
    "minizip": true,
    "xaudio2": false,
    "verbose": false,
    "progress": true,
    "warnings": "all",
    "werror": false,
    "dev": false,
    "extra_suffix": "",
    "vsproj": false,
    "macports_clang": "no",
    "disable_3d": false,
    "disable_advanced_gui": false,
    "no_editor_splash": false,
    "system_certs_path": "",
    "builtin_bullet": true,
    "builtin_certs": true,
    "builtin_enet": true,
    "builtin_freetype": true,
    "builtin_glslang": true,
    "builtin_libogg": true,
    "builtin_libpng": true,
    "builtin_libtheora": true,
    "builtin_libvorbis": true,
    "builtin_libvpx": true,
    "builtin_libwebp": true,
    "builtin_wslay": true,
    "builtin_mbedtls": true,
    "builtin_miniupnpc": true,
    "builtin_opus": true,
    "builtin_pcre2": true,
    "builtin_pcre2_with_jit": true,
    "builtin_recast": true,
    "builtin_rvo2": true,
    "builtin_squish": true,
    "builtin_vulkan": true,
    "builtin_xatlas": true,
    "builtin_zlib": true,
    "builtin_zstd": true,
    "ANDROID_NDK_ROOT": "d:\\bin\\android\\ndk\\",
    "ndk_platform": "android-18",
    "android_arch": "armv7",
    "android_neon": true,
    "mingw_prefix_32": "",
    "mingw_prefix_64": "",
    "target_win_version": "0x0601",
    "debug_symbols": "yes",
    "separate_debug_symbols": false,
    "use_mingw": false,
    "use_llvm": false,
    "use_thinlto": false,
    "module_arkit_enabled": false,
    "module_assimp_enabled": false,
    "module_basis_universal_enabled": true,
    "module_bmp_enabled": false,
    "module_bullet_enabled": false,
    "module_camera_enabled": false,
    "module_csg_enabled": false,
    "module_cvtt_enabled": true,
    "module_dds_enabled": false,
    "module_enet_enabled": false,
    "module_etc_enabled": false,
    "module_freetype_enabled": true,
    "module_gdnative_enabled": false,
    "module_gdnavigation_enabled": true,
    "module_gdscript_enabled": true,
    "module_glslang_enabled": true,
    "module_gridmap_enabled": false,
    "module_hdr_enabled": false,
    "module_jpg_enabled": true,
    "module_jsonrpc_enabled": false,
    "module_mbedtls_enabled": false,
    "module_mobile_vr_enabled": false,
    "module_mono_enabled": false,
    "module_ogg_enabled": true,
    "module_opensimplex_enabled": false,
    "module_opus_enabled": false,
    "module_pvr_enabled": false,
    "module_regex_enabled": true,
    "module_squish_enabled": false,
    "module_stb_vorbis_enabled": true,
    "module_svg_enabled": true,
    "module_tga_enabled": false,
    "module_theora_enabled": false,
    "module_tinyexr_enabled": false,
    "module_upnp_enabled": false,
    "module_vhacd_enabled": false,
    "module_visual_script_enabled": true,
    "module_vorbis_enabled": false,
    "module_webm_enabled": false,
    "module_webp_enabled": false,
    "module_webrtc_enabled": false,
    "module_websocket_enabled": false,
    "module_xatlas_unwrap_enabled": false,
    "CPPPATH": [
        "#thirdparty/freetype//include",
        "#thirdparty/libpng/",
        "#thirdparty/glad/",
        "#thirdparty/vulkan",
        "#thirdparty/vulkan/include",
        "#thirdparty/vulkan/loader",
        "#thirdparty/zstd/",
        "#thirdparty/zlib/",
        "#platform/windows",
        "#"
    ],
    "BUILDERS": "<<non-serializable: BuilderDict>>",
    "CPPDEFINES": [
        [
            "DEBUG_ENABLED"
        ],
        [
            "WINDOWS_ENABLED"
        ],
        [
            "WASAPI_ENABLED"
        ],
        [
            "WINMIDI_ENABLED"
        ],
        [
            "TYPED_METHOD_BIND"
        ],
        [
            "WIN32"
        ],
        [
            "MSVC"
        ],
        [
            "WINVER=0x0601"
        ],
        [
            "_WIN32_WINNT=0x0601"
        ],
        [
            "NOMINMAX"
        ],
        [
            "_WIN64"
        ],
        [
            "VULKAN_ENABLED"
        ],
        "TOOLS_ENABLED",
        "MINIZIP_ENABLED",
        "ZSTD_STATIC_LINKING_ONLY",
        "GLAD_ENABLED",
        "GLES_OVER_GL"
    ],
    "MSVC_FLAGS": [
        "/utf8"
    ],
    "CXXCOMSTR": [
        "\u001b[94mCompiling \u001b[95m==> \u001b[93m$SOURCE\u001b[0m"
    ],
    "CCCOMSTR": [
        "\u001b[94mCompiling \u001b[95m==> \u001b[93m$SOURCE\u001b[0m"
    ],
    "SHCCCOMSTR": [
        "\u001b[94mCompiling shared \u001b[95m==> \u001b[93m$SOURCE\u001b[0m"
    ],
    "SHCXXCOMSTR": [
        "\u001b[94mCompiling shared \u001b[95m==> \u001b[93m$SOURCE\u001b[0m"
    ],
    "ARCOMSTR": [
        "\u001b[91mLinking Static Library \u001b[95m==> \u001b[93m$TARGET\u001b[0m"
    ],
    "RANLIBCOMSTR": [
        "\u001b[91mRanlib Library         \u001b[95m==> \u001b[93m$TARGET\u001b[0m"
    ],
    "SHLINKCOMSTR": [
        "\u001b[91mLinking Shared Library \u001b[95m==> \u001b[93m$TARGET\u001b[0m"
    ],
    "LINKCOMSTR": [
        "\u001b[91mLinking Program        \u001b[95m==> \u001b[93m$TARGET\u001b[0m"
    ],
    "JARCOMSTR": [
        "\u001b[91mCreating Java Archive  \u001b[95m==> \u001b[93m$TARGET\u001b[0m"
    ],
    "JAVACCOMSTR": [
        "\u001b[94mCompiling \u001b[95m==> \u001b[93m$SOURCE\u001b[0m"
    ],
    "LIBS": [
        "<<non-serializable: NodeList>>",
        "<<non-serializable: NodeList>>",
        "<<non-serializable: NodeList>>",
        "<<non-serializable: NodeList>>",
        "<<non-serializable: NodeList>>",
        "<<non-serializable: NodeList>>",
        "<<non-serializable: NodeList>>",
        "<<non-serializable: NodeList>>",
        "<<non-serializable: NodeList>>",
        "<<non-serializable: NodeList>>",
        "<<non-serializable: NodeList>>",
        "<<non-serializable: NodeList>>",
        "<<non-serializable: NodeList>>",
        "<<non-serializable: NodeList>>",
        "<<non-serializable: NodeList>>",
        "<<non-serializable: NodeList>>",
        "<<non-serializable: NodeList>>",
        "<<non-serializable: NodeList>>",
        "<<non-serializable: NodeList>>",
        "<<non-serializable: NodeList>>",
        "<<non-serializable: NodeList>>",
        "<<non-serializable: NodeList>>"
    ],
    "check_c_headers": [
        [
            "mntent.h",
            "HAVE_MNTENT"
        ]
    ]
}

PR state

The PR is meant to be rebased after #37198, so ignore progress logic diff. I'd just like to know if something like this would be useful needed for Godot.

methods.py Outdated
Comment on lines 684 to 791
def dump(env):
# Dumps latest build information for debugging purposes and external tools.
from json import dump
def non_serializable(obj):
return "<<non-serializable: %s>>" % (type(obj).__qualname__)
with open(".scons_env.json", "w") as f:
dump(env.Dictionary(), f, indent=4, default=non_serializable)
Copy link
Contributor Author

@Xrayez Xrayez Mar 23, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SCons also provides its own env.Dump() method, but the output is pretty-printable so it's not really usable nor can be converted to a dictionary to be used by external tools, so I just serialize env.Dictionary() as JSON here.

Not everything can be serialized so those fields are replaced with <<non-serializable: %s>> markers.

Note: the env.Dump doesn't serialize non-serializable types either.

@Calinou Calinou added this to the 4.0 milestone Mar 24, 2020
@Xrayez Xrayez marked this pull request as ready for review May 27, 2020 19:44
@Xrayez
Copy link
Contributor Author

Xrayez commented May 27, 2020

@akien-mga, I've submitted a PR to SCons fellows at SCons/scons#3672 as you suggested at IRC:

Akien> For #37248, it's OK if it doesn't have a significant impact on build time, but ideally it would be best to implement support for json serialization in upstream SCons' Dump() method

In either case this PR is ready feature-wise.

@Xrayez
Copy link
Contributor Author

Xrayez commented Jun 10, 2020

I wonder whether it really makes sense to merge this PR. Given that SCons/scons#3672 is merged, by the time Godot starts to use SCons 4.0, I'll likely be using Godot 4.0-stable... I'm sort of fine patching Godot as of now, especially if this feature likely won't be cherry-picked for 3.2, so I'd have to patch the SConstruct anyways in order to benefit from this feature in 3.2. #37198 would also kind of has to be cherry-picked too for consistency, so not sure.

@akien-mga
Copy link
Member

Well it's not a lot of code, and now that the feature is being included in SCons 4.0, we can add a comment about it to eventually replace this by env.Dump(pretty="json") once we start requiring SCons 4.0 as min version.

I don't mind cherry-picking it to 3.2, it shouldn't hurt.

I expect that dumping the env contents doesn't take a significant amount of time?

@Xrayez
Copy link
Contributor Author

Xrayez commented Jun 10, 2020

I expect that dumping the env contents doesn't take a significant amount of time?

Measured with perf_counter, ~0.006 seconds on my machine, but likely much faster on non-Windows platforms anyways. 😛

if "env" in locals():
    methods.show_progress(env)
    import time
    t1 = time.perf_counter()
    methods.dump(env)
    t2 = time.perf_counter()
    print(t2 - t1) # prints 0.0058202
    Exit()

A new `methods.dump(env)` is added to dump the construction environment
used by SCons to build Godot to a `.scons_env.json`. The file can be used
for debugging purposes and any external tool.
if "env" in locals():
methods.show_progress(env)
# TODO: replace this with `env.Dump(format="json")`
# once we start requiring SCons 4.0 as min version.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added as TODO.

@akien-mga akien-mga added the cherrypick:3.x Considered for cherry-picking into a future 3.x release label Jun 10, 2020
@akien-mga akien-mga merged commit 1aeb882 into godotengine:master Jun 10, 2020
@akien-mga
Copy link
Member

Thanks!

@Xrayez Xrayez deleted the env-dump branch June 10, 2020 13:21
@akien-mga
Copy link
Member

Cherry-picked for 3.2.2.

@akien-mga akien-mga removed the cherrypick:3.x Considered for cherry-picking into a future 3.x release label Jun 10, 2020
akien-mga added a commit to akien-mga/godot that referenced this pull request Jun 11, 2020
akien-mga added a commit that referenced this pull request Jun 11, 2020
[3.2] SCons: Fix python2 compatibility after #37198 and #37248
huhund pushed a commit to huhund/godot that referenced this pull request Nov 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants