Updated Working for Web (HTML5) (markdown)

master
Ray 4年前
コミット
1bcdf1dbe9
1個のファイルの変更22行の追加0行の削除
  1. +22
    -0
      Working-for-Web-(HTML5).md

+ 22
- 0
Working-for-Web-(HTML5).md

@ -219,3 +219,25 @@ if __name__ == '__main__':
Finally, access your game in the browser using:
localhost:8080/project_name.html
### Building with CLion/CMake/Emscripten for Web
Use the following **CMake options** (find them under **CLion > Preferences > Build,Execution,Deployment > CMake**)
```
-DCMAKE_TOOLCHAIN_FILE=<YOUR PATH HERE>/emsdk/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake
-DPLATFORM=Web
```
Do not use the **-S, -H, -B** options mentioned in the wiki because they get in the way. **-B build** in particular was preventing **CLion** from finding the generated files (because it was creating an additional build directory inside CLion's own directory).
Included this snippet at the top of `CMakeLists.txt`, with no changes whatsoever:
```
if (EMSCRIPTEN)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -s USE_GLFW=3 -s ASSERTIONS=1 -s WASM=1 -s ASYNCIFY")
set(CMAKE_EXECUTABLE_SUFFIX ".html") # This line is used to set your executable to build with the emscripten html template so taht you can directly open it.
endif ()
```
_This was tested under both **macOS Catalina 10.15.7** and **Windows 10** with **CLion 2020.2** and **Emscripten 2.0.13**_

読み込み中…
キャンセル
保存