Browse Source

Filter target architecture information if the tool is available.

The initial target architecture detection for LuaJIT on Raspberry Pi native build was painfully slow due to the amount of output produced by compiler.
The filter reduces the number of output rows and speeds up the process significantly.
Yao Wei Tjong 姚伟忠 12 years ago
parent
commit
5896e52552
1 changed files with 7 additions and 1 deletions
  1. 7 1
      Source/ThirdParty/LuaJIT/CMakeLists.txt

+ 7 - 1
Source/ThirdParty/LuaJIT/CMakeLists.txt

@@ -136,7 +136,13 @@ if (MSVC)
 else ()
 else ()
     get_directory_property (TARGET_TCFLAGS COMPILE_DEFINITIONS)
     get_directory_property (TARGET_TCFLAGS COMPILE_DEFINITIONS)
     string (REPLACE ";" ";-D" TARGET_TCFLAGS ";${TARGET_TCFLAGS}")
     string (REPLACE ";" ";-D" TARGET_TCFLAGS ";${TARGET_TCFLAGS}")
-    execute_process (COMMAND ${CMAKE_C_COMPILER} ${TARGET_TCFLAGS} -E ${CMAKE_CURRENT_SOURCE_DIR}/src/lj_arch.h -dM OUTPUT_VARIABLE TARGET_TESTARCH ERROR_QUIET)
+    execute_process (COMMAND egrep -V RESULT_VARIABLE EGREP_EXIT_CODE OUTPUT_QUIET ERROR_QUIET)    
+    if (EGREP_EXIT_CODE EQUAL 0)
+        execute_process (COMMAND ${CMAKE_C_COMPILER} ${TARGET_TCFLAGS} -E ${CMAKE_CURRENT_SOURCE_DIR}/src/lj_arch.h -dM
+            COMMAND egrep "LJ_|MIPSEL|__SSE__" OUTPUT_VARIABLE TARGET_TESTARCH ERROR_QUIET)
+    else ()
+        execute_process (COMMAND ${CMAKE_C_COMPILER} ${TARGET_TCFLAGS} -E ${CMAKE_CURRENT_SOURCE_DIR}/src/lj_arch.h -dM OUTPUT_VARIABLE TARGET_TESTARCH ERROR_QUIET)
+    endif ()
 endif ()
 endif ()
 
 
 # Makefile: Build mode handling
 # Makefile: Build mode handling