[Mesa-dev] [PATCH] scons : Support LLVM 3.5 and 3.6 on windows.

2015-04-27 Thread olivier . pena . 80
From: Olivier Pena op...@isagri.fr

llvm/Config/llvm-config.h is parsed instead of llvm/Config/config.h for 
detecting LLVM version 
(http://lists.cs.uiuc.edu/pipermail/llvmdev/2014-June/073707.html)
---
 scons/llvm.py | 33 ++---
 1 file changed, 26 insertions(+), 7 deletions(-)

diff --git a/scons/llvm.py b/scons/llvm.py
index be7df9f..6c6b733 100644
--- a/scons/llvm.py
+++ b/scons/llvm.py
@@ -72,18 +72,25 @@ def generate(env):
 return
 
 # Try to determine the LLVM version from llvm/Config/config.h
-llvm_config = os.path.join(llvm_dir, 'include/llvm/Config/config.h')
+llvm_config = os.path.join(llvm_dir, 
'include/llvm/Config/llvm-config.h')
 if not os.path.exists(llvm_config):
 print 'scons: could not find %s' % llvm_config
 return
-llvm_version_re = re.compile(r'^#define PACKAGE_VERSION ([^]*)')
+llvm_version_major_re = re.compile(r'^#define LLVM_VERSION_MAJOR 
([0-9]+)')
+llvm_version_minor_re = re.compile(r'^#define LLVM_VERSION_MINOR 
([0-9]+)')
 llvm_version = None
+llvm_version_major = None
+llvm_version_minor = None
 for line in open(llvm_config, 'rt'):
-mo = llvm_version_re.match(line)
+mo = llvm_version_major_re.match(line)
 if mo:
-llvm_version = mo.group(1)
-llvm_version = distutils.version.LooseVersion(llvm_version)
-break
+llvm_version_major = mo.group(1)
+mo = llvm_version_minor_re.match(line)
+if mo:
+llvm_version_minor = mo.group(1)
+if (llvm_version_major is not None) and (llvm_version_minor is not 
None):
+llvm_version = 
distutils.version.LooseVersion('{0}.{1}'.format(llvm_version_major, 
llvm_version_minor))
+
 if llvm_version is None:
 print 'scons: could not determine the LLVM version from %s' % 
llvm_config
 return
@@ -99,7 +106,19 @@ def generate(env):
 ])
 env.Prepend(LIBPATH = [os.path.join(llvm_dir, 'lib')])
 # LIBS should match the output of `llvm-config --libs engine mcjit 
bitwriter x86asmprinter`
-if llvm_version = distutils.version.LooseVersion('3.5'):
+if llvm_version = distutils.version.LooseVersion('3.6'):
+env.Prepend(LIBS = [
+'LLVMBitWriter', 'LLVMX86Disassembler', 'LLVMX86AsmParser',
+'LLVMX86CodeGen', 'LLVMSelectionDAG', 'LLVMAsmPrinter',
+'LLVMCodeGen', 'LLVMScalarOpts', 'LLVMProfileData',
+'LLVMInstCombine', 'LLVMTransformUtils', 'LLVMipa',
+'LLVMAnalysis', 'LLVMX86Desc', 'LLVMMCDisassembler',
+'LLVMX86Info', 'LLVMX86AsmPrinter', 'LLVMX86Utils',
+'LLVMMCJIT', 'LLVMTarget', 'LLVMExecutionEngine',
+'LLVMRuntimeDyld', 'LLVMObject', 'LLVMMCParser',
+'LLVMBitReader', 'LLVMMC', 'LLVMCore', 'LLVMSupport'
+])
+elif llvm_version = distutils.version.LooseVersion('3.5'):
 env.Prepend(LIBS = [
 'LLVMBitWriter', 'LLVMMCJIT', 'LLVMRuntimeDyld',
 'LLVMX86Disassembler', 'LLVMX86AsmParser', 'LLVMX86CodeGen',
-- 
1.9.4.msysgit.2

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] scons : Support LLVM 3.5 and 3.6 on windows.

2015-04-27 Thread Jose Fonseca

On 27/04/15 11:23, olivier.pena...@gmail.com wrote:

From: Olivier Pena op...@isagri.fr

llvm/Config/llvm-config.h is parsed instead of llvm/Config/config.h for 
detecting LLVM version 
(http://lists.cs.uiuc.edu/pipermail/llvmdev/2014-June/073707.html)
---
  scons/llvm.py | 33 ++---
  1 file changed, 26 insertions(+), 7 deletions(-)

diff --git a/scons/llvm.py b/scons/llvm.py
index be7df9f..6c6b733 100644
--- a/scons/llvm.py
+++ b/scons/llvm.py
@@ -72,18 +72,25 @@ def generate(env):
  return

  # Try to determine the LLVM version from llvm/Config/config.h
-llvm_config = os.path.join(llvm_dir, 'include/llvm/Config/config.h')
+llvm_config = os.path.join(llvm_dir, 
'include/llvm/Config/llvm-config.h')



  if not os.path.exists(llvm_config):


We must keep supporting down to LLVM version 3.3, so the patch needs to 
be updated re-try with config.h (and the old regular expressions) when 
llvm-config.h does not exist.



  print 'scons: could not find %s' % llvm_config
  return
-llvm_version_re = re.compile(r'^#define PACKAGE_VERSION ([^]*)')
+llvm_version_major_re = re.compile(r'^#define LLVM_VERSION_MAJOR 
([0-9]+)')
+llvm_version_minor_re = re.compile(r'^#define LLVM_VERSION_MINOR 
([0-9]+)')
  llvm_version = None
+llvm_version_major = None
+llvm_version_minor = None
  for line in open(llvm_config, 'rt'):
-mo = llvm_version_re.match(line)
+mo = llvm_version_major_re.match(line)
  if mo:
-llvm_version = mo.group(1)
-llvm_version = distutils.version.LooseVersion(llvm_version)
-break
+llvm_version_major = mo.group(1)
+mo = llvm_version_minor_re.match(line)
+if mo:
+llvm_version_minor = mo.group(1)
+if (llvm_version_major is not None) and (llvm_version_minor is not 
None):
+llvm_version = 
distutils.version.LooseVersion('{0}.{1}'.format(llvm_version_major, 
llvm_version_minor))
+
  if llvm_version is None:
  print 'scons: could not determine the LLVM version from %s' % 
llvm_config
  return
@@ -99,7 +106,19 @@ def generate(env):
  ])
  env.Prepend(LIBPATH = [os.path.join(llvm_dir, 'lib')])
  # LIBS should match the output of `llvm-config --libs engine mcjit 
bitwriter x86asmprinter`
-if llvm_version = distutils.version.LooseVersion('3.5'):
+if llvm_version = distutils.version.LooseVersion('3.6'):
+env.Prepend(LIBS = [
+'LLVMBitWriter', 'LLVMX86Disassembler', 'LLVMX86AsmParser',
+'LLVMX86CodeGen', 'LLVMSelectionDAG', 'LLVMAsmPrinter',
+'LLVMCodeGen', 'LLVMScalarOpts', 'LLVMProfileData',
+'LLVMInstCombine', 'LLVMTransformUtils', 'LLVMipa',
+'LLVMAnalysis', 'LLVMX86Desc', 'LLVMMCDisassembler',
+'LLVMX86Info', 'LLVMX86AsmPrinter', 'LLVMX86Utils',
+'LLVMMCJIT', 'LLVMTarget', 'LLVMExecutionEngine',
+'LLVMRuntimeDyld', 'LLVMObject', 'LLVMMCParser',
+'LLVMBitReader', 'LLVMMC', 'LLVMCore', 'LLVMSupport'


Is there any actual change in the LIBS content? Just for my info, what 
is it?


Jose


+])
+elif llvm_version = distutils.version.LooseVersion('3.5'):
  env.Prepend(LIBS = [
  'LLVMBitWriter', 'LLVMMCJIT', 'LLVMRuntimeDyld',
  'LLVMX86Disassembler', 'LLVMX86AsmParser', 'LLVMX86CodeGen',



___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] scons : Support LLVM 3.5 and 3.6 on windows.

2015-04-27 Thread Olivier PENA
Hi Jose,

It seems the minimum version is 3.3 (var required_llvm_version).
LLVM 3.3 already provided llvm-config.h.
So, that should be enough ?

I compiled and ran osmesa and libgl-gdi successfully with llvm 3.4.2, 3.5.0 and 
3.6.0 (msvc 2013 32 bits) with this patch.

It seems there is some changes in the library returned by llvm-config --libs 
engine mcjit bitwriter x86asmprinter (as commented in llvm.py) with llvm 3.6
   removed : LLVMJIT 
   added : LLVMProfileData, LLVMX86Desc, LLVMMCDisassembler



-Message d'origine-
De : mesa-dev [mailto:mesa-dev-boun...@lists.freedesktop.org] De la part de 
Jose Fonseca
Envoyé : lundi 27 avril 2015 16:28
À : olivier.pena...@gmail.com; mesa-dev@lists.freedesktop.org
Objet : Re: [Mesa-dev] [PATCH] scons : Support LLVM 3.5 and 3.6 on windows.

On 27/04/15 11:23, olivier.pena...@gmail.com wrote:
 From: Olivier Pena op...@isagri.fr

 llvm/Config/llvm-config.h is parsed instead of llvm/Config/config.h for 
 detecting LLVM version 
 (http://lists.cs.uiuc.edu/pipermail/llvmdev/2014-June/073707.html)
 ---
   scons/llvm.py | 33 ++---
   1 file changed, 26 insertions(+), 7 deletions(-)

 diff --git a/scons/llvm.py b/scons/llvm.py
 index be7df9f..6c6b733 100644
 --- a/scons/llvm.py
 +++ b/scons/llvm.py
 @@ -72,18 +72,25 @@ def generate(env):
   return

   # Try to determine the LLVM version from llvm/Config/config.h
 -llvm_config = os.path.join(llvm_dir, 'include/llvm/Config/config.h')
 +llvm_config = os.path.join(llvm_dir, 
 'include/llvm/Config/llvm-config.h')

   if not os.path.exists(llvm_config):

We must keep supporting down to LLVM version 3.3, so the patch needs to 
be updated re-try with config.h (and the old regular expressions) when 
llvm-config.h does not exist.

   print 'scons: could not find %s' % llvm_config
   return
 -llvm_version_re = re.compile(r'^#define PACKAGE_VERSION ([^]*)')
 +llvm_version_major_re = re.compile(r'^#define LLVM_VERSION_MAJOR 
 ([0-9]+)')
 +llvm_version_minor_re = re.compile(r'^#define LLVM_VERSION_MINOR 
 ([0-9]+)')
   llvm_version = None
 +llvm_version_major = None
 +llvm_version_minor = None
   for line in open(llvm_config, 'rt'):
 -mo = llvm_version_re.match(line)
 +mo = llvm_version_major_re.match(line)
   if mo:
 -llvm_version = mo.group(1)
 -llvm_version = distutils.version.LooseVersion(llvm_version)
 -break
 +llvm_version_major = mo.group(1)
 +mo = llvm_version_minor_re.match(line)
 +if mo:
 +llvm_version_minor = mo.group(1)
 +if (llvm_version_major is not None) and (llvm_version_minor is not 
 None):
 +llvm_version = 
 distutils.version.LooseVersion('{0}.{1}'.format(llvm_version_major, 
 llvm_version_minor))
 +
   if llvm_version is None:
   print 'scons: could not determine the LLVM version from %s' % 
 llvm_config
   return
 @@ -99,7 +106,19 @@ def generate(env):
   ])
   env.Prepend(LIBPATH = [os.path.join(llvm_dir, 'lib')])
   # LIBS should match the output of `llvm-config --libs engine mcjit 
 bitwriter x86asmprinter`
 -if llvm_version = distutils.version.LooseVersion('3.5'):
 +if llvm_version = distutils.version.LooseVersion('3.6'):
 +env.Prepend(LIBS = [
 +'LLVMBitWriter', 'LLVMX86Disassembler', 'LLVMX86AsmParser',
 +'LLVMX86CodeGen', 'LLVMSelectionDAG', 'LLVMAsmPrinter',
 +'LLVMCodeGen', 'LLVMScalarOpts', 'LLVMProfileData',
 +'LLVMInstCombine', 'LLVMTransformUtils', 'LLVMipa',
 +'LLVMAnalysis', 'LLVMX86Desc', 'LLVMMCDisassembler',
 +'LLVMX86Info', 'LLVMX86AsmPrinter', 'LLVMX86Utils',
 +'LLVMMCJIT', 'LLVMTarget', 'LLVMExecutionEngine',
 +'LLVMRuntimeDyld', 'LLVMObject', 'LLVMMCParser',
 +'LLVMBitReader', 'LLVMMC', 'LLVMCore', 'LLVMSupport'

Is there any actual change in the LIBS content? Just for my info, what 
is it?

Jose

 +])
 +elif llvm_version = distutils.version.LooseVersion('3.5'):
   env.Prepend(LIBS = [
   'LLVMBitWriter', 'LLVMMCJIT', 'LLVMRuntimeDyld',
   'LLVMX86Disassembler', 'LLVMX86AsmParser', 'LLVMX86CodeGen',


___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


 Click https://www.mailcontrol.com/sr/MZbqvYs5QwJvpeaetUwhCQ==  to report this 
email as spam.


-
Ce message a été traité contre les virus par quatre outils différents 
(Kaspersky, McAfee, Symantec et ThreatSeeker). 
This message has been scanned for viruses (by Kaspersky, McAfee

Re: [Mesa-dev] [PATCH] scons : Support LLVM 3.5 and 3.6 on windows.

2015-04-27 Thread Jose Fonseca

On 27/04/15 15:48, Olivier PENA wrote:

Hi Jose,

It seems the minimum version is 3.3 (var required_llvm_version).
LLVM 3.3 already provided llvm-config.h.
So, that should be enough ?


Oh, I hadn't noticed that.  It looks great then.

In fact, now that llvm_config.h is guaranteed to exist, I wonder if we 
should replace our HAVE_LLVM macro with


  #include llvm/Config/llvm_config.h
  #define HAVE_LLVM ((LLVM_VERSION_MAJOR  8) | LLVM_VERSION_MINOR)

Anyway, this can be left to a follow up change.



I compiled and ran osmesa and libgl-gdi successfully with llvm 3.4.2, 3.5.0 and 
3.6.0 (msvc 2013 32 bits) with this patch.

It seems there is some changes in the library returned by llvm-config --libs 
engine mcjit bitwriter x86asmprinter (as commented in llvm.py) with llvm 3.6
removed : LLVMJIT
added : LLVMProfileData, LLVMX86Desc, LLVMMCDisassembler


OK.  Thanks for the summary.

I'll commit your patch shortly.

Jose





-Message d'origine-
De : mesa-dev [mailto:mesa-dev-boun...@lists.freedesktop.org] De la part de 
Jose Fonseca
Envoyé : lundi 27 avril 2015 16:28
À : olivier.pena...@gmail.com; mesa-dev@lists.freedesktop.org
Objet : Re: [Mesa-dev] [PATCH] scons : Support LLVM 3.5 and 3.6 on windows.

On 27/04/15 11:23, olivier.pena...@gmail.com wrote:

From: Olivier Pena op...@isagri.fr

llvm/Config/llvm-config.h is parsed instead of llvm/Config/config.h for detecting LLVM version 
(https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.cs.uiuc.edu_pipermail_llvmdev_2014-2DJune_073707.htmld=AwIGaQc=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEsr=zfmBZnnVGHeYde45pMKNnVyzeaZbdIqVLprmZCM2zzEm=DXFfwqG_A91A1WPD11H_UUyk6-Y99WhboOz2yC_TpIgs=p3Svjp-aZys1Pl1IjovLe4_MMdLj2W2uuE1prB6jcVAe=
 )
---
   scons/llvm.py | 33 ++---
   1 file changed, 26 insertions(+), 7 deletions(-)

diff --git a/scons/llvm.py b/scons/llvm.py
index be7df9f..6c6b733 100644
--- a/scons/llvm.py
+++ b/scons/llvm.py
@@ -72,18 +72,25 @@ def generate(env):
   return

   # Try to determine the LLVM version from llvm/Config/config.h
-llvm_config = os.path.join(llvm_dir, 'include/llvm/Config/config.h')
+llvm_config = os.path.join(llvm_dir, 
'include/llvm/Config/llvm-config.h')



   if not os.path.exists(llvm_config):


We must keep supporting down to LLVM version 3.3, so the patch needs to
be updated re-try with config.h (and the old regular expressions) when
llvm-config.h does not exist.


   print 'scons: could not find %s' % llvm_config
   return
-llvm_version_re = re.compile(r'^#define PACKAGE_VERSION ([^]*)')
+llvm_version_major_re = re.compile(r'^#define LLVM_VERSION_MAJOR 
([0-9]+)')
+llvm_version_minor_re = re.compile(r'^#define LLVM_VERSION_MINOR 
([0-9]+)')
   llvm_version = None
+llvm_version_major = None
+llvm_version_minor = None
   for line in open(llvm_config, 'rt'):
-mo = llvm_version_re.match(line)
+mo = llvm_version_major_re.match(line)
   if mo:
-llvm_version = mo.group(1)
-llvm_version = distutils.version.LooseVersion(llvm_version)
-break
+llvm_version_major = mo.group(1)
+mo = llvm_version_minor_re.match(line)
+if mo:
+llvm_version_minor = mo.group(1)
+if (llvm_version_major is not None) and (llvm_version_minor is not 
None):
+llvm_version = 
distutils.version.LooseVersion('{0}.{1}'.format(llvm_version_major, 
llvm_version_minor))
+
   if llvm_version is None:
   print 'scons: could not determine the LLVM version from %s' % 
llvm_config
   return
@@ -99,7 +106,19 @@ def generate(env):
   ])
   env.Prepend(LIBPATH = [os.path.join(llvm_dir, 'lib')])
   # LIBS should match the output of `llvm-config --libs engine mcjit 
bitwriter x86asmprinter`
-if llvm_version = distutils.version.LooseVersion('3.5'):
+if llvm_version = distutils.version.LooseVersion('3.6'):
+env.Prepend(LIBS = [
+'LLVMBitWriter', 'LLVMX86Disassembler', 'LLVMX86AsmParser',
+'LLVMX86CodeGen', 'LLVMSelectionDAG', 'LLVMAsmPrinter',
+'LLVMCodeGen', 'LLVMScalarOpts', 'LLVMProfileData',
+'LLVMInstCombine', 'LLVMTransformUtils', 'LLVMipa',
+'LLVMAnalysis', 'LLVMX86Desc', 'LLVMMCDisassembler',
+'LLVMX86Info', 'LLVMX86AsmPrinter', 'LLVMX86Utils',
+'LLVMMCJIT', 'LLVMTarget', 'LLVMExecutionEngine',
+'LLVMRuntimeDyld', 'LLVMObject', 'LLVMMCParser',
+'LLVMBitReader', 'LLVMMC', 'LLVMCore', 'LLVMSupport'


Is there any actual change in the LIBS content? Just for my info, what
is it?

Jose


+])
+elif llvm_version = distutils.version.LooseVersion('3.5'):
   env.Prepend(LIBS