Quellcode durchsuchen

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 姚伟忠 vor 12 Jahren
Ursprung
Commit
5896e52552
1 geänderte Dateien mit 7 neuen und 1 gelöschten Zeilen
  1. 7 1
      Source/ThirdParty/LuaJIT/CMakeLists.txt

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

@@ -136,7 +136,13 @@ if (MSVC)
 else ()
     get_directory_property (TARGET_TCFLAGS COMPILE_DEFINITIONS)
     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 ()
 
 # Makefile: Build mode handling