Sanitize cmake, cleanup develop.py

This commit is contained in:
Siana Gearz
2013-05-06 06:07:23 +02:00
parent a2df4b6693
commit 30332cff3f
4 changed files with 90 additions and 53 deletions

View File

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

View File

@@ -1,13 +1,39 @@
cmake_minimum_required(VERSION 2.6.4)
# -*- cmake -*-
project(libhacd CXX C)
project(libhacd)
include(00-Common)
file (GLOB SOURCE_FILES *.cpp )
file (GLOB INCLUDE_FILES *.h )
set(libhacd_SOURCE_FILES
hacdGraph.cpp
hacdHACD.cpp
hacdICHull.cpp
hacdManifoldMesh.cpp
hacdMeshDecimator.cpp
hacdMicroAllocator.cpp
hacdRaycastMesh.cpp
)
set(libhacd_HEADER_FILES
hacdCircularList.h
hacdCircularList.inl
hacdGraph.h
hacdHACD.h
hacdICHull.h
hacdManifoldMesh.h
hacdMeshDecimator.h
hacdMicroAllocator.h
hacdRaycastMesh.h
hacdSArray.h
hacdVector.h
hacdVector.inl
hacdVersion.h
)
set_source_files_properties(${libhacd_HEADER_FILES}
PROPERTIES HEADER_FILE_ONLY TRUE)
IF(WINDOWS)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
ENDIF(WINDOWS)
add_library(hacd ${SOURCE_FILES} ${INCLUDE_FILES})
add_library(hacd ${libhacd_SOURCE_FILES} ${libhacd_INCLUDE_FILES})

View File

@@ -1,9 +1,35 @@
# -*- cmake -*-
project(libndhacd)
include(00-Common)
include_directories(${LIBS_OPEN_DIR}/libhacd)
set (SOURCE_FILES LLConvexDecomposition.cpp nd_hacdConvexDecomposition.cpp nd_hacdStructs.cpp nd_hacdUtils.cpp nd_EnterExitTracer.cpp nd_StructTracer.cpp )
file(GLOB HEADER_FILES *.h)
set (libndhacd_SOURCE_FILES
LLConvexDecomposition.cpp
nd_hacdConvexDecomposition.cpp
nd_hacdStructs.cpp
nd_hacdUtils.cpp
nd_EnterExitTracer.cpp
nd_StructTracer.cpp
)
add_library( nd_hacdConvexDecomposition STATIC ${SOURCE_FILES} ${HEADER_FILES})
set (libndhacd_HEADER_FILES
LLConvexDecomposition.h
ndConvexDecomposition.h
nd_hacdConvexDecomposition.h
nd_hacdStructs.h
nd_StructTracer.h
LLConvexDecompositionStubImpl.h
nd_EnterExitTracer.h
nd_hacdDefines.h
nd_hacdUtils.h
windowsincludes.h
)
set_source_files_properties(${libndhacd_HEADER_FILES}
PROPERTIES HEADER_FILE_ONLY TRUE)
add_library( nd_hacdConvexDecomposition STATIC ${libndhacd_SOURCE_FILES} ${libndhacd_HEADER_FILES})

View File

@@ -1,13 +1,24 @@
cmake_minimum_required(VERSION 2.6.4)
# -*- cmake -*-
project(ndPathingLib CXX C)
project(libpathing)
include(00-Common)
if( MSVC )
add_definitions(-D_SECURE_SCL=0 -D_CRT_SECURE_NO_WARNINGS=1)
endif( MSVC )
file (GLOB SOURCE_FILES *.cpp )
file (GLOB INCLUDE_FILES *.h )
set(libpathing_SOURCE_FILES
llpathinglib.cpp
llphysicsextensions.cpp
)
add_library(nd_Pathing STATIC ${SOURCE_FILES} ${INCLUDE_FILES} )
set(libpathing_HEADER_FILES
llpathinglib.h
llphysicsextensions.h
)
set_source_files_properties(${libpathing_HEADER_FILES}
PROPERTIES HEADER_FILE_ONLY TRUE)
add_library(nd_Pathing STATIC ${libpathing_SOURCE_FILES} ${libpathing_HEADER_FILES} )