Clone of mesa.
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

gallium.py 21KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620
  1. """gallium
  2. Frontend-tool for Gallium3D architecture.
  3. """
  4. #
  5. # Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
  6. # All Rights Reserved.
  7. #
  8. # Permission is hereby granted, free of charge, to any person obtaining a
  9. # copy of this software and associated documentation files (the
  10. # "Software"), to deal in the Software without restriction, including
  11. # without limitation the rights to use, copy, modify, merge, publish,
  12. # distribute, sub license, and/or sell copies of the Software, and to
  13. # permit persons to whom the Software is furnished to do so, subject to
  14. # the following conditions:
  15. #
  16. # The above copyright notice and this permission notice (including the
  17. # next paragraph) shall be included in all copies or substantial portions
  18. # of the Software.
  19. #
  20. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  21. # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  22. # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
  23. # IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
  24. # ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  25. # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  26. # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  27. #
  28. import distutils.version
  29. import os
  30. import os.path
  31. import re
  32. import subprocess
  33. import platform as _platform
  34. import SCons.Action
  35. import SCons.Builder
  36. import SCons.Scanner
  37. def symlink(target, source, env):
  38. target = str(target[0])
  39. source = str(source[0])
  40. if os.path.islink(target) or os.path.exists(target):
  41. os.remove(target)
  42. os.symlink(os.path.basename(source), target)
  43. def install(env, source, subdir):
  44. target_dir = os.path.join(env.Dir('#.').srcnode().abspath, env['build_dir'], subdir)
  45. return env.Install(target_dir, source)
  46. def install_program(env, source):
  47. return install(env, source, 'bin')
  48. def install_shared_library(env, sources, version = ()):
  49. targets = []
  50. install_dir = os.path.join(env.Dir('#.').srcnode().abspath, env['build_dir'])
  51. version = tuple(map(str, version))
  52. if env['SHLIBSUFFIX'] == '.dll':
  53. dlls = env.FindIxes(sources, 'SHLIBPREFIX', 'SHLIBSUFFIX')
  54. targets += install(env, dlls, 'bin')
  55. libs = env.FindIxes(sources, 'LIBPREFIX', 'LIBSUFFIX')
  56. targets += install(env, libs, 'lib')
  57. else:
  58. for source in sources:
  59. target_dir = os.path.join(install_dir, 'lib')
  60. target_name = '.'.join((str(source),) + version)
  61. last = env.InstallAs(os.path.join(target_dir, target_name), source)
  62. targets += last
  63. while len(version):
  64. version = version[:-1]
  65. target_name = '.'.join((str(source),) + version)
  66. action = SCons.Action.Action(symlink, "$TARGET -> $SOURCE")
  67. last = env.Command(os.path.join(target_dir, target_name), last, action)
  68. targets += last
  69. return targets
  70. def createInstallMethods(env):
  71. env.AddMethod(install_program, 'InstallProgram')
  72. env.AddMethod(install_shared_library, 'InstallSharedLibrary')
  73. def num_jobs():
  74. try:
  75. return int(os.environ['NUMBER_OF_PROCESSORS'])
  76. except (ValueError, KeyError):
  77. pass
  78. try:
  79. return os.sysconf('SC_NPROCESSORS_ONLN')
  80. except (ValueError, OSError, AttributeError):
  81. pass
  82. try:
  83. return int(os.popen2("sysctl -n hw.ncpu")[1].read())
  84. except ValueError:
  85. pass
  86. return 1
  87. def pkg_config_modules(env, name, modules):
  88. '''Simple wrapper for pkg-config.'''
  89. env[name] = False
  90. if env['platform'] == 'windows':
  91. return
  92. if not env.Detect('pkg-config'):
  93. return
  94. if subprocess.call(["pkg-config", "--exists", ' '.join(modules)]) != 0:
  95. return
  96. # Put -I and -L flags directly into the environment, as these don't affect
  97. # the compilation of targets that do not use them
  98. try:
  99. env.ParseConfig('pkg-config --cflags-only-I --libs-only-L ' + ' '.join(modules))
  100. except OSError:
  101. return
  102. # Other flags may affect the compilation of unrelated targets, so store
  103. # them with a prefix, (e.g., XXX_CFLAGS, XXX_LIBS, etc)
  104. try:
  105. flags = env.ParseFlags('!pkg-config --cflags-only-other --libs-only-l --libs-only-other ' + ' '.join(modules))
  106. except OSError:
  107. return
  108. prefix = name.upper() + '_'
  109. for flag_name, flag_value in flags.iteritems():
  110. env[prefix + flag_name] = flag_value
  111. env[name] = True
  112. def generate(env):
  113. """Common environment generation code"""
  114. # Tell tools which machine to compile for
  115. env['TARGET_ARCH'] = env['machine']
  116. env['MSVS_ARCH'] = env['machine']
  117. # Toolchain
  118. platform = env['platform']
  119. if env['toolchain'] == 'default':
  120. if platform == 'winddk':
  121. env['toolchain'] = 'winddk'
  122. elif platform == 'wince':
  123. env['toolchain'] = 'wcesdk'
  124. env.Tool(env['toolchain'])
  125. # Allow override compiler and specify additional flags from environment
  126. if os.environ.has_key('CC'):
  127. env['CC'] = os.environ['CC']
  128. # Update CCVERSION to match
  129. pipe = SCons.Action._subproc(env, [env['CC'], '--version'],
  130. stdin = 'devnull',
  131. stderr = 'devnull',
  132. stdout = subprocess.PIPE)
  133. if pipe.wait() == 0:
  134. line = pipe.stdout.readline()
  135. match = re.search(r'[0-9]+(\.[0-9]+)+', line)
  136. if match:
  137. env['CCVERSION'] = match.group(0)
  138. if os.environ.has_key('CFLAGS'):
  139. env['CCFLAGS'] += SCons.Util.CLVar(os.environ['CFLAGS'])
  140. if os.environ.has_key('CXX'):
  141. env['CXX'] = os.environ['CXX']
  142. if os.environ.has_key('CXXFLAGS'):
  143. env['CXXFLAGS'] += SCons.Util.CLVar(os.environ['CXXFLAGS'])
  144. if os.environ.has_key('LDFLAGS'):
  145. env['LINKFLAGS'] += SCons.Util.CLVar(os.environ['LDFLAGS'])
  146. env['gcc'] = 'gcc' in os.path.basename(env['CC']).split('-')
  147. env['msvc'] = env['CC'] == 'cl'
  148. if env['msvc'] and env['toolchain'] == 'default' and env['machine'] == 'x86_64':
  149. # MSVC x64 support is broken in earlier versions of scons
  150. env.EnsurePythonVersion(2, 0)
  151. # shortcuts
  152. machine = env['machine']
  153. platform = env['platform']
  154. x86 = env['machine'] == 'x86'
  155. ppc = env['machine'] == 'ppc'
  156. gcc = env['gcc']
  157. msvc = env['msvc']
  158. # Determine whether we are cross compiling; in particular, whether we need
  159. # to compile code generators with a different compiler as the target code.
  160. host_platform = _platform.system().lower()
  161. host_machine = os.environ.get('PROCESSOR_ARCHITEW6432', os.environ.get('PROCESSOR_ARCHITECTURE', _platform.machine()))
  162. host_machine = {
  163. 'x86': 'x86',
  164. 'i386': 'x86',
  165. 'i486': 'x86',
  166. 'i586': 'x86',
  167. 'i686': 'x86',
  168. 'ppc' : 'ppc',
  169. 'x86_64': 'x86_64',
  170. }.get(host_machine, 'generic')
  171. env['crosscompile'] = platform != host_platform
  172. if machine == 'x86_64' and host_machine != 'x86_64':
  173. env['crosscompile'] = True
  174. env['hostonly'] = False
  175. # Backwards compatability with the debug= profile= options
  176. if env['build'] == 'debug':
  177. if not env['debug']:
  178. print 'scons: warning: debug option is deprecated and will be removed eventually; use instead'
  179. print
  180. print ' scons build=release'
  181. print
  182. env['build'] = 'release'
  183. if env['profile']:
  184. print 'scons: warning: profile option is deprecated and will be removed eventually; use instead'
  185. print
  186. print ' scons build=profile'
  187. print
  188. env['build'] = 'profile'
  189. if False:
  190. # Enforce SConscripts to use the new build variable
  191. env.popitem('debug')
  192. env.popitem('profile')
  193. else:
  194. # Backwards portability with older sconscripts
  195. if env['build'] in ('debug', 'checked'):
  196. env['debug'] = True
  197. env['profile'] = False
  198. if env['build'] == 'profile':
  199. env['debug'] = False
  200. env['profile'] = True
  201. if env['build'] == 'release':
  202. env['debug'] = False
  203. env['profile'] = False
  204. # Put build output in a separate dir, which depends on the current
  205. # configuration. See also http://www.scons.org/wiki/AdvancedBuildExample
  206. build_topdir = 'build'
  207. build_subdir = env['platform']
  208. if env['machine'] != 'generic':
  209. build_subdir += '-' + env['machine']
  210. if env['build'] != 'release':
  211. build_subdir += '-' + env['build']
  212. build_dir = os.path.join(build_topdir, build_subdir)
  213. # Place the .sconsign file in the build dir too, to avoid issues with
  214. # different scons versions building the same source file
  215. env['build_dir'] = build_dir
  216. env.SConsignFile(os.path.join(build_dir, '.sconsign'))
  217. if 'SCONS_CACHE_DIR' in os.environ:
  218. print 'scons: Using build cache in %s.' % (os.environ['SCONS_CACHE_DIR'],)
  219. env.CacheDir(os.environ['SCONS_CACHE_DIR'])
  220. env['CONFIGUREDIR'] = os.path.join(build_dir, 'conf')
  221. env['CONFIGURELOG'] = os.path.join(os.path.abspath(build_dir), 'config.log')
  222. # Parallel build
  223. if env.GetOption('num_jobs') <= 1:
  224. env.SetOption('num_jobs', num_jobs())
  225. env.Decider('MD5-timestamp')
  226. env.SetOption('max_drift', 60)
  227. # C preprocessor options
  228. cppdefines = []
  229. if env['build'] in ('debug', 'checked'):
  230. cppdefines += ['DEBUG']
  231. else:
  232. cppdefines += ['NDEBUG']
  233. if env['build'] == 'profile':
  234. cppdefines += ['PROFILE']
  235. if platform == 'windows':
  236. cppdefines += [
  237. 'WIN32',
  238. '_WINDOWS',
  239. #'_UNICODE',
  240. #'UNICODE',
  241. # http://msdn.microsoft.com/en-us/library/aa383745.aspx
  242. ('_WIN32_WINNT', '0x0601'),
  243. ('WINVER', '0x0601'),
  244. ]
  245. if msvc and env['toolchain'] != 'winddk':
  246. cppdefines += [
  247. 'VC_EXTRALEAN',
  248. '_USE_MATH_DEFINES',
  249. '_CRT_SECURE_NO_WARNINGS',
  250. '_CRT_SECURE_NO_DEPRECATE',
  251. '_SCL_SECURE_NO_WARNINGS',
  252. '_SCL_SECURE_NO_DEPRECATE',
  253. ]
  254. if env['build'] in ('debug', 'checked'):
  255. cppdefines += ['_DEBUG']
  256. if env['toolchain'] == 'winddk':
  257. # Mimic WINDDK's builtin flags. See also:
  258. # - WINDDK's bin/makefile.new i386mk.inc for more info.
  259. # - buildchk_wxp_x86.log files, generated by the WINDDK's build
  260. # - http://alter.org.ua/docs/nt_kernel/vc8_proj/
  261. if machine == 'x86':
  262. cppdefines += ['_X86_', 'i386']
  263. if machine == 'x86_64':
  264. cppdefines += ['_AMD64_', 'AMD64']
  265. if platform == 'winddk':
  266. cppdefines += [
  267. 'STD_CALL',
  268. ('CONDITION_HANDLING', '1'),
  269. ('NT_INST', '0'),
  270. ('WIN32', '100'),
  271. ('_NT1X_', '100'),
  272. ('WINNT', '1'),
  273. ('_WIN32_WINNT', '0x0501'), # minimum required OS version
  274. ('WINVER', '0x0501'),
  275. ('_WIN32_IE', '0x0603'),
  276. ('WIN32_LEAN_AND_MEAN', '1'),
  277. ('DEVL', '1'),
  278. ('__BUILDMACHINE__', 'WinDDK'),
  279. ('FPO', '0'),
  280. ]
  281. if env['build'] in ('debug', 'checked'):
  282. cppdefines += [('DBG', 1)]
  283. if platform == 'wince':
  284. cppdefines += [
  285. '_CRT_SECURE_NO_DEPRECATE',
  286. '_USE_32BIT_TIME_T',
  287. 'UNICODE',
  288. '_UNICODE',
  289. ('UNDER_CE', '600'),
  290. ('_WIN32_WCE', '0x600'),
  291. 'WINCEOEM',
  292. 'WINCEINTERNAL',
  293. 'WIN32',
  294. 'STRICT',
  295. 'x86',
  296. '_X86_',
  297. 'INTERNATIONAL',
  298. ('INTLMSG_CODEPAGE', '1252'),
  299. ]
  300. if platform == 'windows':
  301. cppdefines += ['PIPE_SUBSYSTEM_WINDOWS_USER']
  302. if platform == 'winddk':
  303. cppdefines += ['PIPE_SUBSYSTEM_WINDOWS_DISPLAY']
  304. if platform == 'wince':
  305. cppdefines += ['PIPE_SUBSYSTEM_WINDOWS_CE']
  306. cppdefines += ['PIPE_SUBSYSTEM_WINDOWS_CE_OGL']
  307. if platform == 'embedded':
  308. cppdefines += ['PIPE_OS_EMBEDDED']
  309. env.Append(CPPDEFINES = cppdefines)
  310. # C compiler options
  311. cflags = [] # C
  312. cxxflags = [] # C++
  313. ccflags = [] # C & C++
  314. if gcc:
  315. ccversion = env['CCVERSION']
  316. if env['build'] == 'debug':
  317. ccflags += ['-O0']
  318. elif ccversion.startswith('4.2.'):
  319. # gcc 4.2.x optimizer is broken
  320. print "warning: gcc 4.2.x optimizer is broken -- disabling optimizations"
  321. ccflags += ['-O0']
  322. else:
  323. ccflags += ['-O3']
  324. ccflags += ['-g3']
  325. if env['build'] in ('checked', 'profile'):
  326. # See http://code.google.com/p/jrfonseca/wiki/Gprof2Dot#Which_options_should_I_pass_to_gcc_when_compiling_for_profiling?
  327. ccflags += [
  328. '-fno-omit-frame-pointer',
  329. '-fno-optimize-sibling-calls',
  330. ]
  331. if env['machine'] == 'x86':
  332. ccflags += [
  333. '-m32',
  334. #'-march=pentium4',
  335. ]
  336. if distutils.version.LooseVersion(ccversion) >= distutils.version.LooseVersion('4.2') \
  337. and (platform != 'windows' or env['build'] == 'debug' or True):
  338. # NOTE: We need to ensure stack is realigned given that we
  339. # produce shared objects, and have no control over the stack
  340. # alignment policy of the application. Therefore we need
  341. # -mstackrealign ore -mincoming-stack-boundary=2.
  342. #
  343. # XXX: -O and -mstackrealign causes stack corruption on MinGW
  344. #
  345. # XXX: We could have SSE without -mstackrealign if we always used
  346. # __attribute__((force_align_arg_pointer)), but that's not
  347. # always the case.
  348. ccflags += [
  349. '-mstackrealign', # ensure stack is aligned
  350. '-mmmx', '-msse', '-msse2', # enable SIMD intrinsics
  351. #'-mfpmath=sse',
  352. ]
  353. if platform in ['windows', 'darwin']:
  354. # Workaround http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37216
  355. ccflags += ['-fno-common']
  356. if env['machine'] == 'x86_64':
  357. ccflags += ['-m64']
  358. if platform == 'darwin':
  359. ccflags += ['-fno-common']
  360. # See also:
  361. # - http://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
  362. ccflags += [
  363. '-Wall',
  364. '-Wno-long-long',
  365. '-ffast-math',
  366. '-fmessage-length=0', # be nice to Eclipse
  367. ]
  368. cflags += [
  369. '-Wmissing-prototypes',
  370. '-std=gnu99',
  371. ]
  372. if distutils.version.LooseVersion(ccversion) >= distutils.version.LooseVersion('4.0'):
  373. ccflags += [
  374. '-Wmissing-field-initializers',
  375. ]
  376. if distutils.version.LooseVersion(ccversion) >= distutils.version.LooseVersion('4.2'):
  377. ccflags += [
  378. '-Werror=pointer-arith',
  379. ]
  380. cflags += [
  381. '-Werror=declaration-after-statement',
  382. ]
  383. if msvc:
  384. # See also:
  385. # - http://msdn.microsoft.com/en-us/library/19z1t1wy.aspx
  386. # - cl /?
  387. if env['build'] == 'debug':
  388. ccflags += [
  389. '/Od', # disable optimizations
  390. '/Oi', # enable intrinsic functions
  391. '/Oy-', # disable frame pointer omission
  392. ]
  393. else:
  394. ccflags += [
  395. '/O2', # optimize for speed
  396. ]
  397. if env['build'] == 'release':
  398. ccflags += [
  399. '/GL', # enable whole program optimization
  400. ]
  401. else:
  402. ccflags += [
  403. '/GL-', # disable whole program optimization
  404. ]
  405. ccflags += [
  406. '/fp:fast', # fast floating point
  407. '/W3', # warning level
  408. #'/Wp64', # enable 64 bit porting warnings
  409. ]
  410. if env['machine'] == 'x86':
  411. ccflags += [
  412. #'/arch:SSE2', # use the SSE2 instructions
  413. ]
  414. if platform == 'windows':
  415. ccflags += [
  416. # TODO
  417. ]
  418. if platform == 'winddk':
  419. ccflags += [
  420. '/Zl', # omit default library name in .OBJ
  421. '/Zp8', # 8bytes struct member alignment
  422. '/Gy', # separate functions for linker
  423. '/Gm-', # disable minimal rebuild
  424. '/WX', # treat warnings as errors
  425. '/Gz', # __stdcall Calling convention
  426. '/GX-', # disable C++ EH
  427. '/GR-', # disable C++ RTTI
  428. '/GF', # enable read-only string pooling
  429. '/G6', # optimize for PPro, P-II, P-III
  430. '/Ze', # enable extensions
  431. '/Gi-', # disable incremental compilation
  432. '/QIfdiv-', # disable Pentium FDIV fix
  433. '/hotpatch', # prepares an image for hotpatching.
  434. #'/Z7', #enable old-style debug info
  435. ]
  436. if platform == 'wince':
  437. # See also C:\WINCE600\public\common\oak\misc\makefile.def
  438. ccflags += [
  439. '/Zl', # omit default library name in .OBJ
  440. '/GF', # enable read-only string pooling
  441. '/GR-', # disable C++ RTTI
  442. '/GS', # enable security checks
  443. # Allow disabling language conformance to maintain backward compat
  444. #'/Zc:wchar_t-', # don't force wchar_t as native type, instead of typedef
  445. #'/Zc:forScope-', # don't enforce Standard C++ for scoping rules
  446. #'/wd4867',
  447. #'/wd4430',
  448. #'/MT',
  449. #'/U_MT',
  450. ]
  451. # Automatic pdb generation
  452. # See http://scons.tigris.org/issues/show_bug.cgi?id=1656
  453. env.EnsureSConsVersion(0, 98, 0)
  454. env['PDB'] = '${TARGET.base}.pdb'
  455. env.Append(CCFLAGS = ccflags)
  456. env.Append(CFLAGS = cflags)
  457. env.Append(CXXFLAGS = cxxflags)
  458. if env['platform'] == 'windows' and msvc:
  459. # Choose the appropriate MSVC CRT
  460. # http://msdn.microsoft.com/en-us/library/2kzt1wy3.aspx
  461. if env['build'] in ('debug', 'checked'):
  462. env.Append(CCFLAGS = ['/MTd'])
  463. env.Append(SHCCFLAGS = ['/LDd'])
  464. else:
  465. env.Append(CCFLAGS = ['/MT'])
  466. env.Append(SHCCFLAGS = ['/LD'])
  467. # Assembler options
  468. if gcc:
  469. if env['machine'] == 'x86':
  470. env.Append(ASFLAGS = ['-m32'])
  471. if env['machine'] == 'x86_64':
  472. env.Append(ASFLAGS = ['-m64'])
  473. # Linker options
  474. linkflags = []
  475. shlinkflags = []
  476. if gcc:
  477. if env['machine'] == 'x86':
  478. linkflags += ['-m32']
  479. if env['machine'] == 'x86_64':
  480. linkflags += ['-m64']
  481. if env['platform'] not in ('darwin'):
  482. shlinkflags += [
  483. '-Wl,-Bsymbolic',
  484. ]
  485. # Handle circular dependencies in the libraries
  486. if env['platform'] in ('darwin'):
  487. pass
  488. else:
  489. env['_LIBFLAGS'] = '-Wl,--start-group ' + env['_LIBFLAGS'] + ' -Wl,--end-group'
  490. if msvc:
  491. if env['build'] == 'release':
  492. # enable Link-time Code Generation
  493. linkflags += ['/LTCG']
  494. env.Append(ARFLAGS = ['/LTCG'])
  495. if platform == 'windows' and msvc:
  496. # See also:
  497. # - http://msdn2.microsoft.com/en-us/library/y0zzbyt4.aspx
  498. linkflags += [
  499. '/fixed:no',
  500. '/incremental:no',
  501. ]
  502. if platform == 'winddk':
  503. linkflags += [
  504. '/merge:_PAGE=PAGE',
  505. '/merge:_TEXT=.text',
  506. '/section:INIT,d',
  507. '/opt:ref',
  508. '/opt:icf',
  509. '/ignore:4198,4010,4037,4039,4065,4070,4078,4087,4089,4221',
  510. '/incremental:no',
  511. '/fullbuild',
  512. '/release',
  513. '/nodefaultlib',
  514. '/wx',
  515. '/debug',
  516. '/debugtype:cv',
  517. '/version:5.1',
  518. '/osversion:5.1',
  519. '/functionpadmin:5',
  520. '/safeseh',
  521. '/pdbcompress',
  522. '/stack:0x40000,0x1000',
  523. '/driver',
  524. '/align:0x80',
  525. '/subsystem:native,5.01',
  526. '/base:0x10000',
  527. '/entry:DrvEnableDriver',
  528. ]
  529. if env['build'] != 'release':
  530. linkflags += [
  531. '/MAP', # http://msdn.microsoft.com/en-us/library/k7xkk3e2.aspx
  532. ]
  533. if platform == 'wince':
  534. linkflags += [
  535. '/nodefaultlib',
  536. #'/incremental:no',
  537. #'/fullbuild',
  538. '/entry:_DllMainCRTStartup',
  539. ]
  540. env.Append(LINKFLAGS = linkflags)
  541. env.Append(SHLINKFLAGS = shlinkflags)
  542. # We have C++ in several libraries, so always link with the C++ compiler
  543. if env['gcc']:
  544. env['LINK'] = env['CXX']
  545. # Default libs
  546. env.Append(LIBS = [])
  547. # Load tools
  548. if env['llvm']:
  549. env.Tool('llvm')
  550. env.Tool('udis86')
  551. pkg_config_modules(env, 'x11', ['x11', 'xext'])
  552. pkg_config_modules(env, 'drm', ['libdrm'])
  553. pkg_config_modules(env, 'drm_intel', ['libdrm_intel'])
  554. pkg_config_modules(env, 'drm_radeon', ['libdrm_radeon'])
  555. pkg_config_modules(env, 'xorg', ['xorg-server'])
  556. pkg_config_modules(env, 'kms', ['libkms'])
  557. env['dri'] = env['x11'] and env['drm']
  558. # Custom builders and methods
  559. env.Tool('custom')
  560. createInstallMethods(env)
  561. # for debugging
  562. #print env.Dump()
  563. def exists(env):
  564. return 1