1
# On Unix platforms, we must specify the absolute path to emcc for cmake, having emcc in PATH will cause cmake to fail finding it.
2
# The user must set the EMSCRIPTEN variable to point to the Emscripten root folder.
4
# Try locating Emscripten root directory based on the location of this toolchain file.
5
get_filename_component(GUESS_EMSCRIPTEN_ROOT_PATH "${CMAKE_CURRENT_LIST_FILE}/../../.." ABSOLUTE)
6
if (EXISTS "${GUESS_EMSCRIPTEN_ROOT_PATH}/emcc")
7
set(EMSCRIPTEN_ROOT_PATH "${GUESS_EMSCRIPTEN_ROOT_PATH}")
10
# If not found, try if the environment variable Emscripten was set.
11
if ("${EMSCRIPTEN_ROOT_PATH}" STREQUAL "")
12
if ("$ENV{EMSCRIPTEN}" STREQUAL "")
13
message(ERROR "Could not locate emcc and the environment variable EMSCRIPTEN has not been set! Please point it to Emscripten root directory!")
15
set(EMSCRIPTEN_ROOT_PATH "$ENV{EMSCRIPTEN}")
19
set(CMAKE_C_COMPILER "${EMSCRIPTEN_ROOT_PATH}/emcc")
20
set(CMAKE_CXX_COMPILER "${EMSCRIPTEN_ROOT_PATH}/em++")
21
set(CMAKE_AR "${EMSCRIPTEN_ROOT_PATH}/emar")
22
set(CMAKE_RANLIB "${EMSCRIPTEN_ROOT_PATH}/emranlib")
24
include(${EMSCRIPTEN_ROOT_PATH}/cmake/Platform/Emscripten.cmake)