Remove extra unnecessary routine to adjust build arguments. Fix if-else clause issue.

This commit is contained in:
Jim Galarowicz 2017-07-19 18:52:30 -05:00
parent eee748db33
commit 8c82834ca2
5 changed files with 32 additions and 163 deletions

View File

@ -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)

View File

@ -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

View File

@ -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)

View File

@ -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)

View File

@ -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