Skip to content

Commit 80bf3da

Browse files
authored
Merge pull request #245 from williamgrantuk/Cmake-fixes
Add -s flags to projects/CMake/CMakeLists.txt for newer versions of raylib
2 parents 3b129b4 + b9a49da commit 80bf3da

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

projects/CMake/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ target_link_libraries(${PROJECT_NAME} PUBLIC raylib raylib_cpp)
3535
if (${PLATFORM} STREQUAL "Web")
3636
# Tell Emscripten to build an example.html file.
3737
set_target_properties(${PROJECT_NAME} PROPERTIES SUFFIX ".html")
38+
39+
# Required linker flags for using Raylib with Emscripten
40+
target_link_options(${PROJECT_NAME} PRIVATE -sEXPORTED_FUNCTIONS=['_main','_malloc'] -sEXPORTED_RUNTIME_METHODS=ccall -sUSE_GLFW=3)
3841
endif()
3942

4043
# That's it! You should have an example executable that you can run. Have fun!

projects/CMake/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ make
1616
```
1717
mkdir build
1818
cd build
19-
emcmake cmake .. -DPLATFORM=Web -DCMAKE_BUILD_TYPE=Release -DCMAKE_EXE_LINKER_FLAGS="-s USE_GLFW=3"
19+
emcmake cmake .. -DPLATFORM=Web -DCMAKE_BUILD_TYPE=Release
2020
emmake make
2121
```
2222

0 commit comments

Comments
 (0)