Skip to content

Commit

Permalink
Updates for out of OpenCPN tree build
Browse files Browse the repository at this point in the history
Update for OSX build
Update from 8 to 5 degree layout
Changed original OCPN saved layout as I could not find a layout
compatible with this. Now OCPN layout is the same as QTVlm layout. All
layouts can be read by Weather_routing plugin
  • Loading branch information
ptulp committed Feb 14, 2015
1 parent c61c448 commit 4244f99
Show file tree
Hide file tree
Showing 55 changed files with 5,313 additions and 924 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
build/
src/version.h
.directory
211 changes: 35 additions & 176 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,77 +1,31 @@
##---------------------------------------------------------------------------
## Author: Dave Register
##***************************************************************************
## * Copyright (C) 2010 by David S. Register *
## * This program is free software; you can redistribute it and/or modify *
## * it under the terms of the GNU General Public License as published by *
## * the Free Software Foundation; either version 2 of the License, or *
## * (at your option) any later version. *
## * *
## * This program is distributed in the hope that it will be useful, *
## * but WITHOUT ANY WARRANTY; without even the implied warranty of *
## * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
## * GNU General Public License for more details. *
## * *
## * You should have received a copy of the GNU General Public License *
## * along with this program; if not, write to the *
## * Free Software Foundation, Inc., *
## * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
## ***************************************************************************

## Author: nohal aka. Pavel Kalian
## Copyright:
## License: wxWidgets License
##---------------------------------------------------------------------------

# define minimum cmake version
CMAKE_MINIMUM_REQUIRED(VERSION 2.6.2)
# This should be 2.8.0 to have FindGTK2 module
IF (COMMAND cmake_policy)
CMAKE_POLICY(SET CMP0003 OLD)
CMAKE_POLICY(SET CMP0005 OLD)
CMAKE_POLICY(SET CMP0011 OLD)
ENDIF (COMMAND cmake_policy)

PROJECT(polar_pi)

SET(PACKAGE_NAME polar_pi)
SET(PLUGIN_SOURCE_DIR .)
MESSAGE (STATUS "*** Staging to build ${PACKAGE_NAME} ***")

#SET(CMAKE_BUILD_TYPE Debug)
#SET(CMAKE_VERBOSE_MAKEFILE ON)

INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/src)

# require proper c++
#ADD_DEFINITIONS( "-Wall -ansi -pedantic -Wno-variadic-macros" )
#TODO: Should we use -fno-stack-protector
# IF NOT DEBUGGING CFLAGS="-O2 -march=native"
IF(NOT WIN32)
ADD_DEFINITIONS( "-Wall -O0 -fexceptions -fvisibility=hidden" )

IF(NOT APPLE)
SET(CMAKE_SHARED_LINKER_FLAGS "-Wl,-Bsymbolic")
ELSE(NOT APPLE)
SET(CMAKE_SHARED_LINKER_FLAGS "-Wl -undefined dynamic_lookup")
ENDIF(NOT APPLE)

ENDIF(NOT WIN32)
SET(VERBOSE_NAME Polar)
SET(TITLE_NAME POLAR)
SET(CPACK_PACKAGE_CONTACT "Peter Tulp")

# 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)
SET(BUNDLE_DATA FALSE)

IF(NOT DEFINED wxWidgets_USE_FILE)
SET(wxWidgets_USE_LIBS base core net xml html adv)
SET(BUILD_SHARED_LIBS TRUE)
FIND_PACKAGE(wxWidgets REQUIRED)
ENDIF(NOT DEFINED wxWidgets_USE_FILE)
INCLUDE( VERSION.cmake )
SET(PLUGIN_VERSION "${PLUGIN_VERSION_MAJOR}.${PLUGIN_VERSION_MINOR}.${PLUGIN_VERSION_PATCH}" )

INCLUDE(${wxWidgets_USE_FILE})
SET(VERSION_MAJOR ${PLUGIN_VERSION_MAJOR})
SET(VERSION_MINOR "${PLUGIN_VERSION_MINOR}${PLUGIN_VERSION_PATCH}")
SET(VERSION_DATE ${PLUGIN_VERSION_DATE})

FIND_PACKAGE(Gettext REQUIRED)

# For convenience we define the sources as a variable. You can add
# header files and cpp/c files and CMake will sort them out
#SET(CMAKE_BUILD_TYPE Debug)

INCLUDE("cmake/PluginConfigure.cmake")

SET(SRC_POLAR
src/polar_pi.h
Expand All @@ -84,14 +38,22 @@ SET(SRC_POLAR
src/Polar.h
src/Polar.cpp
src/icons.h
src/icons.cpp
src/icons.cpp
src/jsonreader.h
src/jsonreader.cpp
src/jsonwriter.h
src/jsonwriter.cpp
src/jsonval.h
src/jsonval.cpp
src/json_defs.h

)
SET(SRC_NMEA0183
SET(SRC_LNMEA0183
src/nmea0183/LatLong.hpp
src/nmea0183/latlong.cpp
src/nmea0183/long.cpp
src/nmea0183/nmea0183.cpp
src/nmea0183/nmea0183.h
src/nmea0183/nmea0183.hpp
src/nmea0183/Response.hpp
src/nmea0183/response.cpp
src/nmea0183/RMB.hpp
Expand Down Expand Up @@ -134,121 +96,18 @@ SET(SRC_NMEA0183
src/nmea0183/vhw.cpp
src/nmea0183/vwr.cpp
src/nmea0183/vwr.hpp
src/nmea0183/vwt.cpp
src/nmea0183/vwt.hpp
src/nmea0183/zda.cpp
src/nmea0183/zda.hpp
src/nmea0183/rsa.hpp
src/nmea0183/rsa.cpp
src/nmea0183/SatInfo.h
)
INCLUDE_DIRECTORIES(src/nmea0183)

SET(SRC_WXJSON
src/wxJSON/jsonreader.h
src/wxJSON/jsonreader.cpp
src/wxJSON/jsonwriter.h
src/wxJSON/jsonwriter.cpp
src/wxJSON/jsonval.h
src/wxJSON/jsonval.cpp
src/wxJSON/json_defs.h
)
INCLUDE_DIRECTORIES(src/wxJSON)

ADD_LIBRARY(${PACKAGE_NAME} SHARED ${SRC_POLAR} ${SRC_NMEA0183} ${SRC_WXJSON} )

IF(WIN32)
SET(OPENCPN_IMPORT_LIB "../../${CMAKE_CFG_INTDIR}/${PARENT}")
TARGET_LINK_LIBRARIES( ${PACKAGE_NAME} LIB_BZIP ${OPENCPN_IMPORT_LIB} )
ADD_DEPENDENCIES(${PACKAGE_NAME} ${PARENT})
ENDIF(WIN32)

TARGET_LINK_LIBRARIES( ${PACKAGE_NAME} ${wxWidgets_LIBRARIES} )

IF(APPLE)
INSTALL(TARGETS ${PACKAGE_NAME} RUNTIME LIBRARY DESTINATION ${CMAKE_BINARY_DIR}/OpenCPN.app/Contents/PlugIns)
ENDIF(APPLE)

IF(UNIX AND NOT APPLE)
IF(NOT DEFINED PREFIX_PLUGINS)
SET(PREFIX_PLUGINS /usr/local/lib/opencpn)
ENDIF(NOT DEFINED PREFIX_PLUGINS)

INSTALL(TARGETS ${PACKAGE_NAME} RUNTIME LIBRARY DESTINATION ${PREFIX_PLUGINS})
ENDIF(UNIX AND NOT APPLE)

IF(WIN32)
INSTALL(TARGETS ${PACKAGE_NAME} RUNTIME DESTINATION "plugins")
ENDIF(WIN32)

# find src/ -name \*.cpp -or -name \*.c -or -name \*.h -or -name \*.hpp >po/POTFILES.in
FIND_PROGRAM(GETTEXT_XGETTEXT_EXECUTABLE xgettext)
IF (GETTEXT_XGETTEXT_EXECUTABLE)
ADD_CUSTOM_COMMAND(
OUTPUT po/${PACKAGE_NAME}.pot.dummy
COMMAND ${GETTEXT_XGETTEXT_EXECUTABLE} --force-po --package-name=${PACKAGE_NAME} --package-version="${PACKAGE_VERSION}" --output=po/${PACKAGE_NAME}.pot --keyword=_ --width=80 --files-from=${CMAKE_CURRENT_SOURCE_DIR}/po/POTFILES.in
DEPENDS po/POTFILES.in po/${PACKAGE_NAME}.pot
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "polar-pot-update [${PACKAGE_NAME}]: Generated pot file."
)
ADD_CUSTOM_TARGET(polar-pot-update COMMENT "polar-pot-update: Done." DEPENDS po/${PACKAGE_NAME}.pot.dummy)

ENDIF(GETTEXT_XGETTEXT_EXECUTABLE )

MACRO(GETTEXT_UPDATE_PO _potFile)
SET(_poFiles ${_potFile})
GET_FILENAME_COMPONENT(_absPotFile ${_potFile} ABSOLUTE)

FOREACH (_currentPoFile ${ARGN})
GET_FILENAME_COMPONENT(_absFile ${_currentPoFile} ABSOLUTE)
GET_FILENAME_COMPONENT(_poBasename ${_absFile} NAME_WE)

ADD_CUSTOM_COMMAND(
OUTPUT ${_absFile}.dummy
COMMAND ${GETTEXT_MSGMERGE_EXECUTABLE} --width=80 --strict --quiet --update --backup=none --no-location -s ${_absFile} ${_absPotFile}
DEPENDS ${_absPotFile} ${_absFile}
COMMENT "polar-po-update [${_poBasename}]: Updated po file."
)

SET(_poFiles ${_poFiles} ${_absFile}.dummy)

ENDFOREACH (_currentPoFile )

ADD_CUSTOM_TARGET(polar-po-update COMMENT "polar-po-update: Done." DEPENDS ${_poFiles})
ENDMACRO(GETTEXT_UPDATE_PO)

IF (GETTEXT_MSGMERGE_EXECUTABLE)
FILE(GLOB PACKAGE_PO_FILES po/*.po)
GETTEXT_UPDATE_PO(po/${PACKAGE_NAME}.pot ${PACKAGE_PO_FILES})
ENDIF(GETTEXT_MSGMERGE_EXECUTABLE)

SET(_gmoFiles)
MACRO(GETTEXT_BUILD_MO)
FOREACH (_poFile ${ARGN})
GET_FILENAME_COMPONENT(_absFile ${_poFile} ABSOLUTE)
GET_FILENAME_COMPONENT(_poBasename ${_absFile} NAME_WE)
SET(_gmoFile ${CMAKE_CURRENT_BINARY_DIR}/${_poBasename}.mo)

ADD_CUSTOM_COMMAND(
OUTPUT ${_gmoFile}
COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} --check -o ${_gmoFile} ${_absFile}
DEPENDS ${_absFile}
COMMENT "polar-i18n [${_poBasename}]: Created mo file."
)

IF(APPLE)
INSTALL(FILES ${_gmoFile} DESTINATION ${CMAKE_INSTALL_PREFIX}/bin/OpenCPN.app/Contents/Resources/${_poBasename}.lproj RENAME opencpn-${PACKAGE_NAME}.mo )
ELSE(APPLE)
INSTALL(FILES ${_gmoFile} DESTINATION ${PREFIX_DATA}/locale/${_poBasename}/LC_MESSAGES RENAME opencpn-${PACKAGE_NAME}.mo )
ENDIF(APPLE)

SET(_gmoFiles ${_gmoFiles} ${_gmoFile})
ENDFOREACH (_poFile )
ENDMACRO(GETTEXT_BUILD_MO)

if(GETTEXT_MSGFMT_EXECUTABLE)
FILE(GLOB PACKAGE_PO_FILES po/*.po)
GETTEXT_BUILD_MO(${PACKAGE_PO_FILES})
ADD_CUSTOM_TARGET(polar-i18n COMMENT "polar-i18n: Done." DEPENDS ${_gmoFiles})
#ADD_DEPENDENCIES(polar-i18n ${PACKAGE_PO_FILES})
ADD_DEPENDENCIES(${PACKAGE_NAME} polar-i18n)
ENDIF(GETTEXT_MSGFMT_EXECUTABLE)
)
ADD_DEFINITIONS(-DTIXML_USE_STL)
ADD_LIBRARY(${PACKAGE_NAME} SHARED ${SRC_POLAR} ${SRC_LNMEA0183})

INCLUDE("cmake/PluginInstall.cmake")
INCLUDE("cmake/PluginLocalization.cmake")
INCLUDE("cmake/PluginPackage.cmake")
Loading

0 comments on commit 4244f99

Please sign in to comment.