Windows build fixes.
authorCarl Hetherington <cth@carlh.net>
Sat, 7 Mar 2020 00:13:29 +0000 (01:13 +0100)
committerCarl Hetherington <cth@carlh.net>
Sat, 28 Mar 2020 18:47:28 +0000 (19:47 +0100)
platform/windows/wscript
src/lib/cross_windows.cc
src/lib/wscript
src/tools/dcpomatic_dist_writer.cc
src/tools/wscript
wscript

index db19c750ef315ea265e25d3250c7c8a01ad227ca..ab0333db215c2454dcaa98339f30ea6f8050ead2 100644 (file)
@@ -75,11 +75,10 @@ File "%static_deps%/bin/libintl-8.dll"
 File "%static_deps%/bin/libboost_chrono-mt.dll"
 File "%static_deps%/bin/libboost_filesystem-mt.dll"
 File "%static_deps%/bin/libboost_system-mt.dll"
-File "%static_deps%/bin/libboost_thread_win32-mt.dll"
+File "%static_deps%/bin/libboost_thread-mt.dll"
 File "%static_deps%/bin/libboost_date_time-mt.dll"
 File "%static_deps%/bin/libboost_locale-mt.dll"
 File "%static_deps%/bin/libboost_regex-mt.dll"
-File "%static_deps%/bin/libeay32.dll"
 """, file=f)
 
     if bits == 32:
@@ -129,15 +128,14 @@ File "%static_deps%/bin/libxslt-1.dll"
 File "%static_deps%/bin/libffi-6.dll"
 File "%static_deps%/bin/openssl.exe"
 File "%static_deps%/bin/libcurl-4.dll"
-File "%static_deps%/bin/ssleay32.dll"
-File "%static_deps%/bin/libzip-4.dll"
+File "%static_deps%/bin/libzip.dll"
 File "%static_deps%/bin/libcairomm-1.0-1.dll"
 File "%static_deps%/bin/libpangomm-1.4-1.dll"
 File "%static_deps%/bin/libsamplerate-0.dll"
-File "%static_deps%/bin/libnettle-6.dll"
-File "%static_deps%/bin/icuuc56.dll"
-File "%static_deps%/bin/icudt56.dll"
-File "%static_deps%/bin/icuin56.dll"
+File "%static_deps%/bin/libnettle-7.dll"
+File "%static_deps%/bin/icuuc65.dll"
+File "%static_deps%/bin/icudt65.dll"
+File "%static_deps%/bin/icuin65.dll"
 File "%static_deps%/bin/liblzma-5.dll"
 File "%static_deps%/bin/libpcre-1.dll"
 File "%static_deps%/bin/libharfbuzz-0.dll"
@@ -146,21 +144,18 @@ File "%static_deps%/bin/liblcms2-2.dll"
 File "%static_deps%/bin/libwinpthread-1.dll"
 File "%static_deps%/bin/libgnutls-30.dll"
 File "%static_deps%/bin/libgmp-10.dll"
-File "%static_deps%/bin/libhogweed-4.dll"
+File "%static_deps%/bin/libhogweed-5.dll"
 File "%static_deps%/bin/libidn2-0.dll"
 File "%static_deps%/bin/libunistring-2.dll"
 File "%static_deps%/bin/libssh2-1.dll"
 File "%static_deps%/bin/libgcrypt-20.dll"
-""", file=f)
-
-    if bits == 32:
-        print('File "%static_deps%/bin/libgpg-error-0.dll"', file=f)
-    else:
-        print('File "%static_deps%/bin/libgpg-error6-0.dll"', file=f)
-
-    print("""
+File "%static_deps%/bin/libgpg-error-0.dll"
 File "%static_deps%/bin/libpangoft2-1.0-0.dll"
-File "%static_deps%/bin/libx264-152.dll"
+File "%static_deps%/bin/libx264-155.dll"
+File "%static_deps%/bin/libwebp-7.dll"
+File "%static_deps%/bin/libcrypto-1_1-x64.dll"
+File "%static_deps%/bin/libltdl-7.dll"
+File "%static_deps%/bin/libdl.dll"
 
 File "%cdist_deps%/bin/asdcp-carl.dll"
 File "%cdist_deps%/bin/kumu-carl.dll"
@@ -208,6 +203,7 @@ File "%cdist_deps%/src/openssl/apps/openssl.exe"
         print('File "%resources%/dcpomatic2_batch_debug.bat"', file=f)
         print('File "%resources%/dcpomatic2_kdm_debug.bat"', file=f)
         print('File "%resources%/dcpomatic2_player_debug.bat"', file=f)
+        print('File "%resources%/dcpomatic2_dist_debug.bat"', file=f)
         print('File "%mingw%/bin/gdb.exe"', file=f)
     else:
         print('File "%binaries%/src/wx/dcpomatic2-wx.dll"', file=f)
@@ -336,6 +332,8 @@ File "%binaries%/src/tools/dcpomatic2_cli.exe"
 File "%binaries%/src/tools/dcpomatic2_create.exe"
 File "%binaries%/src/tools/dcpomatic2_kdm.exe"
 File "%binaries%/src/tools/dcpomatic2_kdm_cli.exe"
+File "%binaries%/src/tools/dcpomatic2_dist.exe"
+File "%binaries%/src/tools/dcpomatic2_dist_writer.exe"
     """, file=f)
 
     print("""
@@ -348,6 +346,7 @@ File "%binaries%/src/tools/dcpomatic2_playlist.exe"
             print('CreateShortCut "$SMPROGRAMS\\DCP-o-matic 2 debug\\DCP-o-matic 2 debug.lnk" "$INSTDIR\\bin\\dcpomatic2_debug.bat"', file=f)
             print('CreateShortCut "$SMPROGRAMS\\DCP-o-matic 2 debug\\DCP-o-matic 2 Batch Converter debug.lnk" "$INSTDIR\\bin\\dcpomatic2_batch_debug.bat" ""', file=f)
             print('CreateShortCut "$SMPROGRAMS\\DCP-o-matic 2 debug\\DCP-o-matic 2 KDM Creator debug.lnk" "$INSTDIR\\bin\\dcpomatic2_kdm_debug.bat" ""', file=f)
+            print('CreateShortCut "$SMPROGRAMS\\DCP-o-matic 2 debug\\DCP-o-matic 2 Disk Writer debug.lnk" "$INSTDIR\\bin\\dcpomatic2_dist_debug.bat" ""', file=f)
             print('CreateShortCut "$SMPROGRAMS\\DCP-o-matic 2 debug\\Uninstall DCP-o-matic 2 debug.lnk" "$INSTDIR\\Uninstall.exe"', file=f)
         print('CreateShortCut "$SMPROGRAMS\\DCP-o-matic 2 debug\\DCP-o-matic 2 Player debug.lnk" "$INSTDIR\\bin\\dcpomatic2_player_debug.bat" ""', 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)
@@ -357,6 +356,7 @@ File "%binaries%/src/tools/dcpomatic2_playlist.exe"
             print('CreateShortCut "$SMPROGRAMS\\DCP-o-matic 2\\DCP-o-matic 2.lnk" "$INSTDIR\\bin\\dcpomatic2.exe"', file=f)
             print('CreateShortCut "$SMPROGRAMS\\DCP-o-matic 2\\DCP-o-matic 2 Batch Converter.lnk" "$INSTDIR\\bin\\dcpomatic2_batch.exe"', file=f)
             print('CreateShortCut "$SMPROGRAMS\\DCP-o-matic 2\\DCP-o-matic 2 KDM Creator.lnk" "$INSTDIR\\bin\\dcpomatic2_kdm.exe"', file=f)
+            print('CreateShortCut "$SMPROGRAMS\\DCP-o-matic 2\\DCP-o-matic 2 Disk Writer.lnk" "$INSTDIR\\bin\\dcpomatic2_dist.exe"', file=f)
             print('CreateShortCut "$SMPROGRAMS\\DCP-o-matic 2\\Uninstall DCP-o-matic 2.lnk" "$INSTDIR\\Uninstall.exe"', file=f)
         print('CreateShortCut "$SMPROGRAMS\\DCP-o-matic 2\\DCP-o-matic 2 Player.lnk" "$INSTDIR\\bin\\dcpomatic2_player.exe"', file=f)
         print('CreateShortCut "$SMPROGRAMS\\DCP-o-matic 2\\DCP-o-matic 2 Playlist Editor.lnk" "$INSTDIR\\bin\\dcpomatic2_playlist.exe"', file=f)
@@ -372,6 +372,7 @@ File "%binaries%/src/tools/dcpomatic2_playlist.exe"
             print('CreateShortCut "$DESKTOP\\DCP-o-matic 2 debug.lnk" "$INSTDIR\\bin\\dcpomatic2_debug.bat" ""', file=f)
             print('CreateShortCut "$DESKTOP\\DCP-o-matic 2 Batch Converter debug.lnk" "$INSTDIR\\bin\\dcpomatic2_batch_debug.bat" ""', file=f)
             print('CreateShortCut "$DESKTOP\\DCP-o-matic 2 KDM Creator debug.lnk" "$INSTDIR\\bin\\dcpomatic2_kdm_debug.bat" ""', file=f)
+            print('CreateShortCut "$DESKTOP\\DCP-o-matic 2 Disk Writer debug.lnk" "$INSTDIR\\bin\\dcpomatic2_dist_debug.bat" ""', file=f)
     else:
         print('Section "DCP-o-matic 2 desktop shortcuts" SEC_MASTER_DESKTOP', file=f)
         print('CreateShortCut "$DESKTOP\\DCP-o-matic 2 Player.lnk" "$INSTDIR\\bin\\dcpomatic2_player.exe"', file=f)
@@ -379,6 +380,7 @@ File "%binaries%/src/tools/dcpomatic2_playlist.exe"
             print('CreateShortCut "$DESKTOP\\DCP-o-matic 2.lnk" "$INSTDIR\\bin\\dcpomatic2.exe" ""', file=f)
             print('CreateShortCut "$DESKTOP\\DCP-o-matic 2 Batch Converter.lnk" "$INSTDIR\\bin\\dcpomatic2_batch.exe"', file=f)
             print('CreateShortCut "$DESKTOP\\DCP-o-matic 2 KDM Creator.lnk" "$INSTDIR\\bin\\dcpomatic2_kdm.exe"', file=f)
+            print('CreateShortCut "$DESKTOP\\DCP-o-matic 2 Disk Writer.lnk" "$INSTDIR\\bin\\dcpomatic2_dist.exe"', file=f)
 
     print("SectionEnd", file=f)
 
@@ -436,6 +438,7 @@ RMDir "$INSTDIR"
 Delete "$DESKTOP\\DCP-o-matic 2 debug.lnk"
 Delete "$DESKTOP\\DCP-o-matic 2 Batch Converter debug.lnk"
 Delete "$DESKTOP\\DCP-o-matic 2 KDM Creator debug.lnk"
+Delete "$DESKTOP\\DCP-o-matic 2 Disk Writer debug.lnk"
 Delete "$SMPROGRAMS\\DCP-o-matic 2 debug\\*.*"
 RmDir  "$SMPROGRAMS\\DCP-o-matic 2 debug"
 DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\\DCP-o-matic 2 debug"
@@ -451,6 +454,7 @@ Delete "$DESKTOP\\DCP-o-matic 2.lnk"
 Delete "$DESKTOP\\DCP-o-matic 2 Batch Converter.lnk"
 Delete "$DESKTOP\\DCP-o-matic 2 Encode Server.lnk"
 Delete "$DESKTOP\\DCP-o-matic 2 KDM creator.lnk"
+Delete "$DESKTOP\\DCP-o-matic 2 Disk Writer.lnk"
 Delete "$SMPROGRAMS\\DCP-o-matic 2\\*.*"
 RmDir  "$SMPROGRAMS\\DCP-o-matic 2"
 DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\\DCP-o-matic 2"
index 2b7696b68f37cf69bae7a74c1112ec89843acc42..9c6fab57708ef69783911983f35937f5fb1d551b 100644 (file)
@@ -32,6 +32,9 @@ extern "C" {
 #include <boost/algorithm/string.hpp>
 #include <boost/foreach.hpp>
 #include <windows.h>
+#include <winternl.h>
+#include <winioctl.h>
+#include <ntdddisk.h>
 #include <setupapi.h>
 #undef DATADIR
 #include <shlwapi.h>
@@ -306,7 +309,7 @@ home_directory ()
 }
 
 string
-command_and_read (string cmd)
+command_and_read (string)
 {
        return "";
 }
@@ -349,7 +352,7 @@ get_drives ()
                ZeroMemory (&friendly_name_buffer, sizeof(friendly_name_buffer));
 
                bool r = SetupDiGetDeviceRegistryPropertyW (
-                       device_info, &device_info_data, SPDRP_FRIENDLYNAME, 0, static_cast<PBYTE>(wbuffer), sizeof(wbuffer), 0
+                       device_info, &device_info_data, SPDRP_FRIENDLYNAME, 0, reinterpret_cast<PBYTE>(friendly_name_buffer), sizeof(friendly_name_buffer), 0
                        );
 
                if (r) {
@@ -390,7 +393,7 @@ get_drives ()
                        r = SetupDiGetDeviceInterfaceDetailW (device_info, &device_interface_data, device_detail_data, size, &size, 0);
                        if (!r) {
                                LOG_DIST_NC("SetupDiGetDeviceInterfaceDetailW failed");
-                               return 1;
+                               return vector<Drive>();
                        }
 
                        HANDLE device = CreateFileW (
@@ -422,7 +425,7 @@ get_drives ()
                                );
 
                        if (r) {
-                               LOG_DIST("GET_DEVICE_NUMBER gives %1", disk_number.DeviceNumber);
+                               LOG_DIST("GET_DEVICE_NUMBER gives %1", device_number.DeviceNumber);
                                /* Disk number for \\.\PHYSICALDRIVEx is device_number.DeviceNumber */
                        }
 
index c998b6936a68a2748d54b980f7fefb046564bdb2..fce323e0f0c44335e1fb3fe46c54e137be22b667 100644 (file)
@@ -207,7 +207,7 @@ def build(bld):
         obj.source += ' copy_to_drive_job.cc'
 
     if bld.env.TARGET_WINDOWS:
-        obj.uselib += ' WINSOCK2 DBGHELP SHLWAPI MSWSOCK BOOST_LOCALE'
+        obj.uselib += ' WINSOCK2 DBGHELP SHLWAPI MSWSOCK BOOST_LOCALE SETUPAPI'
         obj.source += ' cross_windows.cc'
     if bld.env.TARGET_OSX:
         obj.source += ' cross_osx.cc'
index 52763185dfbdf856578d9ed0ceaa19a54db4e806..084f82c34e47dde95aa7957440b3b8fae51b2bb9 100644 (file)
@@ -24,7 +24,6 @@
 #include "lib/cross.h"
 #include "lib/digester.h"
 extern "C" {
-#include <lwext4/file_dev.h>
 #include <lwext4/ext4_mbr.h>
 #include <lwext4/ext4_fs.h>
 #include <lwext4/ext4_mkfs.h>
@@ -37,20 +36,30 @@ extern "C" {
 #include <sys/ioctl.h>
 #include <sys/types.h>
 #include <sys/stat.h>
+#endif
+
 #ifdef DCPOMATIC_OSX
 #undef nil
 #endif
-#include <glibmm.h>
-#endif
 
 #ifdef DCPOMATIC_LINUX
 #include <linux/fs.h>
 #include <polkit/polkit.h>
+extern "C" {
+#include <lwext4/file_dev.h>
+}
+#include <poll.h>
 #endif
 
+#ifdef DCPOMATIC_WINDOWS
+extern "C" {
+#include <lwext4/file_windows.h>
+}
+#endif
+
+#include <glibmm.h>
 #include <unistd.h>
 #include <sys/types.h>
-#include <poll.h>
 #include <boost/filesystem.hpp>
 #include <iostream>
 
@@ -229,7 +238,7 @@ try
        info.journal = false;
 
 #ifdef WIN32
-       file_windows_name_set(WINDOWS_DRIVE);
+       file_windows_name_set(device.c_str());
        struct ext4_blockdev* bd = file_windows_dev_get();
 #else
        file_dev_name_set (device.c_str());
@@ -343,9 +352,15 @@ polkit_callback (GObject *, GAsyncResult* res, gpointer)
 bool
 idle ()
 {
+#ifdef DCPOMATIC_POSIX
        struct pollfd input[1] = { { fd: 0, events: POLLIN, revents: 0 } };
        int const r = poll (input, 1, 0);
        if (r > 0 && (input[0].revents & POLLIN)) {
+#else
+       DWORD num;
+       GetNumberOfConsoleInputEvents(GetStdHandle(STD_INPUT_HANDLE), &num);
+       if (num) {
+#endif
                string s;
                getline (cin, s);
                if (s.empty()) {
index 59cb38d1037afbfa2fe3fe9eb071eb0396299d98..8a6bc60c539f4832c7caf99c1605c240c1409719 100644 (file)
@@ -35,7 +35,7 @@ def build(bld):
     if bld.env.TARGET_LINUX:
         uselib += 'POLKIT '
 
-    if bld.env.TARGET_LINUX or bld.env.TARGET_OSX:
+    if bld.env.ENABLE_DIST:
         uselib += 'LWEXT4 '
 
     if bld.env.TARGET_WINDOWS:
diff --git a/wscript b/wscript
index 03e75657a3d835c4017c3e07ec7e11848c14457e..67e429d8d038664fd0f07d2ef6389d79836739de 100644 (file)
--- a/wscript
+++ b/wscript
@@ -169,8 +169,9 @@ def configure(conf):
         conf.check(lib='dsound', uselib_store='DSOUND', msg="Checking for library dsound")
         conf.check(lib='winmm', uselib_store='WINMM', msg="Checking for library winmm")
         conf.check(lib='ksuser', uselib_store='KSUSER', msg="Checking for library ksuser")
+        conf.check(lib='setupapi', uselib_store='SETUPAPI', msg="Checking for library setupapi")
         boost_lib_suffix = '-mt'
-        boost_thread = 'boost_thread_win32-mt'
+        boost_thread = 'boost_thread-mt'
         conf.check_cxx(fragment="""
                                #include <boost/locale.hpp>\n
                                int main() { std::locale::global (boost::locale::generator().generate ("")); }\n
@@ -529,12 +530,16 @@ def configure(conf):
         # Really just checking for the header here (there's no associated library) but the test
         # program has to link with boost_system so I'm doing it this way.
         if conf.options.enable_dist:
+            deps = ['boost_system%s' % boost_lib_suffix]
+            if conf.env.TARGET_WINDOWS:
+                deps.append('ws2_32')
+                deps.append('boost_filesystem%s' % boost_lib_suffix)
             conf.check_cxx(fragment="""
                                 #include <boost/process.hpp>\n
                                 int main() { boost::process::child* c = new boost::process::child("foo"); }\n
                                 """,
                            msg='Checking for boost process library',
-                           lib=['boost_system%s' % boost_lib_suffix],
+                           lib=deps,
                            uselib_store='BOOST_PROCESS')
 
     # libxml++ requires glibmm and versions of glibmm 2.45.31 and later