summary refs log tree commit diff
path: root/pkgs/applications/misc/octoprint/m33-fio-one-library.patch
blob: 968983696feb2f0ad560f1e4de0c728be4ce432b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
From 62b4fabd1d4ee7a584a565d48c7eaec6e80fe0bd Mon Sep 17 00:00:00 2001
From: Nikolay Amiantov <ab@fmap.me>
Date: Fri, 12 Aug 2016 23:41:22 +0300
Subject: [PATCH] Build and use one version of preprocessor library

---
 octoprint_m33fio/__init__.py   | 66 +-----------------------------------------
 shared library source/Makefile | 59 +++----------------------------------
 2 files changed, 5 insertions(+), 120 deletions(-)

diff --git a/octoprint_m33fio/__init__.py b/octoprint_m33fio/__init__.py
index da539f5..b0a17ad 100755
--- a/octoprint_m33fio/__init__.py
+++ b/octoprint_m33fio/__init__.py
@@ -979,71 +979,7 @@ class M33FioPlugin(
 		# Check if using shared library or checking if it is usable
 		if self._settings.get_boolean(["UseSharedLibrary"]) or isUsable :
 	
-			# Check if running on Linux
-			if platform.uname()[0].startswith("Linux") :
-
-				# Check if running on a Raspberry Pi 1
-				if platform.uname()[4].startswith("armv6l") and self.getCpuHardware() == "BCM2708" :
-	
-					# Set shared library
-					self.sharedLibrary = ctypes.cdll.LoadLibrary(self._basefolder.replace('\\', '/') + "/static/libraries/preprocessor_arm1176jzf-s.so")
-	
-				# Otherwise check if running on a Raspberry Pi 2 or Raspberry Pi 3
-				elif platform.uname()[4].startswith("armv7l") and self.getCpuHardware() == "BCM2709" :
-	
-					# Set shared library
-					self.sharedLibrary = ctypes.cdll.LoadLibrary(self._basefolder.replace('\\', '/') + "/static/libraries/preprocessor_arm_cortex-a7.so")
-	
-				# Otherwise check if running on an ARM7 device
-				elif platform.uname()[4].startswith("armv7") :
-	
-					# Set shared library
-					self.sharedLibrary = ctypes.cdll.LoadLibrary(self._basefolder.replace('\\', '/') + "/static/libraries/preprocessor_arm7.so")
-	
-				# Otherwise check if using an i386 or x86-64 device
-				elif platform.uname()[4].endswith("86") or platform.uname()[4].endswith("64") :
-
-					# Check if Python is running as 32-bit
-					if platform.architecture()[0].startswith("32") :
-		
-						# Set shared library
-						self.sharedLibrary = ctypes.cdll.LoadLibrary(self._basefolder.replace('\\', '/') + "/static/libraries/preprocessor_i386.so")
-	
-					# Otherwise check if Python is running as 64-bit
-					elif platform.architecture()[0].startswith("64") :
-		
-						# Set shared library
-						self.sharedLibrary = ctypes.cdll.LoadLibrary(self._basefolder.replace('\\', '/') + "/static/libraries/preprocessor_x86-64.so")
-
-			# Otherwise check if running on Windows and using an i386 or x86-64 device
-			elif platform.uname()[0].startswith("Windows") and (platform.uname()[4].endswith("86") or platform.uname()[4].endswith("64")) :
-
-				# Check if Python is running as 32-bit
-				if platform.architecture()[0].startswith("32") :
-	
-					# Set shared library
-					self.sharedLibrary = ctypes.cdll.LoadLibrary(self._basefolder.replace('\\', '/') + "/static/libraries/preprocessor_i386.dll")
-
-				# Otherwise check if Python is running as 64-bit
-				elif platform.architecture()[0].startswith("64") :
-	
-					# Set shared library
-					self.sharedLibrary = ctypes.cdll.LoadLibrary(self._basefolder.replace('\\', '/') + "/static/libraries/preprocessor_x86-64.dll")
-
-			# Otherwise check if running on OS X and using an i386 or x86-64 device
-			elif platform.uname()[0].startswith("Darwin") and (platform.uname()[4].endswith("86") or platform.uname()[4].endswith("64")) :
-
-				# Check if Python is running as 32-bit
-				if platform.architecture()[0].startswith("32") :
-	
-					# Set shared library
-					self.sharedLibrary = ctypes.cdll.LoadLibrary(self._basefolder.replace('\\', '/') + "/static/libraries/preprocessor_i386.dylib")
-
-				# Otherwise check if Python is running as 64-bit
-				elif platform.architecture()[0].startswith("64") :
-	
-					# Set shared library
-					self.sharedLibrary = ctypes.cdll.LoadLibrary(self._basefolder.replace('\\', '/') + "/static/libraries/preprocessor_x86-64.dylib")
+			self.sharedLibrary = ctypes.cdll.LoadLibrary(self._basefolder.replace('\\', '/') + "/static/libraries/libpreprocessor.so")
 
 			# Check if shared library was set
 			if self.sharedLibrary :
diff --git a/shared library source/Makefile b/shared library source/Makefile
index a43d657..0b254aa 100755
--- a/shared library source/Makefile	
+++ b/shared library source/Makefile	
@@ -1,62 +1,11 @@
 # Target platform options: LINUX32, LINUX64, WINDOWS32, WINDOWS64, PI, PI2, ARM7, OSX32, OSX64
-LIBRARY_NAME = preprocessor
+LIBRARY_NAME = libpreprocessor
 TARGET_PLATFORM = LINUX64
 VER = .1
 
-ifeq ($(TARGET_PLATFORM), LINUX32)
-	PROG = $(LIBRARY_NAME)_i386.so
-	CC = g++
-	CFLAGS = -fPIC -m32 -static-libgcc -O3 -Wl,-soname,$(PROG)$(VER) -static-libstdc++
-endif
-
-ifeq ($(TARGET_PLATFORM), LINUX64)
-	PROG = $(LIBRARY_NAME)_x86-64.so
-	CC = g++
-	CFLAGS = -fPIC -m64 -static-libgcc -O3 -Wl,-soname,$(PROG)$(VER) -static-libstdc++
-endif
-
-ifeq ($(TARGET_PLATFORM), WINDOWS32)
-	PROG = $(LIBRARY_NAME)_i386.dll
-	CC = i686-w64-mingw32-g++
-	CFLAGS = -static-libgcc -O3 -Wl,-soname,$(PROG)$(VER) -static-libstdc++
-endif
-
-ifeq ($(TARGET_PLATFORM), WINDOWS64)
-	PROG = $(LIBRARY_NAME)_x86-64.dll
-	CC = x86_64-w64-mingw32-g++
-	CFLAGS = -static-libgcc -O3 -Wl,-soname,$(PROG)$(VER) -static-libstdc++
-endif
-
-ifeq ($(TARGET_PLATFORM), PI)
-	PROG = $(LIBRARY_NAME)_arm1176jzf-s.so
-	CC = ~/tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/bin/arm-linux-gnueabihf-g++
-	CFLAGS = -fPIC -mcpu=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard -static-libgcc -O3 -Wl,-soname,$(PROG)$(VER) -static-libstdc++
-endif
-
-ifeq ($(TARGET_PLATFORM), PI2)
-	PROG = $(LIBRARY_NAME)_arm_cortex-a7.so
-	CC = ~/tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/bin/arm-linux-gnueabihf-g++
-	CFLAGS = -fPIC -mcpu=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -static-libgcc -O3 -Wl,-soname,$(PROG)$(VER) -static-libstdc++
-endif
-
-ifeq ($(TARGET_PLATFORM), ARM7)
-	PROG = $(LIBRARY_NAME)_arm7.so
-	CC = ~/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-g++
-	CFLAGS = -fPIC -mcpu=generic-armv7-a -mfpu=vfp -mfloat-abi=hard -static-libgcc -O3 -Wl,-soname,$(PROG)$(VER) -static-libstdc++
-endif
-
-ifeq ($(TARGET_PLATFORM), OSX32)
-	PROG = $(LIBRARY_NAME)_i386.dylib
-	CC = clang++
-	CFLAGS = -fPIC -m32 -stdlib=libc++ -O3 -Wl,-install_name,$(PROG)$(VER)
-
-endif
-
-ifeq ($(TARGET_PLATFORM), OSX64)
-	PROG = $(LIBRARY_NAME)_x86-64.dylib
-	CC = clang++
-	CFLAGS = -fPIC -m64 -stdlib=libc++ -O3 -Wl,-install_name,$(PROG)$(VER)
-endif
+PROG = $(LIBRARY_NAME).so
+CC = g++
+CFLAGS = -fPIC -O3 -Wl,-soname,$(PROG)$(VER)
 
 SRCS = preprocessor.cpp gcode.cpp vector.cpp
 CFLAGS += -Wall -std=c++11 -fvisibility=hidden -shared
-- 
2.9.2