Configure Testplugin Template
-
Plugin: Testplugin_pi
-
Author: Jon Gough
-
CI-CMake Template v1.0.160
Features
-
Fully functional plugin
-
Uses OCPN interfaces and demonstrates how to use the ocpn_draw_pi API, JSON & Binary versions.
-
Continuous Integration and CMake package.
-
Guidance for the automated build process.
-
Cmake, CMakeLists.txt and scripts that are needed to compile the environments.
-
Encapsulates the complexities of multi environment builds and deploys.
-
Makes it easier to build and deliver plugins.
-
Plugin changes are made in CMakeLists.txt.
-
No need to modify the other build files.
-
Delivered to OpenCPN Plugin Management User Interface using metadata files
-
Via OpenCPN Container Project for an Integrated Plugin Management Facility
-
Found at https://github.com/opencpn/plugins
Goal
Assist plugin developers to convert their plugins to the Plugin Manager system which:
-
Uses tarballs and metadata.xml files to store the necessary information.
-
Deploys directly to Cloudsmith repositories (or another location)
-
Online Files are accessed by OpenCPN Plugin Manager using "Library Catalog" (metadata.xml)
-
Plugins are installed from within OpenCPN Options > Plugins
-
User selects a Plugin to download, install or enable from an updated Catalog.
The template configuration is found in https://github.com/jongough/testplugin_pi.
Rename Existing Directories and Files
Create new working Git branch for your Plugin:
-
Keep your currently working "master" branch intact.
-
Create a new git branch.
-
EG: 'git checkout -b <testplugin-template> master'
-
Work in the new branch <testplugin-template>.
-
Pull new working branch to local.
-
Pull testplugin to local.
-
Make sure both local github repositories are current.
-
Copy original files to a backup:
-
Rename CMakeLists.txt ---→ CMakeLists.txt.bk
-
Rename appveyor.yml ---→ appveyor.save.yml.bk
-
Rename .travis.yml ---→ .travis.save.yml.bk
-
Rename the cmake directory --→ cmake-bk
Keep any other specialized plugin directories or files.
Directories to Remain intact in your Plugin
-
Include
-
Data
-
src
-
po
Any other plugin specific directories.
File Compare Software
-
Use software similar to WinMerge (open source) for File Comparison.
-
Get the two local folders opened and compare each folder.
-
Then follow instructions below.
Copy Files & Folders from Testplugin_pi
Copy full Directories, Sub-dir and Files unless noted replacing any existing folders and files entirely.
-
.circleci
-
ci
-
cmake
-
buildosx
-
buidwin
-
mingw
-
extinclude (Json Validation - only odraw, watchdog, weather_routing)
-
extsrc (Json Validation - only odraw, watchdog, weather_routing) + ocpninclude (only glu directory and TexFont.h
-
ocpnsrc (only GL directory and TexFont.cpp
-
appveyor.yml (file)
-
.travis.yml (file)
Changes Required
-
Backup CMakeLists.txt, appveyor.yml, .travis.yml
-
Modify CMakeLists.txt file, following the in-line notes
-
Modify Plugin Specifics at the top.
-
Plugin name types,
-
CommonName -search "plugin"_pi.cpp for "GetCommon"
-
Version numbers and date
-
Parent, Package and Git User. Git Repository
-
Cloudsmith User
-
Cloudsmith Base Repository (optional)
-
Plugin XML Info_url, Summary and Description
-
-
In the section that also uses your plugins specific code:
-
Modify/configure set(SRCS and HDRS and 'Include' Dir
-
Modify/configure 'Set(SRCS & HDRS' Directories
-
-
Modify/configure 'Add Library' listings for the plugin.
-
Make sure all your necessary libraries are found.
-
-
-
API Number must be at least 1.16 for the new Plugin Manager, due to a change in how directories are found and location.
-
API Names changed from MY_API_VERSION_MAJOR/MINOR to OCPN_API_VERSION_MAJOR/MINOR
-
OCPN_API_VERSION_MAJOR/MINOR is now used in cmake/in-files/version.h.in
-
In [pluginname_pi].cpp
-
Several lines must change from MY_API_VERSION_MAJOR/MINOR to
-
EG: "return OCPN_API_VERSION_MAJOR;"
-
EG: "return OCPN_API_VERSION_MINOR;"
-
-
Find wxString (pluginname_pi)::GetCommonName() and change
-
return _("(pluginname-pi)"); to
-
return _T(PLUGIN_COMMON_NAME);
-
-
-
In the file (plugin_pi).h
-
Several lines must be commented out.
-
// #define MY_API_VERSION_MAJOR 1
-
// #define MY_API_VERSION_MINOR 16
-
or removed.
-
because new values definitions are defined in cmake/in-files/version.h.in
-
-
-
Adapt Plugin
There will be additional changes needed to adapt your plugin to the template. Some of this is related to changes in the API or the ways of handling things. Please see Adapt Plugin for more information that is available about specific changes.
Process
-
Cmake Files are somewhat generic, but often can be plugin specific, depending on the plugin.
-
Review the cmake.save files one by one with the new ones and make necessary adjustments.
-
Configuring this is not simple and requires knowledge about the plugin operation.
Test Build Locally
Note the errors and sequentially fix them one by one until the plugin compiles and builds. The try the plugin in Opencpn and test it. Get everythng working properly.
Get Deployment working
-
Get the uploads to Cloudsmith working.
-
See Prequisite Services and Clousamirh Setup.
-
Also join the OpenCPN Organization as a member of the Plugins Team.
-
EDIT EDIT CHECK THE TEXT BELOW WITH THE ABOVE BELOW IS MORE CURRENT
Posssible Addditions
1. Get setup locally.
-
From local <plugin> master branch git checkout -b master-cmake
-
From remote online github Testplugin repository master branch make a PR from jongough master and merge it.
-
Locally using bash prompt cd documents/github/testplugin_pi then git pull origin master to update
-
Locally in bash cd watchdog_pi make sure you are in master-cmake branch
-
Locally using WinMerge open a comparison between testplugin_pi and watchdog_pi
-
Now you are ready to update frontend2 to be current. copy these folder and files to the plugin from Testplugin_pi
-
Directories & files to copy from Testplugin--→plugin to be identical.
-
Folders identical to testplugin - circleci, buildosx, buildwin, ci, cmake, mingw, extinclude, extsrc
-
Folders for testplugin only (don’t copy) - include, (actually there is one android datectrl.h file)
-
Folders that are different/not exist in watchdog (Different) build, data, src (Not existing) forms, ocpninclude
-
ocpninclude - Many ocpn_draw files. I don’t believe we need this folder.
-
Did the GL folder go to libs/GL?
-
I see that ocpn_plugin.h, msvc/opencpn.lib and mingw/libopencpn.dll.a landed in libs/ocpn-api so I can delete the api-16 directory.
-
Texfont.h is in src/ folder.
-
Don’t see pluginmanager.h anywhere, is it needed?
-
How to instruct other Plugin Devs about the paths for these changes?
-
Watchdog_pi uses ocpn_draw for boundaries.
-
libs (renamed from lib) - copy over all folders leaving existing folders (nmea0183 and bzip2).
-
mingw identical
-
modules for watchdog documentation..
-
ocpninclude -not needed. (Tried copying all files to wd to fix TexFont.cpp issues - it did not fix it)
-
ocpnsrc - copied over, is it needed? Has glu and Texfont.cpp
-
po - different
-
src - different
-
ui -different
-
adding buildandroid back in but it is old from bdbcat build and probably not needed.
-
adding include/android/wx/datectrl.h back in but it is old from bdbcat and probably not needed.
-
Files travis.yml, appveyor.yml should be copied.
-
CMakeLists.txt will vary and should be changed appropriately to build.