web.cmake 1015 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. function( web_options )
  10. # web options
  11. endfunction()
  12. function( web_generate )
  13. target_compile_definitions(${TARGET_NAME}
  14. PUBLIC
  15. WEB_ENABLED
  16. UNIX_ENABLED
  17. )
  18. target_compile_options( ${TARGET_NAME}
  19. PUBLIC
  20. -sSIDE_MODULE
  21. -sSUPPORT_LONGJMP=wasm
  22. -fno-exceptions
  23. $<${THREADS_ENABLED}:-sUSE_PTHREADS=1>
  24. )
  25. target_link_options( ${TARGET_NAME}
  26. INTERFACE
  27. -sWASM_BIGINT
  28. -sSUPPORT_LONGJMP=wasm
  29. -fvisibility=hidden
  30. -shared
  31. )
  32. common_compiler_flags()
  33. endfunction()