+
+
+
+ {{{ SCRIPT }}}
+
+
diff --git a/templates/cpp-template-default/proj.emscripten/main.cpp b/templates/cpp-template-default/proj.emscripten/main.cpp
new file mode 100644
index 000000000000..b265379f11bc
--- /dev/null
+++ b/templates/cpp-template-default/proj.emscripten/main.cpp
@@ -0,0 +1,40 @@
+/****************************************************************************
+ Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
+
+ https://axmolengine.github.io/
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
+ ****************************************************************************/
+
+#include "AppDelegate.h"
+#include "cocos2d.h"
+
+#include
+#include
+#include
+#include
+
+USING_NS_AX;
+
+int main(int argc, char** argv)
+{
+ // create the application instance
+ AppDelegate app;
+ return Application::getInstance()->run();
+}
diff --git a/templates/lua-template-default/CMakeLists.txt b/templates/lua-template-default/CMakeLists.txt
index 5c1c16e40b07..2d3cdfeb81a1 100644
--- a/templates/lua-template-default/CMakeLists.txt
+++ b/templates/lua-template-default/CMakeLists.txt
@@ -107,6 +107,11 @@ elseif(LINUX)
proj.linux/main.cpp
)
list(APPEND GAME_SOURCE ${common_content_files})
+elseif(EMSCRIPTEN)
+ list(APPEND GAME_SOURCE
+ proj.emscripten/main.cpp
+ )
+ list(APPEND GAME_SOURCE ${common_content_files})
elseif(WINDOWS)
if(NOT WINRT)
list(APPEND GAME_HEADER
@@ -253,3 +258,29 @@ endif()
if (NOT DEFINED BUILD_ENGINE_DONE)
ax_uwp_set_all_targets_deploy_min_version()
endif()
+
+set(GAME_RES_FOLDER "${CMAKE_CURRENT_SOURCE_DIR}/Content")
+
+if(EMSCRIPTEN)
+ set(CMAKE_C_FLAGS "-s FORCE_FILESYSTEM=1 -s FETCH=1 -s USE_GLFW=3 -s VERBOSE=1 -s USE_LIBJPEG=1 -s USE_LIBPNG=1 -s USE_ZLIB=1 -s USE_FREETYPE=1")
+ set(CMAKE_CXX_FLAGS "-s FORCE_FILESYSTEM=1 -s FETCH=1 -s USE_GLFW=3 -s VERBOSE=1 -s USE_LIBJPEG=1 -s USE_LIBPNG=1 -s USE_ZLIB=1 -s USE_FREETYPE=1")
+endif()
+
+if(EMSCRIPTEN)
+ set(CMAKE_EXECUTABLE_SUFFIX ".html")
+ target_link_options(${APP_NAME} PRIVATE
+ "-sEXPORTED_FUNCTIONS=[_main]"
+ "-sEXPORTED_RUNTIME_METHODS=[ccall,cwrap]"
+ )
+ set(EMSCRIPTEN_LINK_FLAGS "-lidbfs.js -s MIN_WEBGL_VERSION=2 -s MAX_WEBGL_VERSION=2 -s INITIAL_MEMORY=512MB --shell-file ${CMAKE_CURRENT_SOURCE_DIR}/index.html --use-preload-cache")
+ # Disable wasm, generate js build
+ # string(APPEND EMSCRIPTEN_LINK_FLAGS " -s WASM=0")
+ # string(APPEND EMSCRIPTEN_LINK_FLAGS " -s SEPARATE_DWARF_URL=https://xxx:8080/axmolwasm/axmolwasm/build/HelloLua.debug.wasm")
+ # string(APPEND EMSCRIPTEN_LINK_FLAGS " -gseparate-dwarf=HelloLua.debug.wasm")
+
+ foreach(FOLDER IN LISTS GAME_RES_FOLDER)
+ string(APPEND EMSCRIPTEN_LINK_FLAGS " --preload-file ${FOLDER}/@/")
+ endforeach()
+
+ set_target_properties(${APP_NAME} PROPERTIES LINK_FLAGS "${EMSCRIPTEN_LINK_FLAGS}")
+endif()
\ No newline at end of file
diff --git a/templates/lua-template-default/index.html b/templates/lua-template-default/index.html
new file mode 100644
index 000000000000..dc5d71b2d949
--- /dev/null
+++ b/templates/lua-template-default/index.html
@@ -0,0 +1,150 @@
+
+
+
+
+
+ Emscripten-Generated Code
+
+
+
+
+
+
+
+ {{{ SCRIPT }}}
+
+
diff --git a/tests/cpp-tests/proj.emscripten/main.cpp b/tests/cpp-tests/proj.emscripten/main.cpp
new file mode 100644
index 000000000000..b265379f11bc
--- /dev/null
+++ b/tests/cpp-tests/proj.emscripten/main.cpp
@@ -0,0 +1,40 @@
+/****************************************************************************
+ Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
+
+ https://axmolengine.github.io/
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
+ ****************************************************************************/
+
+#include "AppDelegate.h"
+#include "cocos2d.h"
+
+#include
+#include
+#include
+#include
+
+USING_NS_AX;
+
+int main(int argc, char** argv)
+{
+ // create the application instance
+ AppDelegate app;
+ return Application::getInstance()->run();
+}
diff --git a/tests/fairygui-tests/CMakeLists.txt b/tests/fairygui-tests/CMakeLists.txt
index ae85a52b7d3c..f7f8d30ddfd9 100644
--- a/tests/fairygui-tests/CMakeLists.txt
+++ b/tests/fairygui-tests/CMakeLists.txt
@@ -74,6 +74,11 @@ elseif(LINUX)
proj.linux/main.cpp
)
list(APPEND GAME_SOURCE ${common_content_files})
+elseif(EMSCRIPTEN)
+ list(APPEND GAME_SOURCE
+ proj.emscripten/main.cpp
+ )
+ list(APPEND GAME_SOURCE ${common_content_files})
elseif(WINDOWS)
if(NOT WINRT)
list(APPEND GAME_HEADER
@@ -190,3 +195,27 @@ endif()
if (NOT DEFINED BUILD_ENGINE_DONE)
ax_uwp_set_all_targets_deploy_min_version()
endif()
+
+set(GAME_RES_FOLDER "${CMAKE_CURRENT_SOURCE_DIR}/Content")
+
+if(EMSCRIPTEN)
+ set(CMAKE_C_FLAGS "-s FORCE_FILESYSTEM=1 -s FETCH=1 -s USE_GLFW=3 -s VERBOSE=1 -s USE_LIBJPEG=1 -s USE_LIBPNG=1 -s USE_ZLIB=1 -s USE_FREETYPE=1")
+ set(CMAKE_CXX_FLAGS "-s FORCE_FILESYSTEM=1 -s FETCH=1 -s USE_GLFW=3 -s VERBOSE=1 -s USE_LIBJPEG=1 -s USE_LIBPNG=1 -s USE_ZLIB=1 -s USE_FREETYPE=1")
+endif()
+
+if(EMSCRIPTEN)
+ set(CMAKE_EXECUTABLE_SUFFIX ".html")
+ target_link_options(${APP_NAME} PRIVATE
+ "-sEXPORTED_FUNCTIONS=[_main]"
+ "-sEXPORTED_RUNTIME_METHODS=[ccall,cwrap]"
+ )
+ set(EMSCRIPTEN_LINK_FLAGS "-lidbfs.js -s MIN_WEBGL_VERSION=2 -s MAX_WEBGL_VERSION=2 -s INITIAL_MEMORY=512MB --shell-file ${CMAKE_CURRENT_SOURCE_DIR}/index.html --use-preload-cache")
+ # Disable wasm, generate js build
+ # string(APPEND EMSCRIPTEN_LINK_FLAGS " -s WASM=0")
+
+ foreach(FOLDER IN LISTS GAME_RES_FOLDER)
+ string(APPEND EMSCRIPTEN_LINK_FLAGS " --preload-file ${FOLDER}/@/")
+ endforeach()
+
+ set_target_properties(${APP_NAME} PROPERTIES LINK_FLAGS "${EMSCRIPTEN_LINK_FLAGS}")
+endif()
\ No newline at end of file
diff --git a/tests/fairygui-tests/index.html b/tests/fairygui-tests/index.html
new file mode 100644
index 000000000000..dc5d71b2d949
--- /dev/null
+++ b/tests/fairygui-tests/index.html
@@ -0,0 +1,150 @@
+
+
+
+
+
+ Emscripten-Generated Code
+
+
+
+
+
+
+
+ {{{ SCRIPT }}}
+
+
diff --git a/tests/fairygui-tests/proj.emscripten/main.cpp b/tests/fairygui-tests/proj.emscripten/main.cpp
new file mode 100644
index 000000000000..b265379f11bc
--- /dev/null
+++ b/tests/fairygui-tests/proj.emscripten/main.cpp
@@ -0,0 +1,40 @@
+/****************************************************************************
+ Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
+
+ https://axmolengine.github.io/
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
+ ****************************************************************************/
+
+#include "AppDelegate.h"
+#include "cocos2d.h"
+
+#include
+#include
+#include
+#include
+
+USING_NS_AX;
+
+int main(int argc, char** argv)
+{
+ // create the application instance
+ AppDelegate app;
+ return Application::getInstance()->run();
+}
diff --git a/tests/live2d-tests/CMakeLists.txt b/tests/live2d-tests/CMakeLists.txt
index b64fcb323837..bc380c232798 100644
--- a/tests/live2d-tests/CMakeLists.txt
+++ b/tests/live2d-tests/CMakeLists.txt
@@ -74,6 +74,11 @@ elseif(LINUX)
proj.linux/main.cpp
)
list(APPEND GAME_SOURCE ${common_content_files})
+elseif(EMSCRIPTEN)
+ list(APPEND GAME_SOURCE
+ proj.emscripten/main.cpp
+ )
+ list(APPEND GAME_SOURCE ${common_content_files})
elseif(WINDOWS)
if(NOT WINRT)
list(APPEND GAME_HEADER
diff --git a/tests/live2d-tests/index.html b/tests/live2d-tests/index.html
new file mode 100644
index 000000000000..dc5d71b2d949
--- /dev/null
+++ b/tests/live2d-tests/index.html
@@ -0,0 +1,150 @@
+
+
+
+
+
+ Emscripten-Generated Code
+
+
+
+
+
+
+
+ {{{ SCRIPT }}}
+
+
diff --git a/tests/live2d-tests/proj.emscripten/main.cpp b/tests/live2d-tests/proj.emscripten/main.cpp
new file mode 100644
index 000000000000..b265379f11bc
--- /dev/null
+++ b/tests/live2d-tests/proj.emscripten/main.cpp
@@ -0,0 +1,40 @@
+/****************************************************************************
+ Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
+
+ https://axmolengine.github.io/
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
+ ****************************************************************************/
+
+#include "AppDelegate.h"
+#include "cocos2d.h"
+
+#include
+#include
+#include
+#include
+
+USING_NS_AX;
+
+int main(int argc, char** argv)
+{
+ // create the application instance
+ AppDelegate app;
+ return Application::getInstance()->run();
+}
diff --git a/tests/lua-tests/CMakeLists.txt b/tests/lua-tests/CMakeLists.txt
index 11fd2dbe5513..7be1ef48ff16 100644
--- a/tests/lua-tests/CMakeLists.txt
+++ b/tests/lua-tests/CMakeLists.txt
@@ -74,6 +74,11 @@ elseif(LINUX)
proj.linux/main.cpp
)
list(APPEND GAME_SOURCE ${common_content_files})
+elseif(EMSCRIPTEN)
+ list(APPEND GAME_SOURCE
+ proj.emscripten/main.cpp
+ )
+ list(APPEND GAME_SOURCE ${common_content_files})
elseif(WINDOWS)
if(NOT WINRT)
list(APPEND GAME_HEADER
@@ -234,3 +239,27 @@ endif()
if (NOT DEFINED BUILD_ENGINE_DONE)
ax_uwp_set_all_targets_deploy_min_version()
endif()
+
+set(GAME_RES_FOLDER "${CMAKE_CURRENT_SOURCE_DIR}/Content")
+
+if(EMSCRIPTEN)
+ set(CMAKE_C_FLAGS "-s FORCE_FILESYSTEM=1 -s FETCH=1 -s USE_GLFW=3 -s VERBOSE=1 -s USE_LIBJPEG=1 -s USE_LIBPNG=1 -s USE_ZLIB=1 -s USE_FREETYPE=1")
+ set(CMAKE_CXX_FLAGS "-s FORCE_FILESYSTEM=1 -s FETCH=1 -s USE_GLFW=3 -s VERBOSE=1 -s USE_LIBJPEG=1 -s USE_LIBPNG=1 -s USE_ZLIB=1 -s USE_FREETYPE=1")
+endif()
+
+if(EMSCRIPTEN)
+ set(CMAKE_EXECUTABLE_SUFFIX ".html")
+ target_link_options(${APP_NAME} PRIVATE
+ "-sEXPORTED_FUNCTIONS=[_main]"
+ "-sEXPORTED_RUNTIME_METHODS=[ccall,cwrap]"
+ )
+ set(EMSCRIPTEN_LINK_FLAGS "-lidbfs.js -s MIN_WEBGL_VERSION=2 -s MAX_WEBGL_VERSION=2 -s INITIAL_MEMORY=512MB --shell-file ${CMAKE_CURRENT_SOURCE_DIR}/index.html --use-preload-cache")
+ # Disable wasm, generate js build
+ # string(APPEND EMSCRIPTEN_LINK_FLAGS " -s WASM=0")
+
+ foreach(FOLDER IN LISTS GAME_RES_FOLDER)
+ string(APPEND EMSCRIPTEN_LINK_FLAGS " --preload-file ${FOLDER}/@/")
+ endforeach()
+
+ set_target_properties(${APP_NAME} PROPERTIES LINK_FLAGS "${EMSCRIPTEN_LINK_FLAGS}")
+endif()
\ No newline at end of file
diff --git a/tests/lua-tests/index.html b/tests/lua-tests/index.html
new file mode 100644
index 000000000000..dc5d71b2d949
--- /dev/null
+++ b/tests/lua-tests/index.html
@@ -0,0 +1,150 @@
+
+
+
+
+
+ Emscripten-Generated Code
+
+
+
+