Fixed the build for web using CMake.

I found that the build for me was failing and I added some if defined checks in the core.c file where the glfwSetWindowAttrib was used. (error: implicit declaration of function 'glfwSetWindowAttrib' is invalid in C99 [-Werror,-Wimplicit-function-declaration])

I also changed some values in the toolchain file so that it correctly uses the .bat files when on windows.
This commit is contained in:
Hristo Stamenov 2020-12-08 15:38:00 +02:00
commit 191d261393

View file

@ -1,7 +1,24 @@
SET(CMAKE_SYSTEM_NAME Linux)
SET(CMAKE_SYSTEM_PROCESSOR x86)
SET(CMAKE_CROSSCOMPILING TRUE)
SET_PROPERTY(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE)
# Unset WIN32 and APPLE
SET(WIN32)
SET(APPLE)
# Emscripten is able to mimic Unix systems
SET(UNIX 1)
if (CMAKE_HOST_WIN32)
SET(CMAKE_C_COMPILER "emcc.bat")
SET(CMAKE_CXX_COMPILER "em++.bat")
else ()
SET(CMAKE_C_COMPILER "emcc")
SET(CMAKE_CXX_COMPILER "em++")
endif()
SET(CMAKE_C_COMPILER emcc)
SET(CMAKE_CXX_COMPILER em++)
if(NOT DEFINED CMAKE_AR)
find_program(CMAKE_AR NAMES emar)
endif()