Change path to CMakeLists.txt to be relative to root, not pwd (#4420)

* Change path to CMakeLists.txt to be relative to root, not pwd

* Changes requested during code review

* Revert back to old naming of root_cmakelists_dir
* Make relative directory more clear in docs

* Revert change causing build_type AttributeError

* Fix forgotten abs_path var

* Update CLHEP with new relative path

* Update more packages with new root_cmakelists_dir syntax
This commit is contained in:
Adam J. Stewart 2017-07-18 11:58:19 -05:00 committed by becker33
parent 5a1ee22575
commit 1215c3b20c
9 changed files with 20 additions and 23 deletions

View File

@ -24,6 +24,7 @@
##############################################################################
import inspect
import os
import platform
import spack.build_environment
@ -84,9 +85,12 @@ def build_type(self):
@property
def root_cmakelists_dir(self):
"""Returns the location of the root CMakeLists.txt
"""The relative path to the directory containing CMakeLists.txt
:return: directory containing the root CMakeLists.txt
This path is relative to the root of the extracted tarball,
not to the ``build_directory``. Defaults to the current directory.
:return: directory containing CMakeLists.txt
"""
return self.stage.source_path
@ -143,8 +147,9 @@ def cmake_args(self):
def cmake(self, spec, prefix):
"""Runs ``cmake`` in the build directory"""
options = [self.root_cmakelists_dir] + self.std_cmake_args + \
self.cmake_args()
options = [os.path.abspath(self.root_cmakelists_dir)]
options += self.std_cmake_args
options += self.cmake_args()
with working_dir(self.build_directory, create=True):
inspect.getmodule(self).cmake(*options)

View File

@ -59,7 +59,7 @@ class Bcl2fastq2(Package):
# libexslt bits.
patch('cxxConfigure-cmake.patch')
root_cmakelists_dir = '../src'
root_cmakelists_dir = 'src'
def url_for_version(self, version):
url = "https://support.illumina.com/content/dam/illumina-support/documents/downloads/software/bcl2fastq/bcl2fastq2-v{0}-tar.zip"

View File

@ -31,10 +31,6 @@ class Clfft(CMakePackage):
homepage = "https://github.com/clMathLibraries/clFFT"
url = "https://github.com/clMathLibraries/clFFT/archive/v2.12.2.tar.gz"
@property
def root_cmakelists_dir(self):
return join_path(self.stage.source_path, 'src')
version('2.12.2', '9104d85f9f2f3c58dd8efc0e4b06496f')
variant('client', default=True,
@ -43,6 +39,8 @@ def root_cmakelists_dir(self):
depends_on('opencl@1.2:')
depends_on('boost@1.33.0:', when='+client')
root_cmakelists_dir = 'src'
def cmake_args(self):
spec = self.spec

View File

@ -63,7 +63,7 @@ def patch(self):
'%s/%s/CLHEP/CMakeLists.txt'
% (self.stage.path, self.spec.version))
root_cmakelists_dir = '../CLHEP'
root_cmakelists_dir = 'CLHEP'
def build_type(self):
spec = self.spec

View File

@ -38,4 +38,4 @@ class Cpprestsdk(CMakePackage):
depends_on('boost')
root_cmakelists_dir = '../Release'
root_cmakelists_dir = 'Release'

View File

@ -31,10 +31,6 @@ class IsaacServer(CMakePackage):
homepage = "http://computationalradiationphysics.github.io/isaac/"
url = "https://github.com/ComputationalRadiationPhysics/isaac/archive/v1.3.0.tar.gz"
@property
def root_cmakelists_dir(self):
return join_path(self.stage.source_path, 'server')
version('develop', branch='dev',
git='https://github.com/ComputationalRadiationPhysics/isaac.git')
version('master', branch='master',
@ -51,3 +47,5 @@ def root_cmakelists_dir(self):
depends_on('boost@1.56:', type='link')
depends_on('libwebsockets@2.1.1:', type='link')
# depends_on('gstreamer@1.0', when='+gstreamer')
root_cmakelists_dir = 'server'

View File

@ -31,10 +31,6 @@ class Isaac(CMakePackage):
homepage = "http://computationalradiationphysics.github.io/isaac/"
url = "https://github.com/ComputationalRadiationPhysics/isaac/archive/v1.3.0.tar.gz"
@property
def root_cmakelists_dir(self):
return join_path(self.stage.source_path, 'lib')
version('develop', branch='dev',
git='https://github.com/ComputationalRadiationPhysics/isaac.git')
version('master', branch='master',
@ -55,3 +51,5 @@ def root_cmakelists_dir(self):
# depends_on('alpaka', when='+alpaka')
depends_on('icet', type='link')
depends_on('mpi', type='link')
root_cmakelists_dir = 'lib'

View File

@ -55,7 +55,7 @@ class Quinoa(CMakePackage):
depends_on("pstreams")
depends_on("pegtl")
root_cmakelists_dir = '../src'
root_cmakelists_dir = 'src'
def build_type(self):
spec = self.spec

View File

@ -40,6 +40,4 @@ class Spades(CMakePackage):
conflicts('%gcc@7.1.0:')
@property
def root_cmakelists_dir(self):
return join_path(self.stage.source_path, 'src')
root_cmakelists_dir = 'src'