]> git.lyx.org Git - features.git/commitdiff
Scons: allow use of different icons for lyx and tex2lyx
authorBo Peng <bpeng@lyx.org>
Tue, 2 Jan 2007 06:13:53 +0000 (06:13 +0000)
committerBo Peng <bpeng@lyx.org>
Tue, 2 Jan 2007 06:13:53 +0000 (06:13 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16464 a592a061-630c-0410-9148-cb99ea01b6c8

development/scons/SConstruct
development/scons/scons_utils.py

index bcb3d03efb75172ed5fd1dec83e5f864d9ba59fa..1d436c90c984ed7211bade48e5733ce201192ff0 100644 (file)
@@ -1371,18 +1371,6 @@ if frontend == 'qt4':
 
     frontend_env = conf.Finish()
 
-if os.name == 'nt':
-    # if under windows, create an rc file
-    rc_file = frontend_env.File('$BUILDDIR/lyx.rc').abspath
-    rc = open(rc_file, 'w')
-    print >> rc, 'IDI_ICON1  ICON DISCARDABLE "%s"' % \
-        os.path.join(frontend_env.Dir('$TOP_SRCDIR').abspath, 'development', 'win32',
-            'packaging', 'icons', 'lyx_32x32.ico')
-    rc.close()
-    frontend_env['ICON_RES'] = frontend_env.RES(rc_file)
-else:
-    frontend_env['ICON_RES'] = []
-
 #
 # Report results
 #
@@ -1759,7 +1747,7 @@ if build_client:
             LIBS = ['support'] + intl_libs + system_libs +
                 socket_libs + boost_libraries + qtcore_lib,
             source = ['$BUILDDIR/common/client/%s' % x for x in src_client_files] + \
-                frontend_env['ICON_RES']
+                utils.createResFromIcon(frontend_env, 'lyx_32x32.ico', '$LOCALLIBPATH/client.rc')
         )
         Alias('client', frontend_env.Command(os.path.join('$BUILDDIR', os.path.split(str(client[0]))[1]),
             client, [Copy('$TARGET', '$SOURCE')]))
@@ -1790,7 +1778,7 @@ if build_tex2lyx:
         target = '$BUILDDIR/common/tex2lyx/tex2lyx',
         LIBS = ['support'] + boost_libraries + intl_libs + system_libs + qtcore_lib,
         source = ['$BUILDDIR/common/tex2lyx/%s' % x for x in src_tex2lyx_files] + \
-            frontend_env['ICON_RES'],
+            utils.createResFromIcon(frontend_env, 'lyx_32x32.ico', '$LOCALLIBPATH/tex2lyx.rc'),
         CPPPATH = ['$BUILDDIR/common/tex2lyx', '$CPPPATH'],
         LIBPATH = ['#$LOCALLIBPATH', '$LIBPATH'],
     )
@@ -1838,7 +1826,8 @@ if build_lyx:
     #
     lyx = frontend_env.Program(
         target = '$BUILDDIR/lyx',
-        source = ['$BUILDDIR/common/main.C'] + frontend_env['ICON_RES'],
+        source = ['$BUILDDIR/common/main.C'] + \
+            utils.createResFromIcon(frontend_env, 'lyx_32x32.ico', '$LOCALLIBPATH/lyx.rc'),
         LIBS = [
             'lyxbase_pre',
             'mathed',
index defdcdb71954694fbe09c44815fa2eca3517d208..1a200f0186abfd02d81ea783fe63a2c1c43c09a3 100644 (file)
@@ -75,6 +75,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
 #