Closed lolo32 closed 9 years ago
Thanks - Paul Lewis sent me this message a couple days ago, this might help. I'll look at this on OSX tonight.
I was able to get LZHAM to compile on OS X, but I had to make a couple modifications to the code:
In lzhamdecomp/lzham_platform.cpp, I had to change: asm {int 3} to: __asm("int $3");
In lzhamdecomp/lzham_traits.h, I had to change:
to:
(Otherwise, I got these errors about expecting unqualified-ids in clang)
Then, I was able to compile by running cmake -G Xcode and then xcodebuild.
When I compiled lzham and ran lzhamtest, I noticed that the decompression is single-threaded. Is making it multi-threaded a work-in-progress/possible, or is this just a limitation of the algorithm?
Thank you, Paul
I made the same modifications, and the patch following was born:
diff --git a/lzhamdecomp/lzham_platform.cpp b/lzhamdecomp/lzham_platform.cpp
index cd4f9dd..172dc60 100644
--- a/lzhamdecomp/lzham_platform.cpp
+++ b/lzhamdecomp/lzham_platform.cpp
@@ -62,7 +62,7 @@ void lzham_debug_break(void)
#if LZHAM_USE_WIN32_API
DebugBreak();
#elif (TARGET_OS_MAC == 1) && (TARGET_IPHONE_SIMULATOR == 0) && (TARGET_OS_IPHONE == 0)
- __asm {int 3}
+ __asm__("int $3");
#else
assert(0);
#endif
diff --git a/lzhamdecomp/lzham_traits.h b/lzhamdecomp/lzham_traits.h
index cb0076c..d7ba871 100644
--- a/lzhamdecomp/lzham_traits.h
+++ b/lzhamdecomp/lzham_traits.h
@@ -67,7 +67,12 @@ namespace lzham
// Defines type Q as bitwise copyable.
#define LZHAM_DEFINE_BITWISE_COPYABLE(Q) template<> struct bitwise_copyable<Q> { enum { cFlag = true }; };
-#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__)
+#if defined(__APPLE__) && defined(__MACH__)
+ // Apple OSX and iOS
+ #include <TargetConditionals.h>
+#endif
+
+#if (defined(__APPLE__) && TARGET_OS_MAC != 1) || defined(__FreeBSD__) || defined(__NetBSD__)
#define LZHAM_IS_POD(T) std::__is_pod<T>::__value
#else
#define LZHAM_IS_POD(T) __is_pod(T)
@lolo32 it works. OSX and iOS, both. thanks
I'm trying to compile it, revision 4ed83a3, on Mac OSX, and I got the error "
error: expected unqualified-id
"Here are the steps I done:
I got an error when the first file is being compiled. Compilation message following:
Here is my CMake cache, in advanced mode (all default or auto detected):
Additional informations: