From 7fef63264b0f5e8386cb5f07e5a0ec1fc2c37635 Mon Sep 17 00:00:00 2001 From: Bo Peng Date: Sat, 3 Jun 2006 22:15:35 +0000 Subject: [PATCH] Scons: generate msvs porject files with target msvs_projects git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13994 a592a061-630c-0410-9148-cb99ea01b6c8 --- development/scons/SConscript | 106 ++++++++++++++++++++++++++++------- development/scons/SConstruct | 15 +++-- 2 files changed, 97 insertions(+), 24 deletions(-) diff --git a/development/scons/SConscript b/development/scons/SConscript index 62ab097458..3e6ab19458 100644 --- a/development/scons/SConscript +++ b/development/scons/SConscript @@ -18,7 +18,7 @@ targets = env['BUILD_TARGETS'] build_lyx = (targets == [] or 'lyx' in targets or 'install' in targets or 'all' in targets) build_boost = env['INCLUDED_BOOST'] or 'boost' in targets build_intl = env['INCLUDED_GETTEXT'] or 'intl' in targets -build_supports = build_lyx or True in [x in targets for x in ['supports', 'client', 'tex2lyx']] +build_support = build_lyx or True in [x in targets for x in ['support', 'client', 'tex2lyx']] build_mathed = build_lyx or 'mathed' in targets build_insets = build_lyx or 'insets' in targets build_frontends = build_lyx or 'frontends' in targets @@ -30,7 +30,7 @@ build_lyxbase = build_lyx or 'lyxbase' in targets build_po = 'po' in targets or 'install' in targets or 'all' in targets build_qt3 = (build_lyx and env['frontend'] == 'qt3') or 'qt3' in targets build_qt4 = (build_lyx and env['frontend'] == 'qt4') or 'qt4' in targets -build_msvc_projects = env['USE_VC'] and 'msvc_projects' in targets +build_msvs_projects = env['USE_VC'] and 'msvs_projects' in targets # now, if rebuild_targets is specified, do not rebuild some targets @@ -48,7 +48,7 @@ if rebuild_targets: return old_value build_boost = ifBuildLib('boost', 'included_boost_filesystem', build_boost) build_intl = ifBuildLib('intl', 'included_intl', build_intl) - build_supports = ifBuildLib('supports', 'supports', build_supports) + build_support = ifBuildLib('support', 'support', build_support) build_mathed = ifBuildLib('mathed', 'mathed', build_mathed) build_insets = ifBuildLib('insets', 'insets', build_insets) build_frontends = ifBuildLib('frontends', 'frontends', build_frontends) @@ -91,24 +91,24 @@ if build_boost: regex = boostenv.StaticLibrary( target = '$LOCALLIBPATH/included_boost_regex', - source = globSource(dir = env.subst('$TOP_SRC_DIR/boost/libs/regex/src'), pattern = '*.cpp', - build_dir = '$BUILDDIR/boost/regex/src') + source = globSource(dir = env.subst('$TOP_SRC_DIR/boost/libs/regex/src'), + pattern = '*.cpp', build_dir = '$BUILDDIR/boost/regex/src') ) print 'Processing files in boost/libs/signals/src...' signals = boostenv.StaticLibrary( target = '$LOCALLIBPATH/included_boost_signals', - source = globSource(dir = env.subst('$TOP_SRC_DIR/boost/libs/signals/src'), pattern = '*.cpp', - build_dir = '$BUILDDIR/boost/signals/src') + source = globSource(dir = env.subst('$TOP_SRC_DIR/boost/libs/signals/src'), + pattern = '*.cpp', build_dir = '$BUILDDIR/boost/signals/src') ) print 'Processing files in boost/libs/iostreams/src...' iostreams = boostenv.StaticLibrary( target = '$LOCALLIBPATH/included_boost_iostreams', - source = globSource(dir = env.subst('$TOP_SRC_DIR/boost/libs/iostreams/src'), pattern = '*.cpp', - build_dir = '$BUILDDIR/boost/iostreams/src') + source = globSource(dir = env.subst('$TOP_SRC_DIR/boost/libs/iostreams/src'), + pattern = '*.cpp', build_dir = '$BUILDDIR/boost/iostreams/src') ) Alias('boost', filesystem) Alias('boost', regex) @@ -160,13 +160,14 @@ if build_intl: ) Alias('intl', intl) + # # Now, src code under src/ # env.BuildDir('$BUILDDIR/common', '$TOP_SRC_DIR/src', duplicate = 0) -if build_supports: +if build_support: # # src/support # @@ -174,13 +175,13 @@ if build_supports: env.substFile('$BUILDDIR/common/support/package.C', '$TOP_SRC_DIR/src/support/package.C.in') - supports = env.StaticLibrary( - target = '$LOCALLIBPATH/supports', - source = globSource(dir = env.subst('$TOP_SRC_DIR/src/support'), pattern = env['LYX_EXT'], + support = env.StaticLibrary( + target = '$LOCALLIBPATH/support', + source = globSource(dir = env.subst('$TOP_SRC_DIR/src/support'), pattern = env['LYX_EXT'], exclude = ['os_win32.C', 'os_unix.C', 'os_cygwin.C', 'atexit.c'], include = ['package.C'], build_dir = '$BUILDDIR/common/support') ) - Alias('supports', supports) + Alias('support', support) if build_mathed: @@ -472,7 +473,7 @@ if build_qt4: qt4 = qt4env.StaticLibrary( target = '$LOCALLIBPATH/qt4', LIBS = qt4env['QT_LIB'], - source = globSource(dir = env.subst('$TOP_SRC_DIR/src/frontends/qt4'), pattern = env['LYX_EXT'], + source = globSource(dir = env.subst('$TOP_SRC_DIR/src/frontends/qt4'), pattern = env['LYX_EXT'], exclude = ['QBrowseBox.C'], build_dir = '$BUILDDIR/common/frontends/qt4') ) Alias('qt4', qt4) @@ -489,7 +490,7 @@ if build_client: if env['HAVE_FCNTL']: client = env.Program( target = '$BUILDDIR/common/client/lyxclient', - LIBS = ['supports'] + env['INTL_LIBS'] + env['SYSTEM_LIBS'] + + LIBS = ['support'] + env['INTL_LIBS'] + env['SYSTEM_LIBS'] + env['SOCKET_LIBS'] + env['BOOST_LIBRARIES'], source = globSource(dir = env.subst('$TOP_SRC_DIR/src/client'), pattern = env['LYX_EXT'], build_dir = '$BUILDDIR/common/client') @@ -519,7 +520,7 @@ if build_tex2lyx: tex2lyx = tex2lyx_env.Program( target = '$BUILDDIR/common/tex2lyx/tex2lyx', - LIBS = ['supports'] + env['BOOST_LIBRARIES'] + env['SYSTEM_LIBS'], + LIBS = ['support'] + env['BOOST_LIBRARIES'] + env['SYSTEM_LIBS'], source = globSource(dir = env.subst('$TOP_SRC_DIR/src/tex2lyx'), pattern = env['LYX_EXT'], include = ['FloatList.C', 'Floating.C', 'counters.C', 'lyxlayout.C', 'lyxtextclass.C', 'lyxlex.C', 'lyxlex_pimpl.C'], @@ -562,7 +563,7 @@ if build_lyxbase: lyxbase_pre = env.StaticLibrary( target = '$LOCALLIBPATH/lyxbase_pre', - source = globSource(dir = env.subst('$TOP_SRC_DIR/src'), pattern = env['LYX_EXT'], + source = globSource(dir = env.subst('$TOP_SRC_DIR/src'), pattern = env['LYX_EXT'], exclude = lyx_post_source + ['main.C', 'aspell.C', 'pspell.C', 'ispell.C', 'Variables.C', 'Sectioning.C'], include = ['version.C'] + main_source, build_dir = '$BUILDDIR/common') ) @@ -594,7 +595,7 @@ if build_lyx: env['frontend'], 'controllers', 'graphics', - 'supports', + 'support', 'lyxbase_post', ] + env['BOOST_LIBRARIES'] + @@ -608,7 +609,72 @@ if build_lyx: Alias('lyx', env.Command(os.path.join('$BUILDDIR', target_name), lyx, [Copy('$TARGET', '$SOURCE')])) Alias('lyx', lyx) - + + +if build_msvs_projects: + def build_project(target, dir, src_pattern = env['LYX_EXT'], include=[], + resource=None, rebuild=True): + if resource is not None: + res = globSource(dir = env.subst('$TOP_SRC_DIR/'+resource), pattern = '*.ui', + build_dir = env.subst('$TOP_SRC_DIR/'+resource)) + else: + res = [] + if rebuild: + cmds = 'faststart=yes rebuild='+target + else: + cmds = 'faststart=yes' + if type(dir) == type([]): + src = [] + inc = [] + for d in dir: + src.extend(globSource(dir = env.subst('$TOP_SRC_DIR/' + d), + pattern = src_pattern, include = include, + build_dir = boostenv.subst('$TOP_SRC_DIR/' + d) )) + inc.extend(globSource(dir = env.subst('$TOP_SRC_DIR/' + d), + pattern = '*.h', + build_dir = env.subst('$TOP_SRC_DIR/' + d) )) + else: + src = globSource(dir = env.subst('$TOP_SRC_DIR/' + dir), + pattern = src_pattern, include = include, + build_dir = boostenv.subst('$TOP_SRC_DIR/' + dir) ) + inc = globSource(dir = env.subst('$TOP_SRC_DIR/' + dir), + pattern = '*.h', + build_dir = env.subst('$TOP_SRC_DIR/' + dir) ) + # project + proj = boostenv.MSVSProject( + target = '$MSVSPATH/' + target + env['MSVSPROJECTSUFFIX'], + srcs = src, + incs = [boostenv.subst('$TOP_SRC_DIR/src/config.h')], + localincs = inc, + resources = res, + buildtarget = target, + cmdargs = cmds, + variant = 'Release' + ) + Alias('msvs_projects', proj) + build_project('boost', ['boost/libs/filesystem/src', + 'boost/libs/regex/src', 'boost/libs/signals/src', + 'boost/libs/iostreams/src'], src_pattern = '*.cpp') + build_project('intl', 'intl', src_pattern = '*.c') + build_project('support', 'src/support', include=['package.C.in']) + build_project('mathed', 'src/mathed') + build_project('insets', 'src/insets') + build_project('frontends', 'src/frontends') + build_project('graphics', 'src/graphics') + build_project('controllers', 'src/frontends/controllers') + build_project('qt3', 'src/frontends/qt3', resource = 'src/frontends/qt3/ui') + build_project('qt4', 'src/frontends/qt4', resource = 'src/frontends/qt4/ui') + build_project('client', 'src/client', rebuild=False) + build_project('tex2lyx', 'src/tex2lyx', rebuild=False) + build_project('lyxbase', 'src') + if frontend == 'qt3': + build_project('lyx', ['src', 'src/support', 'src/mathed', 'src/insets', + 'src/frontends', 'src/graphics', 'src/frontends/controllers', + 'src/frontends/qt3'], resource = 'src/frontends/qt3/ui') + else: + build_project('lyx', ['src', 'src/support', 'src/mathed', 'src/insets', + 'src/frontends', 'src/graphics', 'src/frontends/controllers', + 'src/frontends/qt4'], resource = 'src/frontends/qt4/ui') if build_po: diff --git a/development/scons/SConstruct b/development/scons/SConstruct index d354087c02..6f4f961516 100644 --- a/development/scons/SConstruct +++ b/development/scons/SConstruct @@ -329,9 +329,10 @@ if (not ARGUMENTS.has_key('load_option') or \ and ARGUMENTS['frontend'] != opt_cache['frontend'] \ and opt_cache.has_key('qt_dir'): opt_cache.pop('qt_dir') - # and we do not cache fast_start - if opt_cache.has_key('fast_start'): - opt_cache.pop('fast_start') + # and we do not cache some options + for arg in ['fast_start']: + if opt_cache.has_key(arg): + opt_cache.pop(arg) for key in opt_cache.keys(): if not ARGUMENTS.has_key(key): ARGUMENTS[key] = opt_cache[key] @@ -369,7 +370,11 @@ env['ENV']['HOME'] = os.environ.get('HOME') # these are defined for MSVC env['ENV']['LIB'] = os.environ.get('LIB') env['ENV']['INCLUDE'] = os.environ.get('INCLUDE') -env['TOP_SRC_DIR'] = TOP_SRC_DIR +if use_vc: + # full path name is used to build msvs project files + env['TOP_SRC_DIR'] = Dir(TOP_SRC_DIR).abspath +else: + env['TOP_SRC_DIR'] = TOP_SRC_DIR env['SCONS_DIR'] = SCONS_DIR # install to default_prefix by default env['PREFIX'] = env.get('prefix', default_prefix) @@ -452,6 +457,8 @@ else: # all built libraries will go to build_dir/libs # (This is different from the make file approach) env['LOCALLIBPATH'] = '$BUILDDIR/libs' +# to make use of local cached parameters, this one has to be '.' +env['MSVSPATH'] = '.' env.AppendUnique(LIBPATH = ['$LOCALLIBPATH']) # -- 2.39.5