Created
August 14, 2012 22:37
-
-
Save theuni/3353618 to your computer and use it in GitHub Desktop.
libsquish sse
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/lib/libsquish/Makefile.in b/lib/libsquish/Makefile.in | |
index f7b3cc1..34f93bd 100644 | |
--- a/lib/libsquish/Makefile.in | |
+++ b/lib/libsquish/Makefile.in | |
@@ -12,11 +12,6 @@ SRCS= \ | |
squish.cpp | |
CXXFLAGS+=-I. | |
-ifeq ($(findstring powerpc,$(ARCH)),powerpc) | |
- CXXFLAGS+=-DSQUISH_USE_ALTIVEC=1 -maltivec | |
-else ifeq ($(findstring x86,$(ARCH)), x86) | |
- CXXFLAGS+=-DSQUISH_USE_SSE=2 -msse2 | |
-endif | |
LIB=libsquish.a | |
@@ -32,9 +27,9 @@ all: $(LIB) $(NATIVE_LIB) | |
# TexturePacker links to libsquish and needs to run on build system, so make a native flavor. | |
$(NATIVE_LIB): $(SRCS) | |
ifeq ($(findstring Darwin,$(shell uname -s)),Darwin) | |
- g++ $(NATIVE_ARCH) -DSQUISH_USE_SSE=2 -msse2 -I. $(SRCS) -dynamiclib -install_name `pwd`/libsquish-native.so -o $@ | |
+ g++ $(NATIVE_ARCH) -I. $(SRCS) -dynamiclib -install_name `pwd`/libsquish-native.so -o $@ | |
else | |
- g++ -DSQUISH_USE_SSE=2 -msse2 -I. $(SRCS) -shared -fPIC -Wl,-soname,`pwd`/libsquish-native.so -o $@ | |
+ g++ -I. $(SRCS) -shared -fPIC -Wl,-soname,`pwd`/libsquish-native.so -o $@ | |
endif | |
endif | |
diff --git a/lib/libsquish/config.h b/lib/libsquish/config.h | |
index 2fad557..00a2d06 100644 | |
--- a/lib/libsquish/config.h | |
+++ b/lib/libsquish/config.h | |
@@ -28,13 +28,23 @@ | |
// Set to 1 when building squish to use Altivec instructions. | |
#ifndef SQUISH_USE_ALTIVEC | |
+#if defined(__ALTIVEC__) | |
+#define SQUISH_USE_ALTIVEC 1 | |
+#else | |
#define SQUISH_USE_ALTIVEC 0 | |
#endif | |
+#endif | |
// Set to 1 or 2 when building squish to use SSE or SSE2 instructions. | |
#ifndef SQUISH_USE_SSE | |
+#if defined(__SSE2__) | |
+#define SQUISH_USE_SSE 2 | |
+#elif defined(__SSE__) | |
+#define SQUISH_USE_SSE 1 | |
+#else | |
#define SQUISH_USE_SSE 0 | |
#endif | |
+#endif | |
// Internally set SQUISH_USE_SIMD when either Altivec or SSE is available. | |
#if SQUISH_USE_ALTIVEC && SQUISH_USE_SSE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment