Compile open cpn on windows


Published on

Published in: Education
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Compile open cpn on windows

  1. 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 Developers Guide Compiling - Linux Important note before you start Compiling - Mac OS X The order of the steps described bellow really matters. Dont skip any steps not explicitly marked as Compiling - Windows optional and dont change their order unless you really know what you are doing. Its an excellent idea to read Internationalization the whole text first and make sure you understand what its 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 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: 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 dont 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 dont intend to debug the WX sources, you can skip this step alltogether. If you do, you can still try 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 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 (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 NowWelcome If you want a tutorial, have a look at the series of articles starting atForget Servers. Focus Code. CSS. HTML.LESS. SFTP. Cmake Get it from Open While installing its advisable to let the setup program add cmake to the system PATH variableSource ESBEasy-to-Use Graphical GettextInterface. Try The Free Install Poedit from - its version of gettext is the best available out there.ESB Download Now! … 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 systemIntroducing Nexus variable7Thin, light & portable. NSIS (Unicode)Made for Google Play . Needed only in case you intend to build the installation package for OpenCPN. Not needed for normalBuy now for $ development. Get it from X P The NSIS Unicode 2.46 setup file is also included in the GIT repository -> ..buildwinNSIS_Unicodensis-2.46-Service Pack Unicode-setup.exeDownload Windows XP Direct download link: Packs. Free PCWorld Downloads.P C -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. 2. Grant Funding May Be Just copy the value (its the installation path) of the "HKEY_LOCAL_MACHINESOFTWARENSISUnicode" key toAvailable See If YouQualify! "HKEY_LOCAL_MACHINESOFTWARENSIS".www.C 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, its 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 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 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 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} 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 its 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 its 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 dont 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. 3. variable called WXWIN with a value of C:${WXDIR} (for example C:wxWidgets-2.8.12) - it will help cmake find thelibraries automatically Again, dont forget to restart the running programs involved in the build. .Getting the OpenCPN sourceRun cmd.exe or better, if you want to have the toolchain ready from the command line, „Visual Studio 2008Command Prompt“ from Start menu → Programs → Microsoft Visual C++ 2008 Express Edition → Visual StudioToolsTo get the source for the first time, issuegit clone git:// update the code you cloned before, cd into the source directory and issuegit fetch --allBuilding the OpenCPN sourceCreate a directory named build under the topmost source directoryConfiguring alternative 1: From the command line (recommended):cd into the build directoryissuecmake -G „Visual Studio 10“ ..Configuring alternative 2: Using Cmake-guiRun „CMake (cmake-gui)“ from Start menu → Programs → Cmake 2.8Fill in your source and build directoriesClick on the Configure buttonIf 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_NOTFOUNDClick on the Generate buttonSolution and project files should be created in your build directoryIMPORTANT suggestion:Use CMAKE GUI tool to configure OpenCPN to verify that wxWidgets_LIB_DIR points to the {root}/lib/vc_dlldirectory This check is necessary since the cmake FindWxWidgets module sometimes finds the wrong source .and/or build config.Compiling Alternative 1: From the command lineRun „Visual Studio Command Prompt (2010)“ from Start menu → Programs → Microsoft Visual C++ 2010 Expresscd into the build directoryissuecmake -–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 configurationprocess). Simply running the build again fixes the problem.Compiling Alternative 2: From Visual StudioOpen the solution created by cmake (build/OpenCPN.sln)Compile the whole solution or individual projectsYou have to compile project opencpn before you can compile any plugins (to be fixed in the configurationprocess)If you want to debug, dont forget to select opencpn as a start-up project and if you didnt add the WX DLL pathto 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. 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 versionHos ting and bandwidth for is generous ly donated by SouthBay NetworkOpenCPN is open s ource s oftware