------------------------------------------------------------ revno: 2809 committer: poy <p...@123gen.com> branch nick: trunk timestamp: Tue 2012-01-10 19:45:17 +0100 message: fix MSVC project generation modified: SConstruct build_util.py dwt/src/SConscript dwt/test/SConscript test/SConscript utils/SConscript
-- lp:dcplusplus https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk Your team Dcplusplus-team is subscribed to branch lp:dcplusplus. To unsubscribe from this branch go to https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk/+edit-subscription
=== modified file 'SConstruct' --- SConstruct 2012-01-08 12:00:31 +0000 +++ SConstruct 2012-01-10 18:45:17 +0000 @@ -264,9 +264,5 @@ dev.test = dev.build('test/') dev.utils = dev.build('utils/') dev.win32 = dev.build('win32/') - -Default(dev.win32) - dev.installer = dev.build('installer/') - dev.finalize() === modified file 'build_util.py' --- build_util.py 2012-01-08 12:00:31 +0000 +++ build_util.py 2012-01-10 18:45:17 +0000 @@ -108,16 +108,16 @@ matches = [] for root, dirnames, filenames in os.walk('.'): for filename in fnmatch.filter(filenames, source_glob): - matches.append(os.path.join(root, filename)) + matches.append(root + '/' + filename) if not recursive: dirnames[:] = [] - return map(lambda x: self.get_build_path(source_path) + x, matches) + return map(lambda x: os.path.normpath(self.get_build_path(source_path) + x), matches) # execute the SConscript file in the specified sub-directory. def build(self, source_path, local_env = None): if not local_env: local_env = self.env - full_path = local_env.Dir('.').path + '/' + source_path + full_path = local_env.Dir('.').path + '/' + source_path return local_env.SConscript(source_path + 'SConscript', exports = { 'dev': self, 'source_path': full_path }) # create a build environment and set up sources and targets. @@ -148,7 +148,7 @@ # helpers for the MSVC project builder (see build_lib) def simple_lib(inc_ext, src_ext): - return lambda self, name: (self.env.Glob('#/' + name + '/*.' + inc_ext), self.env.Glob('#/' + name + '/*.' + src_ext)) + return lambda self, env: (env.Glob('*.' + inc_ext), env.Glob('*.' + src_ext)) c_lib = simple_lib('h', 'c') cpp_lib = simple_lib('h', 'cpp') @@ -159,7 +159,10 @@ if msvcproj_name is None: import os msvcproj_name = os.path.basename(os.path.dirname(sources[0])) - glob_inc, glob_src = msvcproj_glob(msvcproj_name) + glob_inc, glob_src = msvcproj_glob(env) + # when there's only 1 file, SCons strips directories from the path... + if len(glob_inc) == 1: glob_inc.append(env.File('dummy')) + if len(glob_src) == 1: glob_src.append(env.File('dummy')) path = self.msvcproj_path + msvcproj_name + env['MSVSPROJECTSUFFIX'] env.Precious(path) self.msvcproj_projects.append(env.MSVSProject( === modified file 'dwt/src/SConscript' --- dwt/src/SConscript 2012-01-08 12:00:31 +0000 +++ dwt/src/SConscript 2012-01-10 18:45:17 +0000 @@ -4,15 +4,15 @@ env.Append(CPPPATH = ['#/dwt/include']) -def get_msvcproj_files(name): +def get_msvcproj_files(env): def parse_patterns(patterns): array = [] for pattern in patterns: - for file in env.Glob('#/' + name + '/' + pattern): + for file in env.Glob('#/dwt/' + pattern): array.append(file) return array - return (parse_patterns(['*.h', 'include/dwt/*.h', 'include/dwt/*/*.h', 'include/dwt/*/*/*.h']), - parse_patterns(['*.cpp', 'src/*.cpp', 'src/*/*.cpp', 'src/*/*/*.cpp'])) + return (parse_patterns(['include/dwt/*.h', 'include/dwt/*/*.h', 'include/dwt/*/*/*.h']), + parse_patterns(['src/*.cpp', 'src/*/*.cpp', 'src/*/*/*.cpp'])) ret = dev.build_lib(env, target, sources, get_msvcproj_files, 'dwt') === modified file 'dwt/test/SConscript' --- dwt/test/SConscript 2012-01-08 12:00:31 +0000 +++ dwt/test/SConscript 2012-01-10 18:45:17 +0000 @@ -10,11 +10,14 @@ # imitate build_util's prepare_build env.VariantDir(dev.get_build_path(source_path), '.', duplicate = 0) -import os -ret = [] -for f in Glob('*.cpp'): - sources = dev.get_sources(source_path, str(f)) - ret.append(env.Program(dev.get_target(source_path, os.path.basename(str(f)).replace('.cpp', ''), in_bin = False), [sources, dev.dwt, dev.dwarf, dev.boost, dev.bzip2, dev.intl])) +if env['msvcproj']: + ret = dev.build_lib(env, None, None, dev.cpp_lib, 'dwt-test') +else: + import os + ret = [] + for f in Glob('*.cpp'): + sources = dev.get_sources(source_path, str(f)) + ret.append(env.Program(dev.get_target(source_path, os.path.basename(str(f)).replace('.cpp', ''), in_bin = False), [sources, dev.dwt, dev.dwarf, dev.boost, dev.bzip2, dev.intl])) env.Help("\nYou can build dwt tests by running 'scons dwt/test'\n") === modified file 'test/SConscript' --- test/SConscript 2012-01-08 10:19:19 +0000 +++ test/SConscript 2012-01-10 18:45:17 +0000 @@ -41,9 +41,11 @@ openssl_lib += env['arch'] + '/' env.Append(LIBPATH = [openssl_lib]) -ret = env.Program(target, [sources, dev.client, dev.dwarf, dev.zlib, dev.boost, dev.bzip2, dev.geoip, dev.miniupnpc, dev.natpmp, dev.intl]) - -ret = env.Command(dev.get_target(source_path, 'gtest.passed', in_bin=False), ret[0].abspath, runUnitTest) +if env['msvcproj']: + ret = dev.build_lib(env, target, sources, dev.cpp_lib) +else: + ret = env.Program(target, [sources, dev.client, dev.dwarf, dev.zlib, dev.boost, dev.bzip2, dev.geoip, dev.miniupnpc, dev.natpmp, dev.intl]) + ret = env.Command(dev.get_target(source_path, 'gtest.passed', in_bin=False), ret[0].abspath, runUnitTest) env.Help("\nYou can run the test suite by running 'scons test'\n") === modified file 'utils/SConscript' --- utils/SConscript 2012-01-08 12:00:31 +0000 +++ utils/SConscript 2012-01-10 18:45:17 +0000 @@ -37,11 +37,14 @@ # imitate build_util's prepare_build env.VariantDir(dev.get_build_path(source_path), '.', duplicate = 0) -import os -ret = [] -for f in Glob('*.cpp'): - sources = dev.get_sources(source_path, str(f)) - ret.append(env.Program(dev.get_target(source_path, os.path.basename(str(f)).replace('.cpp', ''), in_bin = False), [sources, dev.client, dev.dwarf, dev.zlib, dev.boost, dev.bzip2, dev.geoip, dev.miniupnpc, dev.natpmp, dev.intl])) +if env['msvcproj']: + ret = dev.build_lib(env, None, None, dev.cpp_lib, 'utils') +else: + import os + ret = [] + for f in Glob('*.cpp'): + sources = dev.get_sources(source_path, str(f)) + ret.append(env.Program(dev.get_target(source_path, os.path.basename(str(f)).replace('.cpp', ''), in_bin = False), [sources, dev.client, dev.dwarf, dev.zlib, dev.boost, dev.bzip2, dev.geoip, dev.miniupnpc, dev.natpmp, dev.intl])) env.Help("\nYou can build additional utilities by running 'scons utils'\n")
_______________________________________________ Mailing list: https://launchpad.net/~linuxdcpp-team Post to : linuxdcpp-team@lists.launchpad.net Unsubscribe : https://launchpad.net/~linuxdcpp-team More help : https://help.launchpad.net/ListHelp