Hello,

I would like to share my experience about speed up package with BundleUtilities 
on Windows host using mingw32 env.
My test setup :
        - Windows 7
        - cmake 3.4.1
        - msys2 i686-20160205
        
Currently my project take about 40 min to package. This is not acceptable. The 
main reason is about deep dependencies analyse with objdump.

1/ There is already a patch trying to resolve this issue : 
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f01a8823 
<https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f01a8823>
But this patch use grep. grep is a unix utility not provided by Windows.
grep could be replaced by findstr on Windows. This way we can achieve the same 
level of filtering with the same criteria.


2/ Regarding fixup_bundle flow, we can observe multi recursive analyse call to 
the same library. This is an huge time consumer. 
This simple patch disable analyse of already processed libraries. (The time to 
package my project drop down to 4 min with this patch)

--- GetPrerequisites.cmake      2016-04-15 15:41:21.000000000 +0200
+++ GetPrerequisites.cmake.new  2016-06-18 17:36:19.000000000 +0200

@@ -727,7 +727,11 @@
     set(gp_regex_fallback "")
     set(gp_regex_cmp_count 1)
     # objdump generaates copious output so we create a grep filter to 
pre-filter results
-    find_program(gp_grep_cmd grep)
+    if(WIN32)
+      find_program(gp_grep_cmd findstr)
+    else()
+      find_program(gp_grep_cmd grep)
+    endif()
     if(gp_grep_cmd)
       set(gp_cmd_maybe_filter COMMAND ${gp_grep_cmd} "^[[:blank:]]*DLL Name: ")
     endif()
@@ -920,9 +924,18 @@
     list(SORT ${prerequisites_var})
   endif()
   if(${recurse})
+    GET_PROPERTY(MyLocalVariable GLOBAL PROPERTY MY_PREREQUISE)
+    list(APPEND analysed ${MyLocalVariable} ${target})
+    list(REMOVE_DUPLICATES analysed)    
+    SET_PROPERTY(GLOBAL PROPERTY MY_PREREQUISE ${analysed})
+
     set(more_inputs ${unseen_prereqs})
     foreach(input ${more_inputs})
-      get_prerequisites("${input}" ${prerequisites_var} ${exclude_system} 
${recurse} "${exepath}" "${dirs}" "${rpaths}")
+      GET_PROPERTY(MyTmp GLOBAL PROPERTY MY_PREREQUISE)
+      list (FIND MyTmp ${input} is_found)
+      if(${is_found} EQUAL -1)
+       get_prerequisites("${input}" ${prerequisites_var} ${exclude_system} 
${recurse} "${exepath}" "${dirs}" "${rpaths}")
+      endif()
     endforeach()
   endif()
 
Laurent
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers

Reply via email to