web.cmake 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. #[=======================================================================[.rst:
  2. Web
  3. ---
  4. This file contains functions for options and configuration for targeting the
  5. Web platform
  6. ]=======================================================================]
  7. # Emscripten requires this hack for use of the SHARED option
  8. set(CMAKE_PROJECT_godot-cpp_INCLUDE cmake/emsdkHack.cmake)
  9. #[==============================[ Web Options ]==============================]
  10. function(web_options)
  11. endfunction()
  12. #[===========================[ Target Generation ]===========================]
  13. function(web_generate)
  14. target_compile_definitions(godot-cpp PUBLIC WEB_ENABLED UNIX_ENABLED)
  15. target_compile_options(
  16. godot-cpp
  17. PUBLIC #
  18. -sSIDE_MODULE
  19. -sSUPPORT_LONGJMP=wasm
  20. $<${THREADS_ENABLED}:-sUSE_PTHREADS=1>
  21. )
  22. target_link_options(
  23. godot-cpp
  24. INTERFACE #
  25. -sWASM_BIGINT
  26. -sSUPPORT_LONGJMP=wasm
  27. -fvisibility=hidden
  28. -shared
  29. )
  30. common_compiler_flags()
  31. endfunction()