1. NEWS ABOUT BOOK DOWNLOAD FORUM LOGIN TRACKER
BOOK NAVIGATION Compiling - Windows
The officially supported Windows build platform for OpenCPN 2.6 beta and later is Microsoft Visual C++ 2010
OpenCPN User Manual Express. It is still possible to perform the build with Visual Studio 2008, but if you want to create installation
Developer Manual packages, expect versioning problems.
Latest Beta Before you begin, update your Windows. If still using XP, Service Pack 3 is needed.
Development
Developer's Guide
Compiling - Linux
Important note before you start
Compiling - Mac OS X The order of the steps described bellow really matters. Don't skip any steps not explicitly marked as
Compiling - Windows optional and don't change their order unless you really know what you are doing. It's an excellent idea to read
Internationalization the whole text first and make sure you understand what it's talking about, especially if you are new to software
Code Formatting development. If you encounter any problems, please get to us in the forum and tell us where you are failing so
we can help you and improve these instructions for the others.
PlugIn API
Troubleshooting
Preparing the toolchain
Vector Palette
User Interface Styling
Bug and Feature VC++ 2010 Express
Tracking Get it http://www.microsoft.com/visualstudio/en-us/products/2010-editions/visua...
OpenCPN Release Run the setup and click through the installation wizard, Silverlight and SQL Server are not needed for OpenCPN,
History so you can save some time and space by not installing them.
After installation, register it (Help->Register Product), otherwise you will have just 30 days to use it.
Supplementary Hardware
If you are on XP or Vista, you can supposedly make VS 2010 run faster: http://news.softpedia.com/news/Speed-
Up-Visual-Studio-2010-on-XP-SP3-and-Vista-SP2-152520.shtml
Service Pack 1
SEARCH It is essential to perform ALL the updates you can, as if you don't install the Visual Studio 2010 Service Pack 1,
you will not be able to convert the WX projects to VS 2010 format. Go to Help menu and select Check for
Updates. It may be necessary to repeat this step.
SOCIAL VC++ 2008 Express Edition
If you don't intend to debug the WX sources, you can skip this step alltogether. If you do, you can still try to
Facebook.com/OpenCPN
skip this step now and get back to it later in case you experience problems converting the WX projects to the
Like 1,932 people like this .
VS2010 format.
Get it from http://www.microsoft.com/visualstudio/en-us/products/2008-editions/express
Run the setup and click through the installation wizard, Silverlight and SQL Server are not needed for OpenCPN,
so you can save some time and space by not installing them
Git for Windows
Get it from http://msysgit.github.com/ (You want Git for Windows. Not MSysGit)
ADS
The defaults for all the installation settings are fine except the following:
* On the „Adjusting your PATH environment“, select „Run Git from the Windows Command Prompt“
* On the „Choosing CR/LF behavior“ select „Commit line endings as they are“
Developers Now
Welcome If you want a tutorial, have a look at the series of articles starting at
Forget Servers. Focus http://www.lostechies.com/blogs/jason_meridth/archive/2009/06/01/git-for...
on Code. CSS. HTML.
LESS. SFTP. GIT.
developers.squarespace.com Cmake
Get it from http://cmake.org/cmake/resources/software.html
Talend Open While installing it's advisable to let the setup program add cmake to the system PATH variable
Source ESB
Easy-to-Use Graphical Gettext
Interface. Try The Free
Install Poedit from http://www.poedit.net/ - it's version of gettext is the best available out there.
ESB Download Now!
www.talend.com/Free_ESB_Software
… Add gettext to your PATH - if you installed Poedit, right-click My Computer, select Properties... and on the
Advanced tab click on Environment Variables button and add C:Program FilesPoeditbin to the PATH system
Introducing Nexus variable
7
Thin, light & portable. NSIS (Unicode)
Made for Google Play . Needed only in case you intend to build the installation package for OpenCPN. Not needed for normal
Buy now for $199
google.com/nexus development.
Get it from http://code.google.com/p/unsis/downloads/list
Windows X P The NSIS Unicode 2.46 setup file is also included in the GIT repository -> ..buildwinNSIS_Unicodensis-2.46-
Service Pack Unicode-setup.exe
Download Windows XP Direct download link: http://code.google.com/p/unsis/downloads/detail?name=nsis-2.46.3-Unicode...
Service Packs. Free PC
World Downloads.
P C World.com/XP -Service-P ack
Download and install it. Due to a "bug" in CMake, which only looks at "HKEY_LOCAL_MACHINESOFTWARENSIS" for
the installation location of NSIS and the Unicode version adds its registry key in
"HKEY_LOCAL_MACHINESOFTWARENSISUnicode", there is some registry tweaking needed.
2012 Grants
2. Grant Funding May Be Just copy the value (it's the installation path) of the "HKEY_LOCAL_MACHINESOFTWARENSISUnicode" key to
Available See If You
Qualify! "HKEY_LOCAL_MACHINESOFTWARENSIS".
www.C lassesUSA.com Alternatively you can just run the batch file 'CopyNSISUnicodeRegKey.bat' which is also included in the GIT
repository -> ..buildwinNSIS_UnicodeCopyNSISUnicodeRegKey.bat
This means if you also want to use the ANSI NSIS version you first have to change the value of
"HKEY_LOCAL_MACHINESOFTWARENSIS" registry key according to the installation path of the respective version
you want to use.
To make the installer package use proper language name transaltions, it's necessary to modify file X:Program
FilesNSISUnicodeContribLanguage filesNorwegian.nsh and change the line
!insertmacro LANGFILE "Norwegian" "Norwegian"
to
!insertmacro LANGFILE "Norwegian" "Norsk"
Pre-requisities
WxWidgets
Download from wxMSW-2.8.12-Setup.exe from http://www.wxwidgets.org/downloads/#latest_stable and install it
Necessary modifications
Go to the folder where you installed/unpacked wxWidgets and edit the file includewxmswsetup.h
Set:
#define wxUSE_GRAPHICS_CONTEXT 1
#define wxUSE_GLCANVAS 1
Compile wxWidgets alternative 1: From command line (recomended and faster)
Start up your Visual Studio 2010 Command Prompt and navigate to
cd C:${WXDIR}buildmsw
Then compile using the makefile with the following command :
nmake -f makefile.vc BUILD=release MONOLITHIC=0 SHARED=1 UNICODE=1 USE_GDIPLUS=1 USE_OPENGL=1
If you want to fully debug OpenCPN, build the wxWidgets debug dlls also.
nmake -f makefile.vc BUILD=debug MONOLITHIC=0 SHARED=1 UNICODE=1 USE_GDIPLUS=1 USE_OPENGL=1
Compile wxWidgets alternative 2: From Visual Studio IDE (optional)
If you want to later build and debug wxWidgets itself using the Visual Studio IDE, open
C:${WXDIR}buildmswconfig.vc and change the line saying "UNICODE = 0" to UNICODE = 1
Convert the solution to VC++ 2010 format
Open C:${WXDIR}buildmswwx_dll.dsw and answer Yes to all the project conversion questions.
Save the solution (Ctrl-S) You can ignore the warnings
If you keep getting the "Project files cannot be loaded. error is: X:XXXXXXXXX.dsp: error: Project upgrade
failed." errors, you have to take the intermediate step of converting the projects to VS2008 format - install
VC++ 2008 as described earlier and
Convert the solution to VC++ 2008 format
Open C:${WXDIR}buildmswwx_dll.dsw and answer Yes to all the project conversion questions.
Save the solution (Ctrl-S)
Close VC++ 2008
Run VC++ 2010
Open the solution (C:${WXDIR}buildmswwx_dll.sln) and answer yes to all the questions of the conversion
wizard
You can ignore the warnings
Save the solution
In the properties of project core, add GDIPlus.lib into Configuration Properties -> Linker -> Input ->
Additional Dependencies for both DLL Unicode Debug and DLL Unicode Release configurations
Compile Debug
Select DLL Unicode Debug from the configurations list and build the solution
odbc fails to compile – can be ignored as it's not used by OpenCPN
Compile Release
Select DLL Unicode Release from the configurations list and build the solution
odbc fails to compile – can be ignored as it's not used by OpenCPN
Making your life with wxWidgets easier
You should add C:${WXDIR}libvc_dll to your PATH environment variable. After doing it, you have to restart the
running programs (cmd.exe, cmake-gui, VisualStudio etc.) to make sure they "see" the changed environment
variables. If you are unsure, restart Windows and everything will be set. If you don't do it, you will have problems
running your debug builds later.
If you have problems with cmake not finding your wxWidgets installation, try creating another environment
3. variable called WXWIN with a value of C:${WXDIR} (for example C:wxWidgets-2.8.12) - it will help cmake find the
libraries automatically Again, don't forget to restart the running programs involved in the build.
.
Getting the OpenCPN source
Run cmd.exe or better, if you want to have the toolchain ready from the command line, „Visual Studio 2008
Command Prompt“ from Start menu → Programs → Microsoft Visual C++ 2008 Express Edition → Visual Studio
Tools
To get the source for the first time, issue
git clone git://github.com/OpenCPN/OpenCPN.git
To update the code you cloned before, cd into the source directory and issue
git fetch --all
Building the OpenCPN source
Create a directory named build under the topmost source directory
Configuring alternative 1: From the command line (recommended):
cd into the build directory
issue
cmake -G „Visual Studio 10“ ..
Configuring alternative 2: Using Cmake-gui
Run „CMake (cmake-gui)“ from Start menu → Programs → Cmake 2.8
Fill in your source and build directories
Click on the Configure button
If you are asked to choose the generator, select „Visual Studio 9 2008“
The information which appeared is red and the Generate button stays disabled? Just hit Configure again...
Ignore GTK2_GTK_INCLUDE_DIR-NOTFOUND and wxwidgets_wxrc_EXECUTABLE_NOTFOUND
Click on the Generate button
Solution and project files should be created in your build directory
IMPORTANT suggestion:
Use CMAKE GUI tool to configure OpenCPN to verify that wxWidgets_LIB_DIR points to the {root}/lib/vc_dll
directory This check is necessary since the cmake FindWxWidgets module sometimes finds the wrong source
.
and/or build config.
Compiling Alternative 1: From the command line
Run „Visual Studio Command Prompt (2010)“ from Start menu → Programs → Microsoft Visual C++ 2010 Express
cd into the build directory
issue
cmake -–build .
Wait for the build to complete.
You may get errors when building the plugins as they are built before opencpn (to be fixed in the configuration
process). Simply running the build again fixes the problem.
Compiling Alternative 2: From Visual Studio
Open the solution created by cmake (build/OpenCPN.sln)
Compile the whole solution or individual projects
You have to compile project opencpn before you can compile any plugins (to be fixed in the configuration
process)
If you want to debug, don't forget to select opencpn as a start-up project and if you didn't add the WX DLL path
to the PATH environment variable earlier, copy the needed WX DLLs to the build directory (Debug or Release,
depending on which version you build). The DLLs can be found in C:${WXDIR}libvc_dll and you will need:
Debug: wxbase28ud_net_vc_custom.dll, wxbase28ud_vc_custom.dll, wxbase28ud_xml_vc_custom.dll,
wxmsw28ud_adv_vc_custom.dll, wxmsw28ud_core_vc_custom.dll
4. Release: wxbase28u_net_vc_custom.dll, wxbase28u_vc_custom.dll, wxbase28u_xml_vc_custom.dll,
wxmsw28u_adv_vc_custom.dll, wxmsw28u_core_vc_custom.dll
Optional: Creating the installer package
Build the PACKAGE project and opencpn_2.X.Y_setup.exe is created in your build directory (replace X with
the release and Y with the build number)
Currently the installer packs the DLLs from the git repository into the package. You have to replace them with
your custom built DLLs after the installation if you want to experiment with different versions and build settings
of the wxWidgets libraries.
Running the debug build
To be able to run the debug build, you must create a folder named uidata in your build directory and copy the
following files from srcbitmaps into it: styles.xml, toolicons_traditional.png,
toolicons_journeyman.png, toolicons_journeyman_flat.png
To be able to use vector charts, you must copy folder named s57data (data/s57data) from the source tree into
your build directory, otherwise vector charts support will be turned off at runtime.
‹ Compiling - Mac OS X Internationalization ›
Printer-friendly version
Hos ting and bandwidth for OpenCPN.org is generous ly donated by SouthBay Network
OpenCPN is open s ource s oftware