Skip to content

Commit

Permalink
Merge pull request seandepagnier#234 from did-g/json_mingw
Browse files Browse the repository at this point in the history
Json and mingw
  • Loading branch information
seandepagnier authored Jan 8, 2019
2 parents 1cfa586 + 8a1fbf1 commit a5e2395
Show file tree
Hide file tree
Showing 16 changed files with 118 additions and 1,054 deletions.
10 changes: 2 additions & 8 deletions cmake/PluginConfigure.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ ENDIF(DEFINED _wx_selected_config)
MESSAGE (STATUS "*** Staging to build ${PACKAGE_NAME} ***")

include ("VERSION.cmake")
configure_file(${PROJECT_SOURCE_DIR}/cmake/wxWTranslateCatalog.h.in ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/include/wxWTranslateCatalog.h)

# Do the version.h configuration into the build output directory,
# thereby allowing building from a read-only source tree.
Expand All @@ -95,7 +96,7 @@ ENDIF(NOT SKIP_VERSION_CONFIG)

SET(PLUGIN_VERSION "${PLUGIN_VERSION_MAJOR}.${PLUGIN_VERSION_MINOR}.${PLUGIN_VERSION_PATCH}" )

INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/include ${PROJECT_SOURCE_DIR}/src)
INCLUDE_DIRECTORIES(BEFORE ${PROJECT_SOURCE_DIR}/include ${PROJECT_SOURCE_DIR}/src)

# SET(PROFILING 1)

Expand Down Expand Up @@ -276,13 +277,6 @@ IF(NOT WIN32)

ENDIF(NOT WIN32)


# Add some definitions to satisfy MS
IF(WIN32)
ADD_DEFINITIONS(-D__MSVC__)
ADD_DEFINITIONS(-D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_SECURE_NO_DEPRECATE)
ENDIF(WIN32)

# Let cmake find additional modules private
LIST(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR})

Expand Down
4 changes: 2 additions & 2 deletions cmake/PluginGL.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ SET(SRC_PLUGINGL
src/plugingl/qtstylesheet.cpp
)

ADD_LIBRARY(LIB_PLUGINGL STATIC ${SRC_PLUGINGL})
TARGET_LINK_LIBRARIES( ${PACKAGE_NAME} LIB_PLUGINGL )
ADD_LIBRARY(${PACKAGE_NAME}_LIB_PLUGINGL STATIC ${SRC_PLUGINGL})
TARGET_LINK_LIBRARIES( ${PACKAGE_NAME} ${PACKAGE_NAME}_LIB_PLUGINGL )
4 changes: 2 additions & 2 deletions cmake/PluginJSON.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ ENDIF(QT_ANDROID)

INCLUDE_DIRECTORIES(${PLUGIN_SOURCE_DIR}/src/jsoncpp)

ADD_LIBRARY(LIB_PLUGINJSON STATIC ${SRC_JSON})
TARGET_LINK_LIBRARIES( ${PACKAGE_NAME} LIB_PLUGINJSON )
ADD_LIBRARY(${PACKAGE_NAME}_LIB_PLUGINJSON STATIC ${SRC_JSON})
TARGET_LINK_LIBRARIES( ${PACKAGE_NAME} ${PACKAGE_NAME}_LIB_PLUGINJSON )
4 changes: 2 additions & 2 deletions cmake/PluginNMEA.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,5 @@ SET(SRC_NMEA0183

INCLUDE_DIRECTORIES(src/nmea0183)

ADD_LIBRARY(LIB_PLUGINNMEA0183 STATIC ${SRC_NMEA0183})
TARGET_LINK_LIBRARIES( ${PACKAGE_NAME} LIB_PLUGINNMEA0183 )
ADD_LIBRARY(${PACKAGE_NAME}_LIB_PLUGINNMEA0183 STATIC ${SRC_NMEA0183})
TARGET_LINK_LIBRARIES( ${PACKAGE_NAME} ${PACKAGE_NAME}_LIB_PLUGINNMEA0183 )
4 changes: 2 additions & 2 deletions cmake/PluginXML.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ SET(SRC_TINYXML
src/tinyxml/tinyxmlparser.cpp
src/tinyxml/tinyxmlerror.cpp
)
ADD_LIBRARY(LIB_PLUGINXML STATIC ${SRC_TINYXML})
TARGET_LINK_LIBRARIES( ${PACKAGE_NAME} LIB_PLUGINXML )
ADD_LIBRARY(${PACKAGE_NAME}_LIB_PLUGINXML STATIC ${SRC_TINYXML})
TARGET_LINK_LIBRARIES( ${PACKAGE_NAME} ${PACKAGE_NAME}_LIB_PLUGINXML )
ENDIF(WIN32)

ADD_DEFINITIONS(-DTIXML_USE_STL)
2 changes: 1 addition & 1 deletion include/GL/gl.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@

#if defined(_WIN32) && !defined(_WINGDI_) && !defined(_GNU_H_WINDOWS32_DEFINES) \
&& !defined(OPENSTEP) && !defined(__CYGWIN__) || defined(__MINGW32__)
#include <GL/mesa_wgl.h>
// #include <GL/mesa_wgl.h>
#endif

#if defined(macintosh) && PRAGMA_IMPORT_SUPPORTED
Expand Down
10 changes: 4 additions & 6 deletions src/RouteMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,6 @@
#include "weather_routing_pi.h"

#include "georef.h"
#include "wx/jsonreader.h"
#include "wx/jsonwriter.h"

#define distance(X, Y) sqrt((X)*(X) + (Y)*(Y)) // much faster than hypot

Expand Down Expand Up @@ -1376,10 +1374,10 @@ void IsoRoute::FindIsoRouteBounds(double bounds[4])
SkipPosition *s = skippoints->next;
while(s != skippoints) {
p = s->point;
bounds[MINLAT] = MIN(p->lat, bounds[MINLAT]);
bounds[MAXLAT] = MAX(p->lat, bounds[MAXLAT]);
bounds[MINLON] = MIN(p->lon, bounds[MINLON]);
bounds[MAXLON] = MAX(p->lon, bounds[MAXLON]);
bounds[MINLAT] = wxMin(p->lat, bounds[MINLAT]);
bounds[MAXLAT] = wxMax(p->lat, bounds[MAXLAT]);
bounds[MINLON] = wxMin(p->lon, bounds[MINLON]);
bounds[MAXLON] = wxMax(p->lon, bounds[MAXLON]);

if(p->lat == bounds[MAXLAT])
maxlat = s;
Expand Down
24 changes: 10 additions & 14 deletions src/RouteMapOverlay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@

#include "ocpn_plugin.h"
#include "plugingl/pidc.h"
#include "wx/jsonreader.h"
#include "wx/jsonwriter.h"

#include "json/json.h"
#include "Utilities.h"
#include "Boat.h"
#include "RouteMapOverlay.h"
Expand Down Expand Up @@ -1251,20 +1249,18 @@ void RouteMapOverlay::GetLLBounds(double &latmin, double &latmax, double &lonmin

void RouteMapOverlay::RequestGrib(wxDateTime time)
{
wxJSONValue v;
Json::Value v;
time = time.FromUTC();
v[_T("Day")] = time.GetDay();
v[_T("Month")] = time.GetMonth();
v[_T("Year")] = time.GetYear();
v[_T("Hour")] = time.GetHour();
v[_T("Minute")] = time.GetMinute();
v[_T("Second")] = time.GetSecond();
v["Day"] = time.GetDay();
v["Month"] = time.GetMonth();
v["Year"] = time.GetYear();
v["Hour"] = time.GetHour();
v["Minute"] = time.GetMinute();
v["Second"] = time.GetSecond();

wxJSONWriter w;
wxString out;
w.Write(v, out);
Json::FastWriter w;

SendPluginMessage(wxString(_T("GRIB_TIMELINE_RECORD_REQUEST")), out);
SendPluginMessage("GRIB_TIMELINE_RECORD_REQUEST", w.write(v));

Lock();
m_bNeedsGrib = false;
Expand Down
12 changes: 12 additions & 0 deletions src/plugingl/pidc.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,18 @@
//class ViewPort;
class GLUtesselator;

#ifndef DECL_EXP
#ifdef __WXMSW__
# define DECL_EXP __declspec(dllexport)
#else
# ifdef __GNUC__
# define DECL_EXP __attribute__((visibility("default")))
#else
# define DECL_EXP
# endif
#endif
#endif

void DrawGLThickLine( float x1, float y1, float x2, float y2, wxPen pen, bool b_hiqual );

//----------------------------------------------------------------------------
Expand Down
Loading

0 comments on commit a5e2395

Please sign in to comment.