WX3.1 and C 11 migration - nohal/OpenCPN GitHub Wiki
Migration to wxWidgets 3.1.1 (or newer) and C++ 11 for O5
- ALL the plugins will have to be rebuilt on platforms where we switch to wx3.1, but not many need major changes to be buildable
(So far only weatherfax comes to mind as being problematic because of the obsoletelibaudiofile
version it contains) - Do not forget
git submodule init && git submodule update
with wxWidgets
Linux
- C++11 should not be a problem at all
- There is no problem to switch to wx3.1 for snap (and flatpack), which seems to be supported on current versions of all major distros.
- There is a problem to switch to wx3.1 for normal packages on major distros. As big that we must retain wx3.0 compatibility
Windows
VS 2017
- The toolchain changes to
v141_xp
- The
buildwin
dependency pack has to be completely rebuilt - Because we need to retain XP compatibility, we can't use prebuilt
wxwin
- The XP compatible SDK must be selected for installation with VS2017
wxWidgets
mkdir build-release
cd build-release
cmake -G "Visual Studio 15 2017" -Tv141_xp ..
cmake --build . --config release
cmake --build . --config debug
OpenCPN
cmake -G "Visual Studio 15 2017" -Tv141_xp ..
cmake --build . --config release
cmake --build . --config debug
Buildwin rebuild
- zlib (1.2.11)
Get from http://www.zlib.net
Get the headers, zlib.lib and zlib.dll, replace the thing in buildwin, fix CMakeLists.txt in grib_pi TODO: remove the headers from O tree and adjust CMakeLists.txtmkdir build cd build cmake -DCMAKE_INSTALL_PREFIX=c:/work/deps -Tv141_xp .. cmake --build . --config release --target install
- openssl (1.1.0g) TODO: Needed for something? We build cURL with WinSSL now
Needs perl
Editperl Configure VC-WIN32 no-asm --prefix=c:\work\deps
makefile
, add -D_USING_V141_SDK71_ to CFLAG
Installation ends with an error, butnmake nmake install
c:\work\deps
is already populated with the development stuff we need - cairo (Using modified https://github.com/wingtk/gvsbuild - It is a real adventure...)
- fontconfig
- iconv
- libpng
- libxml2
- pixman
- cairo
- openssl
- zlib
- cURL (7.58.0)
TODO: We need openssl for libwebsockets, switch SSL lib back to it?
Get from http://curl.haxx.se/download.html
Get the headers, .lib and .dllmkdir build cd build //cmake -DOPENSSL_ROOT_DIR=c:/work/deps -DZLIB_ROOT=C:/work/zlib-1.2.11 -T v141_xp .. cmake -DCMAKE_USE_WINSSL=ON -DZLIB_ROOT=C:/work/deps -DENABLE_INET_PTON=OFF -T v141_xp .. cmake --build . --config release
- liblzma (xzutils 5.2.3)
Open
windows\xz_win.sln
, convert, change the toolchain tov141_xp
, build Release version ofliblzma_dll
- libarchive
- TODO: bzip2? (It is "hard" to build it on Windows from the upstream distribution)
mkdir build-release cd build-release cmake -DWINDOWS_VERSION=WINXP -DENABLE_CNG=OFF -DZLIB_INCLUDE_DIR=C:/work/OpenCPN/buildwin/include -DZLIB_LIBRARY=C:/work/OpenCPN/buildwin/zlib1.lib -DLIBLZMA_INCLUDE_DIR=C:/work/OpenCPN/buildwin/include -DLIBLZMA_LIBRARY=C:/work/OpenCPN/buildwin/liblzma.lib -Tv141_xp ..
Edit CMakeCache.txt
and set ARCHIVE_CRYPTO_SHA[256,384,512]_WIN
to FALSE
to build.
cmake ..
cmake --build . --config release
-
expat
-
crashrpt
-
ocpn_gltest1.exe
-
wx
-
VC redist libs
-
portaudio (some plugins)
-
libwebsockets (SignalK)
mkdir build cd build cmake -Tv141_xp -DOPENSSL_ROOT_DIR=c:\work\deps -DZLIB_ROOT_DIR=c:\work\deps -DLWS_ZLIB_INCLUDE_DIRS=c:\work\deps\include -DLWS_ZLIB_LIBRARIES=c:\work\deps\lib\zlib.lib .. cmake --build . --config release
TODO: But it builds with internal zlib anyway...
macOS
Apple pushes to move the least supported version to 10.9, but it seems 10.7 support is still not impossible.
Building wxWidgets
Local developer builds
Against wxmac from Homebrew installed with brew install wxmac --HEAD
(brew install wxmac --devel
once it is wx3.1.1)
Production builds
Have to still retain the 10.7 compatibility and need
mkdir build-release
cd build-release
../configure --with-cxx=11 --with-macosx-version-min=10.7 --enable-unicode --with-osx-cocoa --enable-aui --disable-debug --with-opengl --without-liblzma --without-subdirs
make -j2
sudo make install
(Or switch to the cmake based build)
Building OpenCPN
Local developer builds
cmake -DOCPN_USE_LIBCPP=ON ..
Production builds
export MACOSX_DEPLOYMENT_TARGET=10.7
cmake -DOCPN_USE_LIBCPP=ON ..
To really support 10.7, libarchive
and cairo
must be built manually, not taken from Homebrew