Преглед на файлове

Fix Emscripten toolchain file for determining EMCC version in Windows.

Yao Wei Tjong 姚伟忠 преди 10 години
родител
ревизия
ae59d55580
променени са 1 файла, в които са добавени 5 реда и са изтрити 5 реда
  1. 5 5
      CMake/Toolchains/emscripten.toolchain.cmake

+ 5 - 5
CMake/Toolchains/emscripten.toolchain.cmake

@@ -35,15 +35,18 @@ set (CMAKE_SYSTEM_NAME Linux)
 set (CMAKE_SYSTEM_VERSION 1)
 set (CMAKE_SYSTEM_VERSION 1)
 
 
 # specify the cross compiler
 # specify the cross compiler
+if (CMAKE_HOST_WIN32)
+    set (TOOL_EXT .bat)
+endif ()
 if (NOT EMSCRIPTEN_ROOT_PATH AND DEFINED ENV{EMSCRIPTEN_ROOT_PATH})
 if (NOT EMSCRIPTEN_ROOT_PATH AND DEFINED ENV{EMSCRIPTEN_ROOT_PATH})
     file (TO_CMAKE_PATH $ENV{EMSCRIPTEN_ROOT_PATH} EMSCRIPTEN_ROOT_PATH)
     file (TO_CMAKE_PATH $ENV{EMSCRIPTEN_ROOT_PATH} EMSCRIPTEN_ROOT_PATH)
 endif ()
 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. "
     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.")
         "Use EMSCRIPTEN_ROOT_PATH environment variable or build option to specify the location of the toolchain.")
 endif ()
 endif ()
 if (NOT EMCC_VERSION)
 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)
     if (EXIT_CODE EQUAL 0)
         string (REGEX MATCH "[^ .]+\\.[^.]+\\.[^ ]+" EMCC_VERSION "${EMCC_VERSION}")    # Stringify as it could be empty when an error has occured
         string (REGEX MATCH "[^ .]+\\.[^.]+\\.[^ ]+" EMCC_VERSION "${EMCC_VERSION}")    # Stringify as it could be empty when an error has occured
     else ()
     else ()
@@ -51,9 +54,6 @@ if (NOT EMCC_VERSION)
     endif ()
     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
     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 ()
 endif ()
-if (CMAKE_HOST_WIN32)
-    set (TOOL_EXT .bat)
-endif ()
 set (COMPILER_PATH ${EMSCRIPTEN_ROOT_PATH})
 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)
 # 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
 # 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