1b8e80941SmrgImport('*')
2b8e80941Smrg
3b8e80941Smrgenv = env.Clone()
4b8e80941Smrg
5b8e80941Smrgenv.Prepend(CPPPATH = [
6b8e80941Smrg    '#src/mapi',
7b8e80941Smrg    '#src/mesa',
8b8e80941Smrg    #Dir('../../../mapi'), # src/mapi build path for python-generated GL API files/headers
9b8e80941Smrg])
10b8e80941Smrg
11b8e80941Smrgenv.Prepend(LIBS = [
12b8e80941Smrg    st_osmesa,
13b8e80941Smrg    ws_null,
14b8e80941Smrg    glapi,
15b8e80941Smrg    compiler,
16b8e80941Smrg    mesa,
17b8e80941Smrg    gallium,
18b8e80941Smrg    glsl,
19b8e80941Smrg    nir,
20b8e80941Smrg    spirv,
21b8e80941Smrg    mesautil,
22b8e80941Smrg    softpipe
23b8e80941Smrg])
24b8e80941Smrg
25b8e80941Smrgenv.Append(CPPDEFINES = ['GALLIUM_SOFTPIPE'])
26b8e80941Smrg
27b8e80941Smrgsources = ['target.c']
28b8e80941Smrg
29b8e80941Smrgif env['llvm']:
30b8e80941Smrg    env.Append(CPPDEFINES = 'GALLIUM_LLVMPIPE')
31b8e80941Smrg    env.Prepend(LIBS = [llvmpipe])
32b8e80941Smrg
33b8e80941Smrg    if env['swr']:
34b8e80941Smrg        env.Append(CPPDEFINES = 'GALLIUM_SWR')
35b8e80941Smrg        env.Prepend(LIBS = [swr])
36b8e80941Smrg
37b8e80941Smrgif env['platform'] == 'windows':
38b8e80941Smrg    if env['gcc'] and env['machine'] != 'x86_64':
39b8e80941Smrg        sources += ['osmesa.mingw.def']
40b8e80941Smrg    else:
41b8e80941Smrg        sources += ['osmesa.def']
42b8e80941Smrg    # Link with winsock2 library
43b8e80941Smrg    env.Append(LIBS = ['ws2_32'])
44b8e80941Smrg
45b8e80941Smrg
46b8e80941Smrggallium_osmesa = env.SharedLibrary(
47b8e80941Smrg    target ='osmesa',
48b8e80941Smrg    source = sources,
49b8e80941Smrg    LIBS = env['LIBS'],
50b8e80941Smrg)
51b8e80941Smrg
52b8e80941Smrgenv.Alias('osmesa', gallium_osmesa)
53