Jelajahi Sumber

Fix Web build. EMCC version 1.37.25 requires explicit runtime exports.

Yao Wei Tjong 姚伟忠 8 tahun lalu
induk
melakukan
a075fd950f
1 mengubah file dengan 5 tambahan dan 5 penghapusan
  1. 5 5
      CMake/Modules/UrhoCommon.cmake

+ 5 - 5
CMake/Modules/UrhoCommon.cmake

@@ -662,11 +662,11 @@ else ()
                     set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -s USE_PTHREADS=1")
                     set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s USE_PTHREADS=1")
                 endif ()
-                # Prior to version 1.31.3 emcc does not consistently add the cpp standard and remove Emscripten-specific compiler flags
-                # before passing on the work to the underlying LLVM/Clang compiler, this has resulted in preprocessing error when enabling the PCH and ccache
-                # (See https://github.com/kripken/emscripten/issues/3365 for more detail)
-                if (EMSCRIPTEN_EMCC_VERSION VERSION_LESS 1.31.3)
-                    set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++03")
+                # Since version 1.37.25 emcc reduces default runtime exports, but we need "Pointer_stringify" so it needs to be explicitly declared now
+                # (See https://github.com/kripken/emscripten/commit/3bc1f9f08b9f420680124af703c787244468cedc for more detail)
+                if (NOT EMSCRIPTEN_EMCC_VERSION VERSION_LESS 1.37.25)
+                    set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s EXTRA_EXPORTED_RUNTIME_METHODS=\"['Pointer_stringify']\"")
+                    set (CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -s EXTRA_EXPORTED_RUNTIME_METHODS=\"['Pointer_stringify']\"")
                 endif ()
                 set (CMAKE_C_FLAGS_RELEASE "-Oz -DNDEBUG")
                 set (CMAKE_CXX_FLAGS_RELEASE "-Oz -DNDEBUG")