From aed8844e5718450a70528a7666efacbed35fe176 Mon Sep 17 00:00:00 2001 From: Alex Zolotarev Date: Sun, 2 Oct 2011 09:23:53 +0300 Subject: [PATCH] [win] Compilation fixes --- base/string_utils.cpp | 4 +- .../cell_covering_visualize_test.cpp | 118 ------------------ indexer/indexer_tests/indexer_tests.pro | 4 +- map/map_tests/map_tests.pro | 4 +- platform/platform_win.cpp | 6 +- yg/internal/opengl_win32.cpp | 6 +- yg/yg_tests/yg_tests.pro | 2 +- 7 files changed, 12 insertions(+), 132 deletions(-) delete mode 100644 indexer/indexer_tests/cell_covering_visualize_test.cpp diff --git a/base/string_utils.cpp b/base/string_utils.cpp index 6dc718a939..edc2e57d6a 100644 --- a/base/string_utils.cpp +++ b/base/string_utils.cpp @@ -48,7 +48,7 @@ bool to_int(char const * s, int & i) bool to_uint64(char const * s, uint64_t & i) { char * stop; -#ifdef OMIM_OS_WINDOWS +#ifdef OMIM_OS_WINDOWS_NATIVE i = _strtoui64(s, &stop, 10); #else i = strtoull(s, &stop, 10); @@ -59,7 +59,7 @@ bool to_uint64(char const * s, uint64_t & i) bool to_int64(char const * s, int64_t & i) { char * stop; -#ifdef OMIM_OS_WINDOWS +#ifdef OMIM_OS_WINDOWS_NATIVE i = _strtoi64(s, &stop, 10); #else i = strtoll(s, &stop, 10); diff --git a/indexer/indexer_tests/cell_covering_visualize_test.cpp b/indexer/indexer_tests/cell_covering_visualize_test.cpp deleted file mode 100644 index 54e2029aed..0000000000 --- a/indexer/indexer_tests/cell_covering_visualize_test.cpp +++ /dev/null @@ -1,118 +0,0 @@ -#include "../../base/SRC_FIRST.hpp" - -#include "../cell_coverer.hpp" - -#include "../../qt_tstfrm/main_tester.hpp" -#include "../../qt_tstfrm/tstwidgets.hpp" - -#include "../../yg/screen.hpp" -#include "../../yg/skin.hpp" -#include "../../yg/pen_info.hpp" - -#include "../../geometry/screenbase.hpp" - -#include "../../testing/testing.hpp" - -#include "../../base/math.hpp" - -#include "../../std/bind.hpp" - -namespace -{ - class CoordsPusher - { - public: - typedef vector< CoordPointT > VT; - - CoordsPusher(VT & v) : m_v(v) {} - CoordsPusher & operator()(CoordT x, CoordT y) - { - m_v.push_back(make_pair(x, y)); - return *this; - } - private: - VT & m_v; - }; - - class CellTesterWidget : public tst::GLDrawWidget - { - vector< vector < CoordPointT > > m_lines; - vector m_rects; - ScreenBase m_screenBase; - - public: - CellTesterWidget(vector< vector< CoordPointT > > & points, - vector & rects, m2::RectD const & rect) - { - m_lines.swap(points); - m_rects.swap(rects); - m_screenBase.SetFromRect(rect); - } - - virtual void DoDraw(shared_ptr pScreen) - { - for (size_t i = 0; i < m_rects.size(); ++i) - { - m2::RectF r(m_rects[i].minX(), m_rects[i].minY(), m_rects[i].maxX(), m_rects[i].maxY()); - pScreen->immDrawSolidRect(r, yg::Color(255, 0, 0, 128)); - } - for (size_t i = 0; i < m_lines.size(); ++i) - { - std::vector pts; - for (size_t j = 0; j < m_lines[i].size(); ++j) - pts.push_back(m_screenBase.GtoP(m2::PointD(m_lines[i][j].first, m_lines[i][j].second))); - pScreen->drawPath(&pts[0], pts.size(), 0, m_skin->mapPenInfo(yg::PenInfo(yg::Color(0, 255, 0, 255), 2, 0, 0, 0)), 0); - } - } - - virtual void DoResize(int w, int h) - { - m_p->onSize(w, h); - m_screenBase.OnSize(0, 0, w, h); - } - }; - -/* QWidget * create_widget(vector< vector< CoordPointT > > & points, - vector & rects, m2::RectD const & rect) - { - return new CellTesterWidget(points, rects, rect); - } -*/ - - // TODO: Unit test Visualize_Covering. - /* - UNIT_TEST(Visualize_Covering) - { - typedef Bounds<-180, -270, 180, 90> BoundsT; - - vector< vector< CoordPointT > > points; - points.resize(1); - CoordsPusher c(points[0]); - c(53.888893127441406, 27.545927047729492) - (53.888614654541016, 27.546476364135742) - (53.889347076416016, 27.546852111816406) - (53.889404296875000, 27.546596527099609) - (53.888893127441406, 27.545927047729492); - - vector cells; - CoverPolygon(points[0], 21, cells); - - vector cellsRects; - - m2::RectD viewport; - for (size_t i = 0; i < cells.size(); ++i) - { - CoordT minX, minY, maxX, maxY; - GetCellBounds(cells[i], minX, minY, maxX, maxY); - - m2::RectD r(minX, minY, maxX, maxY); - cellsRects.push_back(r); - viewport.Add(r); - } - - tst::BaseTester tester; - tester.Run("cell covering testing", - bind(&create_widget, ref(points), ref(cellsRects), cref(viewport))); - } - */ -} diff --git a/indexer/indexer_tests/indexer_tests.pro b/indexer/indexer_tests/indexer_tests.pro index 818e1501a3..d4fd1b118f 100644 --- a/indexer/indexer_tests/indexer_tests.pro +++ b/indexer/indexer_tests/indexer_tests.pro @@ -10,7 +10,7 @@ include($$ROOT_DIR/common.pri) QT *= core win32 { - LIBS *= -lopengl32 -lShell32 + LIBS *= -lShell32 win32-g++: LIBS *= -lpthread } @@ -19,7 +19,6 @@ HEADERS += \ SOURCES += \ ../../testing/testingmain.cpp \ - cell_covering_visualize_test.cpp \ cell_id_test.cpp \ cell_coverer_test.cpp \ test_type.cpp \ @@ -34,3 +33,4 @@ SOURCES += \ test_polylines.cpp \ geometry_serialization_test.cpp \ mwm_set_test.cpp \ + diff --git a/map/map_tests/map_tests.pro b/map/map_tests/map_tests.pro index 264329204f..88708f91db 100644 --- a/map/map_tests/map_tests.pro +++ b/map/map_tests/map_tests.pro @@ -6,14 +6,14 @@ CONFIG -= app_bundle TEMPLATE = app ROOT_DIR = ../.. -DEPENDENCIES = map indexer platform geometry coding base +DEPENDENCIES = map yg indexer platform geometry coding base freetype fribidi expat include($$ROOT_DIR/common.pri) QT *= core win32 { - LIBS *= -lShell32 + LIBS *= -lShell32 -lOpengl32 win32-g++: LIBS *= -lpthread } diff --git a/platform/platform_win.cpp b/platform/platform_win.cpp index a8c3b8d5c9..ff59584210 100644 --- a/platform/platform_win.cpp +++ b/platform/platform_win.cpp @@ -4,7 +4,9 @@ #include -static bool GetUserWritableDir(string & outDir) +#define LOCALAPPDATA_DIR "MapsWithMe" + +bool GetUserWritableDir(string & outDir) { char pathBuf[MAX_PATH] = {0}; if (SUCCEEDED(::SHGetFolderPathA(NULL, CSIDL_LOCAL_APPDATA | CSIDL_FLAG_CREATE, NULL, SHGFP_TYPE_CURRENT, pathBuf))) @@ -19,7 +21,7 @@ static bool GetUserWritableDir(string & outDir) } /// @return full path including binary itself -static bool GetPathToBinary(string & outPath) +bool GetPathToBinary(string & outPath) { // get path to executable char pathBuf[MAX_PATH] = {0}; diff --git a/yg/internal/opengl_win32.cpp b/yg/internal/opengl_win32.cpp index db66c0af15..ed268d6167 100644 --- a/yg/internal/opengl_win32.cpp +++ b/yg/internal/opengl_win32.cpp @@ -1,11 +1,7 @@ -#include "../../base/SRC_FIRST.hpp" - #include "opengl_win32.hpp" #include "../../base/logging.hpp" -#include "../../base/start_mem_debug.hpp" - #ifdef OMIM_OS_WINDOWS #define DEFINE_GL_PROC(type, name) \ @@ -35,7 +31,7 @@ namespace win32 #define DEFINE_GL_PROC(type, name) \ name = GetGLProc(hInst, #name); \ if (name == NULL) \ - name = GetGLProc(hInst, #name ## "EXT"); + name = GetGLProc(hInst, #name "EXT"); #include "gl_procedures.inl" #undef DEFINE_GL_PROC diff --git a/yg/yg_tests/yg_tests.pro b/yg/yg_tests/yg_tests.pro index 438b686548..8ca0935ce2 100644 --- a/yg/yg_tests/yg_tests.pro +++ b/yg/yg_tests/yg_tests.pro @@ -4,7 +4,7 @@ CONFIG -= app_bundle TEMPLATE = app ROOT_DIR = ../.. -DEPENDENCIES = qt_tstfrm map yg platform geometry coding base expat freetype fribidi +DEPENDENCIES = qt_tstfrm map indexer yg platform geometry coding base expat freetype fribidi include($$ROOT_DIR/common.pri)