summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2020-03-07 01:13:29 +0100
committerCarl Hetherington <cth@carlh.net>2020-03-28 19:47:28 +0100
commit9521be84ec7a0993d025da8676d93430b3e1e8a1 (patch)
treebfcb481da309dcaedb7487fc34db2a6f3845c28d /src
parentd9e3a57957c0c52e7227553f03818aab376be384 (diff)
Windows build fixes.
Diffstat (limited to 'src')
-rw-r--r--src/lib/cross_windows.cc11
-rw-r--r--src/lib/wscript2
-rw-r--r--src/tools/dcpomatic_dist_writer.cc25
-rw-r--r--src/tools/wscript2
4 files changed, 29 insertions, 11 deletions
diff --git a/src/lib/cross_windows.cc b/src/lib/cross_windows.cc
index 2b7696b68..9c6fab577 100644
--- a/src/lib/cross_windows.cc
+++ b/src/lib/cross_windows.cc
@@ -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 */
}
diff --git a/src/lib/wscript b/src/lib/wscript
index c998b6936..fce323e0f 100644
--- a/src/lib/wscript
+++ b/src/lib/wscript
@@ -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'
diff --git a/src/tools/dcpomatic_dist_writer.cc b/src/tools/dcpomatic_dist_writer.cc
index 52763185d..084f82c34 100644
--- a/src/tools/dcpomatic_dist_writer.cc
+++ b/src/tools/dcpomatic_dist_writer.cc
@@ -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()) {
diff --git a/src/tools/wscript b/src/tools/wscript
index 59cb38d10..8a6bc60c5 100644
--- a/src/tools/wscript
+++ b/src/tools/wscript
@@ -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: