From ea532f0e725bd68e7784189c9b7f6f7bf7f9d901 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Sat, 10 Apr 2010 02:41:39 +0100 Subject: scons: Make LLVM a black-white dependency. Now that draw depends on llvm it is very difficult to correctly handle broken llvm installations. Either the user requests LLVM and it needs to supply a working installation. Or it doesn't, and it gets no LLVM accelerate pipe drivers. --- src/gallium/auxiliary/SConscript | 2 +- src/gallium/auxiliary/draw/draw_context.h | 2 +- src/gallium/auxiliary/draw/draw_llvm.h | 4 ++-- src/gallium/auxiliary/draw/draw_private.h | 4 ++-- src/gallium/auxiliary/draw/draw_pt.c | 2 +- src/gallium/auxiliary/draw/draw_vs_llvm.c | 2 +- src/gallium/auxiliary/gallivm/lp_bld.h | 4 ++-- src/gallium/drivers/llvmpipe/SConscript | 9 ++++----- src/gallium/drivers/sw/SConscript | 8 +++----- src/gallium/state_trackers/python/SConscript | 1 - src/gallium/targets/dri-swrast/SConscript | 8 +++----- src/gallium/targets/graw-xlib/SConscript | 8 +++----- src/gallium/targets/libgl-gdi/SConscript | 6 ++---- src/gallium/targets/libgl-xlib/SConscript | 8 +++----- 14 files changed, 28 insertions(+), 40 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/SConscript b/src/gallium/auxiliary/SConscript index bd8139f1de8..3ad06003268 100644 --- a/src/gallium/auxiliary/SConscript +++ b/src/gallium/auxiliary/SConscript @@ -191,7 +191,7 @@ source = [ 'target-helpers/wrap_screen.c', ] -if drawllvm: +if env['llvm']: source += [ 'gallivm/lp_bld_alpha.c', 'gallivm/lp_bld_arit.c', diff --git a/src/gallium/auxiliary/draw/draw_context.h b/src/gallium/auxiliary/draw/draw_context.h index a0e1c1c59b9..1af4961716c 100644 --- a/src/gallium/auxiliary/draw/draw_context.h +++ b/src/gallium/auxiliary/draw/draw_context.h @@ -196,7 +196,7 @@ boolean draw_need_pipeline(const struct draw_context *draw, const struct pipe_rasterizer_state *rasterizer, unsigned prim ); -#ifdef DRAW_LLVM +#ifdef HAVE_LLVM /******************************************************************************* * LLVM integration */ diff --git a/src/gallium/auxiliary/draw/draw_llvm.h b/src/gallium/auxiliary/draw/draw_llvm.h index d1cbac4af97..28b9044a81e 100644 --- a/src/gallium/auxiliary/draw/draw_llvm.h +++ b/src/gallium/auxiliary/draw/draw_llvm.h @@ -1,5 +1,5 @@ -#ifndef DRAW_LLVM_H -#define DRAW_LLVM_H +#ifndef HAVE_LLVM_H +#define HAVE_LLVM_H #include "draw/draw_private.h" diff --git a/src/gallium/auxiliary/draw/draw_private.h b/src/gallium/auxiliary/draw/draw_private.h index 7e24e5fd6fc..da64102d9d1 100644 --- a/src/gallium/auxiliary/draw/draw_private.h +++ b/src/gallium/auxiliary/draw/draw_private.h @@ -46,7 +46,7 @@ #include "tgsi/tgsi_scan.h" -#ifdef DRAW_LLVM +#ifdef HAVE_LLVM #include #endif @@ -241,7 +241,7 @@ struct draw_context unsigned instance_id; -#ifdef DRAW_LLVM +#ifdef HAVE_LLVM LLVMExecutionEngineRef engine; #endif void *driver_private; diff --git a/src/gallium/auxiliary/draw/draw_pt.c b/src/gallium/auxiliary/draw/draw_pt.c index a60a3b2a2b1..43f6c5650a0 100644 --- a/src/gallium/auxiliary/draw/draw_pt.c +++ b/src/gallium/auxiliary/draw/draw_pt.c @@ -140,7 +140,7 @@ boolean draw_pt_init( struct draw_context *draw ) if (!draw->pt.middle.fetch_shade_emit) return FALSE; -#if DRAW_LLVM +#if HAVE_LLVM draw->pt.middle.general = draw_pt_fetch_pipeline_or_emit_llvm( draw ); #else draw->pt.middle.general = NULL; diff --git a/src/gallium/auxiliary/draw/draw_vs_llvm.c b/src/gallium/auxiliary/draw/draw_vs_llvm.c index 0c483de4071..2a3b6b39b95 100644 --- a/src/gallium/auxiliary/draw/draw_vs_llvm.c +++ b/src/gallium/auxiliary/draw/draw_vs_llvm.c @@ -40,7 +40,7 @@ #include "tgsi/tgsi_parse.h" -#ifdef DRAW_LLVM +#ifdef HAVE_LLVM struct draw_llvm_vertex_shader { struct draw_vertex_shader base; diff --git a/src/gallium/auxiliary/gallivm/lp_bld.h b/src/gallium/auxiliary/gallivm/lp_bld.h index 70a4960f913..2fa682f4009 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld.h +++ b/src/gallium/auxiliary/gallivm/lp_bld.h @@ -38,9 +38,9 @@ #include -/** Set version to 0 if missing to avoid #ifdef HAVE_LLVM everywhere */ +/** Ensure HAVE_LLVM is set to avoid #ifdef HAVE_LLVM everywhere */ #ifndef HAVE_LLVM -#define HAVE_LLVM 0x0207 +#error "HAVE_LLVM should be set with LLVM's version number, e.g. (0x0207 for 2.7)" #endif diff --git a/src/gallium/drivers/llvmpipe/SConscript b/src/gallium/drivers/llvmpipe/SConscript index f5a38d05d48..8e3267c8438 100644 --- a/src/gallium/drivers/llvmpipe/SConscript +++ b/src/gallium/drivers/llvmpipe/SConscript @@ -1,12 +1,11 @@ Import('*') -env = env.Clone() - -env.Tool('llvm') -if not env.has_key('LLVM_VERSION'): - print 'warning: LLVM not found: not building llvmpipe' +if not env['llvm']: + print 'warning: LLVM disabled: not building llvmpipe' Return() +env = env.Clone() + env.Tool('udis86') env.Append(CPPPATH = ['.']) diff --git a/src/gallium/drivers/sw/SConscript b/src/gallium/drivers/sw/SConscript index 6fbbdf3cc46..cea237aa171 100644 --- a/src/gallium/drivers/sw/SConscript +++ b/src/gallium/drivers/sw/SConscript @@ -23,11 +23,9 @@ if 'softpipe' in env['drivers']: env.Prepend(LIBS = [softpipe]) if 'llvmpipe' in env['drivers']: - env.Tool('llvm') - if 'LLVM_VERSION' in env: - env.Append(CPPDEFINES = 'GALLIUM_LLVMPIPE') - env.Tool('udis86') - env.Prepend(LIBS = [llvmpipe]) + env.Append(CPPDEFINES = 'GALLIUM_LLVMPIPE') + env.Tool('udis86') + env.Prepend(LIBS = [llvmpipe]) if 'cell' in env['drivers']: env.Append(CPPDEFINES = 'GALLIUM_CELL') diff --git a/src/gallium/state_trackers/python/SConscript b/src/gallium/state_trackers/python/SConscript index 781f54bf2b9..bff97079f6b 100644 --- a/src/gallium/state_trackers/python/SConscript +++ b/src/gallium/state_trackers/python/SConscript @@ -46,7 +46,6 @@ if 'python' in env['statetrackers']: if 'llvmpipe' in env['drivers']: env.Append(CPPDEFINES = ['HAVE_LLVMPIPE']) - env.Tool('llvm') env.Prepend(LIBS = [llvmpipe]) if 'softpipe' in env['drivers']: env.Append(CPPDEFINES = ['HAVE_SOFTPIPE']) diff --git a/src/gallium/targets/dri-swrast/SConscript b/src/gallium/targets/dri-swrast/SConscript index 94ff99a0a90..9a3838d64e2 100644 --- a/src/gallium/targets/dri-swrast/SConscript +++ b/src/gallium/targets/dri-swrast/SConscript @@ -25,11 +25,9 @@ if 'softpipe' in env['drivers']: env.Prepend(LIBS = [softpipe]) if 'llvmpipe' in env['drivers']: - env.Tool('llvm') - if 'LLVM_VERSION' in env: - env.Append(CPPDEFINES = 'GALLIUM_LLVMPIPE') - env.Tool('udis86') - env.Prepend(LIBS = [llvmpipe]) + env.Append(CPPDEFINES = 'GALLIUM_LLVMPIPE') + env.Tool('udis86') + env.Prepend(LIBS = [llvmpipe]) swrastg_sources = [ 'swrast_drm_api.c' diff --git a/src/gallium/targets/graw-xlib/SConscript b/src/gallium/targets/graw-xlib/SConscript index 24cea92f907..1b5350a9a48 100644 --- a/src/gallium/targets/graw-xlib/SConscript +++ b/src/gallium/targets/graw-xlib/SConscript @@ -33,11 +33,9 @@ if 'softpipe' in env['drivers']: env.Prepend(LIBS = [softpipe]) if 'llvmpipe' in env['drivers']: - env.Tool('llvm') - if 'LLVM_VERSION' in env: - env.Append(CPPDEFINES = 'GALLIUM_LLVMPIPE') - env.Tool('udis86') - env.Prepend(LIBS = [llvmpipe]) + env.Append(CPPDEFINES = 'GALLIUM_LLVMPIPE') + env.Tool('udis86') + env.Prepend(LIBS = [llvmpipe]) # Need this for trace, identity drivers referenced by # gallium_wrap_screen(). diff --git a/src/gallium/targets/libgl-gdi/SConscript b/src/gallium/targets/libgl-gdi/SConscript index 21b4eb2abee..a6ef1f2406a 100644 --- a/src/gallium/targets/libgl-gdi/SConscript +++ b/src/gallium/targets/libgl-gdi/SConscript @@ -27,10 +27,8 @@ if env['platform'] == 'windows': drivers = [softpipe] if 'llvmpipe' in env['drivers']: - env.Tool('llvm') - if 'LLVM_VERSION' in env: - sources = ['gdi_llvmpipe_winsys.c'] - drivers = [llvmpipe] + sources = ['gdi_llvmpipe_winsys.c'] + drivers = [llvmpipe] if not sources or not drivers: print 'warning: softpipe or llvmpipe not selected, gdi winsys disabled' diff --git a/src/gallium/targets/libgl-xlib/SConscript b/src/gallium/targets/libgl-xlib/SConscript index c1614d4a9f7..0d2ffd20709 100644 --- a/src/gallium/targets/libgl-xlib/SConscript +++ b/src/gallium/targets/libgl-xlib/SConscript @@ -50,11 +50,9 @@ if 'softpipe' in env['drivers']: env.Prepend(LIBS = [softpipe]) if 'llvmpipe' in env['drivers']: - env.Tool('llvm') - if 'LLVM_VERSION' in env: - env.Append(CPPDEFINES = 'GALLIUM_LLVMPIPE') - env.Tool('udis86') - env.Prepend(LIBS = [llvmpipe]) + env.Append(CPPDEFINES = 'GALLIUM_LLVMPIPE') + env.Tool('udis86') + env.Prepend(LIBS = [llvmpipe]) if 'cell' in env['drivers']: env.Append(CPPDEFINES = 'GALLIUM_CELL') -- cgit v1.2.3