summaryrefslogtreecommitdiffhomepage
path: root/cmake
diff options
context:
space:
mode:
authorhristo <[email protected]>2020-12-13 21:29:47 +0200
committerGitHub <[email protected]>2020-12-13 20:29:47 +0100
commit6e79476650321cd08c6814a304887d378b54799f (patch)
treef4a6661b55a02cbf45db88713bf22b879198894b /cmake
parent11ebb54674bd78bc02ce3cf4e0e2eab96fe22f88 (diff)
downloadraylib-6e79476650321cd08c6814a304887d378b54799f.tar.gz
raylib-6e79476650321cd08c6814a304887d378b54799f.zip
Fixed the build for web using CMake. (#1452)
* 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. * Cleaned up the additional variables (they are not important) * Added more improvements to cmakelists Added the option to use the system provided Emscripten toolchain to be more uniform with other libraries. Fixed and issue which prevented example being built from cmake and also building with html extensions properly. * Fixed ENUM to STRING because of a missed warning
Diffstat (limited to 'cmake')
-rw-r--r--cmake/emscripten.cmake16
1 files changed, 12 insertions, 4 deletions
diff --git a/cmake/emscripten.cmake b/cmake/emscripten.cmake
index 621ae787..1780dee9 100644
--- a/cmake/emscripten.cmake
+++ b/cmake/emscripten.cmake
@@ -1,12 +1,20 @@
SET(CMAKE_SYSTEM_NAME Linux)
+SET(CMAKE_SYSTEM_PROCESSOR x86)
+
+if (CMAKE_HOST_WIN32)
+ SET(EMSCRIPTEN_EXTENSION ".bat")
+else ()
+ SET(EMSCRIPTEN_EXTENSION "")
+endif()
+
+SET(CMAKE_C_COMPILER emcc${EMSCRIPTEN_EXTENSION})
+SET(CMAKE_CXX_COMPILER em++${EMSCRIPTEN_EXTENSION})
-SET(CMAKE_C_COMPILER emcc)
-SET(CMAKE_CXX_COMPILER em++)
if(NOT DEFINED CMAKE_AR)
- find_program(CMAKE_AR NAMES emar)
+ find_program(CMAKE_AR NAMES emar${EMSCRIPTEN_EXTENSION})
endif()
if(NOT DEFINED CMAKE_RANLIB)
- find_program(CMAKE_RANLIB NAMES emranlib)
+ find_program(CMAKE_RANLIB NAMES emranlib${EMSCRIPTEN_EXTENSION})
endif()
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)