Add -s flags to projects/CMake/CMakeLists.txt for newer versions of raylib

This commit is contained in:
William Grant
2023-07-08 20:25:31 +01:00
parent 3b129b4a8d
commit b9a49da6f3
2 changed files with 4 additions and 1 deletions

View File

@@ -35,6 +35,9 @@ target_link_libraries(${PROJECT_NAME} PUBLIC raylib raylib_cpp)
if (${PLATFORM} STREQUAL "Web")
# Tell Emscripten to build an example.html file.
set_target_properties(${PROJECT_NAME} PROPERTIES SUFFIX ".html")
# Required linker flags for using Raylib with Emscripten
target_link_options(${PROJECT_NAME} PRIVATE -sEXPORTED_FUNCTIONS=['_main','_malloc'] -sEXPORTED_RUNTIME_METHODS=ccall -sUSE_GLFW=3)
endif()
# That's it! You should have an example executable that you can run. Have fun!

View File

@@ -16,7 +16,7 @@ make
```
mkdir build
cd build
emcmake cmake .. -DPLATFORM=Web -DCMAKE_BUILD_TYPE=Release -DCMAKE_EXE_LINKER_FLAGS="-s USE_GLFW=3"
emcmake cmake .. -DPLATFORM=Web -DCMAKE_BUILD_TYPE=Release
emmake make
```