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**_

불러오는 중...
취소
저장