当前位置: 首页 > news >正文

OpenCPN Compiling on Windows

官方编译教程

Compiling on Windows :: OpenCPN Developer Manual

Prerequisities

  • for OpenCPN v5.0.0

  • with wxWidgets v3.1.2

  • Plugin API starts with API 1.16 (Supports plugins with earlier API but they must be compiled again for OpenCPN v5.0 due to the change in wxWidgets.)

  • Highest chance of success if these steps are followed exactly.

Visual Studio 2017

  • Get Visual Studio Community 2017. Go to this microsoft web page Older Visual Studio and scroll down.

  • Install and select the workload Desktop development with C* and include component *Windows XP support for C.

  • Also include the appropriate Windows x SDK component. Generally install the most current version, Windows 10 preferred.

Git

  • Get Git for Windows from https://gitforwindows.org

  • Install and let the installer register git in your PATH and select Checkout as-is, commit Unix-style line endings

CMake

  • Get the latest CMake installation packages from https://cmake.org

  • Install and let the installer register in the PATH environment variable

POedit

  • Get the latest POedit installation package from https://poedit.net

  • Install

  • Add C:\Program Files (x86)\Poedit\GettextTools\bin to your PATH

NSIS

  • Download NSIS (Nullsoft Scriptabe Install System) from Download - NSIS

  • Install

GNU gettext

  • Download the setup package from GetText for Windows

  • Install

  • Add C:\Program Files (x86)\GnuWin32\bin to your PATH

7-Zip

  • Download 7-Zip from Download

  • Install

Get the wxWidgets 3.1.2 sources and built them

  • Open a x86 Native Tools Command Prompt for VS 2017 (In Windows 10 by typing in the search box next to the Windows start button x86 Native…etc) and execute the following commands:

cd C:\Users\myname\Sources
git clone -b v3.1.2 https://github.com/wxWidgets/wxWidgets
cd wxWidgets
git submodule init
git submodule updatecd build\msw
nmake /f makefile.vc BUILD=release SHARED=1 CXXFLAGS=/D_USING_V141_SDK71_ CFLAGS=/D_USING_V141_SDK71_ LDFLAGS=/SUBSYSTEM:WINDOWS,5.01
nmake /f makefile.vc BUILD=debug SHARED=1 CXXFLAGS=/D_USING_V141_SDK71_ CFLAGS=/D_USING_V141_SDK71_ LDFLAGS=/SUBSYSTEM:WINDOWS,5.01
  • Set the environment variable wxWIDGETS_ROOT_DIR with a value of the top level directory of your wxWidgets source tree.

Alternatives:
  • The commands on this page refers to C:\users\myname\Sources as the directory for all sources. Obviously one can use other directories.

  • The commands above download the sources from GitHub and then build the release and the debug version. Instead of using git clone, you can download the wxWidgets sources manually from https:__github.com/wxWidgets/wxWidgets/releases/tag/v3.1.2.

  • Alternatively there is a faster way to get started, by just getting wxWidgets prebuilt from wxWidgets-3.1.2.7z. This however is not suitable for serious development or debugging as only release configuration libraries are included.

  • Video: wxWidgets with Visual Studio 2019/2017 Getting Visual Studio setup to use wxWidgets can sometimes be difficult, this video uses the Visual Studio Interface.

Getting and building OpenCPN source

Get the OpenCPN sources

In the open x86 Native Tools Command Prompt for VS 2017 execute the following commands:

cd \Users\myname\Sources
git clone https://github.com/OpenCPN/OpenCPN
Get prebuilt Windows dependencies
  • Download the dependencies bundle from OpenCPN_buildwin-4.99a.7z

  • Extract into c:\Users\myname\Sources\OpenCPN\buildwin using 7-Zip

Building OpenCPN
  • In the open x86 Native Tools Command Prompt for VS 2017 execute the following commands to create the build directory, generate the solutions files and build the debug version, the release version and the setup package.

cd C:\Users\myname\Sources\OpenCPN
mkdir build
cd build
cmake -G "Visual Studio 15 2017" -T v141_xp ..# 注意这一步可以会一直提示找不到wxWidgets, 
# 建议直接把路径加上
# cmake -DwxWidgets_ROOT_DIR=D:/ThirdParty/wxWidgets/wxWidgets-3.1.2  -G "Visual Studio 15 2017" -T v141_xp ..cmake --build .
cmake --build . --config release
cmake --build . --config release --target package
  • These commands should generate an OpenCPN install package in c:\Users\username\Sources\OpenCPN\build\opencpn_5.0.0_setup.exe

  • Excecute this program to install OpenCPN. Choose c:\Program Files (x86)\OpenCPN\ as installation directory to avoid unnecessary issues when installing plugins.

Alternatives:
  • Instead of running the last 3 cmake-commands, one could also start Visual Studio, open the generated solutionfile OpenCPN.sln and build from there.

  • Obviously other directories can be used as well, just as multiple opencpn installation. The instructions above are meant for those setting up a new development environment for just OpenCPN 5.0.

Setup Copyfiles.bat - Last step to Debug

Copyfiles.bat is a useful single batch file to copy all the needed files to the various directories. This batch file does not execute any cmake commands.

  • Download here

  • Move the file to <Your OpenCPN source tree> (for example: C:\Compile\Github\Opencpn)

  • Execute copyfiles.bat

  • Start Visual Studio 2017 and the OpenCPN-solution file. (For Example: C:\Compile\Github\Opencpn\build\opencpn.sln)

  • If the Solution Explorer is not visible, open the Solution Explorer (Via the view-menu, or Ctrl+Alt+L)

  • Select the project "Opencpn" from the list, right click and pick "Set as Startup Project"

Now Opencpn should be ready to debug.

BatchUTILS

BatchUTILS is another alternative that is a more complete set of batch files to assist building OpenCPN. Osetup.bat is intended to be modified by an individual user based on their own system. Git clone https://github.com/transmitterdan/BatchUTILS to your github directory, next to the OpenCPN local repository. Discussion about https:__github.com/transmitterdan/BatchUTILS/issues/1[the use and development of BatchUtils]

It’s nearly impossible to guess all the possible wxWidgets versions someone might have on their system. Also, other tools sometimes change paths as new versions are released. So it is expected that each user will customize Osetup.bat. The latest of Transmitter Dan’s batchutils is in git. If you want to use some other environment variable other than WXDIR that is ok. The Cmake tool will accept a number of possible environment names as the root of the wxWidgets toolkit.

NOTE:

FIXME: These are the steps in appveyor, and they are not the same

install:# VS2015 and earlier version - '"C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x86'- call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars32.bat"# set 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;C:\Program Files\Git\bin;c:\cygwin\bin- cmd: python3.6m --version# install dependencies:- choco install poedit- choco install git# - choco install nsis-3.04 -x86- ps: Start-FileDownload https://download.opencpn.org/s/54HsBDLNzRZLL6i/download -FileName nsis-3.04-setup.exe- cmd: nsis-3.04-setup.exe /S# Download and unzip wxwidgets, version 3.1.2- ps: Start-FileDownload https://download.opencpn.org/s/E2p4nLDzeqx4SdX/download -FileName wxWidgets-3.1.2.7z- cmd: 7z x wxWidgets-3.1.2.7z -o%WXWIN% > null# some debugging information# - set   Displays sensitive password!# - cmake --help# build wxWidgets - Disabled as we provide prebuilt WX to save time#- cmd: cd %WXWIN%\build\msw\#- cmd: nmake -f makefile.vc BUILD=release SHARED=1 CFLAGS=/D_USING_V120_SDK71_ CXXFLAGS=/D_USING_V120_SDK71_#- cmd: nmake -f makefile.vc BUILD=debug SHARED=1 CFLAGS=/D_USING_V120_SDK71_ CXXFLAGS=/D_USING_V120_SDK71_before_build:- cd c:\project\opencpn- mkdir build- cd build- ps: Start-FileDownload https://download.opencpn.org/s/oibxM3kzfzKcSc3/download -FileName OpenCPN_buildwin-4.99a.7z- cmd: 7z x -y OpenCPN_buildwin-4.99a.7z -oc:\project\opencpn\buildwin- cmake -T v141_xp -DOCPN_CI_BUILD=ON ..build_script:# - cmake --build . --config debug- cmake --build . --target opencpn --config RelWithDebInfo- cmake --build . --target package --config RelWithDebInfo

相关文章:

  • 北京网站建设多少钱?
  • 辽宁网页制作哪家好_网站建设
  • 高端品牌网站建设_汉中网站制作
  • Python 数据分析笔记— Numpy 基本操作(上)
  • C++笔记---模板初阶
  • Elasticsearch7.14.2集群部署和elk部署
  • C#中通过TabControl控制MDI子窗体显示切换的实现过程
  • jmeter响应断言、json断言、断言持续时间、大小断言操作
  • pytest.mark简介
  • RabbitMQ中的死信交换机?(RabbitMQ延迟队列有了解过吗)
  • [Labview] 表格改值后单元格编辑功能,更改颜色、字体、颜色等
  • sqli-labs靶场通关攻略(五十一到五十六关)
  • 数据线性结构
  • Notepad++回车不自动补全
  • opencv之形态学
  • flutter 类似Android 中RelativeLayout在末尾居中
  • Golang | Leetcode Golang题解之第386题字典序排数
  • STM32(八):定时器——输入捕获实验
  • [数据结构]链表的实现在PHP中
  • 230. Kth Smallest Element in a BST
  • Android系统模拟器绘制实现概述
  • Cumulo 的 ClojureScript 模块已经成型
  • laravel with 查询列表限制条数
  • linux安装openssl、swoole等扩展的具体步骤
  • Stream流与Lambda表达式(三) 静态工厂类Collectors
  • Zsh 开发指南(第十四篇 文件读写)
  • 二维平面内的碰撞检测【一】
  • 给第三方使用接口的 URL 签名实现
  • 前端js -- this指向总结。
  • 十年未变!安全,谁之责?(下)
  • 硬币翻转问题,区间操作
  • 国内开源镜像站点
  • ​草莓熊python turtle绘图代码(玫瑰花版)附源代码
  • ​如何在iOS手机上查看应用日志
  • ###C语言程序设计-----C语言学习(6)#
  • #职场发展#其他
  • (2)STM32单片机上位机
  • (2024.6.23)最新版MAVEN的安装和配置教程(超详细)
  • (windows2012共享文件夹和防火墙设置
  • (编程语言界的丐帮 C#).NET MD5 HASH 哈希 加密 与JAVA 互通
  • (附源码)node.js知识分享网站 毕业设计 202038
  • (附源码)springboot青少年公共卫生教育平台 毕业设计 643214
  • (附源码)计算机毕业设计ssm电影分享网站
  • (十三)Flask之特殊装饰器详解
  • (一)C语言之入门:使用Visual Studio Community 2022运行hello world
  • (原)Matlab的svmtrain和svmclassify
  • (自用)交互协议设计——protobuf序列化
  • ..回顾17,展望18
  • .htaccess 强制https 单独排除某个目录
  • .NET Core 2.1路线图
  • .NET delegate 委托 、 Event 事件,接口回调
  • .Net Remoting常用部署结构
  • .NET 材料检测系统崩溃分析
  • .net 设置默认首页
  • .NET 中 GetProcess 相关方法的性能
  • .Net(C#)自定义WinForm控件之小结篇
  • .NET/C# 的字符串暂存池
  • .NET/C# 反射的的性能数据,以及高性能开发建议(反射获取 Attribute 和反射调用方法)