Browse Source

Removed C++11 dependencies, and compile Windows binaries staically with mingw.

Michael McMaster 11 years ago
parent
commit
bd9c9c8658

+ 4 - 0
lib/SCSI2SD/software/bootloaderhost/Firmware.hh

@@ -18,7 +18,11 @@
 #ifndef Firmware_HH
 #define Firmware_HH
 
+#if __cplusplus >= 201103L
 #include <cstdint>
+#else
+#include <stdint.h>
+#endif
 #include <string>
 
 namespace SCSI2SD

+ 3 - 3
lib/SCSI2SD/software/bootloaderhost/Makefile

@@ -2,12 +2,12 @@ VPATH=cybootloaderutils
 
 CPPFLAGS = -I cybootloaderutils -I hidapi/hidapi
 CFLAGS += -Wall -Wno-pointer-sign -O2
-CXXFLAGS += -Wall -std=c++11 -O2
+CXXFLAGS += -Wall -O2
 
 TARGET ?= $(shell uname -s)
 ifeq ($(TARGET),Win32)
 	VPATH += hidapi/windows
-	LDFLAGS += -mconsole -mwindows -lsetupapi
+	LDFLAGS += -static -mconsole -mwindows -lsetupapi
 	BUILD = build/windows/32bit
 	CC=i686-w64-mingw32-gcc
 	CXX=i686-w64-mingw32-g++
@@ -15,7 +15,7 @@ ifeq ($(TARGET),Win32)
 endif
 ifeq ($(TARGET),Win64)
 	VPATH += hidapi/windows
-	LDFLAGS += -mconsole -mwindows -lsetupapi
+	LDFLAGS += -static -mconsole -mwindows -lsetupapi
 	BUILD = build/windows/64bit
 	CC=x86_64-w64-mingw32-gcc
 	CXX=x86_64-w64-mingw32-g++

+ 0 - 1
lib/SCSI2SD/software/bootloaderhost/SCSI2SD_Bootloader.cc

@@ -17,7 +17,6 @@
 
 #include "SCSI2SD_Bootloader.hh"
 
-#include <cstdint>
 #include <iostream>
 #include <sstream>
 #include <stdexcept>

+ 4 - 0
lib/SCSI2SD/software/bootloaderhost/SCSI2SD_Bootloader.hh

@@ -20,7 +20,11 @@
 
 #include "hidapi.h"
 
+#if __cplusplus >= 201103L
 #include <cstdint>
+#else
+#include <stdint.h>
+#endif
 #include <string>
 
 namespace SCSI2SD

+ 5 - 0
lib/SCSI2SD/software/bootloaderhost/SCSI2SD_HID.hh

@@ -20,7 +20,12 @@
 
 #include "hidapi.h"
 
+#if __cplusplus >= 201103L
 #include <cstdint>
+#else
+#include <stdint.h>
+#endif
+
 #include <string>
 
 namespace SCSI2SD

+ 12 - 3
lib/SCSI2SD/software/bootloaderhost/main.cc

@@ -19,13 +19,22 @@
 #include "SCSI2SD_Bootloader.hh"
 #include "Firmware.hh"
 
+#if __cplusplus >= 201103L
 #include <cstdint>
+#include <memory>
+using std::shared_ptr;
+#else
+#include <stdint.h>
+#include <tr1/memory>
+using std::tr1::shared_ptr;
+#endif
+
 #include <iomanip>
 #include <iostream>
-#include <memory>
 #include <sstream>
 
 #include <stdio.h>
+#include <stdlib.h>
 #include <unistd.h>
 
 using namespace SCSI2SD;
@@ -84,8 +93,8 @@ int main(int argc, char* argv[])
 	}
 
 	// Enumerate and print the HID devices on the system
-	std::shared_ptr<Bootloader> bootloader(Bootloader::Open());
-	std::shared_ptr<HID> hid(HID::Open());
+	shared_ptr<Bootloader> bootloader(Bootloader::Open());
+	shared_ptr<HID> hid(HID::Open());
 
 	if (hid)
 	{

+ 3 - 3
lib/SCSI2SD/software/scsi2sd-config/Makefile

@@ -1,13 +1,13 @@
 
 CPPFLAGS = -I ../bootloaderhost/hidapi/hidapi -I ../bootloaderhost
 CFLAGS += -Wall -Wno-pointer-sign -O2
-CXXFLAGS += -Wall -std=c++11 -O2
+CXXFLAGS += -Wall -O2
 VPATH += ../bootloaderhost
 
 TARGET ?= $(shell uname -s)
 ifeq ($(TARGET),Win32)
 	VPATH += hidapi/windows
-	LDFLAGS += -mconsole -mwindows -lsetupapi -lws2_32
+	LDFLAGS += -static -mconsole -mwindows -lsetupapi -lws2_32
 	BUILD = build/windows/32bit
 	CC=i686-w64-mingw32-gcc
 	CXX=i686-w64-mingw32-g++
@@ -15,7 +15,7 @@ ifeq ($(TARGET),Win32)
 endif
 ifeq ($(TARGET),Win64)
 	VPATH += hidapi/windows
-	LDFLAGS += -mconsole -mwindows -lsetupapi -lws2_32
+	LDFLAGS += -static -mconsole -mwindows -lsetupapi -lws2_32
 	BUILD = build/windows/64bit
 	CC=x86_64-w64-mingw32-gcc
 	CXX=x86_64-w64-mingw32-g++

+ 9 - 2
lib/SCSI2SD/software/scsi2sd-config/scsi2sd-config.cc

@@ -17,9 +17,16 @@
 
 #include "SCSI2SD_HID.hh"
 
+#if __cplusplus >= 201103L
+#include <memory>
+using std::shared_ptr;
+#else
+#include <tr1/memory>
+using std::tr1::shared_ptr;
+#endif
+
 #include <iomanip>
 #include <iostream>
-#include <memory>
 #include <sstream>
 
 // Request extended stdio format macros.
@@ -188,7 +195,7 @@ int main(int argc, char* argv[])
 		HID::PRODUCT_ID);
 
 	// Enumerate and print the HID devices on the system
-	std::shared_ptr<HID> scsi2sdHID(HID::Open());
+	shared_ptr<HID> scsi2sdHID(HID::Open());
 
 	if (!scsi2sdHID)
 	{

+ 3 - 3
lib/SCSI2SD/software/scsi2sd-debug/Makefile

@@ -1,13 +1,13 @@
 
 CPPFLAGS = -I ../bootloaderhost/hidapi/hidapi -I ../bootloaderhost
 CFLAGS += -Wall -Wno-pointer-sign -O2
-CXXFLAGS += -Wall -std=c++11 -O2
+CXXFLAGS += -Wall -O2
 VPATH += ../bootloaderhost
 
 TARGET ?= $(shell uname -s)
 ifeq ($(TARGET),Win32)
 	VPATH += hidapi/windows
-	LDFLAGS += -mconsole -mwindows -lsetupapi -lws2_32
+	LDFLAGS += -static -mconsole -mwindows -lsetupapi -lws2_32
 	BUILD = build/windows/32bit
 	CC=i686-w64-mingw32-gcc
 	CXX=i686-w64-mingw32-g++
@@ -15,7 +15,7 @@ ifeq ($(TARGET),Win32)
 endif
 ifeq ($(TARGET),Win64)
 	VPATH += hidapi/windows
-	LDFLAGS += -mconsole -mwindows -lsetupapi -lws2_32
+	LDFLAGS += -static -mconsole -mwindows -lsetupapi -lws2_32
 	BUILD = build/windows/64bit
 	CC=x86_64-w64-mingw32-gcc
 	CXX=x86_64-w64-mingw32-g++