Commit 2e92d338 authored by Jose Fonseca's avatar Jose Fonseca Committed by Marge Bot
Browse files

scons: Prune out unnecessary targets.

This prunes out all targets except libgl-gdi, libgl-xlib, and svga, as
suggested by Marek Olšák.

libgl-xlib will be remove once I have had time to confirm no automated
tests we have rely upon it.

There are also a bunch of Makefile.sources which become orphaned as
result, that are not taken care of in this change.

v2: Prune remainders of swr support.

Tested-by: Marge Bot <mesa/mesa!4348>
Part-of: <mesa/mesa!4348>
parent 0f847b18
Pipeline #126131 passed with stages
in 35 minutes and 32 seconds
......@@ -561,7 +561,7 @@ meson-mingw32-x86_64:
scons:
extends: .scons-build
variables:
SCONS_TARGET: "llvm=1 swr=1"
SCONS_TARGET: "llvm=1"
SCONS_CHECK_COMMAND: "scons force_scons=1 ${SCONS_TARGET} check"
script:
- SCONS_TARGET="" SCONS_CHECK_COMMAND="scons check force_scons=1" .gitlab-ci/scons-build.sh
......
"""dxsdk
Tool-specific initialization for Microsoft DirectX SDK
"""
#
# Copyright (c) 2009 VMware, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
import os
import os.path
import SCons.Errors
import SCons.Util
def get_dxsdk_root(env):
try:
return os.environ['DXSDK_DIR']
except KeyError:
return None
def generate(env):
dxsdk_root = get_dxsdk_root(env)
if dxsdk_root is None:
# DirectX SDK not found
return
if env['machine'] in ('generic', 'x86'):
target_cpu = 'x86'
elif env['machine'] == 'x86_64':
target_cpu = 'x64'
else:
raise SCons.Errors.InternalError("Unsupported target machine")
include_dir = os.path.join(dxsdk_root, 'Include')
lib_dir = os.path.join(dxsdk_root, 'Lib', target_cpu)
env.Append(CPPDEFINES = [('HAVE_DXSDK', '1')])
gcc = 'gcc' in os.path.basename(env['CC']).split('-')
if gcc:
# Make GCC more forgiving towards Microsoft's headers
env.Prepend(CPPFLAGS = ['-isystem', include_dir])
else:
env.Prepend(CPPPATH = [include_dir])
env.Prepend(LIBPATH = [lib_dir])
def exists(env):
return get_dxsdk_root(env) is not None
# vim:set ts=4 sw=4 et:
......@@ -45,17 +45,7 @@ if env['platform'] != 'windows':
SConscript('mapi/glapi/gen/SConscript')
SConscript('mapi/glapi/SConscript')
# Haiku C++ libGL dispatch (renderers depend on libgl)
if env['platform'] in ['haiku']:
SConscript('hgl/SConscript')
SConscript('mesa/SConscript')
if not env['embedded']:
if env['platform'] not in ('cygwin', 'darwin', 'freebsd', 'haiku', 'windows'):
SConscript('glx/SConscript')
if env['platform'] == 'haiku':
SConscript('egl/SConscript')
SConscript('gallium/SConscript')
#######################################################################
# SConscript for EGL
Import('*')
env = env.Clone()
env.Append(CPPPATH = [
'#/include',
'#/include/HaikuGL',
'#/src/egl/main',
'#/src',
])
# parse Makefile.sources
egl_sources = env.ParseSourceList('Makefile.sources', 'LIBEGL_C_FILES')
env.Append(CPPDEFINES = [
'_EGL_NATIVE_PLATFORM=_EGL_PLATFORM_HAIKU',
'_EGL_BUILT_IN_DRIVER_HAIKU',
'HAVE_HAIKU_PLATFORM',
])
egl_sources.append('drivers/haiku/egl_haiku.cpp')
env.Prepend(LIBS = [mesautil])
egl = env.SharedLibrary(
target = 'EGL',
source = egl_sources,
)
egl = env.InstallSharedLibrary(egl, version=(1, 0, 0))
env.Alias('egl', egl)
......@@ -16,7 +16,6 @@ SConscript([
'drivers/llvmpipe/SConscript',
'drivers/softpipe/SConscript',
'drivers/svga/SConscript',
'drivers/swr/SConscript',
])
#
......@@ -38,63 +37,20 @@ if env['platform'] == 'windows':
'winsys/sw/gdi/SConscript',
])
if env['platform'] == 'haiku':
SConscript([
'winsys/sw/hgl/SConscript',
])
if env['dri']:
SConscript([
'winsys/sw/dri/SConscript',
'winsys/svga/drm/SConscript',
])
#
# State trackers and targets
#
SConscript([
'targets/graw-null/SConscript',
])
if not env['embedded']:
SConscript([
'state_trackers/osmesa/SConscript',
'targets/osmesa/SConscript',
])
if env['x11']:
SConscript([
'state_trackers/glx/xlib/SConscript',
'targets/graw-xlib/SConscript',
'targets/libgl-xlib/SConscript',
])
if env['platform'] == 'windows':
SConscript([
'state_trackers/wgl/SConscript',
'targets/graw-gdi/SConscript',
'targets/libgl-gdi/SConscript',
])
if env['platform'] == 'haiku':
SConscript([
'state_trackers/hgl/SConscript',
'targets/haiku-softpipe/SConscript',
])
if env['dri']:
SConscript([
'state_trackers/dri/SConscript',
'targets/dri/SConscript',
])
#
# Unit tests & tools
#
if not env['embedded']:
SConscript('tests/unit/SConscript')
SConscript('tests/graw/SConscript')
Import('*')
from sys import executable as python_cmd
import os.path
import distutils.version
if not env['swr']:
Return()
if not env['llvm']:
print('warning: LLVM disabled: not building swr')
env['swr'] = False
Return()
if env['LLVM_VERSION'] < distutils.version.LooseVersion('6.0'):
print("warning: swr requires LLVM >= 6.0: not building swr")
env['swr'] = False
Return()
env.MSVC2013Compat()
env = env.Clone()
# construct llvm include dir
if env['platform'] == 'windows':
# on windows there is no llvm-config, so LLVM is defined
llvm_includedir = os.path.join(os.environ['LLVM'], 'include')
else:
llvm_config = os.environ.get('LLVM_CONFIG', 'llvm-config')
llvm_includedir = env.backtick('%s --includedir' % llvm_config).rstrip()
print("llvm include dir %s" % llvm_includedir)
if not env['msvc'] :
env.Append(CCFLAGS = [
'-std=c++14',
])
swrroot = '#src/gallium/drivers/swr/'
srcroot = Dir(swrroot).abspath
bldroot = Dir('.').abspath
env.CodeGenerate(
target = 'rasterizer/codegen/gen_knobs.cpp',
script = swrroot + 'rasterizer/codegen/gen_knobs.py',
source = '',
command = python_cmd + ' $SCRIPT --output $TARGET --gen_cpp'
)
Depends('rasterizer/codegen/gen_knobs.cpp',
swrroot + 'rasterizer/codegen/templates/gen_knobs.cpp')
env.CodeGenerate(
target = 'rasterizer/codegen/gen_knobs.h',
script = swrroot + 'rasterizer/codegen/gen_knobs.py',
source = '',
command = python_cmd + ' $SCRIPT --output $TARGET --gen_h'
)
Depends('rasterizer/codegen/gen_knobs.h',
swrroot + 'rasterizer/codegen/templates/gen_knobs.h')
env.CodeGenerate(
target = 'rasterizer/jitter/gen_state_llvm.h',
script = swrroot + 'rasterizer/codegen/gen_llvm_types.py',
source = 'rasterizer/core/state.h',
command = python_cmd + ' $SCRIPT --input $SOURCE --output $TARGET'
)
Depends('rasterizer/jitter/gen_state_llvm.h',
swrroot + 'rasterizer/codegen/templates/gen_llvm.hpp')
env.CodeGenerate(
target = 'rasterizer/jitter/gen_builder.hpp',
script = swrroot + 'rasterizer/codegen/gen_llvm_ir_macros.py',
source = os.path.join(llvm_includedir, 'llvm/IR/IRBuilder.h'),
command = python_cmd + ' $SCRIPT --input $SOURCE --output ' + bldroot + '/rasterizer/jitter --gen_h'
)
Depends('rasterizer/jitter/gen_builder.hpp',
swrroot + 'rasterizer/codegen/templates/gen_builder.hpp')
env.CodeGenerate(
target = 'rasterizer/jitter/gen_builder_meta.hpp',
script = swrroot + 'rasterizer/codegen/gen_llvm_ir_macros.py',
source = '',
command = python_cmd + ' $SCRIPT --output ' + bldroot + '/rasterizer/jitter --gen_meta_h'
)
Depends('rasterizer/jitter/gen_builder.hpp',
swrroot + 'rasterizer/codegen/templates/gen_builder.hpp')
env.CodeGenerate(
target = 'rasterizer/jitter/gen_builder_intrin.hpp',
script = swrroot + 'rasterizer/codegen/gen_llvm_ir_macros.py',
source = '',
command = python_cmd + ' $SCRIPT --output ' + bldroot + '/rasterizer/jitter --gen_intrin_h'
)
Depends('rasterizer/jitter/gen_builder.hpp',
swrroot + 'rasterizer/codegen/templates/gen_builder.hpp')
env.CodeGenerate(
target = './gen_swr_context_llvm.h',
script = swrroot + 'rasterizer/codegen/gen_llvm_types.py',
source = 'swr_context.h',
command = python_cmd + ' $SCRIPT --input $SOURCE --output $TARGET'
)
Depends('rasterizer/jitter/gen_state_llvm.h',
swrroot + 'rasterizer/codegen/templates/gen_llvm.hpp')
env.CodeGenerate(
target = './gen_surf_state_llvm.h',
script = swrroot + 'rasterizer/codegen/gen_llvm_types.py',
source = 'rasterizer/memory/SurfaceState.h',
command = python_cmd + ' $SCRIPT --input $SOURCE --output $TARGET'
)
Depends('rasterizer/jitter/gen_state_llvm.h',
swrroot + 'rasterizer/codegen/templates/gen_llvm.hpp')
env.CodeGenerate(
script = swrroot + 'rasterizer/codegen/gen_archrast.py',
target = ['rasterizer/archrast/gen_ar_event.hpp',
'rasterizer/archrast/gen_ar_event.cpp',
'rasterizer/archrast/gen_ar_eventhandler.hpp',
'rasterizer/archrast/gen_ar_eventhandlerfile.hpp'],
source = [srcroot + '/rasterizer/archrast/events.proto',
srcroot + '/rasterizer/archrast/events_private.proto'],
command = python_cmd + ' $SCRIPT --proto $SOURCES --output-dir ' + bldroot + '/rasterizer/archrast')
Depends('rasterizer/archrast/gen_ar_event.hpp',
swrroot + 'rasterizer/archrast/events_private.proto')
Depends('rasterizer/jitter/gen_state_llvm.h',
swrroot + 'rasterizer/codegen/templates/gen_ar_event.hpp')
Depends('rasterizer/archrast/gen_ar_event.cpp',
swrroot + 'rasterizer/archrast/events_private.proto')
Depends('rasterizer/jitter/gen_state_llvm.h',
swrroot + 'rasterizer/codegen/templates/gen_ar_event.cpp')
Depends('rasterizer/archrast/gen_ar_eventhandler.hpp',
swrroot + 'rasterizer/archrast/events_private.proto')
Depends('rasterizer/jitter/gen_state_llvm.h',
swrroot + 'rasterizer/codegen/templates/gen_ar_eventhandler.hpp')
Depends('rasterizer/archrast/gen_ar_eventhandlerfile.hpp',
swrroot + 'rasterizer/archrast/events_private.proto')
Depends('rasterizer/jitter/gen_state_llvm.h',
swrroot + 'rasterizer/codegen/templates/gen_ar_eventhandlerfile.hpp')
# 5 SWR_MULTISAMPLE_TYPE_COUNT
# 2 SWR_MSAA_SAMPLE_PATTERN_COUNT
# 3 SWR_INPUT_COVERAGE_COUNT
# 2 centroid
# 2 forcedSampleCount
# 2 canEarlyZ
backendPixelRateFileCount = 4
backendPixelRateFilePat = "rasterizer/core/backends/gen_BackendPixelRate%s.cpp"
backendPixelRateFiles = list(backendPixelRateFilePat % x for x in range(0, backendPixelRateFileCount))
env.CodeGenerate(
target = 'rasterizer/core/backends/gen_BackendPixelRate.hpp',
script = swrroot + 'rasterizer/codegen/gen_backends.py',
source = '',
command = python_cmd + ' $SCRIPT --outdir ' + bldroot + '/rasterizer/core/backends --dim 5 2 3 2 2 2 --numfiles ' + str(backendPixelRateFileCount) + ' --cpp --hpp'
)
Depends(backendPixelRateFiles,
['rasterizer/core/backends/gen_BackendPixelRate.hpp',
'rasterizer/archrast/gen_ar_event.hpp',
'rasterizer/archrast/gen_ar_eventhandler.hpp',
'rasterizer/codegen/gen_knobs.h']
)
# 5 SWR_MULTISAMPLE_TYPE_COUNT
# 2 CenterPattern
# 2 Conservative
# 3 SWR_INPUT_COVERAGE_COUNT
# 5 STATE_VALID_TRI_EDGE_COUNT
# 2 RasterScissorEdges
genRasterizerFileCount = 4
genRasterizerFilePat = "rasterizer/core/backends/gen_rasterizer%s.cpp"
genRasterizerFiles = list(genRasterizerFilePat % x for x in range(0, genRasterizerFileCount))
env.CodeGenerate(
target = 'rasterizer/core/backends/gen_rasterizer.hpp',
script = swrroot + 'rasterizer/codegen/gen_backends.py',
source = '',
command = python_cmd + ' $SCRIPT --outdir ' + bldroot + '/rasterizer/core/backends --rast --dim 5 2 2 3 5 2 --numfiles ' + str(genRasterizerFileCount) + ' --cpp --hpp'
)
Depends(genRasterizerFiles,
['rasterizer/core/backends/gen_rasterizer.hpp',
'rasterizer/archrast/gen_ar_event.hpp',
'rasterizer/archrast/gen_ar_eventhandler.hpp',
'rasterizer/codegen/gen_knobs.h']
)
Depends('rasterizer/jitter/gen_state_llvm.h',
swrroot + 'rasterizer/codegen/templates/gen_backend.cpp')
# Auto-generated .cpp files (that need to generate object files)
built_sources = [
'rasterizer/codegen/gen_knobs.cpp',
'rasterizer/archrast/gen_ar_event.cpp',
]
built_sources += [backendPixelRateFiles, genRasterizerFiles]
source = built_sources
source += env.ParseSourceList(swrroot + 'Makefile.sources', [
'ARCHRAST_CXX_SOURCES',
'COMMON_CXX_SOURCES',
'CORE_CXX_SOURCES',
'MEMORY_CXX_SOURCES'
])
env.Prepend(CPPPATH = [
'.',
'rasterizer',
'rasterizer/codegen',
'rasterizer/core',
'rasterizer/jitter',
'rasterizer/archrast',
])
# AVX lib
envavx = env.Clone()
envavx.Append(CPPDEFINES = ['KNOB_ARCH=KNOB_ARCH_AVX'])
if env['msvc']:
envavx.Append(CCFLAGS = ['/arch:AVX'])
else:
envavx.Append(CCFLAGS = ['-mavx'])
swrAVX = envavx.SharedLibrary(
target = 'swrAVX',
source = source,
OBJPREFIX = 'avx_'
)
env.Alias('swrAVX', swrAVX)
# AVX2 lib
envavx2 = env.Clone()
envavx2.Append(CPPDEFINES = ['KNOB_ARCH=KNOB_ARCH_AVX2'])
if env['msvc']:
envavx2.Append(CCFLAGS = ['/arch:AVX2'])
else:
envavx2.Append(CCFLAGS = ['-mavx2', '-mfma', '-mbmi2', '-mf16c'])
swrAVX2 = envavx2.SharedLibrary(
target = 'swrAVX2',
source = source,
OBJPREFIX = 'avx2_'
)
env.Alias('swrAVX2', swrAVX2)
source = env.ParseSourceList(swrroot + 'Makefile.sources', [
'CXX_SOURCES',
'COMMON_CXX_SOURCES',
'JITTER_CXX_SOURCES',
'LOADER_SOURCES'
])
source += [
'rasterizer/codegen/gen_knobs.cpp',
'rasterizer/archrast/gen_ar_event.cpp',
]
# main SWR lib
envSWR = envavx.Clone() # pick up the arch flag for intrinsic usage
envSWR.Append(CPPDEFINES = ['HAVE_SWR_AVX', 'HAVE_SWR_AVX2'])
swr = envSWR.ConvenienceLibrary(
target = 'swr',
source = source,
)
# treat arch libs as dependencies, even though they are not linked
# into swr, so we don't have to build them separately
Depends(swr, ['swrAVX', 'swrAVX2'])
env.Alias('swr', swr)
env.Prepend(LIBS = [swr])
Export('swr')
#######################################################################
# SConscript for dri state_tracker
Import('*')
env = env.Clone()
env.PkgUseModules(['DRM'])
env.Append(CPPPATH = [
'#/src',
'#/src/mapi',
'#/src/mesa',
'#/src/mesa/drivers/dri/common',
xmlpool_options.dir.dir, # Dir to generated xmlpool/options.h
])
sources = env.ParseSourceList('Makefile.sources', 'common_SOURCES')
# XXX: if HAVE_DRISW
sources.append(env.ParseSourceList('Makefile.sources', 'drisw_SOURCES'))
# XXX: if HAVE_DRI2
sources.append(env.ParseSourceList('Makefile.sources', 'dri2_SOURCES'))
st_dri = env.ConvenienceLibrary(
target = 'st_dri',
source = sources
)
Export('st_dri')
#######################################################################
# SConscript for Haiku state_tracker
Import('*')
env = env.Clone()
env.Append(CPPPATH = [
'#/src',
'#/src/mapi',
'#/src/mesa',
'#/include/HaikuGL',
])
sources = [
'hgl.c',
'bitmap_wrapper.cpp',
]
st_haiku = env.ConvenienceLibrary(
target = 'st_haiku',
source = sources
)
Export('st_haiku')
import os
Import('*')
env = env.Clone()
env.Append(CPPPATH = [
'#src/mapi',
'#src/mesa',
'.',
])
if env['platform'] == 'windows':
env.AppendUnique(CPPDEFINES = [
'BUILD_GL32', # declare gl* as __declspec(dllexport) in Mesa headers
'WIN32_LEAN_AND_MEAN', # http://msdn2.microsoft.com/en-us/library/6dwk3a1z.aspx
'_GLAPI_NO_EXPORTS', # prevent _glapi_* from being declared __declspec(dllimport)
])
st_osmesa = env.ConvenienceLibrary(
target ='st_osmesa',
source = env.ParseSourceList('Makefile.sources', 'C_SOURCES'),
)
Export('st_osmesa')
Import('*')
env = drienv.Clone()
if env['suncc']:
print('warning: not building dri-vmwgfx')
Return()
env.Append(CPPPATH = [
'#/src/loader',
'#/src/mapi',
'#/src/mesa',
'#/src/mesa/drivers/dri/common',
'#/src/gallium/state_trackers/dri',
])
if env['llvm']:
env.Append(CPPDEFINES = 'GALLIUM_LLVMPIPE')
env.Prepend(LIBS = [llvmpipe])
env.PkgUseModules('DRM')
env.Append(CPPDEFINES = [
'GALLIUM_VMWGFX',
'GALLIUM_SOFTPIPE',
])
env.Prepend(LIBS = [
st_dri,
svgadrm,
svga,
ws_dri,
softpipe,
pipe_loader,
libloader,
mesautil,
compiler,
mesa,
glsl,
nir,
spirv,
gallium,
megadrivers_stub,
dri_common,
])