Cleanup: add main to the list of tools.
[dcpomatic.git] / platform / windows / wscript
index a34ce879f2da6cb6f5d9400b43837d5380f0241e..074c932eb658c00e80f7d6bac8e506c23da5d594 100644 (file)
@@ -1,22 +1,13 @@
 from __future__ import print_function
 import os
 
-def write_installer(bits, dcpomatic_version, debug, disk):
+def write_installer(tools, bits, dcpomatic_version, debug):
 
-    tools = [
-        ('batch', 'Batch Converter'),
-        ('kdm', 'KDM Creator'),
-        ('kdm_cli', 'KDM Creator CLI'),
-        ('player', 'Player'),
-        ('cli', 'CLI'),
-        ('create', 'Creator'),
-        ('playlist', 'Playlist Editor'),
-        ('combiner', 'Combiner'),
-        ('editor', 'Editor'),
-    ]
+    def name_with_underscore(name):
+        return '' if name == 'main' else '_%s' % name
 
-    if disk:
-        tools.append(('disk', 'Disk Writer'))
+    def name_with_space(name):
+        return '' if name == 'main' else ' %s' % name
 
     # It would be nice to use exist_ok here but it requires quite a new python
     try:
@@ -176,16 +167,9 @@ File /oname=dcpomatic2_kdm_inspect.exe "%cdist_deps%/bin/dcpkdm.exe"
 File "%cdist_deps%/bin/leqm_nrt.dll"
 File "%cdist_deps%/bin/asdcp-carl.dll"
 File "%cdist_deps%/bin/kumu-carl.dll"
-    """, file=f)
-
-    if disk:
-        print("""
 File "%static_deps%/bin/libnanomsg.dll"
 File "%cdist_deps%/lib/libblockdev.dll"
 File "%cdist_deps%/lib/liblwext4.dll"
-        """, file=f)
-
-    print("""
 File "%cdist_deps%/bin/avcodec-58.dll"
 File "%cdist_deps%/bin/avfilter-7.dll"
 File "%cdist_deps%/bin/avformat-58.dll"
@@ -204,13 +188,12 @@ File "%cdist_deps%/bin/libopenjp2.dll"
 
     if debug:
         print('File "%resources%/gdb_script"', file=f)
-        print('File "%resources%/dcpomatic2_debug.bat"', file=f)
         print('File "%mingw%/bin/gdb.exe"', file=f)
         print('File "%static_deps%/bin/libtermcap.dll"', file=f)
         print('File "%static_deps%/bin/libreadline8.dll"', file=f)
         print('File "%static_deps%/bin/libmman.dll"', file=f)
         for s, l in tools:
-            print('File "%%resources%%/dcpomatic2_%s_debug.bat"' % s, file=f)
+            print('File "%%resources%%/dcpomatic2%s_debug.bat"' % name_with_underscore(s), file=f)
     else:
         print('File "%binaries%/src/wx/dcpomatic2-wx.dll"', file=f)
         print('File "%binaries%/src/lib/dcpomatic2.dll"', file=f)
@@ -327,6 +310,7 @@ File "%graphics%/pause_black.png"
 File "%graphics%/pause_white.png"
 SetOutPath "$INSTDIR\\xsd"
 File "%cdist_deps%/share/libdcp/xsd/DCDMSubtitle-2010.xsd"
+File "%cdist_deps%/share/libdcp/xsd/DCDMSubtitle-2014.xsd"
 File "%cdist_deps%/share/libdcp/xsd/DCSubtitle.v1.mattsson.xsd"
 File "%cdist_deps%/share/libdcp/xsd/Dolby-2012-AD.xsd"
 File "%cdist_deps%/share/libdcp/xsd/isdcf-mca.xsd"
@@ -373,27 +357,24 @@ SectionEnd
     else:
         print('CreateDirectory "$SMPROGRAMS\\DCP-o-matic 2"', file=f)
 
-    print('File "%binaries%/src/tools/dcpomatic2.exe"', file=f)
     for s, l in tools:
-        print('File "%%binaries%%/src/tools/dcpomatic2_%s.exe"' % s, file=f)
+        print('File "%%binaries%%/src/tools/dcpomatic2%s.exe"' % name_with_underscore(s), file=f)
 
-    if disk:
+    if [t for t in tools if t[0] == 'disk']:
         print("""
 File "%binaries%/src/tools/dcpomatic2_disk_writer.exe"
 File "%resources%/dcpomatic2_disk_writer.exe.manifest"
-    """, file=f)
+        """, file=f)
 
     if debug:
-        print('CreateShortCut "$SMPROGRAMS\\DCP-o-matic 2 debug\\DCP-o-matic 2 debug.lnk" "$INSTDIR\\bin\\dcpomatic2_debug.bat"', file=f)
         for s, l in tools:
-            print('CreateShortCut "$SMPROGRAMS\\DCP-o-matic 2 debug\\DCP-o-matic 2 %s debug.lnk" "$INSTDIR\\bin\\dcpomatic2_%s_debug.bat" ""' % (l, s), file=f)
+            print('CreateShortCut "$SMPROGRAMS\\DCP-o-matic 2 debug\\DCP-o-matic 2%s debug.lnk" "$INSTDIR\\bin\\dcpomatic2%s_debug.bat" ""' % (name_with_space(l), name_with_underscore(s)), file=f)
         print('CreateShortCut "$SMPROGRAMS\\DCP-o-matic 2 debug\\Uninstall DCP-o-matic 2 debug.lnk" "$INSTDIR\\Uninstall.exe"', file=f)
         print('WriteRegStr HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\DCP-o-matic 2 debug" "DisplayName" "DCP-o-matic 2 debug (remove only)"', file=f)
         print('WriteRegStr HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\DCP-o-matic 2 debug" "UninstallString" "$INSTDIR\\Uninstall.exe"', file=f)
     else:
-        print('CreateShortCut "$SMPROGRAMS\\DCP-o-matic 2\\DCP-o-matic 2.lnk" "$INSTDIR\\bin\\dcpomatic2.exe"', file=f)
         for s, l in tools:
-            print('CreateShortCut "$SMPROGRAMS\\DCP-o-matic 2\\DCP-o-matic 2 %s.lnk" "$INSTDIR\\bin\\dcpomatic2_%s.exe"' % (l, s), file=f)
+            print('CreateShortCut "$SMPROGRAMS\\DCP-o-matic 2\\DCP-o-matic 2%s.lnk" "$INSTDIR\\bin\\dcpomatic2%s.exe"' % (name_with_space(l), name_with_underscore(s)), file=f)
         print('CreateShortCut "$SMPROGRAMS\\DCP-o-matic 2\\Uninstall DCP-o-matic 2.lnk" "$INSTDIR\\Uninstall.exe"', file=f)
         print('WriteRegStr HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\DCP-o-matic2" "DisplayName" "DCP-o-matic 2 (remove only)"', file=f)
         print('WriteRegStr HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\DCP-o-matic2" "UninstallString" "$INSTDIR\\Uninstall.exe"', file=f)
@@ -402,14 +383,12 @@ File "%resources%/dcpomatic2_disk_writer.exe.manifest"
 
     if debug:
         print('Section "DCP-o-matic 2 debug desktop shortcuts" SEC_MASTER_DESKTOP', file=f)
-        print('CreateShortCut "$DESKTOP\\DCP-o-matic 2 debug.lnk" "$INSTDIR\\bin\\dcpomatic2_debug.bat" ""', file=f)
         for s, l in tools:
-            print('CreateShortCut "$DESKTOP\\DCP-o-matic 2 %s debug.lnk" "$INSTDIR\\bin\\dcpomatic2_%s_debug.bat" ""' % (l, s), file=f)
+            print('CreateShortCut "$DESKTOP\\DCP-o-matic 2%s debug.lnk" "$INSTDIR\\bin\\dcpomatic2%s_debug.bat" ""' % (name_with_space(l), name_with_underscore(s)), file=f)
     else:
         print('Section "DCP-o-matic 2 desktop shortcuts" SEC_MASTER_DESKTOP', file=f)
-        print('CreateShortCut "$DESKTOP\\DCP-o-matic 2.lnk" "$INSTDIR\\bin\\dcpomatic2.exe" ""', file=f)
         for s, l in tools:
-            print('CreateShortCut "$DESKTOP\\DCP-o-matic 2 %s.lnk" "$INSTDIR\\bin\\dcpomatic2_%s.exe"' % (l, s), file=f)
+            print('CreateShortCut "$DESKTOP\\DCP-o-matic 2%s.lnk" "$INSTDIR\\bin\\dcpomatic2%s.exe"' % (name_with_space(l), name_with_underscore(s)), file=f)
 
     print("SectionEnd", file=f)
 
@@ -459,11 +438,10 @@ SectionEnd
 Section "Uninstall"
 RMDir /r "$INSTDIR\\*.*"
 RMDir "$INSTDIR"
-Delete "$DESKTOP\\DCP-o-matic 2 debug.lnk"
         """, file=f)
 
         for s, l in tools:
-            print('Delete "$DESKTOP\\DCP-o-matic 2 %s debug.lnk"' % l, file=f)
+            print('Delete "$DESKTOP\\DCP-o-matic 2%s debug.lnk"' % name_with_space(l), file=f)
 
         print("""
 Delete "$SMPROGRAMS\\DCP-o-matic 2 debug\\*.*"
@@ -477,11 +455,10 @@ DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\U
 Section "Uninstall"
 RMDir /r "$INSTDIR\\*.*"
 RMDir "$INSTDIR"
-Delete "$DESKTOP\\DCP-o-matic 2.lnk"
         """, file=f)
 
         for s, l in tools:
-            print('Delete "$DESKTOP\\DCP-o-matic 2 %s.lnk"' % l)
+            print('Delete "$DESKTOP\\DCP-o-matic 2%s.lnk"' % name_with_space(l))
 
         print("""
 Delete "$SMPROGRAMS\\DCP-o-matic 2\\*.*"
@@ -493,5 +470,20 @@ DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\U
 
 
 def build(bld):
-    write_installer(32, bld.env.VERSION, bld.env.DEBUG, bld.env.ENABLE_DISK)
-    write_installer(64, bld.env.VERSION, bld.env.DEBUG, bld.env.ENABLE_DISK)
+    all_tools = [
+        ('main', 'main'),
+        ('batch', 'Batch Converter'),
+        ('kdm', 'KDM Creator'),
+        ('kdm_cli', 'KDM Creator CLI'),
+        ('player', 'Player'),
+        ('cli', 'CLI'),
+        ('create', 'Creator'),
+        ('playlist', 'Playlist Editor'),
+        ('combiner', 'Combiner'),
+        ('editor', 'Editor'),
+        ('map', 'Map'),
+        ('disk', 'Disk Writer'),
+    ]
+
+    write_installer(all_tools, 32, bld.env.VERSION, bld.env.DEBUG)
+    write_installer(all_tools, 64, bld.env.VERSION, bld.env.DEBUG)