Sanitize cmake, cleanup develop.py
This commit is contained in:
@@ -45,7 +45,6 @@ import commands
|
||||
class CommandError(Exception):
|
||||
pass
|
||||
|
||||
|
||||
def mkdir(path):
|
||||
try:
|
||||
os.mkdir(path)
|
||||
@@ -54,15 +53,19 @@ def mkdir(path):
|
||||
if err.errno != errno.EEXIST or not os.path.isdir(path):
|
||||
raise
|
||||
|
||||
def getcwd():
|
||||
cwd = os.getcwd()
|
||||
if 'a' <= cwd[0] <= 'z' and cwd[1] == ':':
|
||||
def prettyprint_path_for_cmake(path):
|
||||
if 'a' <= path[0] <= 'z' and path[1] == ':':
|
||||
# CMake wants DOS drive letters to be in uppercase. The above
|
||||
# condition never asserts on platforms whose full path names
|
||||
# always begin with a slash, so we don't need to test whether
|
||||
# we are running on Windows.
|
||||
cwd = cwd[0].upper() + cwd[1:]
|
||||
return cwd
|
||||
path = path[0].upper() + path[1:]
|
||||
return path
|
||||
|
||||
def getcwd():
|
||||
return prettyprint_path_for_cmake(os.getcwd())
|
||||
|
||||
source_indra = prettyprint_path_for_cmake(os.path.dirname(os.path.realpath(__file__)))
|
||||
|
||||
def quote(opts):
|
||||
return '"' + '" "'.join([ opt.replace('"', '') for opt in opts ]) + '"'
|
||||
@@ -150,7 +153,7 @@ class PlatformSetup(object):
|
||||
simple = False
|
||||
try:
|
||||
os.chdir(d)
|
||||
cmd = self.cmake_commandline(cwd, d, args, simple)
|
||||
cmd = self.cmake_commandline(source_indra, d, args, simple)
|
||||
print 'Running %r in %r' % (cmd, d)
|
||||
self.run(cmd, 'cmake')
|
||||
finally:
|
||||
@@ -270,18 +273,9 @@ class LinuxSetup(UnixSetup):
|
||||
return 'linux'
|
||||
|
||||
def build_dirs(self):
|
||||
# Only build the server code if we have it.
|
||||
platform_build = '%s-%s' % (self.platform(), self.build_type.lower())
|
||||
|
||||
if self.arch() == 'i686' and self.is_internal_tree():
|
||||
return ['viewer-' + platform_build, 'server-' + platform_build]
|
||||
elif self.arch() == 'x86_64' and self.is_internal_tree():
|
||||
# the viewer does not build in 64bit -- kdu5 issues
|
||||
# we can either use openjpeg, or overhaul our viewer to handle kdu5 or higher
|
||||
# doug knows about kdu issues
|
||||
return ['server-' + platform_build]
|
||||
else:
|
||||
return ['viewer-' + platform_build]
|
||||
return ['viewer-' + platform_build]
|
||||
|
||||
def cmake_commandline(self, src_dir, build_dir, opts, simple):
|
||||
args = dict(
|
||||
@@ -293,31 +287,11 @@ class LinuxSetup(UnixSetup):
|
||||
type=self.build_type.upper(),
|
||||
project_name=self.project_name,
|
||||
word_size=self.word_size,
|
||||
cxx="g++"
|
||||
)
|
||||
if not self.is_internal_tree():
|
||||
args.update({'cxx':'g++', 'server':'OFF', 'viewer':'ON'})
|
||||
else:
|
||||
if self.distcc:
|
||||
distcc = self.find_in_path('distcc')
|
||||
baseonly = True
|
||||
else:
|
||||
distcc = []
|
||||
baseonly = False
|
||||
if 'server' in build_dir:
|
||||
gcc = distcc + self.find_in_path(
|
||||
self.debian_sarge and 'g++-3.3' or 'g++-4.1',
|
||||
'g++', baseonly)
|
||||
args.update({'cxx': ' '.join(gcc), 'server': 'ON',
|
||||
'viewer': 'OFF'})
|
||||
else:
|
||||
gcc41 = distcc + self.find_in_path('g++-4.1', 'g++', baseonly)
|
||||
args.update({'cxx': ' '.join(gcc41),
|
||||
'server': 'OFF',
|
||||
'viewer': 'ON'})
|
||||
|
||||
cmd = (('cmake -DCMAKE_BUILD_TYPE:STRING=%(type)s '
|
||||
'-G %(generator)r -DSERVER:BOOL=%(server)s '
|
||||
'-DVIEWER:BOOL=%(viewer)s -DSTANDALONE:BOOL=%(standalone)s '
|
||||
'-DUNATTENDED:BOOL=%(unattended)s '
|
||||
'-G %(generator)r -DSTANDALONE:BOOL=%(standalone)s '
|
||||
'-DWORD_SIZE:STRING=%(word_size)s '
|
||||
'-DROOT_PROJECT_NAME:STRING=%(project_name)s '
|
||||
'%(opts)s %(dir)r')
|
||||
|
||||
Reference in New Issue
Block a user