OpenCPN Compiling on Windows

2024-09-01 15:20
文章标签 windows compiling opencpn

本文主要是介绍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

这篇关于OpenCPN Compiling on Windows的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/1127312

相关文章

javafx 如何将项目打包为 Windows 的可执行文件exe

《javafx如何将项目打包为Windows的可执行文件exe》文章介绍了三种将JavaFX项目打包为.exe文件的方法:方法1使用jpackage(适用于JDK14及以上版本),方法2使用La... 目录方法 1:使用 jpackage(适用于 JDK 14 及更高版本)方法 2:使用 Launch4j(

windows端python版本管理工具pyenv-win安装使用

《windows端python版本管理工具pyenv-win安装使用》:本文主要介绍如何通过git方式下载和配置pyenv-win,包括下载、克隆仓库、配置环境变量等步骤,同时还详细介绍了如何使用... 目录pyenv-win 下载配置环境变量使用 pyenv-win 管理 python 版本一、安装 和

Python使用pysmb库访问Windows共享文件夹的详细教程

《Python使用pysmb库访问Windows共享文件夹的详细教程》本教程旨在帮助您使用pysmb库,通过SMB(ServerMessageBlock)协议,轻松连接到Windows共享文件夹,并列... 目录前置条件步骤一:导入必要的模块步骤二:配置连接参数步骤三:实例化SMB连接对象并尝试连接步骤四:

在 Windows 上部署 gitblit

在 Windows 上部署 gitblit 在 Windows 上部署 gitblit 缘起gitblit 是什么安装JDK部署 gitblit 下载 gitblit 并解压配置登录注册为 windows 服务 修改 installService.cmd 文件运行 installService.cmd运行 gitblitw.exe查看 services.msc 缘起

Windows如何添加右键新建菜单

Windows如何添加右键新建菜单 文章目录 Windows如何添加右键新建菜单实验环境缘起以新建`.md`文件为例第一步第二步第三步 总结 实验环境 Windows7 缘起 因为我习惯用 Markdown 格式写文本,每次新建一个.txt后都要手动修改为.md,真的麻烦。如何在右键新建菜单中添加.md选项呢? 网上有很多方法,这些方法我都尝试了,要么太麻烦,要么不凑效

Windows下Nginx的安装及开机启动

1、将nginx-1.16.1.zip解压拷贝至D:\web\nginx目录下。 2、启动Nginx,两种方法: (1)直接双击nginx.exe,双击后一个黑色的弹窗一闪而过。 (2)打开cmd命令窗口,切换到nginx目录下,输入命令 nginx.exe 或者 start nginx ,回车即可。 3、检查nginx是否启动成功。 直接在浏览器地址栏输入网址 http://lo

Windows环境利用VS2022编译 libvpx 源码教程

libvpx libvpx 是一个开源的视频编码库,由 WebM 项目开发和维护,专门用于 VP8 和 VP9 视频编码格式的编解码处理。它支持高质量的视频压缩,广泛应用于视频会议、在线教育、视频直播服务等多种场景中。libvpx 的特点包括跨平台兼容性、硬件加速支持以及灵活的接口设计,使其可以轻松集成到各种应用程序中。 libvpx 的安装和配置过程相对简单,用户可以从官方网站下载源代码

C++实现俄罗斯方块(Windows控制台版)

C++实现俄罗斯方块(Windows控制台版) 在油管上看到一个使用C++控制台编写的俄罗斯方块小游戏,源代码200多行,B站上也有相关的讲解视频,非常不错,值得学习。 B站讲解视频地址为:【百万好评】国外技术大神C++游戏编程实战教程,油管580W收藏,新手10小时入门,并快速达到游戏开发能力(中英字幕) B站 CSDN博主千帐灯无此声还为此写了一篇博客:C++实现俄罗斯方块(源码+详解),讲

Windows下php扩展开发c++动态库

PHP扩展开发,从零了解到初步完成一个小项目,经过三天的仔细研究,现整理如下 一、需求介绍 PHP扩展开发,调用自己之前的c++动态库,完成功能 二、项目之前 系统:windows xp  开发工具:vs 2008 web环境:apache2.4  PHP5.3.29-VC9-ts-x86 aphach和PHP 环境之前已经搭建完成 PHP源码:去官网http://www.php.n

OpenStack镜像制作系列4—Windows Server2019镜像

本系列文章主要对如何制作OpenStack镜像的过程进行描述记录  CSDN:OpenStack镜像制作教程指导(全) OpenStack镜像制作系列1—环境准备 OpenStack镜像制作系列2—Windows7镜像 OpenStack镜像制作系列3—Windows10镜像 OpenStack镜像制作系列4—Windows Server2019镜像 OpenStack镜像制作系