From 8c82834ca2665fa3debc2b031fa472a2d7d617f5 Mon Sep 17 00:00:00 2001 From: Jim Galarowicz Date: Wed, 19 Jul 2017 18:52:30 -0500 Subject: [PATCH] Remove extra unnecessary routine to adjust build arguments. Fix if-else clause issue. --- .../packages/cbtf-argonavis/package.py | 33 +---------- .../builtin/packages/cbtf-krell/package.py | 34 ++--------- .../builtin/packages/cbtf-lanl/package.py | 32 +---------- .../repos/builtin/packages/cbtf/package.py | 40 +++---------- .../builtin/packages/openspeedshop/package.py | 56 +++++-------------- 5 files changed, 32 insertions(+), 163 deletions(-) diff --git a/var/spack/repos/builtin/packages/cbtf-argonavis/package.py b/var/spack/repos/builtin/packages/cbtf-argonavis/package.py index 4284ef2ed4f..2c1c6636393 100644 --- a/var/spack/repos/builtin/packages/cbtf-argonavis/package.py +++ b/var/spack/repos/builtin/packages/cbtf-argonavis/package.py @@ -70,8 +70,11 @@ def build_type(self): def cmake_args(self): spec = self.spec + compile_flags = "-O2 -g" cmake_args = [ + '-DCMAKE_CXX_FLAGS=%s' % compile_flags, + '-DCMAKE_C_FLAGS=%s' % compile_flags, '-DCUDA_DIR=%s' % spec['cuda'].prefix, '-DCUDA_INSTALL_PATH=%s' % spec['cuda'].prefix, '-DCUDA_TOOLKIT_ROOT_DIR=%s' % spec['cuda'].prefix, @@ -86,34 +89,4 @@ def cmake_args(self): '-DMRNET_DIR=%s' % spec['mrnet'].prefix, '-DBoost_NO_SYSTEM_PATHS=ON'] - # Adjust the standard cmake arguments to what we want the build - # type, etc to be - self.adjustBuildTypeParams_cmakeOptions(spec, cmake_args) return cmake_args - - def adjustBuildTypeParams_cmakeOptions(self, spec, cmakeOptions): - # Sets build type parameters into cmakeOptions the options that will - # enable the cbtf-krell built type settings - - compile_flags = "-O2 -g" - BuildTypeOptions = [] - - # Set CMAKE_BUILD_TYPE to what cbtf-krell wants it to be, not the - # stdcmakeargs - for word in cmakeOptions[:]: - if word.startswith('-DCMAKE_BUILD_TYPE'): - cmakeOptions.remove(word) - if word.startswith('-DCMAKE_CXX_FLAGS'): - cmakeOptions.remove(word) - if word.startswith('-DCMAKE_C_FLAGS'): - cmakeOptions.remove(word) - if word.startswith('-DCMAKE_VERBOSE_MAKEFILE'): - cmakeOptions.remove(word) - BuildTypeOptions.extend([ - '-DCMAKE_VERBOSE_MAKEFILE=ON', - '-DCMAKE_BUILD_TYPE=None', - '-DCMAKE_CXX_FLAGS=%s' % compile_flags, - '-DCMAKE_C_FLAGS=%s' % compile_flags - ]) - - cmakeOptions.extend(BuildTypeOptions) diff --git a/var/spack/repos/builtin/packages/cbtf-krell/package.py b/var/spack/repos/builtin/packages/cbtf-krell/package.py index cafb34e2212..a90ea74f9d0 100644 --- a/var/spack/repos/builtin/packages/cbtf-krell/package.py +++ b/var/spack/repos/builtin/packages/cbtf-krell/package.py @@ -102,32 +102,6 @@ class CbtfKrell(CMakePackage): build_directory = 'build_cbtf_krell' - def adjustBuildTypeParams_cmakeOptions(self, spec, cmakeOptions): - # Sets build type parameters into cmakeOptions the options that will - # enable the cbtf-krell built type settings - - compile_flags = "-O2 -g" - BuildTypeOptions = [] - # Set CMAKE_BUILD_TYPE to what cbtf-krell wants it to be, not the - # stdcmakeargs - for word in cmakeOptions[:]: - if word.startswith('-DCMAKE_BUILD_TYPE'): - cmakeOptions.remove(word) - if word.startswith('-DCMAKE_CXX_FLAGS'): - cmakeOptions.remove(word) - if word.startswith('-DCMAKE_C_FLAGS'): - cmakeOptions.remove(word) - if word.startswith('-DCMAKE_VERBOSE_MAKEFILE'): - cmakeOptions.remove(word) - BuildTypeOptions.extend([ - '-DCMAKE_VERBOSE_MAKEFILE=ON', - '-DCMAKE_BUILD_TYPE=None', - '-DCMAKE_CXX_FLAGS=%s' % compile_flags, - '-DCMAKE_C_FLAGS=%s' % compile_flags - ]) - - cmakeOptions.extend(BuildTypeOptions) - def set_mpi_cmakeOptions(self, spec, cmakeOptions): # Appends to cmakeOptions the options that will enable the appropriate # MPI implementations @@ -161,9 +135,13 @@ def build_type(self): def cmake_args(self): spec = self.spec + compile_flags = "-O2 -g" + # Add in paths for finding package config files that tell us # where to find these packages cmake_args = [ + '-DCMAKE_CXX_FLAGS=%s' % compile_flags, + '-DCMAKE_C_FLAGS=%s' % compile_flags, '-DCBTF_DIR=%s' % spec['cbtf'].prefix, '-DBINUTILS_DIR=%s' % spec['binutils'].prefix, '-DLIBMONITOR_DIR=%s' % spec['libmonitor'].prefix, @@ -177,8 +155,4 @@ def cmake_args(self): # Add any MPI implementations coming from variant settings self.set_mpi_cmakeOptions(spec, cmake_args) - # Adjust the standard cmake arguments to what we want the build - # type, etc to be - self.adjustBuildTypeParams_cmakeOptions(spec, cmake_args) - return cmake_args diff --git a/var/spack/repos/builtin/packages/cbtf-lanl/package.py b/var/spack/repos/builtin/packages/cbtf-lanl/package.py index acd2d0fadfd..6ffca1f8b16 100644 --- a/var/spack/repos/builtin/packages/cbtf-lanl/package.py +++ b/var/spack/repos/builtin/packages/cbtf-lanl/package.py @@ -68,8 +68,11 @@ def build_type(self): def cmake_args(self): spec = self.spec + compile_flags = "-O2 -g" cmake_args = [ + '-DCMAKE_CXX_FLAGS=%s' % compile_flags, + '-DCMAKE_C_FLAGS=%s' % compile_flags, '-DCBTF_DIR=%s' % spec['cbtf'].prefix, '-DCBTF_KRELL_DIR=%s' % spec['cbtf-krell'].prefix, '-DMRNET_DIR=%s' % spec['mrnet'].prefix, @@ -77,33 +80,4 @@ def cmake_args(self): '-DCMAKE_MODULE_PATH=%s' % join_path( prefix.share, 'KrellInstitute', 'cmake')] - # Adjust the standard cmake arguments to what we want the build - # type, etc to be - self.adjustBuildTypeParams_cmakeOptions(spec, cmake_args) return cmake_args - - def adjustBuildTypeParams_cmakeOptions(self, spec, cmakeOptions): - # Sets build type parameters into cmakeOptions the options that will - # enable the cbtf-krell built type settings - - compile_flags = "-O2 -g" - BuildTypeOptions = [] - # Set CMAKE_BUILD_TYPE to what cbtf-krell wants it to be, not the - # stdcmakeargs - for word in cmakeOptions[:]: - if word.startswith('-DCMAKE_BUILD_TYPE'): - cmakeOptions.remove(word) - if word.startswith('-DCMAKE_CXX_FLAGS'): - cmakeOptions.remove(word) - if word.startswith('-DCMAKE_C_FLAGS'): - cmakeOptions.remove(word) - if word.startswith('-DCMAKE_VERBOSE_MAKEFILE'): - cmakeOptions.remove(word) - BuildTypeOptions.extend([ - '-DCMAKE_VERBOSE_MAKEFILE=ON', - '-DCMAKE_BUILD_TYPE=None', - '-DCMAKE_CXX_FLAGS=%s' % compile_flags, - '-DCMAKE_C_FLAGS=%s' % compile_flags - ]) - - cmakeOptions.extend(BuildTypeOptions) diff --git a/var/spack/repos/builtin/packages/cbtf/package.py b/var/spack/repos/builtin/packages/cbtf/package.py index 5500c5d1386..46f5715d14e 100644 --- a/var/spack/repos/builtin/packages/cbtf/package.py +++ b/var/spack/repos/builtin/packages/cbtf/package.py @@ -42,7 +42,6 @@ from spack import * - class Cbtf(CMakePackage): """CBTF project contains the base code for CBTF that supports creating components, component networks and the support to connect these @@ -82,24 +81,26 @@ def cmake_args(self): # or BOOST_INCLUDEDIR). Useful when specifying BOOST_ROOT. # Defaults to OFF. + compile_flags = "-O2 -g" + if '+runtime' in spec: # Install message tag include file for use in Intel MIC # cbtf-krell build # FIXME cmake_args = [ + '-DCMAKE_CXX_FLAGS=%s' % compile_flags, + '-DCMAKE_C_FLAGS=%s' % compile_flags, + '-DRUNTIME_ONLY=TRUE', '-DBoost_NO_SYSTEM_PATHS=TRUE', '-DXERCESC_DIR=%s' % spec['xerces-c'].prefix, '-DBOOST_ROOT=%s' % spec['boost'].prefix, '-DMRNET_DIR=%s' % spec['mrnet'].prefix, '-DCMAKE_MODULE_PATH=%s' % join_path( prefix.share, 'KrellInstitute', 'cmake')] - - # Adjust the standard cmake arguments to what we want the build - # type, etc to be - self.adjustBuildTypeParams_cmakeOptions(spec, cmake_args) - else: cmake_args = [ + '-DCMAKE_CXX_FLAGS=%s' % compile_flags, + '-DCMAKE_C_FLAGS=%s' % compile_flags, '-DBoost_NO_SYSTEM_PATHS=TRUE', '-DXERCESC_DIR=%s' % spec['xerces-c'].prefix, '-DBOOST_ROOT=%s' % spec['boost'].prefix, @@ -107,31 +108,4 @@ def cmake_args(self): '-DCMAKE_MODULE_PATH=%s' % join_path( prefix.share, 'KrellInstitute', 'cmake')] - # Adjust the standard cmake arguments to what we want the build - # type, etc to be - self.adjustBuildTypeParams_cmakeOptions(spec, cmake_args) - return cmake_args - - def adjustBuildTypeParams_cmakeOptions(self, spec, cmakeOptions): - # Sets build type parameters into cmakeOptions the options that will - # enable the cbtf-krell built type settings - - compile_flags = "-O2 -g" - BuildTypeOptions = [] - # Set CMAKE_BUILD_TYPE to what cbtf-krell wants it to be, not the - # stdcmakeargs - for word in cmakeOptions[:]: - if word.startswith('-DCMAKE_BUILD_TYPE'): - cmakeOptions.remove(word) - if word.startswith('-DCMAKE_CXX_FLAGS'): - cmakeOptions.remove(word) - if word.startswith('-DCMAKE_C_FLAGS'): - cmakeOptions.remove(word) - BuildTypeOptions.extend([ - '-DCMAKE_BUILD_TYPE=None', - '-DCMAKE_CXX_FLAGS=%s' % compile_flags, - '-DCMAKE_C_FLAGS=%s' % compile_flags - ]) - - cmakeOptions.extend(BuildTypeOptions) diff --git a/var/spack/repos/builtin/packages/openspeedshop/package.py b/var/spack/repos/builtin/packages/openspeedshop/package.py index bf565b078bc..620c2d1295b 100644 --- a/var/spack/repos/builtin/packages/openspeedshop/package.py +++ b/var/spack/repos/builtin/packages/openspeedshop/package.py @@ -149,12 +149,15 @@ def build_type(self): def cmake_args(self): spec = self.spec + compile_flags = "-O2 -g" if '+offline' in spec: instrumentor_setting = "offline" if '+runtime' in spec: cmake_args = [ + '-DCMAKE_CXX_FLAGS=%s' % compile_flags, + '-DCMAKE_C_FLAGS=%s' % compile_flags, '-DINSTRUMENTOR=%s' % instrumentor_setting, '-DLIBMONITOR_DIR=%s' % spec['libmonitor'].prefix, '-DLIBUNWIND_DIR=%s' % spec['libunwind'].prefix, @@ -163,10 +166,6 @@ def cmake_args(self): # Add any MPI implementations coming from variant settings self.set_mpi_cmakeOptions(spec, cmake_args) - # Adjust the build options to the favored - # ones for this build - self.adjustBuildTypeParams_cmakeOptions(spec, cmake_args) - else: cmake_args = [] @@ -174,7 +173,9 @@ def cmake_args(self): self.set_defaultbase_cmakeOptions(spec, cmake_args) cmake_args.extend( - ['-DINSTRUMENTOR=%s' + ['-DCMAKE_CXX_FLAGS=%s' % compile_flags, + '-DCMAKE_C_FLAGS=%s' % compile_flags, + '-DINSTRUMENTOR=%s' % instrumentor_setting, '-DLIBMONITOR_DIR=%s' % spec['libmonitor'].prefix, @@ -190,10 +191,6 @@ def cmake_args(self): # Add any MPI implementations coming from variant settings self.set_mpi_cmakeOptions(spec, cmake_args) - # Adjust the build options to the favored - # ones for this build - self.adjustBuildTypeParams_cmakeOptions(spec, cmake_args) - elif '+cbtf' in spec: instrumentor_setting = "cbtf" @@ -203,7 +200,9 @@ def cmake_args(self): self.set_defaultbase_cmakeOptions(spec, cmake_args) cmake_args.extend( - ['-DINSTRUMENTOR=%s' + ['-DCMAKE_CXX_FLAGS=%s' % compile_flags, + '-DCMAKE_C_FLAGS=%s' % compile_flags, + '-DINSTRUMENTOR=%s' % instrumentor_setting, '-DCBTF_DIR=%s' % spec['cbtf'].prefix, @@ -212,10 +211,6 @@ def cmake_args(self): '-DMRNET_DIR=%s' % spec['mrnet'].prefix]) - # Adjust the build options to the - # favored ones for this build - self.adjustBuildTypeParams_cmakeOptions(spec, cmake_args) - else: cmake_args = [] @@ -224,7 +219,9 @@ def cmake_args(self): if '+useqt4gui' in self.spec: cmake_args.extend( - ['-DINSTRUMENTOR=%s' + ['-DCMAKE_CXX_FLAGS=%s' % compile_flags, + '-DCMAKE_C_FLAGS=%s' % compile_flags, + '-DINSTRUMENTOR=%s' % instrumentor_setting, '-DSQLITE3_DIR=%s' % spec['sqlite'].prefix, @@ -236,7 +233,9 @@ def cmake_args(self): % spec['mrnet'].prefix]) else: cmake_args.extend( - ['-DINSTRUMENTOR=%s' + ['-DCMAKE_CXX_FLAGS=%s' % compile_flags, + '-DCMAKE_C_FLAGS=%s' % compile_flags, + '-DINSTRUMENTOR=%s' % instrumentor_setting, '-DSQLITE3_DIR=%s' % spec['sqlite'].prefix, @@ -249,33 +248,8 @@ def cmake_args(self): '-DMRNET_DIR=%s' % spec['mrnet'].prefix]) - # Adjust the build options to the favored - # ones for this build - self.adjustBuildTypeParams_cmakeOptions(spec, cmake_args) - return cmake_args - def adjustBuildTypeParams_cmakeOptions(self, spec, cmakeOptions): - # Sets build type parameters into cmakeOptions the - # options that will enable the cbtf-krell built type settings - - compile_flags = "-O2 -g" - BuildTypeOptions = [] - # Set CMAKE_BUILD_TYPE to what cbtf-krell wants it - # to be, not the stdcmakeargs - for word in cmakeOptions[:]: - if word.startswith('-DCMAKE_BUILD_TYPE'): - cmakeOptions.remove(word) - if word.startswith('-DCMAKE_CXX_FLAGS'): - cmakeOptions.remove(word) - if word.startswith('-DCMAKE_C_FLAGS'): - cmakeOptions.remove(word) - BuildTypeOptions.extend(['-DCMAKE_BUILD_TYPE=None', - '-DCMAKE_CXX_FLAGS=%s' % compile_flags, - '-DCMAKE_C_FLAGS=%s' % compile_flags]) - - cmakeOptions.extend(BuildTypeOptions) - def set_defaultbase_cmakeOptions(self, spec, cmakeOptions): # Appends to cmakeOptions the options that will enable # the appropriate base level options to the openspeedshop