From patchwork Tue Mar 5 10:00:24 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: alexandros.frantzis@linaro.org X-Patchwork-Id: 15229 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 9F66123E4A for ; Tue, 5 Mar 2013 10:00:28 +0000 (UTC) Received: from mail-vb0-f48.google.com (mail-vb0-f48.google.com [209.85.212.48]) by fiordland.canonical.com (Postfix) with ESMTP id F1FE6A19384 for ; Tue, 5 Mar 2013 10:00:27 +0000 (UTC) Received: by mail-vb0-f48.google.com with SMTP id fc21so1189078vbb.7 for ; Tue, 05 Mar 2013 02:00:27 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:content-type:mime-version:x-launchpad-project :x-launchpad-branch:x-launchpad-message-rationale :x-launchpad-branch-revision-number:x-launchpad-notification-type:to :from:subject:message-id:date:reply-to:sender:errors-to:precedence :x-generated-by:x-launchpad-hash:x-gm-message-state; bh=Gof4KqOPQclb7hCog+BSNTX0MMlOlIyeZux8FrmLNDw=; b=Uu9mnMOThXCsP7VrVI6VB/oGAkfP+9NcRMlvAwX8cND35FXzcsoTyIW8bSuDEuZc7r bPmw33ky+XK/n7qN+YnAp2b6t6f6MMaHWDWk1ffK0RA6a8+cB5JbuDCyhwHvest/v07a mInUuOTuWtJP/hkHgxUQ32d84uljZQnHbkFCReWwJO6QeQfeGg++qUsDywnPt6HnrB6z fsyh7GTLHmWIXn1pZa+ZHcLygdVPkPZPkSbbDIGJSIXFHDlUXU3NSkEUloFZ1lnXj1JP t/oGUpJ8dFboE5rgnHYyDzspZ87JTYaT2zCVYrYsJZf7S1T3XODSR55jKzRUIXxYCAnY YkMw== X-Received: by 10.58.48.166 with SMTP id m6mr9345606ven.59.1362477627386; Tue, 05 Mar 2013 02:00:27 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.58.127.98 with SMTP id nf2csp103029veb; Tue, 5 Mar 2013 02:00:26 -0800 (PST) X-Received: by 10.194.242.197 with SMTP id ws5mr13650554wjc.44.1362477626024; Tue, 05 Mar 2013 02:00:26 -0800 (PST) Received: from indium.canonical.com (indium.canonical.com. [91.189.90.7]) by mx.google.com with ESMTPS id ua5si10357667wjc.61.2013.03.05.02.00.24 (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 05 Mar 2013 02:00:26 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.7 as permitted sender) client-ip=91.189.90.7; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.7 as permitted sender) smtp.mail=bounces@canonical.com Received: from ackee.canonical.com ([91.189.89.26]) by indium.canonical.com with esmtp (Exim 4.71 #1 (Debian)) id 1UCofY-0007J5-77 for ; Tue, 05 Mar 2013 10:00:24 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id 0E8ACE0025 for ; Tue, 5 Mar 2013 10:00:24 +0000 (UTC) MIME-Version: 1.0 X-Launchpad-Project: glmark2 X-Launchpad-Branch: ~glmark2-dev/glmark2/trunk X-Launchpad-Message-Rationale: Subscriber X-Launchpad-Branch-Revision-Number: 262 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~glmark2-dev/glmark2/trunk] Rev 262: build: Improve build system support for multiple flavors Message-Id: <20130305100024.23602.69410.launchpad@ackee.canonical.com> Date: Tue, 05 Mar 2013 10:00:24 -0000 Reply-To: noreply@launchpad.net Sender: bounces@canonical.com Errors-To: bounces@canonical.com Precedence: bulk X-Generated-By: Launchpad (canonical.com); Revision="16514"; Instance="launchpad-lazr.conf" X-Launchpad-Hash: 0a0622e7b9506fd7dfe745b1c7b3e879eef2f3c9 X-Gm-Message-State: ALoCoQmZ6iPsPZirEG7pYD22QpKyKOljUzABXyk46/ZdnX3l59mVIziE4jtb++KtoT1wX5ckwZQT Merge authors: Alexandros Frantzis (afrantzis) Related merge proposals: https://code.launchpad.net/~glmark2-dev/glmark2/build-system-add-flavors/+merge/151596 proposed by: Alexandros Frantzis (afrantzis) review: Approve - Jesse Barker (jesse-barker) ------------------------------------------------------------ revno: 262 [merge] committer: Alexandros Frantzis branch nick: trunk timestamp: Tue 2013-03-05 11:59:25 +0200 message: build: Improve build system support for multiple flavors modified: android/jni/Android.mk android/jni/Android.ndk.mk src/canvas-generic.cpp src/gl-headers.h src/gl-state-egl.cpp src/main.cpp src/wscript_build wscript --- lp:glmark2 https://code.launchpad.net/~glmark2-dev/glmark2/trunk You are subscribed to branch lp:glmark2. To unsubscribe from this branch go to https://code.launchpad.net/~glmark2-dev/glmark2/trunk/+edit-subscription === modified file 'android/jni/Android.mk' --- android/jni/Android.mk 2013-03-01 15:22:03 +0000 +++ android/jni/Android.mk 2013-03-05 09:56:31 +0000 @@ -4,7 +4,7 @@ LOCAL_CPP_EXTENSION := .cc LOCAL_MODULE := libglmark2-matrix -LOCAL_CFLAGS := -DUSE_GLESv2 -Werror -Wall -Wextra -Wnon-virtual-dtor \ +LOCAL_CFLAGS := -DGLMARK2_USE_GLESv2 -Werror -Wall -Wextra -Wnon-virtual-dtor \ -Wno-error=unused-parameter LOCAL_C_INCLUDES := $(LOCAL_PATH)/src LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(wildcard $(LOCAL_PATH)/src/libmatrix/*.cc)) @@ -38,7 +38,7 @@ LOCAL_CPP_EXTENSION := .cc LOCAL_MODULE := libglmark2-ideas -LOCAL_CFLAGS := -DGLMARK_DATA_PATH="" -DUSE_GLESv2 -Werror -Wall -Wextra\ +LOCAL_CFLAGS := -DGLMARK_DATA_PATH="" -DGLMARK2_USE_GLESv2 -Werror -Wall -Wextra\ -Wnon-virtual-dtor -Wno-error=unused-parameter LOCAL_C_INCLUDES := $(LOCAL_PATH)/src \ $(LOCAL_PATH)/src/libmatrix @@ -55,7 +55,7 @@ LOCAL_MODULE := libglmark2-android LOCAL_STATIC_LIBRARIES := libglmark2-matrix libglmark2-png libglmark2-ideas libglmark2-jpeg LOCAL_CFLAGS := -DGLMARK_DATA_PATH="" -DGLMARK_VERSION="\"2012.12\"" \ - -DUSE_GLESv2 -Werror -Wall -Wextra -Wnon-virtual-dtor \ + -DGLMARK2_USE_GLESv2 -Werror -Wall -Wextra -Wnon-virtual-dtor \ -Wno-error=unused-parameter LOCAL_SHARED_LIBRARIES := liblog libz libEGL libGLESv2 libandroid libdl libstlport LOCAL_C_INCLUDES := $(LOCAL_PATH)/src \ === modified file 'android/jni/Android.ndk.mk' --- android/jni/Android.ndk.mk 2013-03-01 15:22:03 +0000 +++ android/jni/Android.ndk.mk 2013-03-05 09:56:31 +0000 @@ -4,7 +4,7 @@ LOCAL_CPP_EXTENSION := .cc LOCAL_MODULE := libglmark2-matrix -LOCAL_CFLAGS := -DUSE_GLESv2 -Werror -Wall -Wextra -Wnon-virtual-dtor \ +LOCAL_CFLAGS := -DGLMARK2_USE_GLESv2 -Werror -Wall -Wextra -Wnon-virtual-dtor \ -Wno-error=unused-parameter LOCAL_C_INCLUDES := $(LOCAL_PATH)/src LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(wildcard $(LOCAL_PATH)/src/libmatrix/*.cc)) @@ -34,7 +34,7 @@ LOCAL_CPP_EXTENSION := .cc LOCAL_MODULE := libglmark2-ideas -LOCAL_CFLAGS := -DGLMARK_DATA_PATH="" -DUSE_GLESv2 -Werror -Wall -Wextra\ +LOCAL_CFLAGS := -DGLMARK_DATA_PATH="" -DGLMARK2_USE_GLESv2 -Werror -Wall -Wextra\ -Wnon-virtual-dtor -Wno-error=unused-parameter LOCAL_C_INCLUDES := $(LOCAL_PATH)/src \ $(LOCAL_PATH)/src/libmatrix @@ -48,7 +48,7 @@ LOCAL_MODULE := libglmark2-android LOCAL_STATIC_LIBRARIES := libglmark2-matrix libglmark2-png libglmark2-ideas libglmark2-jpeg LOCAL_CFLAGS := -DGLMARK_DATA_PATH="" -DGLMARK_VERSION="\"2012.12\"" \ - -DUSE_GLESv2 -Werror -Wall -Wextra -Wnon-virtual-dtor \ + -DGLMARK2_USE_GLESv2 -Werror -Wall -Wextra -Wnon-virtual-dtor \ -Wno-error=unused-parameter LOCAL_LDLIBS := -landroid -llog -lGLESv2 -lEGL -lz LOCAL_C_INCLUDES := $(LOCAL_PATH)/src \ === modified file 'src/canvas-generic.cpp' --- src/canvas-generic.cpp 2013-03-01 14:48:21 +0000 +++ src/canvas-generic.cpp 2013-03-04 19:07:07 +0000 @@ -89,9 +89,9 @@ CanvasGeneric::clear() { glClearColor(0.0f, 0.0f, 0.0f, 1.0f); -#if USE_GL +#if GLMARK2_USE_GL glClearDepth(1.0f); -#elif USE_GLESv2 +#elif GLMARK2_USE_GLESv2 glClearDepthf(1.0f); #endif glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); @@ -310,7 +310,7 @@ bool supports_depth24(false); bool supports_depth32(false); -#if USE_GLESv2 +#if GLMARK2_USE_GLESv2 if (GLExtensions::support("GL_ARM_rgba8")) supports_rgba8 = true; @@ -324,7 +324,7 @@ if (GLExtensions::support("GL_OES_depth32")) supports_depth32 = true; -#elif USE_GL +#elif GLMARK2_USE_GL supports_rgba8 = true; supports_rgb8 = true; supports_depth24 = true; === modified file 'src/gl-headers.h' --- src/gl-headers.h 2012-03-20 11:29:09 +0000 +++ src/gl-headers.h 2013-03-04 19:07:07 +0000 @@ -24,13 +24,13 @@ #define GL_GLEXT_PROTOTYPES -#if USE_GL +#if GLMARK2_USE_GL #include #include #ifndef GL_RGB565 #define GL_RGB565 0x8D62 #endif -#elif USE_GLESv2 +#elif GLMARK2_USE_GLESv2 #include #include #ifndef GL_WRITE_ONLY === modified file 'src/gl-state-egl.cpp' --- src/gl-state-egl.cpp 2013-03-03 10:18:39 +0000 +++ src/gl-state-egl.cpp 2013-03-04 19:07:07 +0000 @@ -307,14 +307,14 @@ void GLStateEGL::init_gl_extensions() { -#if USE_GLESv2 +#if GLMARK2_USE_GLESv2 if (GLExtensions::support("GL_OES_mapbuffer")) { GLExtensions::MapBuffer = reinterpret_cast(eglGetProcAddress("glMapBufferOES")); GLExtensions::UnmapBuffer = reinterpret_cast(eglGetProcAddress("glUnmapBufferOES")); } -#elif USE_GL +#elif GLMARK2_USE_GL GLExtensions::MapBuffer = glMapBuffer; GLExtensions::UnmapBuffer = glUnmapBuffer; #endif @@ -428,9 +428,9 @@ return false; } -#if USE_GLESv2 +#if GLMARK2_USE_GLESv2 EGLenum apiType(EGL_OPENGL_ES_API); -#elif USE_GL +#elif GLMARK2_USE_GL EGLenum apiType(EGL_OPENGL_API); #endif if (!eglBindAPI(apiType)) { @@ -500,9 +500,9 @@ EGL_ALPHA_SIZE, requested_visual_config_.alpha, EGL_DEPTH_SIZE, requested_visual_config_.depth, EGL_STENCIL_SIZE, requested_visual_config_.stencil, -#if USE_GLESv2 +#if GLMARK2_USE_GLESv2 EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, -#elif USE_GL +#elif GLMARK2_USE_GL EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT, #endif EGL_NONE @@ -600,7 +600,7 @@ return false; static const EGLint context_attribs[] = { -#ifdef USE_GLESv2 +#ifdef GLMARK2_USE_GLESv2 EGL_CONTEXT_CLIENT_VERSION, 2, #endif EGL_NONE === modified file 'src/main.cpp' --- src/main.cpp 2013-03-01 14:57:51 +0000 +++ src/main.cpp 2013-03-04 19:07:07 +0000 @@ -37,15 +37,16 @@ #include "canvas-generic.h" -#if USE_DRM +#if GLMARK2_USE_X11 +#include "native-state-x11.h" +#elif GLMARK2_USE_DRM #include "native-state-drm.h" +#endif + +#if GLMARK2_USE_EGL #include "gl-state-egl.h" -#elif USE_GL -#include "native-state-x11.h" +#elif GLMARK2_USE_GLX #include "gl-state-glx.h" -#elif USE_GLESv2 -#include "native-state-x11.h" -#include "gl-state-egl.h" #endif using std::vector; @@ -187,15 +188,16 @@ } // Create the canvas -#if USE_DRM +#if GLMARK2_USE_X11 + NativeStateX11 native_state; +#elif GLMARK2_USE_DRM NativeStateDRM native_state; +#endif + +#if GLMARK2_USE_EGL GLStateEGL gl_state; -#elif USE_GL - NativeStateX11 native_state; +#elif GLMARK2_USE_GLX GLStateGLX gl_state; -#elif USE_GLESv2 - NativeStateX11 native_state; - GLStateEGL gl_state; #endif CanvasGeneric canvas(native_state, gl_state, Options::size.first, Options::size.second); === modified file 'src/wscript_build' --- src/wscript_build 2013-03-01 14:57:51 +0000 +++ src/wscript_build 2013-03-04 19:07:07 +0000 @@ -3,91 +3,72 @@ f.name.find('android') == -1 and f.name.find('native-state-') == -1 and f.name.find('gl-state-') == -1] -gl_sources = ['canvas-generic.cpp', 'native-state-x11.cpp', 'gl-state-glx.cpp'] -glesv2_sources = ['canvas-generic.cpp', 'native-state-x11.cpp', 'gl-state-egl.cpp'] -gl_drm_sources = ['canvas-generic.cpp', 'native-state-drm.cpp', 'gl-state-egl.cpp'] -glesv2_drm_sources = ['canvas-generic.cpp', 'native-state-drm.cpp', 'gl-state-egl.cpp'] +common_uselibs = ['libpng12'] +common_defines = ['USE_EXCEPTIONS'] + libmatrix_sources = [f for f in bld.path.ant_glob('libmatrix/*.cc') if not f.name.endswith('test.cc')] +flavor_sources = { + 'x11-gl' : ['canvas-generic.cpp', 'native-state-x11.cpp', 'gl-state-glx.cpp'], + 'x11-glesv2' : ['canvas-generic.cpp', 'native-state-x11.cpp', 'gl-state-egl.cpp'], + 'drm-gl' : ['canvas-generic.cpp', 'native-state-drm.cpp', 'gl-state-egl.cpp'], + 'drm-glesv2' : ['canvas-generic.cpp', 'native-state-drm.cpp', 'gl-state-egl.cpp'] +} +flavor_target = { + 'x11-gl' : 'glmark2', + 'x11-glesv2' : 'glmark2-es2', + 'drm-gl' : 'glmark2-drm', + 'drm-glesv2' : 'glmark2-es2-drm' +} +flavor_uselibs = { + 'x11-gl' : ['x11', 'gl', 'matrix-gl'], + 'x11-glesv2' : ['x11', 'egl', 'glesv2', 'matrix-glesv2'], + 'drm-gl' : ['drm', 'gbm', 'egl', 'gl', 'matrix-gl'], + 'drm-glesv2' : ['drm', 'gbm', 'egl', 'glesv2', 'matrix-gl'], +} +flavor_defines = { + 'x11-gl' : ['GLMARK2_USE_X11', 'GLMARK2_USE_GL', 'GLMARK2_USE_GLX'], + 'x11-glesv2' : ['GLMARK2_USE_X11', 'GLMARK2_USE_GLESv2', 'GLMARK2_USE_EGL'], + 'drm-gl' : ['GLMARK2_USE_DRM', 'GLMARK2_USE_GL', 'GLMARK2_USE_EGL', '__GBM__'], + 'drm-glesv2' : ['GLMARK2_USE_DRM', 'GLMARK2_USE_GLESv2', 'GLMARK2_USE_EGL', '__GBM__'] +} + includes = ['.', 'scene-ideas', 'scene-terrain'] -if bld.env.USE_GL: - bld( - features = ['cxx', 'cxxstlib'], - source = libmatrix_sources, - target = 'matrix', - lib = ['m'], - includes = ['.'], - export_includes = 'libmatrix', - defines = ['USE_GL', 'USE_EXCEPTIONS'] - ) - bld( - features = ['cxx', 'cprogram'], - source = common_sources + gl_sources, - target = 'glmark2', - use = ['x11', 'gl', 'matrix', 'libpng12'], - lib = ['m', 'jpeg'], - includes = includes, - defines = ['USE_GL', 'USE_EXCEPTIONS'] - ) - -if bld.env.USE_GLESv2: - bld( - features = ['cxx', 'cxxstlib'], - source = libmatrix_sources, - target = 'matrix-es2', - lib = ['m'], - includes = ['.'], - export_includes = 'libmatrix', - defines = ['USE_GLESv2', 'USE_EXCEPTIONS'] - ) - bld( - features = ['cxx', 'cprogram'], - source = common_sources + glesv2_sources, - target = 'glmark2-es2', - use = ['x11', 'egl', 'glesv2', 'matrix-es2', 'libpng12'], - lib = ['m', 'dl', 'jpeg'], - includes = includes, - defines = ['USE_GLESv2', 'USE_EXCEPTIONS'] - ) - -if bld.env.USE_GL_DRM: - bld( - features = ['cxx', 'cxxstlib'], - source = libmatrix_sources, - target = 'matrix-drm', - lib = ['m'], - includes = ['.'], - export_includes = 'libmatrix', - defines = ['USE_DRM', '__GBM__', 'USE_GL', 'USE_EXCEPTIONS'] - ) - bld( - features = ['cxx', 'cprogram'], - source = common_sources + gl_drm_sources, - target = 'glmark2-drm', - use = ['egl', 'gl', 'matrix-drm', 'libpng12', 'drm', 'gbm'], - lib = ['m', 'jpeg', 'dl'], - includes = includes, - defines = ['USE_DRM', '__GBM__', 'USE_GL'] - ) - -if bld.env.USE_GLESv2_DRM: - bld( - features = ['cxx', 'cxxstlib'], - source = libmatrix_sources, - target = 'matrix-es2-drm', - lib = ['m'], - includes = ['.'], - export_includes = 'libmatrix', - defines = ['USE_DRM', '__GBM__', 'USE_GLESv2', 'USE_EXCEPTIONS'] - ) - bld( - features = ['cxx', 'cprogram'], - source = common_sources + glesv2_drm_sources, - target = 'glmark2-es2-drm', - use = ['egl', 'glesv2', 'matrix-es2-drm', 'libpng12', 'drm', - 'gbm'], - lib = ['m', 'jpeg', 'dl'], - includes = includes, - defines = ['USE_DRM', '__GBM__', 'USE_GLESv2'] +all_uselibs = set() + +for name in bld.env.keys(): + if name.startswith('FLAVOR_') and bld.env[name]: + flavor = name.replace('FLAVOR_', '').lower().replace('_', '-') + bld( + features = ['cxx', 'cprogram'], + source = common_sources + flavor_sources[flavor], + target = flavor_target[flavor], + use = common_uselibs + flavor_uselibs[flavor], + lib = ['m', 'jpeg', 'dl'], + includes = includes, + defines = common_defines + flavor_defines[flavor] + ) + all_uselibs |= set(flavor_uselibs[flavor]) + +if 'matrix-gl' in all_uselibs: + bld( + features = ['cxx', 'cxxstlib'], + source = libmatrix_sources, + target = 'matrix-gl', + lib = ['m'], + includes = ['.'], + export_includes = 'libmatrix', + defines = ['GLMARK2_USE_GL', 'USE_EXCEPTIONS'] + ) + +if 'matrix-glesv2' in all_uselibs: + bld( + features = ['cxx', 'cxxstlib'], + source = libmatrix_sources, + target = 'matrix-glesv2', + lib = ['m'], + includes = ['.'], + export_includes = 'libmatrix', + defines = ['GLMARK2_USE_GLESv2', 'USE_EXCEPTIONS'] ) === modified file 'wscript' --- wscript 2012-12-18 19:44:34 +0000 +++ wscript 2013-03-04 19:07:07 +0000 @@ -11,20 +11,32 @@ VERSION = '2012.12' APPNAME = 'glmark2' +FLAVORS = ['x11-gl', 'x11-glesv2', 'drm-gl', 'drm-glesv2'] +FLAVORS_STR = ", ".join(FLAVORS) + +def option_list_cb(option, opt, value, parser): + value = value.split(',') + setattr(parser.values, option.dest, value) + +def list_contains(lst, token): + for e in lst: + if token.endswith('$'): + if e.endswith(token[:-1]): return True + elif token in e: return True + + return False + def options(opt): opt.tool_options('gnu_dirs') opt.tool_options('compiler_cc') opt.tool_options('compiler_cxx') - opt.add_option('--enable-gl', action='store_true', dest = 'gl', - default = False, help='build using OpenGL 2.0') - opt.add_option('--enable-glesv2', action='store_true', dest = 'glesv2', - default = False, help='build using OpenGL ES 2.0') - opt.add_option('--enable-gl-drm', action='store_true', dest = 'gl_drm', - default = False, help='build using OpenGL 2.0 without X') - opt.add_option('--enable-glesv2-drm', action='store_true', - dest = 'glesv2_drm', - default = False, help='build using OpenGL ES 2.0 without X') + opt.add_option('--with-flavors', type = 'string', action='callback', + callback=option_list_cb, + dest = 'flavors', + help = "a list of flavors to build (%s, all)" % FLAVORS_STR) + opt.parser.set_default('flavors', []) + opt.add_option('--no-debug', action='store_false', dest = 'debug', default = True, help='disable compiler debug information') opt.add_option('--no-opt', action='store_false', dest = 'opt', @@ -35,10 +47,21 @@ help='path to additional data (models, shaders, textures)') def configure(ctx): - if not Options.options.gl and not Options.options.glesv2 and \ - not Options.options.gl_drm and not Options.options.glesv2_drm: - ctx.fatal("You must configure using at least one of --enable-gl, " + - "--enable-glesv2, --enable-gl-drm, --enable-glesv2-drm") + # Special 'all' flavor + if 'all' in Options.options.flavors: + Options.options.flavors = list(set(Options.options.flavors) | set(FLAVORS)) + Options.options.flavors.remove('all') + + # Ensure the flavors are valid + for flavor in Options.options.flavors: + if flavor not in FLAVORS: + ctx.fatal('Unknown flavor: %s. Supported flavors are %s' % (flavor, FLAVORS_STR)) + + if not Options.options.flavors: + ctx.fatal('You need to select at least one flavor. Supported flavors are %s' % FLAVORS_STR) + + for flavor in FLAVORS: + ctx.env["FLAVOR_%s" % flavor.upper().replace('-','_')] = flavor in Options.options.flavors ctx.check_tool('gnu_dirs') ctx.check_tool('compiler_cc') @@ -67,16 +90,12 @@ args = '--cflags --libs', mandatory = True) # Check optional packages - opt_pkgs = [('x11', 'x11', Options.options.gl or Options.options.glesv2), - ('gl', 'gl', Options.options.gl or Options.options.gl_drm), - ('egl', 'egl', Options.options.glesv2 or - Options.options.glesv2_drm), - ('glesv2', 'glesv2', Options.options.glesv2 or - Options.options.glesv2_drm), - ('libdrm','drm', Options.options.gl_drm or - Options.options.glesv2_drm), - ('gbm','gbm', Options.options.gl_drm or - Options.options.glesv2_drm)] + opt_pkgs = [('x11', 'x11', list_contains(Options.options.flavors, 'x11')), + ('gl', 'gl', list_contains(Options.options.flavors, 'gl$')), + ('egl', 'egl', list_contains(Options.options.flavors, 'glesv2$')), + ('glesv2', 'glesv2', list_contains(Options.options.flavors, 'glesv2$')), + ('libdrm','drm', list_contains(Options.options.flavors, 'drm')), + ('gbm','gbm', list_contains(Options.options.flavors, 'drm'))] for (pkg, uselib, mandatory) in opt_pkgs: ctx.check_cfg(package = pkg, uselib_store = uselib, args = '--cflags --libs', mandatory = mandatory) @@ -106,25 +125,13 @@ ctx.env.append_unique('DEFINES', 'GLMARK_VERSION="%s"' % VERSION) ctx.env.GLMARK2_VERSION = VERSION - ctx.env.USE_GL = Options.options.gl - ctx.env.USE_GLESv2 = Options.options.glesv2 - ctx.env.USE_GL_DRM = Options.options.gl_drm - ctx.env.USE_GLESv2_DRM = Options.options.glesv2_drm - ctx.msg("Prefix", ctx.env.PREFIX, color = 'PINK') ctx.msg("Data path", data_path, color = 'PINK') ctx.msg("Including extras", "Yes" if ctx.env.HAVE_EXTRAS else "No", color = 'PINK'); if ctx.env.HAVE_EXTRAS: ctx.msg("Extras path", Options.options.extras_path, color = 'PINK') - ctx.msg("Building X11 GL2 version", "Yes" if ctx.env.USE_GL else "No", - color = 'PINK') - ctx.msg("Building X11 GLESv2 version", "Yes" if ctx.env.USE_GLESv2 else "No", - color = 'PINK') - ctx.msg("Building DRM GL2 version", "Yes" if ctx.env.USE_GL_DRM else "No", - color = 'PINK') - ctx.msg("Building DRM GLESv2 version", "Yes" if ctx.env.USE_GLESv2_DRM else "No", - color = 'PINK') + ctx.msg("Building flavors", Options.options.flavors) def build(ctx): ctx.recurse('src')