[Piglit] [RFC] make: Make util libraries shared in non-windows systems
Kenneth Graunke
kenneth at whitecape.org
Sat Jun 2 12:56:49 PDT 2012
On 05/22/2012 04:39 PM, Chad Versace wrote:
> On 05/21/2012 11:17 AM, Pauli Nieminen wrote:
>> Incremental builds take long time linking tests if utilities are
>> modified. The link time can be eliminate if libraries are made shared.
>
>> Shared libraries need to specify symbols that are excepted to be
>> declared in executeable as weak to allow linking without symbols that
>> aren't used in runtime.
>
>> Windows has limitation that shared library can't have programs main
>> function that forces windows to use static libraries.
>
>> Signed-off-by: Pauli Nieminen <pauli.nieminen at linux.intel.com>
>> ---
>> cmake/piglit_util.cmake | 4 ++++
>> tests/util/CMakeLists.txt | 1 +
>> tests/util/piglit-framework.c | 14 ++++++++++++++
>> tests/util/piglit-glx-util.c | 5 +++++
>> 4 files changed, 24 insertions(+), 0 deletions(-)
>
>> diff --git a/cmake/piglit_util.cmake b/cmake/piglit_util.cmake
>> index 0daaad2..9d28036 100644
>> --- a/cmake/piglit_util.cmake
>> +++ b/cmake/piglit_util.cmake
>> @@ -75,7 +75,11 @@ endfunction(piglit_add_executable)
>> function(piglit_add_library name)
>
>> list(REMOVE_AT ARGV 0)
>> +if(WIN32)
>> add_library(${name} ${ARGV})
>> +else(WIN32)
>> + add_library(${name} SHARED ${ARGV})
>> +endif(WIN32)
>> add_dependencies(${name} piglit_dispatch_gen)
>
> This indentation style looks like the style of preprocessor
> indentation, but there's no need for that. It should be indented as normal.
>
> function(piglit_add_libarary ...)
> ...
> if(WIN32)
> add_library(...)
> else(WIN32)
> ...
>
> Nice. I tested this patch by making a small change to
> piglit-util.c then running make, before and after
> the patch. The patch nearly halved the build time
> on my 4-core Sandybridge machine.
>
>
> before:
> real 1m12.053s
> user 2m45.119s
> sys 0m45.084s
>
> after:
> real 0m44.927s
> user 1m45.360s
> sys 0m36.464s
>
> Ken and I discussed removing the main() from piglitutil and
> requiring that each test define its own. Once that is complete,
> we should be able to use a dll on Windows too.
>
> Other than the indentation quibble,
> Reviewed-by: Chad Versace <chad.versace at linux.intel.com>
Not only that, but this patch reduces the size of the piglit/bin
directory from 1.4GB to 27MB. Yes, that's right. GB to MB.
Previously, a compiled version of Piglit was taking up more disk space
than a compiled version of the Linux kernel, complete with full git
history. That's ridiculous.
Acked-by: Kenneth Graunke <kenneth at whitecape.org>
Pauli, do you plan on pushing this, or should I?
More information about the Piglit
mailing list