Skip to content

Commit

Permalink
Fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
W2Wizard authored Oct 8, 2024
1 parent bfe8f5e commit 0a1e773
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,18 @@ else()
set(CCSHADER ${TOOLS_DIR}/compile_shader.bat)
endif()

if(EMSCRIPTEN)
set(EMSCRIPTEN_VALUE 1)
else()
set(EMSCRIPTEN_VALUE 0)
endif()

# Add custom command for fragment shader
add_custom_command(
COMMENT "Building fragment shader"
DEPENDS ${PROJECT_SOURCE_DIR}/shaders/default.frag
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/mlx_frag_shader.c
COMMAND ${CCSHADER} ${PROJECT_SOURCE_DIR}/shaders/default.frag ${EMSCRIPTEN} > ${CMAKE_CURRENT_BINARY_DIR}/mlx_frag_shader.c
COMMAND ${CCSHADER} ${PROJECT_SOURCE_DIR}/shaders/default.frag ${EMSCRIPTEN_VALUE} > ${CMAKE_CURRENT_BINARY_DIR}/mlx_frag_shader.c
VERBATIM
PRE_BUILD
USES_TERMINAL
Expand All @@ -85,7 +91,7 @@ add_custom_command(
COMMENT "Building vertex shader"
DEPENDS ${PROJECT_SOURCE_DIR}/shaders/default.vert
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/mlx_vert_shader.c
COMMAND ${CCSHADER} ${PROJECT_SOURCE_DIR}/shaders/default.vert ${EMSCRIPTEN} > ${CMAKE_CURRENT_BINARY_DIR}/mlx_vert_shader.c
COMMAND ${CCSHADER} ${PROJECT_SOURCE_DIR}/shaders/default.vert ${EMSCRIPTEN_VALUE} > ${CMAKE_CURRENT_BINARY_DIR}/mlx_vert_shader.c
VERBATIM
PRE_BUILD
USES_TERMINAL
Expand Down

0 comments on commit 0a1e773

Please sign in to comment.