Skip to content

Commit

Permalink
Merge pull request #104 from did-g/cleanup
Browse files Browse the repository at this point in the history
Cleanup makefile for wx 3.1 and c++11
  • Loading branch information
seandepagnier authored Jun 14, 2018
2 parents a327233 + 5c8efdb commit cf77b71
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 18 deletions.
27 changes: 20 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,24 @@ INCLUDE("cmake/FindPortaudio.cmake")
IF (PORTAUDIO_FOUND)
MESSAGE (STATUS "Portaudio Found")
INCLUDE_DIRECTORIES(BEFORE ${PORTAUDIO_INCLUDE_DIRS})
SET(EXTRA_LIBS ${EXTRA_LIBS} ${PORTAUDIO_LIBRARIES})
SET(PLUGINS_LIBS ${PLUGINS_LIBS} ${PORTAUDIO_LIBRARIES})
ADD_DEFINITIONS(${PORTAUDIO_DEFINITIONS})
ADD_DEFINITIONS(-DOCPN_USE_PORTAUDIO)
ELSE (PORTAUDIO_FOUND)
MESSAGE (STATUS "Portaudio Not Found...")
ENDIF (PORTAUDIO_FOUND)
ELSE (UNIX)
INCLUDE_DIRECTORIES(BEFORE ${PLUGIN_SOURCE_DIR}/include)
SET(EXTRA_LIBS ${EXTRA_LIBS} ../buildwin/portaudio_x86)
IF(STANDALONE MATCHES "BUNDLED")
# within OpenCPN tree
SET(PLUGINS_LIBS ${EXTRA_LIBS} ../../buildwin/portaudio_x86)
INSTALL(FILES "../../buildwin/portaudio_x86.dll" DESTINATION ".")
ELSE()
SET(PLUGINS_LIBS ${EXTRA_LIBS} ../buildwin/portaudio_x86)
INSTALL(FILES "buildwin/portaudio_x86.dll" DESTINATION ".")
ENDIF()

ADD_DEFINITIONS(-DOCPN_USE_PORTAUDIO)
INSTALL(FILES "buildwin/portaudio_x86.dll" DESTINATION ".")
ENDIF (UNIX)

IF (MSVC)
Expand Down Expand Up @@ -140,7 +147,7 @@ IF(UNIX)

ADD_DEFINITIONS( "-DBUILTIN_RTLAIS" )

SET(EXTRA_LIBS ${EXTRA_LIBS} ${RTLSDR_LIBRARY})
SET(PLUGINS_LIBS ${PLUGINS_LIBS} ${RTLSDR_LIBRARY})
ELSE()
MESSAGE (STATUS "")
MESSAGE (STATUS "================ WARNING ===================")
Expand All @@ -161,7 +168,7 @@ IF(TINYXML_FOUND)
message (STATUS "Building with system tinyxml")
INCLUDE_DIRECTORIES(${TINYXML_INCLUDE_DIR})
ADD_LIBRARY(${PACKAGE_NAME} SHARED ${SRC_WEATHERFAX})
TARGET_LINK_LIBRARIES(${PACKAGE_NAME} ${TINYXML_LIBRARIES} ${EXTRA_LIBS})
TARGET_LINK_LIBRARIES(${PACKAGE_NAME} ${TINYXML_LIBRARIES} ${PLUGINS_LIBS})
ELSE(TINYXML_FOUND)
message (STATUS "Building with embedded tinyxml")
INCLUDE_DIRECTORIES(src/tinyxml/)
Expand All @@ -171,12 +178,18 @@ ELSE(TINYXML_FOUND)
src/tinyxml/tinyxmlerror.cpp
)
ADD_LIBRARY(${PACKAGE_NAME} SHARED ${SRC_WEATHERFAX} ${SRC_LTINYXML})
TARGET_LINK_LIBRARIES(${PACKAGE_NAME} ${EXTRA_LIBS})
TARGET_LINK_LIBRARIES(${PACKAGE_NAME} ${PLUGINS_LIBS})
ENDIF(TINYXML_FOUND)
ADD_DEFINITIONS(-DTIXML_USE_STL)

IF(WIN32)
INSTALL(FILES "buildwin/PVW32Con.exe" DESTINATION "plugins\\\\${PACKAGE_NAME}")
IF(STANDALONE MATCHES "BUNDLED")
# within OpenCPN tree
INSTALL(FILES "../../buildwin/PVW32Con.exe" DESTINATION "plugins\\\\${PACKAGE_NAME}")
ELSE()
INSTALL(FILES "buildwin/PVW32Con.exe" DESTINATION "plugins\\\\${PACKAGE_NAME}")
ENDIF()

ENDIF(WIN32)

ADD_DEFINITIONS(-DTIXML_USE_STL)
Expand Down
1 change: 1 addition & 0 deletions cmake/PluginConfigure.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/include ${PROJECT_SOURCE_DIR}/src)

# IF NOT DEBUGGING CFLAGS="-O2 -march=native"
IF(NOT MSVC)
ADD_DEFINITIONS( "-fvisibility=hidden" )
IF(PROFILING)
ADD_DEFINITIONS( "-Wall -g -fprofile-arcs -ftest-coverage -fexceptions" )
ELSE(PROFILING)
Expand Down
14 changes: 11 additions & 3 deletions cmake/PluginInstall.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
##---------------------------------------------------------------------------

IF(NOT APPLE)
TARGET_LINK_LIBRARIES( ${PACKAGE_NAME} ${wxWidgets_LIBRARIES} ${EXTRA_LIBS} )
TARGET_LINK_LIBRARIES( ${PACKAGE_NAME} ${wxWidgets_LIBRARIES} ${PLUGINS_LIBS} )
ENDIF(NOT APPLE)

IF(WIN32)
Expand All @@ -17,7 +17,11 @@ IF(WIN32)
# glu32.lib)
TARGET_LINK_LIBRARIES(${PACKAGE_NAME} ${OPENGL_LIBRARIES})

SET(OPENCPN_IMPORT_LIB "${PARENT}.lib")
IF(STANDALONE MATCHES "BUNDLED")
SET(OPENCPN_IMPORT_LIB "../../${CMAKE_CFG_INTDIR}/${PARENT}")
ELSE()
SET(OPENCPN_IMPORT_LIB "${PARENT}")
ENDIF()
ENDIF(MSVC)

IF(MINGW)
Expand All @@ -29,6 +33,10 @@ IF(WIN32)
ENDIF(MINGW)

TARGET_LINK_LIBRARIES( ${PACKAGE_NAME} ${OPENCPN_IMPORT_LIB} )

IF(STANDALONE MATCHES "BUNDLED")
ADD_DEPENDENCIES(${PACKAGE_NAME} ${PARENT})
ENDIF(STANDALONE MATCHES "BUNDLED")
ENDIF(WIN32)

IF(UNIX)
Expand All @@ -40,7 +48,7 @@ IF(UNIX)
/usr/lib/gcc/i686-pc-linux-gnu/4.7
)

SET(EXTRA_LIBS ${EXTRA_LIBS} ${GCOV_LIBRARY})
SET(PLUGINS_LIBS ${PLUGINS_LIBS} ${GCOV_LIBRARY})
ENDIF(PROFILING)
ENDIF(UNIX)

Expand Down
2 changes: 1 addition & 1 deletion src/WeatherFax.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ void WeatherFax::Goto(int selection)
#else
WFDistanceBearingMercator(lat0, lon0, lat1, lon1, NULL, &distance);
#endif
if(!isnan(distance))
if(!wxIsNaN(distance))
JumpToPosition((lat0 + lat1) / 2, (lon0 + lon1) / 2, .5/distance);
}

Expand Down
8 changes: 4 additions & 4 deletions src/WeatherFax.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ class FaxArea

FaxArea() : lat1(NAN), lat2(NAN), lon1(NAN), lon2(NAN) {}

bool ContainsLat(double lat) { return isnan(lat) || (lat >= lat1 && lat <= lat2); }
bool ContainsLon(double lon) { return isnan(lon) ||
bool ContainsLat(double lat) { return wxIsNaN(lat) || (lat >= lat1 && lat <= lat2); }
bool ContainsLon(double lon) { return wxIsNaN(lon) ||
(lon2 - lon1 < 180 && lon >= lon1 && lon <= lon2) ||
(lon2 - lon1 >= 180 && (lon <= lon1 || lon >= lon2)); }

Expand All @@ -50,9 +50,9 @@ class FaxArea
+ ((lon >= 0) ? _T("E") : _T("W")); }
wxString AreaDescription() {
return description +
((!isnan(lat1) && !isnan(lat2)) ?
((!wxIsNaN(lat1) && !wxIsNaN(lat2)) ?
_T(" ") + LatArea(lat1) + _T("-") + LatArea(lat2) : _T("")) +
((!isnan(lon1) && !isnan(lon2)) ?
((!wxIsNaN(lon1) && !wxIsNaN(lon2)) ?
_T(" ") + LonArea(lon1) + _T("-") + LonArea(lon2) : _T(""));
}
};
Expand Down
4 changes: 2 additions & 2 deletions src/WeatherFaxImage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ bool WeatherFaxImage::MakeMappedImage(wxWindow *parent, bool paramsonly)

mercatoroffset.x = -minp;

if(isnan(minp) || isnan(maxp))
if(wxIsNaN(minp) || wxIsNaN(maxp))
return false;

int mw = maxp - minp;
Expand All @@ -419,7 +419,7 @@ bool WeatherFaxImage::MakeMappedImage(wxWindow *parent, bool paramsonly)
maxp = wxMax(p3y, p4y);
maxp = wxMax(maxp, p6y);

if(isnan(minp) || isnan(maxp))
if(wxIsNaN(minp) || wxIsNaN(maxp))
return false;

int mh = maxp - minp;
Expand Down
2 changes: 1 addition & 1 deletion src/WeatherFaxWizard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@ mapping1y^2*q + mapping2y^2*(e - 1)/d = 0
double inputtrueratio = (south?-1:1)*sqrt(1 - square(sm2lm1l*cm2lm1l) - square(cm2lm1l))
* (mapping2y - inputpoley) / ((mapping2x - mapping1x) * sm2lm1l * cm2lm1l);

if(isnan(inputpoley) || isnan(inputequator) || isnan(inputtrueratio) || inputtrueratio <= 0) {
if(wxIsNaN(inputpoley) || wxIsNaN(inputequator) || wxIsNaN(inputtrueratio) || inputtrueratio <= 0) {
wxMessageDialog w
( this, _("Calculating Mapping Failed.\n\
Perhaps you have chosen the wrong mapping type for this image, \
Expand Down

0 comments on commit cf77b71

Please sign in to comment.