SimpleITK / SimpleITKPythonPackage

A setup script to generate a Python Wheels
17 stars 11 forks source link

Enable "hidden" visibility to reduce wheel size #15

Open blowekamp opened 7 years ago

blowekamp commented 7 years ago

The current wheel size is nearly 50MB for 64-bit linux. This is the size limit of PyPi. With correctly specified hidden visibility flags, the size can be reduce to ~38MB.

Previous release were manually configured with:

  CMAKE_CXX_FLAGS:STRING=-fvisibility=hidden -fvisibility-inlines-hidden
  CMAKE_C_FLAGS:STRING=-fvisibility=hidden

The newer strategy has been to use the related CMake visibility presets. Correctness with the recent changes in ITK and how SimpleITK interacts with these properties needs to be tests and reviewed in the current SimpleITK master.

It is planned that explicitly setting the following would be best:

 -DCMAKE_VISIBILITY_INLINES_HIDDEN:BOOL=ON
 -DCMAKE_C_VISIBILITY_PRESET:STRING=hidden
 -DCMAKE_CXX_VISIBILITY_PRESET:STRING=hidden

This is under the assumption that the packaging only produces a single shared library.

blowekamp commented 7 years ago

Recent commits in SimpleITK should improve hiding of symbols: SimpleITK/SimpleITK@70470a733245c95636153b7a65ca3657f89ebf0f

Need to update the package version and determine the size of the package distribution.

blowekamp commented 7 years ago

Additionally, the Python Library was not being stripped of symbols. Pull request #19 adresses the stripping issue.