feat: C++ CMake template

This commit is contained in:
2026-10-04 22:48:25 +02:00
parent 425713fb49
commit e487e66f64
38 changed files with 2385 additions and 0 deletions
+50
View File
@@ -0,0 +1,50 @@
# ==============================================================================
# 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})