android.patch 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. diff --git a/include/chipmunk/chipmunk_types.h b/include/chipmunk/chipmunk_types.h
  2. index 9544da8..82d027e 100644
  3. --- a/include/chipmunk/chipmunk_types.h
  4. +++ b/include/chipmunk/chipmunk_types.h
  5. @@ -54,7 +54,11 @@
  6. #ifndef CP_USE_DOUBLES
  7. // Use doubles by default for higher precision.
  8. - #define CP_USE_DOUBLES 1
  9. + #if (!defined(__ARM_NEON__) || !__ARM_NEON__ || __arm64)
  10. + #define CP_USE_DOUBLES 1
  11. + #else
  12. + #define CP_USE_DOUBLES 0
  13. + #endif
  14. #endif
  15. /// @defgroup basicTypes Basic Types
  16. diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
  17. index 34882d1..56589fb 100644
  18. --- a/src/CMakeLists.txt
  19. +++ b/src/CMakeLists.txt
  20. @@ -31,6 +31,9 @@ if(BUILD_SHARED)
  21. # need to explicitly link to the math library because the CMake/Android toolchains may not do it automatically
  22. target_link_libraries(chipmunk m)
  23. endif(ANDROID OR UNIX)
  24. + if(ANDROID)
  25. + target_link_libraries(chipmunk log)
  26. + endif(ANDROID)
  27. install(TARGETS chipmunk RUNTIME DESTINATION ${BIN_INSTALL_DIR}
  28. LIBRARY DESTINATION ${LIB_INSTALL_DIR}
  29. ARCHIVE DESTINATION ${LIB_INSTALL_DIR})
  30. diff --git a/src/cpHastySpace.c b/src/cpHastySpace.c
  31. index 8dca425..fa3074d 100644
  32. --- a/src/cpHastySpace.c
  33. +++ b/src/cpHastySpace.c
  34. @@ -7,8 +7,16 @@
  35. //TODO: Move all the thread stuff to another file
  36. //#include <sys/param.h >
  37. -#ifndef _WIN32
  38. +
  39. +#ifdef __APPLE__
  40. #include <sys/sysctl.h>
  41. +#elif defined(ANDROID)
  42. +#include <linux/sysctl.h>
  43. +#endif
  44. +
  45. +#ifndef _WIN32
  46. +#include <pthread.h>
  47. +#elif defined(__MINGW32__)
  48. #include <pthread.h>
  49. #else
  50. #ifndef WIN32_LEAN_AND_MEAN