Advertisement
Guest User

Untitled

a guest
Apr 19th, 2013
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.56 KB | None | 0 0
  1. From 38efce928ad3f23e374af40a9ebf9eaa51a467a1 Mon Sep 17 00:00:00 2001
  2. From: Michael Pavlyshko <me@mixaill.tk>
  3. Date: Sat, 20 Apr 2013 00:08:02 +0300
  4. Subject: [PATCH] Add MinGW support for alacarte-importer
  5.  
  6. ---
  7. CMakeLists.txt | 11 ++++++++++-
  8. src/utils/transform.cpp | 6 +++++-
  9. 2 files changed, 15 insertions(+), 2 deletions(-)
  10.  
  11. diff --git a/CMakeLists.txt b/CMakeLists.txt
  12. index 06b34bd..24c2bd5 100644
  13. --- a/CMakeLists.txt
  14. +++ b/CMakeLists.txt
  15. @@ -26,6 +26,11 @@ endif (cairo_ver LESS 1 OR cairo_major LESS 12 OR cairo_minor LESS 2)
  16. pkg_check_modules(Freetype freetype2)
  17. pkg_check_modules(SigC++ sigc++-2.0)
  18.  
  19. +#Set windows version for MinGW
  20. +IF(MINGW)
  21. +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_WIN32_WINNT=0x0501")
  22. +add_definitions(-D_WIN32_WINNT=0x0501)
  23. +ENDIF(MINGW)
  24.  
  25. # Add preprocessor makro
  26. add_subdirectory(extras/pch)
  27. @@ -124,7 +129,11 @@ ENDIF(GMOCK_FOUND)
  28. add_precompiled_header(unitTests_eval "include/includes.hpp")
  29.  
  30. target_link_libraries(alacarte-server ${Boost_LIBRARIES} ${Cairomm_LIBRARIES} ${LOG4CPP_LIBRARIES} ${SigC++_LIBRARIES} pthread)
  31. +IF(MINGW)
  32. +target_link_libraries(alacarte-importer ${Boost_LIBRARIES} ${LOG4CPP_LIBRARIES} pthread ws2_32 wsock32)
  33. +ELSE()
  34. target_link_libraries(alacarte-importer ${Boost_LIBRARIES} ${LOG4CPP_LIBRARIES} pthread)
  35. +ENDIF()
  36. target_link_libraries(unitTests_utils ${Boost_LIBRARIES} ${Cairomm_LIBRARIES} ${LOG4CPP_LIBRARIES} pthread)
  37. target_link_libraries(unitTests_general ${Boost_LIBRARIES} ${Cairomm_LIBRARIES} ${LOG4CPP_LIBRARIES} ${SigC++_LIBRARIES} pthread)
  38. target_link_libraries(unitTests_importer ${Boost_LIBRARIES} ${LOG4CPP_LIBRARIES} ${Cairomm_LIBRARIES} ${SigC++_LIBRARIES} pthread)
  39. @@ -173,4 +182,4 @@ if(DOXYGEN_FOUND)
  40. WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
  41. COMMENT "Generating API documentation with Doxygen" VERBATIM
  42. )
  43. -endif(DOXYGEN_FOUND)
  44. +endif(DOXYGEN_FOUND)
  45. \ No newline at end of file
  46. diff --git a/src/utils/transform.cpp b/src/utils/transform.cpp
  47. index 1b097f3..2e9bb90 100644
  48. --- a/src/utils/transform.cpp
  49. +++ b/src/utils/transform.cpp
  50. @@ -29,7 +29,7 @@
  51. * =====================================================================================
  52. */
  53.  
  54. -#include <math.h>
  55. +#include <cmath>
  56.  
  57. #include "settings.hpp"
  58.  
  59. @@ -38,6 +38,10 @@
  60. #define RADIUS 6378137.0
  61. // 2 decimal places
  62. #define FACTOR 100.0
  63. +// workaround for MinGW
  64. +#ifndef M_PI
  65. +#define M_PI 3.14159265358979323846
  66. +#endif
  67.  
  68. /**
  69. * @brief converts tile coordinates to north-west corner of the tile in the Mercator projection.
  70. --
  71. 1.8.1.msysgit.1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement