|
|
@@ -35,15 +35,18 @@ set (CMAKE_SYSTEM_NAME Linux)
|
|
|
set (CMAKE_SYSTEM_VERSION 1)
|
|
|
|
|
|
# specify the cross compiler
|
|
|
+if (CMAKE_HOST_WIN32)
|
|
|
+ set (TOOL_EXT .bat)
|
|
|
+endif ()
|
|
|
if (NOT EMSCRIPTEN_ROOT_PATH AND DEFINED ENV{EMSCRIPTEN_ROOT_PATH})
|
|
|
file (TO_CMAKE_PATH $ENV{EMSCRIPTEN_ROOT_PATH} EMSCRIPTEN_ROOT_PATH)
|
|
|
endif ()
|
|
|
-if (NOT EXISTS ${EMSCRIPTEN_ROOT_PATH}/emcc)
|
|
|
+if (NOT EXISTS ${EMSCRIPTEN_ROOT_PATH}/emcc${TOOL_EXT})
|
|
|
message (FATAL_ERROR "Could not find Emscripten cross compilation tool. "
|
|
|
"Use EMSCRIPTEN_ROOT_PATH environment variable or build option to specify the location of the toolchain.")
|
|
|
endif ()
|
|
|
if (NOT EMCC_VERSION)
|
|
|
- execute_process (COMMAND ${EMSCRIPTEN_ROOT_PATH}/emcc --version RESULT_VARIABLE EXIT_CODE OUTPUT_VARIABLE EMCC_VERSION ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
|
+ execute_process (COMMAND ${EMSCRIPTEN_ROOT_PATH}/emcc${TOOL_EXT} --version RESULT_VARIABLE EXIT_CODE OUTPUT_VARIABLE EMCC_VERSION ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
|
if (EXIT_CODE EQUAL 0)
|
|
|
string (REGEX MATCH "[^ .]+\\.[^.]+\\.[^ ]+" EMCC_VERSION "${EMCC_VERSION}") # Stringify as it could be empty when an error has occured
|
|
|
else ()
|
|
|
@@ -51,9 +54,6 @@ if (NOT EMCC_VERSION)
|
|
|
endif ()
|
|
|
set (EMCC_VERSION ${EMCC_VERSION} CACHE STRING "emcc version being used in this build tree") # Cache the result even when there was error in determining the version
|
|
|
endif ()
|
|
|
-if (CMAKE_HOST_WIN32)
|
|
|
- set (TOOL_EXT .bat)
|
|
|
-endif ()
|
|
|
set (COMPILER_PATH ${EMSCRIPTEN_ROOT_PATH})
|
|
|
# ccache support could only be enabled for emcc prior to 1.31.3 when the CCACHE_CPP2 env var is also set to 1, newer emcc version could enable ccache support without this caveat (see https://github.com/kripken/emscripten/issues/3365 for more detail)
|
|
|
# The CCACHE_CPP2 env var tells ccache to fallback to use original input source file instead of preprocessed one when passing on the compilation task to the compiler proper
|