Skip to content

Commit 88644f5

Browse files
committed
Fixes GLFW_CONTEXT_VERSION_MAJOR ignored (#14)
Automatically set the MAX_WEBGL_VERSION when compiling with the port so that users don't have to worry about it
1 parent 27cced0 commit 88644f5

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

port/emscripten-glfw3.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ def linker_setup(ports, settings):
103103
root_path = os.path.join(ports.get_dir(), port_name)
104104
source_js_path = os.path.join(root_path, 'src', 'js', 'lib_emscripten_glfw3.js')
105105
settings.JS_LIBRARIES += [source_js_path]
106+
settings.MAX_WEBGL_VERSION = 2 # for GLFW_CONTEXT_VERSION_MAJOR to work
106107

107108

108109
# Using contrib.glfw3 to avoid installing headers into top level include path

test/demo/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ project(emscripten_glfw_demo LANGUAGES CXX)
44

55
set(target "demo")
66

7+
# the linker flag -sMAX_WEBGL_VERSION=2 is used because due to Emscripten internals,
8+
# the GLFW_CONTEXT_VERSION_MAJOR is ignored. When using the port, the flag is
9+
# automatically set so there is no need to set it.
710
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -sMAX_WEBGL_VERSION=2 -sNO_DISABLE_EXCEPTION_CATCHING -s ASSERTIONS=1 -s WASM=1 -s SAFE_HEAP=1")
811

912
add_executable(${target} src/main.cpp src/Triangle.cpp)

0 commit comments

Comments
 (0)