From 700c38b09b3163d1d789d778137b939de9c647e2 Mon Sep 17 00:00:00 2001 From: Pauli Nieminen Date: Sat, 19 May 2012 01:20:08 +0300 Subject: make: Make util libraries shared in non-windows systems 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 Reviewed-by: Chad Versace Acked-by: Kenneth Graunke --- cmake/piglit_util.cmake | 6 +++++- tests/util/CMakeLists.txt | 1 + tests/util/piglit-framework.c | 14 ++++++++++++++ tests/util/piglit-glx-util.c | 5 +++++ 4 files changed, 25 insertions(+), 1 deletion(-) diff --git a/cmake/piglit_util.cmake b/cmake/piglit_util.cmake index 0daaad2c..fccbadd5 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) - add_library(${name} ${ARGV}) + if(WIN32) + add_library(${name} ${ARGV}) + else(WIN32) + add_library(${name} SHARED ${ARGV}) + endif(WIN32) add_dependencies(${name} piglit_dispatch_gen) endfunction(piglit_add_library) diff --git a/tests/util/CMakeLists.txt b/tests/util/CMakeLists.txt index e69127d0..5ebbb819 100644 --- a/tests/util/CMakeLists.txt +++ b/tests/util/CMakeLists.txt @@ -26,6 +26,7 @@ if(OPENGL_egl_LIBRARY) ${UTIL_SOURCES} piglit-util-egl.c ) + link_libraries(${OPENGL_egl_LIBRARY}) endif(OPENGL_egl_LIBRARY) if(USE_WAFFLE) diff --git a/tests/util/piglit-framework.c b/tests/util/piglit-framework.c index adbac094..0b43313a 100644 --- a/tests/util/piglit-framework.c +++ b/tests/util/piglit-framework.c @@ -46,6 +46,20 @@ unsigned piglit_winsys_fbo = 0; static int piglit_window; static enum piglit_result result; +#ifndef _WIN32 +__attribute__((weak)) int piglit_width = 100; +__attribute__((weak)) int piglit_height = 100; +__attribute__((weak)) int piglit_window_mode = GLUT_RGB | GLUT_DOUBLE; + +__attribute__((weak)) enum piglit_result piglit_display(void) +{ + return PIGLIT_FAIL; +} +__attribute__((weak)) void piglit_init(int argc, char **argv) +{ +} +#endif + static void display(void) { diff --git a/tests/util/piglit-glx-util.c b/tests/util/piglit-glx-util.c index df54c503..069ea72d 100644 --- a/tests/util/piglit-glx-util.c +++ b/tests/util/piglit-glx-util.c @@ -34,6 +34,11 @@ int piglit_automatic; +#ifndef _WIN32 +__attribute__((weak)) int piglit_width = 100; +__attribute__((weak)) int piglit_height = 100; +#endif + Display * piglit_get_glx_display() { -- cgit v1.2.3