]> git.ipfire.org Git - thirdparty/openvpn.git/commit
CMake: Add complete MinGW and MSVC build
authorFrank Lichtenheld <frank@lichtenheld.com>
Tue, 20 Jun 2023 13:53:07 +0000 (15:53 +0200)
committerGert Doering <gert@greenie.muc.de>
Tue, 27 Jun 2023 16:07:03 +0000 (18:07 +0200)
commite8881ec6dd63bd80ce05202573eac54ab8657fcb
tree47e70720b784cbeea3d2c3e047956383c9dcd7e6
parent0134184012dd46ec44cbca7eb3ece39037ae0bfa
CMake: Add complete MinGW and MSVC build

This is based on the initial CMake patch by
Arne Schwabe, but extends that to provide
a complete replacement for existing MinGW
build (autotools based) and MSVC build
(openvpn.sln).

The following features are added while switching
these builds to CMake:
 - vcpkg support for MinGW build, allowing for
   trivial cross-compilation on Linux
 - Add unittests to MSVC build
 - Rework MSVC config header generation, removing
   need for separate headers between autotools
   and MSVC

The following advantages are reasons for switching
to CMake over the existing MSVC build:
 - Easier to maintain CMake files without IDE
   than the sln and vcxproj files
 - Able to maintain MSVC and MinGW build side-by-side

The plan is to completely remove the existing MSVC
build system but leave the existing autotools builds
in place as-is, including MinGW support.

CMake is not the intended build system for Unix-like
platforms and there are no current plans to switch
to it.

v2:
 - Reduce default warning level for MSVC to /W2. With
   /W3 the build is just much too noisy, making it
   difficult to spot new warnings.
 - Change MSVC CMake presets to have hardcoded build
   type. When using pkg_search_module MSVC Multi-Config
   builds do not work correctly at all since PkgConfig
   doesn't seem to be able to create multi-config
   libraries like find_package does.
 - Change minGW presets to be Multi-Config capable.
 - Remove OPENVPN_VERSION_MAJOR, OPENVPN_VERSION_MINOR,
   OPENVPN_VERSION_PATCH from config.h.cmake.in.
   They are not required and cause macro redefinition
   warnings in MSVC (with openvpn-plugin.h). gcc doesn't
   warn about this because the definitions are identical
   so no need to fix this in autoheader config.h.in.
v3:
 - Apply fixes by Lev Stipakov to match MSVC compile
   options better to previous build.
 - Apply change by Lev Stipakov to enable generation
   of PDB files.
 - Move /Brepro to its own commit. This is a behavior
   change that should be more visible.
 - Rebase on top of my dist fixes.

Change-Id: I237f28eca618d4fc476225b887c0be26cca362b1
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Lev Stipakov <lstipakov@gmail.com>
Message-Id: <20230620135310.94455-3-frank@lichtenheld.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg26754.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
19 files changed:
.github/workflows/build.yaml
.gitignore
CMakeLists.txt
CMakePresets.json [new file with mode: 0644]
Makefile.am
config.h.cmake.in
contrib/cmake/git-version.py [new file with mode: 0644]
contrib/cmake/parse-version.m4.py [new file with mode: 0644]
contrib/vcpkg-manifests/mingw/vcpkg.json [new file with mode: 0644]
contrib/vcpkg-manifests/windows/vcpkg.json [new file with mode: 0644]
contrib/vcpkg-ports/pkcs11-helper/portfile.cmake
doc/CMakeLists.txt [new file with mode: 0644]
doc/Makefile.am
src/openvpnmsica/CMakeLists.txt [new file with mode: 0644]
src/openvpnmsica/Makefile.am
src/openvpnserv/CMakeLists.txt [new file with mode: 0644]
src/openvpnserv/Makefile.am
src/tapctl/CMakeLists.txt [new file with mode: 0644]
src/tapctl/Makefile.am