From 7f0d11f7e31c132b2786fb0799d800ac8adddd8c Mon Sep 17 00:00:00 2001 From: Bo Peng Date: Tue, 2 Jan 2007 22:34:40 +0000 Subject: [PATCH] Scons: embed lyx icon to lyx.exe etc git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_4_X@16470 a592a061-630c-0410-9148-cb99ea01b6c8 --- development/scons/SConstruct | 10 +++++++--- development/scons/scons_utils.py | 15 +++++++++++++++ 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/development/scons/SConstruct b/development/scons/SConstruct index c49eb61143..a7075ebdc8 100644 --- a/development/scons/SConstruct +++ b/development/scons/SConstruct @@ -1676,7 +1676,9 @@ if build_client: target = '$BUILDDIR/common/client/lyxclient', LIBS = ['support'] + intl_libs + system_libs + socket_libs + boost_libraries, - source = ['$BUILDDIR/common/client/%s' % x for x in src_client_files] + source = ['$BUILDDIR/common/client/%s' % x for x in src_client_files] + \ + utils.createResFromIcon(env, 'lyx_32x32.ico', '$LOCALLIBPATH/client.rc') + ) Alias('client', env.Command(os.path.join('$BUILDDIR', os.path.split(str(client[0]))[1]), client, [Copy('$TARGET', '$SOURCE')])) @@ -1710,7 +1712,8 @@ if build_tex2lyx: tex2lyx = tex2lyx_env.Program( target = '$BUILDDIR/common/tex2lyx/tex2lyx', LIBS = ['support'] + boost_libraries + system_libs, - source = ['$BUILDDIR/common/tex2lyx/%s' % x for x in src_tex2lyx_files] + source = ['$BUILDDIR/common/tex2lyx/%s' % x for x in src_tex2lyx_files] + \ + utils.createResFromIcon(tex2lyx_env, 'lyx_32x32.ico', '$LOCALLIBPATH/tex2lyx.rc') ) Alias('tex2lyx', env.Command(os.path.join('$BUILDDIR', os.path.split(str(tex2lyx[0]))[1]), tex2lyx, [Copy('$TARGET', '$SOURCE')])) @@ -1756,7 +1759,8 @@ if build_lyx: # lyx = env.Program( target = '$BUILDDIR/$frontend/lyx', - source = ['$BUILDDIR/common/main.C'], + source = ['$BUILDDIR/common/main.C'] + \ + utils.createResFromIcon(env, 'lyx_32x32.ico', '$LOCALLIBPATH/lyx.rc'), LIBS = [ 'lyxbase_pre', 'mathed', diff --git a/development/scons/scons_utils.py b/development/scons/scons_utils.py index a7979a9d1a..0fad9ddd74 100644 --- a/development/scons/scons_utils.py +++ b/development/scons/scons_utils.py @@ -76,6 +76,21 @@ def env_subst(target, source, env): #st = os.stat(str(source[0])) #os.chmod(str(target[0]), stat.S_IMODE(st[stat.ST_MODE]) | stat.S_IWRITE) + +def createResFromIcon(env, icon_file, rc_file): + ''' create a rc file with icon, and return res file (windows only) ''' + if os.name == 'nt': + rc_name = env.File(rc_file).abspath + rc = open(rc_name, 'w') + print >> rc, 'IDI_ICON1 ICON DISCARDABLE "%s"' % \ + os.path.join(env.Dir('$TOP_SRCDIR').abspath, 'development', 'win32', + 'packaging', 'icons', icon_file) + rc.close() + return env.RES(rc_name) + else: + return [] + + # # autoconf tests #