[Piglit] [RFC] make: Make util libraries shared in non-windows systems
Chad Versace
chad.versace at linux.intel.com
Tue May 22 16:39:58 PDT 2012
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
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>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.19 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iQIcBAEBAgAGBQJPvCPNAAoJEAIvNt057x8ir3MQALWd2YN29U2GvM8KCY9Xfmv3
kChjy0m5K3W5nQEsJW/+JtMzO/CHrmSIuI2UG2zYY+Nfzj8mSJZBdo+Tb/uI6S2x
NOk8rkSsjn9n4kCo8CcYTC28CIRQw/uk/sbHHpos6D1L228N5c1N54ca5XbXRNyV
0k4I3OwN81uUL+N+DFrFBXe07Mfk8jB46V0iZZvDJlvWm5fDn94CFoSJpWx8uOOC
MovpaWNZsa8v8wdt7Di4KA+7wGXzO6OiuaJijr2XIGi0tSlRp5rwqQ+/FTAurFXj
CBn2r05dELluTSOsBZG3iBoP1RihaQOYPJxgadasL7EH+BOvCv1gg/n8qMQ1+zIM
yrr+lcJ0Km4dM39GTqlMAAAur0x2UQcFXmkYVAgVKhidTdv/5kAqqdC9US07YMD2
t7nkgend7xcfFwDhzuIUhUdeUPxPFL4F6kMGSICZ5c8ATzE4EAc567c12wQfLadV
m+yQnr4g/9bzZZXBUiHOF3TKouRn6hbJ5Ub1OQveLGv388TDl1rwQ+f/rri6JNRr
mcQKZysGBnBzjJaC9bsxwpsobqIQrgionp0eTI7TtPBRoYtt447Gw0d0Zv0dMoIs
Gc/33N/66JsEgxP9AgGXaizSmREEYzNEKmozjLRIfjYqWtn9KGWpOKobyizbdu66
krvE4i181fj4wKmfk/bh
=g4Ce
-----END PGP SIGNATURE-----
More information about the Piglit
mailing list