Cruisers Forum
 


Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
Old 27-02-2017, 16:56   #556
Registered User

Join Date: Feb 2017
Location: Vancouver, BC, Canada
Posts: 1
Re: Developer Manual - Compiling Windows

Quote:
Originally Posted by rgleason View Post

Hi,

I'm new to OpenCPN and trying to evaluate it as a base platform for developing AUV (Autonomous Underwater Vehicle) mission planning software. I've downloaded the binary (4.4.0 for Windows) and so far it's looking quite good. Now, I'd like to try compiling it, but I'm a bit daunted by the compile instructions. Before I go too far, I have MS Visual Studio Community 2015 and GitHub Desktop 3.3.4.0 in a Win7 Pro SP1 environment. Does anyone have updated instructions that more closely resemble the environment I currently have?

Thanks in advance, Tristan.
tcrees is offline   Reply With Quote
Old 27-02-2017, 20:32   #557
Registered User
 
rgleason's Avatar

Join Date: Mar 2012
Location: Boston, MA
Boat: 1981 Bristol 32 Sloop
Posts: 17,494
Images: 2
Re: Development Debugging Environment - Setup Help

You won't find much like Opencpn that is as integrated and open source.
Keeping users with older machines going is part of the effort as we all pitch in here.
Also major shifts interupt development, so you are best off setting up the Environment we suggest as others are not supported. Although some will move forward on wxWidgets and I do know of several with Vs of a later date, but inevitably they find some hurdles.

----
I think you should PM Bdbcat perhaps and tell him about your interest. I think Opencpn would be a good fit.
rgleason is offline   Reply With Quote
Old 27-02-2017, 23:09   #558
Registered User

Join Date: Nov 2012
Location: Orust Sweden
Boat: Najad 34
Posts: 4,112
Re: Development Debugging Environment - Setup Help

Quote:
Originally Posted by rgleason View Post
Hakan at line 308 I don't see anything like this!
looking in Pluginmanager.cpp C:\..\GitHub\OpenCPN\src
Searches don't turn anything up.
Around row 308 you'll find: m_plugin_location = plugin_dir;
That's where I've added my #If _DEBUG -code. i.e. when in debug mode don't look in plugin_dir but somewhere else you've to specify.

When Pavel first learned us how to do he pointed to where Dashboard debug resides and I copied also other plugins to that. Now I'm a bit lazy so I made it automated.
but a simple way would be to:
Code:
   #if _DEBUG    //Has for debug use

        m_plugin_location = "C:\\Builds\\OCPN\\OpenCPN\\build\\plugins\\dashboard_pi\\Debug"

    #else
        m_plugin_location = plugin_dir;
    #endif
And Has is my signature, nothing else )
Håkan
Hakan is offline   Reply With Quote
Old 28-02-2017, 07:21   #559
Registered User
 
rgleason's Avatar

Join Date: Mar 2012
Location: Boston, MA
Boat: 1981 Bristol 32 Sloop
Posts: 17,494
Images: 2
Re: Development Debugging Environment - Setup Help

Thanks Hakan, it's for configuration convenience, so we don't have to copy the debug.dll version back up two directories.

Now I get it. Nice idea.
rgleason is offline   Reply With Quote
Old 01-03-2017, 10:50   #560
Registered User
 
transmitterdan's Avatar

Join Date: Oct 2011
Boat: Valiant 42
Posts: 6,008
Re: Developer Manual - Compiling Windows

Quote:
Originally Posted by tcrees View Post
Hi,



I'm new to OpenCPN and trying to evaluate it as a base platform for developing AUV (Autonomous Underwater Vehicle) mission planning software. I've downloaded the binary (4.4.0 for Windows) and so far it's looking quite good. Now, I'd like to try compiling it, but I'm a bit daunted by the compile instructions. Before I go too far, I have MS Visual Studio Community 2015 and GitHub Desktop 3.3.4.0 in a Win7 Pro SP1 environment. Does anyone have updated instructions that more closely resemble the environment I currently have?



Thanks in advance, Tristan.


Tristan,

I have OpenCPN building with VS2015 community edition. I am traveling right now but when I get off airplanes I can help you compile OpenCPN with VS2015.

For now follow all instructions on the web site about installing wxWidgets, PO Edit and all other prerequisites. Compiling with VS2015 is not too hard. But you need all the other tools such as Cmake and git installed first.
transmitterdan is offline   Reply With Quote
Old 04-03-2017, 17:29   #561
Registered User
 
rgleason's Avatar

Join Date: Mar 2012
Location: Boston, MA
Boat: 1981 Bristol 32 Sloop
Posts: 17,494
Images: 2
Re: Development Debugging Environment - Setup Help

Hakan the README says
portaudio.lib
portaudio.dll
pvw32Con.exe

I got it compiling in standalone quite well with those, but when I try to git clone to and Opencpn inline source\plugins and do it just exactly the same as the 4 internal files, it does not work!

IE having just the NSIS.template.in in the source\plugins\name_pi\buildwin
and putting all the necessary dlls and required binaries in source\buildwin

which is exactly how chartdldr, grib, wmm and dashboard do it.

There must be lines in the CMakeFile.txt that are missing????
Does anyone have a clue which ones or am I going to have to compare two of those files, one an internal and one that does not work?

I believe they should compile standalone and inline for debugging purposes.
I am going to try to use one of Pavel's cmake as a model, if nobody "knows" what is missing.

Any help would be appreciated. Thanks.
rgleason is offline   Reply With Quote
Old 04-03-2017, 23:10   #562
Registered User
 
transmitterdan's Avatar

Join Date: Oct 2011
Boat: Valiant 42
Posts: 6,008
Re: Development Debugging Environment - Setup Help

This is what I did to build OpenCPN with VS2015:

Code:
Steps to build Opencpn V4.5 with VS2015

1) wxWidgets V3.0.2 needs some work to build with VS2015

a) Edit C:\wxWidgets-3.0.2\include\wx\compiler.h around line 55 insert 2 new lines for new VC compiler (see below):

#elif __VISUALC__ < 1900
#   define __VISUALC12__
#elif __VISUALC__ < 2000
#   define __VISUALC14__
#else
#   pragma message("Please update wx/compiler.h to recognize this VC++ version")

b) Edit C:\wxWidgets-3.0.2\include\msvc\wx\setup.h around line 66 insert 2 new lines for new VC compiler (see below):

    #elif _MSC_VER == 1800
        #define wxCOMPILER_PREFIX vc120
    #elif _MSC_VER == 1900
        #define wxCOMPILER_PREFIX vc140
    #else
        #error "Unknown MSVC compiler version, please report to wx-dev."
    #endif

2) Build new wxWidgets DLLs both debug and release using VS2015 IDE (not nmake) as follows:

a) Start VS2015 from start menu
b) Open c:\wxWidgets-3.0.2\build\msw\wx_vc12.sln and let VS convert to VS2015 format.
c) Save as c:\wxWidgets-3.0.2\build\msw\wx_vc14.sln but do not exit VS.
d) On the tool bar select DLL Debug from the drop down list of configurations.
e) For each of the projects in Solution Explorer and press Alt-Enter to open properties page
    Select configuration DLL Debug from drop down configuration list
    Under General->Platform Toolset select Visual Studio 2015 - Windows XP (v140_xp)
    Under Linker->System select /SUBSYSTEM:Windows
    Click Apply
    When all targets are configured then click File Save button
f) Rebuild Solution from the Build menu
g) Select DLL Release from the drop down list of configurations.
h) Select all 24 projects in Solution Explorer and press Alt-Enter to open properties page
    Select configuration DLL Release from drop down configuration list
    Under General->Platform Toolset select Visual Studio 2015 - Windows XP (v140_xp)
    Under Linker->System select /SUBSYSTEM:Windows
    Click Apply
    When all targets are configured then click File Save button
i) Rebuild Solution from the Build menu

3) Be sure that the environment variable WXDIR points to C:\wxWidgets-3.0.2 or the folder where you have built wxWidgets.

4) Run config.bat in the OpenCPN\build folder.

5) Open opencpn.sln in VS 2015. Set opencpn as the startup project. Be sure that all targets in the solution utilize the option "Visual Studio 2015 - Windows XP (v140_xp)" as the Platform Toolset for both debug and release.

6) Run dbbuild.bat to build a debug version of OpenCPN.

7) Start OpenCPN in debug mode by clicking "Local Windows Debugger" in VS2015 (be sure you have selected Debug Win32 configuration from the drop downs).
This is config.bat:

Code:
del CMakeCache.txt
cmake -Wno-dev -G "Visual Studio 14 2015" -T v140_xp ..

mkdir .\plugins\wmm_pi\data

xcopy /Y /Q /H /E /K /I ..\plugins\wmm_pi\data\*.* .\plugins\wmm_pi\data

xcopy /Y /Q /H /E /K /I ..\data\gshhs\*.* .\gshhs
xcopy /Y /Q /H /E /K /I ..\data\styles\*.* .\uidata
xcopy /Y /Q /H /E /K /I ..\data\s57data\*.* .\s57data
xcopy /Y /Q /H /E /K /I ..\data\sounds\*.* .\sounds
xcopy /Y /Q /H /E /K /I ..\data\tcdata\*.* .\tcdata
xcopy /Y /Q /H /E /K /I ..\data\wvsdata\*.* .\wvsdata
xcopy /Y /Q /H /E /K /I ..\data\license.txt .\
xcopy /Y /Q /H /E /K /I ..\data\doc\*.* .\doc

xcopy /Y /Q ..\src\bitmaps\styles.xml .\uidata
xcopy /Y /Q ..\src\bitmaps\toolicons_traditional.png .\uidata
xcopy /Y /Q ..\src\bitmaps\toolicons_journeyman.png .\uidata
xcopy /Y /Q ..\src\bitmaps\toolicons_journeyman_flat.png .\uidata

mkdir release
cd release
mkdir uidata
cd ..

xcopy /Y /Q ..\src\bitmaps\styles.xml .\release\uidata

xcopy /Y /Q /H /E /K /I ..\buildwin\*.dll .\release
xcopy /Y /Q /H /E /K /I %WXDIR%\lib\vc_dll\*u_*.dll .\release\wxWidgets
xcopy /Y /Q /H /E /K /I ..\data\gshhs\*.* .\release\gshhs
xcopy /Y /Q /H /E /K /I ..\data\styles\*.* .\release\uidata
xcopy /Y /Q /H /E /K /I ..\data\s57data\*.* .\release\s57data
xcopy /Y /Q /H /E /K /I ..\data\sounds\*.* .\release\sounds
xcopy /Y /Q /H /E /K /I ..\data\tcdata\*.* .\release\tcdata
xcopy /Y /Q /H /E /K /I ..\data\wvsdata\*.* .\release\wvsdata
xcopy /Y /Q /H /E /K /I ..\data\license.txt .\release
xcopy /Y /Q /H /E /K /I ..\data\doc\*.* .\release\doc
xcopy /Y /Q /H /E /K /I ..\buildwin\crashrpt\CrashRpt1403.dll .\release
xcopy /Y /Q /H /E /K /I ..\buildwin\crashrpt\CrashSender1403.exe .\release
xcopy /Y /Q /H /E /K /I ..\buildwin\crashrpt\crashrpt_lang.ini .\release
xcopy /Y /Q /H /E /K /I ..\buildwin\crashrpt\dbghelp.dll .\release

xcopy /Y /Q /H /E /K /I ..\buildwin\*.dll .\debug
xcopy /Y /Q /H /E /K /I %WXDIR%\lib\vc_dll\*ud_*.dll .\debug\wxWidgets

xcopy /Y /Q /H /E /K /I ..\buildwin\*.crt .


xcopy /Y /Q ..\src\bitmaps\toolicons_traditional.png .\Release\uidata
xcopy /Y /Q ..\src\bitmaps\toolicons_journeyman.png .\Release\uidata
xcopy /Y /Q ..\src\bitmaps\toolicons_journeyman_flat.png .\Release\uidata
This is dbbuild.bat:

Code:
@echo off
cmake --build . --config debug
if %ERRORLEVEL% GTR 0 goto quit
call dbcopy.bat
exit /b 0
:quit
echo "Build Failed"
exit /b 1
This is dbcopy.bat:

Code:
@echo off
@echo "Copying gtk dlls."
copy /Y /V .\debug\gtk\cairo.dll .\debug
copy /Y /V .\debug\gtk\fontconfig.dll .\debug
copy /Y /V .\debug\gtk\pixman-1.dll .\debug
copy /Y /V .\debug\gtk\libpng16.dll .\debug
copy /Y /V .\debug\gtk\libxml2.dll .\debug
copy /Y /V .\debug\gtk\iconv.dll .\debug
copy /Y /V .\debug\expat-2.1.0\*.dll .\debug
@echo "Copying expat dlls."
copy /Y /V .\debug\expat-2.1.0\expat.dll .\debug
@echo "Copying chartdldr_pi.dll to .\plugins"
copy /Y /V .\plugins\chartdldr_pi\Debug\chartdldr_pi.dll .\plugins
@echo "Copying grib_pi.dll to .\plugins"
copy /Y /V .\plugins\grib_pi\Debug\grib_pi.dll .\plugins
@echo "Copying dashboard_pi.dll to .\plugins"
copy /Y /V .\plugins\dashboard_pi\Debug\dashboard_pi.dll .\plugins
@echo "Copying wmm_pi.dll to .\plugins"
copy /Y /V .\plugins\wmm_pi\Debug\wmm_pi.dll .\plugins
if not exist .\plugins\gecomapi_pi\Debug\gecomapi_pi.dll goto vdr_pi
@echo "Copying gecomapi_pi.dll to .\plugins"
copy /Y /V .\plugins\gecomapi_pi\Debug\gecomapi_pi.dll .\plugins
:vdr_pi
if not exist .\plugins\vdr_pi\Debug\vdr_pi.dll goto NmeaConverter_pi
@echo "Copying vdr_pi.dll to .\plugins"
copy /Y .\plugins\vdr_pi\Debug\vdr_pi.dll .\plugins
:NmeaConverter_pi
if not exist .\plugins\NmeaConverter_pi\Debug\NmeaConverter_pi.dll goto endcopy
@echo "Copying NmeaConverter_pi.dll to .\plugins"
copy /Y .\plugins\NmeaConverter_pi\Debug\NmeaConverter_pi.dll .\plugins
:endcopy
exit /b 0
Some screen shots of the configuration screen for wxWidgets in VS2015:
Attached Thumbnails
Click image for larger version

Name:	2017-03-05 (2).png
Views:	97
Size:	80.0 KB
ID:	142493   Click image for larger version

Name:	2017-03-05 (1).png
Views:	74
Size:	70.9 KB
ID:	142494  

transmitterdan is offline   Reply With Quote
Old 04-03-2017, 23:25   #563
Registered User
 
transmitterdan's Avatar

Join Date: Oct 2011
Boat: Valiant 42
Posts: 6,008
Re: Development Debugging Environment - Setup Help

FYI for people building plugins you can create a link to the plugin thus you don't have to disturb the actual plugins folder. Something like this should work:

cd OpenCPN\plugins
mklink /D vdr_pi c:\myplugins\vdr_pi

At this point Cmake will see OpenCPN\plugins\vdr_pi as a folder and it will configure the plugin for building. Git will ignore OpenCPN\plugins\vdr_pi however.

Then you should be able to build either from \myplugins\vdr_pi or you can build from within the overall OpenCPN build.

To get rid of the link but not the plugin folder itself:

cd OpenCPN\plugins
rmdir vdr_pi
transmitterdan is offline   Reply With Quote
Old 05-03-2017, 02:03   #564
Registered User
 
rgleason's Avatar

Join Date: Mar 2012
Location: Boston, MA
Boat: 1981 Bristol 32 Sloop
Posts: 17,494
Images: 2
Re: Development Debugging Environment - Setup Help

TDan between that link suggestion and Hakan's there are many options now, but I think I like the link better. Why is that better though?
rgleason is offline   Reply With Quote
Old 05-03-2017, 02:09   #565
Registered User
 
rgleason's Avatar

Join Date: Mar 2012
Location: Boston, MA
Boat: 1981 Bristol 32 Sloop
Posts: 17,494
Images: 2
Re: Development Debugging Environment - Setup Help

1 less confusion, everything stays the same standalone pi and opencpn debuging.
2 control of link from one place.
3. Less copy of files and keeping opencpn MSVS pristine w/o pi stuff.
4 For debug a pi just copy dll and name_pi dir to source/build/plugins

Yes I like it very much! Thankyou
rgleason is offline   Reply With Quote
Old 05-03-2017, 03:54   #566
Registered User
 
rgleason's Avatar

Join Date: Mar 2012
Location: Boston, MA
Boat: 1981 Bristol 32 Sloop
Posts: 17,494
Images: 2
Re: Development Debugging Environment - Setup Help

Upon reflection, the

cd OpenCPN\plugins
mklink /D vdr_pi c:\myplugins\vdr_pi

will be great for debugging, but as Pavel has written, a unified environment is best for programming. So it would be nice to get the plugins working inline with OpenCPN.
rgleason is offline   Reply With Quote
Old 05-03-2017, 08:16   #567
Registered User
 
transmitterdan's Avatar

Join Date: Oct 2011
Boat: Valiant 42
Posts: 6,008
Re: Development Debugging Environment - Setup Help

The link is the same as being inline with OpenCPN.

One correction: Git does see the link and shows it as an untracked folder which is ok as far as I can tell.
transmitterdan is offline   Reply With Quote
Old 05-03-2017, 10:17   #568
Registered User
 
rgleason's Avatar

Join Date: Mar 2012
Location: Boston, MA
Boat: 1981 Bristol 32 Sloop
Posts: 17,494
Images: 2
Re: Development Debugging Environment - Setup Help

Yes, I have many of those errors, due to a separate sub directory with all the standalone plugins, and I just git clone from the command line etc.
rgleason is offline   Reply With Quote
Old 29-09-2017, 06:49   #569
Registered User
 
rgleason's Avatar

Join Date: Mar 2012
Location: Boston, MA
Boat: 1981 Bristol 32 Sloop
Posts: 17,494
Images: 2
Meaning of CMAKE notices?

From CMAKE GUI I recently tried to check a configuration and got this type of notice:

Quote:
CMake Warning at CMakeLists.txt:1640 (ADD_EXECUTABLE):
Cannot generate a safe linker search path for target opencpn because there
is a cycle in the constraint graph:

dir 0 is [C:/Users/Rick/Documents/GitHub/OpenCPN/build/Debug]
dir 1 must precede it due to link library [CrashRpt1403.lib]
dir 2 must precede it due to link library [libcurl.lib]
dir 5 must precede it due to link library [cairo.lib]
dir 6 must precede it due to link library [expat.lib]
dir 1 is [C:/Users/Rick/Documents/GitHub/OpenCPN/buildwin/crashrpt]
dir 2 is [C:/Users/Rick/Documents/GitHub/OpenCPN/buildwin]
dir 5 must precede it due to link library [cairo.lib]
dir 6 must precede it due to link library [expat.lib]
dir 3 is [C:/wxWidgets-3.0.2/lib/vc_dll]
dir 4 is [C:/Users/Rick/Documents/GitHub/OpenCPN/build/lib/Debug]
dir 5 is [C:/Users/Rick/Documents/GitHub/OpenCPN/buildwin/gtk]
dir 6 is [C:/Users/Rick/Documents/GitHub/OpenCPN/buildwin/expat-2.1.0]

Some of these libraries may not be found correctly.
There are similar notices for each of the internal plugins.

Please see the attached file for the full text. Is this a problem? I want it to compile and work properly!!!
Why are these notices there?
Attached Files
File Type: doc Cmake3.2.2 Gui .txt.doc (14.3 KB, 33 views)
rgleason is offline   Reply With Quote
Old 29-09-2017, 09:28   #570
Registered User
 
transmitterdan's Avatar

Join Date: Oct 2011
Boat: Valiant 42
Posts: 6,008
Re: Development Debugging Environment - Setup Help

Are you using the most recent version of Cmake?

Cmake is too smart for its own good sometimes.
transmitterdan is offline   Reply With Quote
Reply

Tags
environment

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Advertise Here


All times are GMT -7. The time now is 02:56.


Google+
Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Social Knowledge Networks
Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2024, vBulletin Solutions, Inc.

ShowCase vBulletin Plugins by Drive Thru Online, Inc.