Added check for windows to check for SSE2 instructions. Needs a custom executable :(
parent
1e2d8e372f
commit
c32e38a1c9
|
@ -579,6 +579,14 @@ class SkeinforgeRepository:
|
||||||
self.executeTitle = 'Skeinforge a file...'
|
self.executeTitle = 'Skeinforge a file...'
|
||||||
|
|
||||||
def getPyPyExe(self):
|
def getPyPyExe(self):
|
||||||
|
if platform.system() == "Windows":
|
||||||
|
checkSSE2exe = os.path.dirname(os.path.abspath(__file__)) + "/checkSSE2.exe"
|
||||||
|
if os.path.exists(checkSSE2exe):
|
||||||
|
if subprocess.call(checkSSE2exe) != 0:
|
||||||
|
print "*****************************************************"
|
||||||
|
print "* Your CPU is lacking SSE2 support, cannot use PyPy *"
|
||||||
|
print "*****************************************************"
|
||||||
|
return False
|
||||||
if platform.system() == "Windows":
|
if platform.system() == "Windows":
|
||||||
pypyExe = os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(__file__)), "../../pypy/pypy.exe"));
|
pypyExe = os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(__file__)), "../../pypy/pypy.exe"));
|
||||||
else:
|
else:
|
||||||
|
|
9
build.sh
9
build.sh
|
@ -110,6 +110,15 @@ fi
|
||||||
#add Skeinforge
|
#add Skeinforge
|
||||||
cp -a SkeinPyPy ${TARGET_DIR}/SkeinPyPy
|
cp -a SkeinPyPy ${TARGET_DIR}/SkeinPyPy
|
||||||
|
|
||||||
|
#Add the SSE2 check if we can build it
|
||||||
|
if [ $BUILD_TARGET = "win32" ]; then
|
||||||
|
WINCC=`whereis i386-mingw32-gcc`
|
||||||
|
if [ "$WINCC" != "" ]; then
|
||||||
|
make -C checkSSE2 CC=${WINCC} TARGET=checkSSE2.exe
|
||||||
|
cp checkSSE2/checkSSE2.exe ${TARGET_DIR}/SkeinPyPy
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
#add printrun
|
#add printrun
|
||||||
mv Printrun ${TARGET_DIR}/Printrun
|
mv Printrun ${TARGET_DIR}/Printrun
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
CC ?= gcc
|
||||||
|
TARGET ?= checkSSE2
|
||||||
|
|
||||||
|
$(TARGET): main.c
|
||||||
|
$(CC) -o $(TARGET) main.c -Os
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
//Read CPU flags, and return 0 if we support SSE2, else return 1
|
||||||
|
//See: http://en.wikipedia.org/wiki/CPUID#EAX.3D1:_Processor_Info_and_Feature_Bits
|
||||||
|
|
||||||
|
int main(int argc, char** argv)
|
||||||
|
{
|
||||||
|
int features;
|
||||||
|
|
||||||
|
//Read the CPU features.
|
||||||
|
asm("mov $1, %%eax\n"
|
||||||
|
"cpuid\n"
|
||||||
|
"mov %%edx, %0"
|
||||||
|
: "=r"(features) : : "%eax", "%edx", "%ecx");
|
||||||
|
|
||||||
|
//Check bit 26, this indicates SSE2 support
|
||||||
|
if (features & (1 << 26))
|
||||||
|
return 0;
|
||||||
|
return 1;
|
||||||
|
}
|
Loading…
Reference in New Issue