Files
cppcourse/deps/Emscripten.cmake
T
2026-10-04 22:48:25 +02:00

51 lines
1.8 KiB
CMake

# ==============================================================================
# Emscripten Configuration
# ==============================================================================
# Emscripten-specific compile definitions, options, and link flags.
# Mirrors the build steps from hellotext (dev/CMakeLists.txt).
#
# Variables set:
# EMSCRIPTEN_DEFINITIONS - Preprocessor definitions for Emscripten
# EMSCRIPTEN_COMPILE_OPTS - Compile flags for Emscripten
# EMSCRIPTEN_LINK_OPTS - Link flags for Emscripten
#
# Requires: Platform.cmake (IS_EMSCRIPTEN)
# ==============================================================================
# ------------------------------------------------------------------------------
# Compile Definitions
# ------------------------------------------------------------------------------
set(EMSCRIPTEN_DEFINITIONS
"GL_GLEXT_PROTOTYPES=1"
"GL3_PROTOTYPES=1"
"EGL_EGLEXT_PROTOTYPES=1"
"ASIO_DISABLE_THREADS"
)
# ------------------------------------------------------------------------------
# Compile Options
# ------------------------------------------------------------------------------
set(EMSCRIPTEN_COMPILE_OPTS
"-pthread"
"-fexceptions"
)
# ------------------------------------------------------------------------------
# Link Options
# ------------------------------------------------------------------------------
set(EMSCRIPTEN_LINK_OPTS
"-sLEGACY_GL_EMULATION=0"
"-sUSE_WEBGL2=1"
"-sFULL_ES3=1"
"-fexceptions"
"-sALLOW_MEMORY_GROWTH"
"-sFETCH"
)
# ------------------------------------------------------------------------------
# Apply Flags
# ------------------------------------------------------------------------------
add_compile_definitions(${EMSCRIPTEN_DEFINITIONS})
add_compile_options(${EMSCRIPTEN_COMPILE_OPTS})
add_link_options(${EMSCRIPTEN_LINK_OPTS})