clang : solve the issue with missing default include paths for OpenMP and libc++

resource : support for finer grained linking of resources
This commit is contained in:
alalazo
2015-12-09 13:06:39 +01:00
parent 50bd4d2e4e
commit 20e67bc5e6
5 changed files with 56 additions and 18 deletions

View File

@@ -22,8 +22,13 @@
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
from spack import *
import os
import os.path
class Clang(Package):
"""The goal of the Clang project is to create a new C, C++,
Objective C and Objective C++ front-end for the LLVM compiler.
@@ -62,3 +67,29 @@ def install(self, spec, prefix):
*options)
make()
make("install")
# CLang doesn't look in llvm folders for system headers...
self.link_llvm_directories(spec)
def link_llvm_directories(self, spec):
def clang_include_dir_at(root):
return join_path(root, 'include')
def clang_lib_dir_at(root):
return join_path(root, 'lib/clang/', str(self.version), 'include')
def do_link(source_dir, destination_dir):
if os.path.exists(source_dir):
for name in os.listdir(source_dir):
source = join_path(source_dir, name)
link = join_path(destination_dir, name)
os.symlink(source, link)
# Link folder and files in include
llvm_dir = clang_include_dir_at(spec['llvm'].prefix)
clang_dir = clang_include_dir_at(self.prefix)
do_link(llvm_dir, clang_dir)
# Link folder and files in lib
llvm_dir = clang_lib_dir_at(spec['llvm'].prefix)
clang_dir = clang_lib_dir_at(self.prefix)
do_link(llvm_dir, clang_dir)

View File

@@ -53,10 +53,10 @@ class Llvm(Package):
destination='projects', when='@3.7.0')
resource(name='libcxx',
url='http://llvm.org/releases/3.7.0/libcxx-3.7.0.src.tar.xz', md5='46aa5175cbe1ad42d6e9c995968e56dd',
destination='projects', basename='libcxx', when='+libcxx@3.7.0')
destination='projects', placement='libcxx', when='+libcxx@3.7.0')
resource(name='libcxxabi',
url='http://llvm.org/releases/3.7.0/libcxxabi-3.7.0.src.tar.xz', md5='5aa769e2fca79fa5335cfae8f6258772',
destination='projects', basename='libcxxabi', when='+libcxx@3.7.0')
destination='projects', placement='libcxxabi', when='+libcxx@3.7.0')
##########
def install(self, spec, prefix):