raylib/cmake/emscripten.cmake
Hristo Stamenov 191d261393 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.
2020-12-08 15:38:00 +02:00

32 lines
768 B
CMake

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()
if(NOT DEFINED CMAKE_AR)
find_program(CMAKE_AR NAMES emar)
endif()
if(NOT DEFINED CMAKE_RANLIB)
find_program(CMAKE_RANLIB NAMES emranlib)
endif()
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)