From 7e65f2ddecfed66184003d4178901d87e11382dc Mon Sep 17 00:00:00 2001 From: Rasbats Date: Sun, 17 May 2020 10:55:51 +0100 Subject: [PATCH] Add compiler switch for managed plugin --- .travis.yml | 77 --------------------------------------------- CMakeLists.txt | 7 +++++ appveyor.yml | 63 ------------------------------------- src/ShipDriver_pi.h | 1 - src/icons.cpp | 25 ++++++++++++--- 5 files changed, 28 insertions(+), 145 deletions(-) delete mode 100644 .travis.yml delete mode 100644 appveyor.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index cf8c434d..00000000 --- a/.travis.yml +++ /dev/null @@ -1,77 +0,0 @@ -language: cpp - -matrix: - include: - - dist: trusty - compiler: gcc - - os: osx - compiler: clang - -install: - - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; - then - sudo apt-get -qq update; - sudo apt-get install libwxgtk3.0-dev libwxgtk3.0-0 libgps-dev libglu1-mesa-dev libgtk2.0-dev libbz2-dev libtinyxml-dev; - sudo apt-get install libexpat1-dev libcairo2-dev; - sudo apt-get install rpm; - fi - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; - then - brew install cairo libexif xz libarchive; - wget http://opencpn.navnux.org/build_deps/wx312_opencpn50_macos109.tar.xz; - tar xJf wx312_opencpn50_macos109.tar.xz -C /tmp; - export PATH="/usr/local/opt/gettext/bin:$PATH"; - echo 'export PATH="/usr/local/opt/gettext/bin:$PATH"' >> ~/.bash_profile; - wget http://opencpn.navnux.org/build_deps/Packages.dmg; - hdiutil attach Packages.dmg; - sudo installer -pkg "/Volumes/Packages 1.2.5/Install Packages.pkg" -target "/"; - fi - -script: - - if [[ "${COVERITY_SCAN_BRANCH}" == 1 ]]; - then - echo "Don't build on coverty_scan branch."; - exit 0; - fi - - mkdir build && cd build - - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; - then - cmake -DCMAKE_BUILD_TYPE=Release ../; - make -sj2 package; - fi - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; - then - cmake -DwxWidgets_CONFIG_EXECUTABLE=/tmp/wx312_opencpn50_macos109/bin/wx-config -DwxWidgets_CONFIG_OPTIONS="--prefix=/tmp/wx312_opencpn50_macos109" -DCMAKE_INSTALL_PREFIX=/tmp/opencpn -DCMAKE_OSX_DEPLOYMENT_TARGET=10.9 ..; - make -sj2; - make create-pkg; - ls -l; - fi - -notifications: - email: false - -git: - depth: 10 - -before_install: - - if [ "$CXX" = "g++" ]; then export CXX="g++-6" CC="gcc-6"; fi -addons: - apt: - sources: - - ubuntu-toolchain-r-test - packages: - - gcc-6 - - g++-6 - -# Set encrypted variable 'GitHub_auth_token' in Travis repo settings to deploy packages -# for tagged commits to GitHub Releases. -deploy: -- provider: releases - api_key: $TRAVIS_TOKEN - file_glob: true - file: $TRAVIS_BUILD_DIR/build/*.{deb,rpm,dmg,txz,pkg.tar.xz} - skip_cleanup: true - draft: true - on: - branch: master - diff --git a/CMakeLists.txt b/CMakeLists.txt index b0e0cbc2..e440bd3d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,6 +30,9 @@ SET( wxWidgets_USE_STATIC OFF) OPTION(SHIPDRIVER_USE_SVG "Use SVG graphics" ON) +# For OpenCPN version 5.x, NOT 5.0 ON. For version 5.0 OFF +OPTION(MANAGED_PLUGIN "Use managed plugin" OFF) + INCLUDE("cmake/PluginConfigure.cmake") INCLUDE("cmake/PluginJSON.cmake") @@ -38,6 +41,10 @@ IF(SHIPDRIVER_USE_SVG) ADD_DEFINITIONS(-DSHIPDRIVER_USE_SVG) ENDIF(SHIPDRIVER_USE_SVG) +IF(MANAGED_PLUGIN) +ADD_DEFINITIONS(-DMANAGED_PLUGIN) +ENDIF(MANAGED_PLUGIN) + include(CheckCXXCompilerFlag) check_cxx_compiler_flag(-std=c++11 HAS_STD_CPP11_FLAG) if(HAS_STD_CPP11_FLAG) diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index b0d95419..00000000 --- a/appveyor.yml +++ /dev/null @@ -1,63 +0,0 @@ -clone_folder: c:\project\shipdriver_pi -shallow_clone: true -image: -- Visual Studio 2017 - -platform: -# - x64 -- Win32 - -configuration: Release -test: OFF - -install: - - call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars32.bat" - - # sent environment variables for wxWidgets - - set WXWIN=C:\wxWidgets-3.1.2 - - set wxWidgets_ROOT_DIR=%WXWIN% - - set wxWidgets_LIB_DIR=%WXWIN%\lib\vc_dll - - cmd: SET PATH=%PATH%;%WXWIN%;%wxWidgets_LIB_DIR%;C:\Program Files (x86)\Poedit\Gettexttools\bin; - - # install dependencies: - - choco install poedit - - - ps: Start-FileDownload http://opencpn.navnux.org/build_deps/nsis-3.04-setup.exe - - cmd: nsis-3.04-setup.exe /S - - # Download and unzip wxwidgets - - ps: Start-FileDownload http://opencpn.navnux.org/build_deps/wxWidgets-3.1.2.7z - - cmd: 7z x wxWidgets-3.1.2.7z -o%WXWIN% > null - - - set - -before_build: - - cd c:\project\shipdriver_pi - - cd buildwin - - ps: Start-FileDownload https://downloads.sourceforge.net/project/opencpnplugins/opencpn_packaging_data/PVW32Con.exe - - cd .. - - mkdir build - - cd build - - ps: Start-FileDownload https://downloads.sourceforge.net/project/opencpnplugins/opencpn_lib/4.99.1405-vc141_xp/opencpn.lib - - ps: Start-FileDownload http://opencpn.navnux.org/build_deps/OpenCPN_buildwin-4.99a.7z - - cmd: 7z x -y OpenCPN_buildwin-4.99a.7z -oc:\project\shipdriver_pi\buildwin - - cmake -T v141_xp .. - -build_script: - # - cmake --build . --config debug - - cmake --build . --target package --config release - -artifacts: - - path: 'build\*.exe' - name: installer - -deploy: - description: 'release created by AppVeyor CI' - provider: GitHub - auth_token: - secure: W2+Lk6mSi+8zfKLC4zQ6Bvk5U6DJTCiJwV7zPPxV5ItDQC49XgWqRIIAimu3a92i - artifact: installer - draft: true - prerelease: true - on: - configuration: Release # Debug contains non-redist MS DLLs diff --git a/src/ShipDriver_pi.h b/src/ShipDriver_pi.h index e2bb6e06..33abe7ed 100644 --- a/src/ShipDriver_pi.h +++ b/src/ShipDriver_pi.h @@ -147,7 +147,6 @@ class ShipDriver_pi : public opencpn_plugin_16 wxString StandardPath(); - private: double m_cursor_lat; diff --git a/src/icons.cpp b/src/icons.cpp index 2b5db5e4..919f9acf 100644 --- a/src/icons.cpp +++ b/src/icons.cpp @@ -8,6 +8,8 @@ #include "icons.h" wxBitmap *_img_ShipDriverIcon; +bool m_managedPlugin; + #ifdef SHIPDRIVER_USE_SVG #include "ocpn_plugin.h" @@ -22,12 +24,27 @@ void initialize_images(void) _img_ShipDriverIcon = new wxBitmap(wxImage(sm)); } +#ifdef MANAGED_PLUGIN + m_managedPlugin = true; +#else + m_managedPlugin = false; +#endif + #ifdef SHIPDRIVER_USE_SVG wxFileName fn; - char * pName = "ShipDriver_pi"; - wxString tmp_path = GetPluginDataDir(pName); - fn.SetPath(tmp_path); - fn.AppendDir(_T("data")); + wxString tmp_path; + if (m_managedPlugin) { + tmp_path = GetPluginDataDir("shipdriver_pi"); + fn.SetPath(tmp_path); + fn.AppendDir(_T("data")); + } + else { + fn.SetPath(*GetpSharedDataLocation()); + fn.AppendDir(_T("plugins")); + fn.AppendDir(_T("shipdriver_pi")); + fn.AppendDir(_T("data")); + } + fn.SetFullName(_T("shipdriver_pi.svg")); _svg_shipdriver = fn.GetFullPath(); fn.SetFullName(_T("shipdriver_pi_toggled.svg"));