Browse Source

makepanda: Build fixes for emscripten

rdb 5 years ago
parent
commit
01faa8072f
2 changed files with 11 additions and 3 deletions
  1. 4 3
      makepanda/makepanda.py
  2. 7 0
      makepanda/makepandacore.py

+ 4 - 3
makepanda/makepanda.py

@@ -1795,7 +1795,7 @@ def CompileLink(dll, obj, opts):
             else:
                 cmd = cxx + ' -shared'
                 # Always set soname on Android to avoid a linker warning when loading the library.
-                if "MODULE" not in opts or GetTarget() == 'android':
+                if GetTarget() == 'android' or ("MODULE" not in opts and GetTarget() != 'emscripten'):
                     cmd += " -Wl,-soname=" + os.path.basename(dll)
                 cmd += ' -o ' + dll + ' -L' + GetOutputDir() + '/lib -L' + GetOutputDir() + '/tmp'
 
@@ -1851,6 +1851,7 @@ def CompileLink(dll, obj, opts):
             cmd += " -s WARN_ON_UNDEFINED_SYMBOLS=1"
             if GetOrigExt(dll) == ".exe":
                 cmd += " --memory-init-file 0"
+                cmd += " -s EXIT_RUNTIME=1"
 
         else:
             cmd += " -pthread"
@@ -4932,8 +4933,8 @@ if (PkgSkip("PVIEW")==0):
   if GetLinkAllStatic():
     if not PkgSkip("GL"):
       TargetAdd('pview.exe', input='libpandagl.dll')
-    if GetTarget() == "emscripten" and not PkgSkip("GLES2"):
-      TargetAdd('pview.exe', input='libp3webgldisplay.dll')
+  if GetTarget() == "emscripten" and not PkgSkip("GLES2"):
+    TargetAdd('pview.exe', input='libp3webgldisplay.dll')
 
 #
 # DIRECTORY: direct/src/directbase/

+ 7 - 0
makepanda/makepandacore.py

@@ -3613,6 +3613,13 @@ def TargetAdd(target, dummy=0, opts=[], input=[], dep=[], ipath=None, winrc=None
                 if opt in tdep.opts and opt not in t.opts:
                     t.opts.append(opt)
 
+        elif GetTarget() == 'emscripten' and ORIG_EXT[fullinput] == '.dll' and fullinput in TARGET_TABLE:
+            # Transfer over flags like -s USE_LIBPNG=1
+            tdep = TARGET_TABLE[fullinput]
+            for opt, _ in LINKFLAGS:
+                if opt in tdep.opts and opt not in t.opts:
+                    t.opts.append(opt)
+
         if x.endswith(".in"):
             # Mark the _igate.cxx file as a dependency also.
             outbase = os.path.basename(x)[:-3]