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
This commit is contained in:
Bo Peng 2007-01-02 22:34:40 +00:00
parent ce7e1004d9
commit 7f0d11f7e3
2 changed files with 22 additions and 3 deletions

View File

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

View File

@ -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
#