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>
| ... | ... |
@@ -39,230 +39,95 @@ jobs: |
| 39 | 39 |
strategy: |
| 40 | 40 |
fail-fast: false |
| 41 | 41 |
matrix: |
| 42 |
- osslver: [1.1.1q, 3.0.5] |
|
| 43 |
- target: [mingw64, mingw] |
|
| 44 |
- include: |
|
| 45 |
- - target: mingw64 |
|
| 46 |
- chost: x86_64-w64-mingw32 |
|
| 47 |
- - target: mingw |
|
| 48 |
- chost: i686-w64-mingw32 |
|
| 42 |
+ arch: [x86, x64] |
|
| 49 | 43 |
|
| 50 |
- name: "gcc-mingw - ${{matrix.target}} - OSSL ${{ matrix.osslver }}"
|
|
| 44 |
+ name: "gcc-mingw - ${{ matrix.arch }} - OSSL"
|
|
| 51 | 45 |
runs-on: ubuntu-22.04 |
| 52 | 46 |
env: |
| 53 |
- MAKEFLAGS: -j3 |
|
| 54 |
- LZO_VERSION: "2.10" |
|
| 55 |
- PKCS11_HELPER_VERSION: "1.29.0" |
|
| 56 |
- OPENSSL_VERSION: "${{ matrix.osslver }}"
|
|
| 57 |
- TAP_WINDOWS_VERSION: "9.23.3" |
|
| 58 |
- CMOCKA_VERSION: "1.1.5" |
|
| 47 |
+ VCPKG_ROOT: ${{ github.workspace }}/vcpkg
|
|
| 59 | 48 |
steps: |
| 60 | 49 |
- name: Install dependencies |
| 61 |
- run: sudo apt update && sudo apt install -y mingw-w64 libtool automake autoconf man2html unzip cmake ninja-build build-essential wget |
|
| 50 |
+ run: sudo apt update && sudo apt install -y mingw-w64 unzip cmake ninja-build build-essential wget python3-docutils man2html-base |
|
| 62 | 51 |
- name: Checkout OpenVPN |
| 63 | 52 |
uses: actions/checkout@v3 |
| 64 |
- with: |
|
| 65 |
- path: openvpn |
|
| 66 | 53 |
|
| 67 |
- - name: autoconf |
|
| 68 |
- run: autoreconf -fvi |
|
| 69 |
- working-directory: openvpn |
|
| 70 |
- |
|
| 71 |
- - name: Cache dependencies |
|
| 72 |
- id: cache |
|
| 73 |
- uses: actions/cache@v3 |
|
| 54 |
+ - name: Restore from cache and install vcpkg |
|
| 55 |
+ uses: lukka/run-vcpkg@v10 |
|
| 74 | 56 |
with: |
| 75 |
- path: '~/mingw/' |
|
| 76 |
- key: ${{ matrix.target }}-mingw-${{ matrix.osslver }}-${{ env.LZO_VERSION }}-${{ env.PKCS11_HELPER_VERSION }}-${{ env.TAP_WINDOWS_VERSION }}--${{ env.CMOCKA_VERSION }}
|
|
| 77 |
- |
|
| 78 |
- # Repeating if: steps.cache.outputs.cache-hit != 'true' |
|
| 79 |
- # on every step for building dependencies is ugly but |
|
| 80 |
- # I haven't found a better solution so far. |
|
| 81 |
- |
|
| 82 |
- - name: Download mingw dependencies |
|
| 83 |
- if: steps.cache.outputs.cache-hit != 'true' |
|
| 84 |
- run: | |
|
| 85 |
- wget -c -P download-cache/ "https://build.openvpn.net/downloads/releases/tap-windows-${TAP_WINDOWS_VERSION}.zip"
|
|
| 86 |
- wget -c -P download-cache/ "https://www.oberhumer.com/opensource/lzo/download/lzo-${LZO_VERSION}.tar.gz"
|
|
| 87 |
- wget -c -P download-cache/ "https://github.com/OpenSC/pkcs11-helper/releases/download/pkcs11-helper-${PKCS11_HELPER_VERSION}/pkcs11-helper-${PKCS11_HELPER_VERSION}.tar.bz2"
|
|
| 88 |
- wget -c -P download-cache/ "https://github.com/coreboot/cmocka/archive/refs/tags/cmocka-${CMOCKA_VERSION}.tar.gz"
|
|
| 89 |
- tar jxf "download-cache/pkcs11-helper-${PKCS11_HELPER_VERSION}.tar.bz2"
|
|
| 90 |
- wget -c -P download-cache/ "https://www.openssl.org/source/old/1.1.1/openssl-${OPENSSL_VERSION}.tar.gz" || wget -c -P download-cache/ "https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz"
|
|
| 91 |
- tar zxf "download-cache/openssl-${OPENSSL_VERSION}.tar.gz"
|
|
| 92 |
- tar zxf "download-cache/lzo-${LZO_VERSION}.tar.gz"
|
|
| 93 |
- tar zxf "download-cache/cmocka-${CMOCKA_VERSION}.tar.gz"
|
|
| 94 |
- unzip download-cache/tap-windows-${TAP_WINDOWS_VERSION}.zip
|
|
| 95 |
- |
|
| 96 |
- - name: create cmocka build directory |
|
| 97 |
- if: steps.cache.outputs.cache-hit != 'true' |
|
| 98 |
- run: mkdir cmocka-build |
|
| 99 |
- |
|
| 100 |
- - name: configure cmocka |
|
| 101 |
- if: steps.cache.outputs.cache-hit != 'true' |
|
| 102 |
- working-directory: "./cmocka-build" |
|
| 103 |
- run: cmake -GNinja -DCMAKE_C_COMPILER=${{ matrix.chost }}-gcc -DCMAKE_CXX_COMPILER=${{ matrix.chost }}-g++ -DCMAKE_SYSTEM_NAME=Windows -DCMAKE_SHARED_LINKER_FLAGS=-static-libgcc -DCMAKE_PREFIX_PATH=${HOME}/mingw/opt/lib/pkgconfig/ -DCMAKE_INCLUDE_PATH=${HOME}/mingw/opt/lib/include -DCMAKE_LIBRARY_PATH=${HOME}/mingw/opt/lib -DCMAKE_INSTALL_PREFIX=${HOME}/mingw/opt/ ../cmocka-cmocka-${{ env.CMOCKA_VERSION }}
|
|
| 104 |
- |
|
| 105 |
- - name: build cmocka |
|
| 106 |
- if: steps.cache.outputs.cache-hit != 'true' |
|
| 107 |
- working-directory: "./cmocka-build" |
|
| 108 |
- run: ninja |
|
| 109 |
- |
|
| 110 |
- - name: install cmocka |
|
| 111 |
- if: steps.cache.outputs.cache-hit != 'true' |
|
| 112 |
- working-directory: "./cmocka-build" |
|
| 113 |
- run: ninja install |
|
| 114 |
- |
|
| 115 |
- - name: Configure OpenSSL |
|
| 116 |
- if: steps.cache.outputs.cache-hit != 'true' |
|
| 117 |
- run: ./Configure --cross-compile-prefix=${{ matrix.chost }}- shared ${{ matrix.target }} no-capieng --prefix="${HOME}/mingw/opt" --openssldir="${HOME}/mingw/opt" -static-libgcc
|
|
| 118 |
- working-directory: "./openssl-${{ env.OPENSSL_VERSION }}"
|
|
| 119 |
- |
|
| 120 |
- - name: Build OpenSSL |
|
| 121 |
- if: steps.cache.outputs.cache-hit != 'true' |
|
| 122 |
- run: make |
|
| 123 |
- working-directory: "./openssl-${{ env.OPENSSL_VERSION }}"
|
|
| 124 |
- |
|
| 125 |
- # OpenSSL 3.0.5 installs itself into mingw/opt/lib64 instead of |
|
| 126 |
- # mingw/opt/lib, so we include both dirs in the following steps |
|
| 127 |
- # (pkcs11-helper and OpenVPN) so the libraries will be found |
|
| 128 |
- - name: Install OpenSSL |
|
| 129 |
- if: steps.cache.outputs.cache-hit != 'true' |
|
| 130 |
- run: make install |
|
| 131 |
- working-directory: "./openssl-${{ env.OPENSSL_VERSION }}"
|
|
| 132 |
- |
|
| 133 |
- - name: autoreconf pkcs11-helper |
|
| 134 |
- if: steps.cache.outputs.cache-hit != 'true' |
|
| 135 |
- run: autoreconf -iv |
|
| 136 |
- working-directory: "./pkcs11-helper-${{ env.PKCS11_HELPER_VERSION }}"
|
|
| 137 |
- |
|
| 138 |
- - name: configure pkcs11-helper |
|
| 139 |
- if: steps.cache.outputs.cache-hit != 'true' |
|
| 140 |
- run: OPENSSL_LIBS="-L${HOME}/mingw/opt/lib -L${HOME}/mingw/opt/lib64 -lssl -lcrypto" OPENSSL_CFLAGS=-I$HOME/mingw/opt/include PKG_CONFIG_PATH=${HOME}/mingw/opt/lib/pkgconfig ./configure --host=${{ matrix.chost }} --program-prefix='' --libdir=${HOME}/mingw/opt/lib --prefix=${HOME}/mingw/opt --build=x86_64-pc-linux-gnu --disable-crypto-engine-gnutls --disable-crypto-engine-nss --disable-crypto-engine-polarssl --disable-crypto-engine-mbedtls
|
|
| 141 |
- working-directory: "./pkcs11-helper-${{ env.PKCS11_HELPER_VERSION }}"
|
|
| 142 |
- |
|
| 143 |
- - name: build pkcs11-helper |
|
| 144 |
- if: steps.cache.outputs.cache-hit != 'true' |
|
| 145 |
- run: make all |
|
| 146 |
- working-directory: "./pkcs11-helper-${{ env.PKCS11_HELPER_VERSION }}"
|
|
| 147 |
- |
|
| 148 |
- - name: install pkcs11-helper |
|
| 149 |
- if: steps.cache.outputs.cache-hit != 'true' |
|
| 150 |
- run: make install |
|
| 151 |
- working-directory: "./pkcs11-helper-${{ env.PKCS11_HELPER_VERSION }}"
|
|
| 152 |
- |
|
| 153 |
- - name: Configure lzo |
|
| 154 |
- if: steps.cache.outputs.cache-hit != 'true' |
|
| 155 |
- run: ./configure --host=${{ matrix.chost }} --program-prefix='' --libdir=${HOME}/mingw/opt/lib --prefix=${HOME}/mingw/opt --build=x86_64-pc-linux-gnu
|
|
| 156 |
- working-directory: "./lzo-${{ env.LZO_VERSION }}"
|
|
| 157 |
- |
|
| 158 |
- - name: build lzo |
|
| 159 |
- if: steps.cache.outputs.cache-hit != 'true' |
|
| 160 |
- working-directory: "./lzo-${{ env.LZO_VERSION }}"
|
|
| 161 |
- run: make |
|
| 162 |
- |
|
| 163 |
- - name: install lzo |
|
| 164 |
- if: steps.cache.outputs.cache-hit != 'true' |
|
| 165 |
- working-directory: "./lzo-${{ env.LZO_VERSION }}"
|
|
| 166 |
- run: make install |
|
| 167 |
- |
|
| 168 |
- - name: copy tap-windows.h header |
|
| 169 |
- if: steps.cache.outputs.cache-hit != 'true' |
|
| 170 |
- run: cp ./tap-windows-${TAP_WINDOWS_VERSION}/include/tap-windows.h ${HOME}/mingw/opt/include/
|
|
| 171 |
- |
|
| 172 |
- - name: configure OpenVPN |
|
| 173 |
- run: PKG_CONFIG_PATH=${HOME}/mingw/opt/lib/pkgconfig LDFLAGS=-L$HOME/mingw/opt/lib CFLAGS=-I$HOME/mingw/opt/include OPENSSL_LIBS="-L${HOME}/opt/lib -L$HOME/mingw/opt/lib64 -lssl -lcrypto" OPENSSL_CFLAGS=-I$HOME/mingw/opt/include PREFIX=$HOME/mingw/opt LZO_CFLAGS=-I$HOME/mingw/opt/include LZO_LIBS="-L${HOME}/mingw/opt/lib -llzo2" ./configure --host=${{ matrix.chost }} --disable-lz4
|
|
| 174 |
- working-directory: openvpn |
|
| 175 |
- |
|
| 176 |
- - name: build OpenVPN |
|
| 177 |
- run: make -j3 |
|
| 178 |
- working-directory: openvpn |
|
| 179 |
- - name: build OpenVPN unittests |
|
| 180 |
- run: make -j3 check |
|
| 181 |
- working-directory: openvpn |
|
| 57 |
+ vcpkgGitCommitId: 'd10d511f25620ca0f315cd83dcef6485efc63010' |
|
| 58 |
+ vcpkgJsonGlob: '**/mingw/vcpkg.json' |
|
| 59 |
+ appendedCacheKey: mingw_${{ matrix.arch }}
|
|
| 182 | 60 |
|
| 183 |
- # We use multiple upload-artifact here, so it becomes a flat folder |
|
| 184 |
- # structure since we need the dlls on the same level as the binaries |
|
| 185 |
- - name: Archive cmocka/openssl/lzo dlls |
|
| 186 |
- uses: actions/upload-artifact@v3 |
|
| 61 |
+ - name: Run CMake with vcpkg.json manifest |
|
| 62 |
+ uses: lukka/run-cmake@v10 |
|
| 187 | 63 |
with: |
| 188 |
- retention-days: 1 |
|
| 189 |
- name: mingw-unittest-${{matrix.target}}-ossl${{ matrix.osslver }}-dlls
|
|
| 190 |
- path: '~/mingw/opt/bin/*.dll' |
|
| 191 |
- |
|
| 192 |
- # libtool puts some wrapper binaries in openvpn/tests/unit_tests/openvpn/ |
|
| 193 |
- # and the real binaries in openvpn/tests/unit_tests/openvpn/.libs/ |
|
| 194 |
- - name: Archive unittest artifacts |
|
| 195 |
- uses: actions/upload-artifact@v3 |
|
| 64 |
+ configurePreset: mingw-${{ matrix.arch }}
|
|
| 65 |
+ buildPreset: mingw-${{ matrix.arch }}
|
|
| 66 |
+ buildPresetAdditionalArgs: "['--config Debug']" |
|
| 67 |
+ |
|
| 68 |
+ - uses: actions/upload-artifact@v3 |
|
| 196 | 69 |
with: |
| 197 |
- retention-days: 1 |
|
| 198 |
- name: mingw-unittest-${{matrix.target}}-ossl${{ matrix.osslver }}-tests
|
|
| 199 |
- path: openvpn/tests/unit_tests/openvpn/.libs/*.exe |
|
| 200 |
- |
|
| 201 |
- # Currently not used by the unit test but might in the future and also |
|
| 202 |
- # helpful if manually downloading and running openvpn.exe from a mingw |
|
| 203 |
- # build |
|
| 204 |
- - name: Archive openvpn binary |
|
| 205 |
- uses: actions/upload-artifact@v3 |
|
| 70 |
+ name: openvpn-mingw-${{ matrix.arch }}
|
|
| 71 |
+ path: | |
|
| 72 |
+ ${{ github.workspace }}/out/build/mingw/${{ matrix.arch }}/Debug/*.exe
|
|
| 73 |
+ ${{ github.workspace }}/out/build/mingw/${{ matrix.arch }}/Debug/*.dll
|
|
| 74 |
+ !${{ github.workspace }}/out/build/mingw/${{ matrix.arch }}/Debug/test_*.exe
|
|
| 75 |
+ |
|
| 76 |
+ - uses: actions/upload-artifact@v3 |
|
| 206 | 77 |
with: |
| 207 |
- retention-days: 1 |
|
| 208 |
- name: mingw-unittest-${{matrix.target}}-ossl${{ matrix.osslver }}-tests
|
|
| 209 |
- path: openvpn/src/openvpn/.libs/*.exe |
|
| 78 |
+ name: openvpn-mingw-${{ matrix.arch }}-tests
|
|
| 79 |
+ path: | |
|
| 80 |
+ ${{ github.workspace }}/out/build/mingw/${{ matrix.arch }}/Debug/test_*.exe
|
|
| 81 |
+ ${{ github.workspace }}/out/build/mingw/${{ matrix.arch }}/Debug/*.dll
|
|
| 210 | 82 |
|
| 211 | 83 |
mingw-unittest: |
| 212 | 84 |
needs: [ mingw ] |
| 213 | 85 |
strategy: |
| 214 | 86 |
fail-fast: false |
| 215 | 87 |
matrix: |
| 216 |
- osslver: [ 1.1.1q, 3.0.5 ] |
|
| 217 |
- target: [ mingw64, mingw ] |
|
| 88 |
+ arch: [x86, x64] |
|
| 218 | 89 |
|
| 219 | 90 |
runs-on: windows-latest |
| 220 |
- name: "mingw unittests - ${{matrix.target}} - OSSL ${{ matrix.osslver }}"
|
|
| 91 |
+ name: "mingw unittests - ${{ matrix.arch }} - OSSL"
|
|
| 221 | 92 |
steps: |
| 222 |
- - name: Retrieve mingw unittest dlls |
|
| 223 |
- uses: actions/download-artifact@v3 |
|
| 224 |
- with: |
|
| 225 |
- name: mingw-unittest-${{matrix.target}}-ossl${{ matrix.osslver }}-dlls
|
|
| 226 |
- path: unittests |
|
| 227 |
- |
|
| 228 | 93 |
- name: Retrieve mingw unittest |
| 229 | 94 |
uses: actions/download-artifact@v3 |
| 230 | 95 |
with: |
| 231 |
- name: mingw-unittest-${{matrix.target}}-ossl${{ matrix.osslver }}-tests
|
|
| 96 |
+ name: openvpn-mingw-${{ matrix.arch }}-tests
|
|
| 232 | 97 |
path: unittests |
| 233 | 98 |
|
| 234 | 99 |
- name: List unittests directory |
| 235 | 100 |
run: "dir unittests" |
| 236 | 101 |
|
| 237 |
- - name: Run argvunit test |
|
| 238 |
- run: ./unittests/argv_testdriver.exe |
|
| 102 |
+ - name: Run argv unit test |
|
| 103 |
+ run: ./unittests/test_argv.exe |
|
| 239 | 104 |
|
| 240 |
- - name: Run auth_tokenunit test |
|
| 241 |
- run: ./unittests/auth_token_testdriver.exe |
|
| 105 |
+ - name: Run auth_token unit test |
|
| 106 |
+ run: ./unittests/test_auth_token.exe |
|
| 242 | 107 |
|
| 243 |
- - name: Run bufferunit test |
|
| 244 |
- run: ./unittests/buffer_testdriver.exe |
|
| 108 |
+ - name: Run buffer unit test |
|
| 109 |
+ run: ./unittests/test_buffer.exe |
|
| 245 | 110 |
|
| 246 | 111 |
- name: Run cryptoapi unit test |
| 247 |
- run: ./unittests/cryptoapi_testdriver.exe |
|
| 112 |
+ run: ./unittests/test_cryptoapi.exe |
|
| 248 | 113 |
|
| 249 |
- - name: Run cryptounit test |
|
| 250 |
- run: ./unittests/crypto_testdriver.exe |
|
| 114 |
+ - name: Run crypto unit test |
|
| 115 |
+ run: ./unittests/test_crypto.exe |
|
| 251 | 116 |
|
| 252 |
- - name: Run miscunit test |
|
| 253 |
- run: ./unittests/misc_testdriver.exe |
|
| 117 |
+ - name: Run misc unit test |
|
| 118 |
+ run: ./unittests/test_misc.exe |
|
| 254 | 119 |
|
| 255 |
- - name: Run ncpunit test |
|
| 256 |
- run: ./unittests/ncp_testdriver.exe |
|
| 120 |
+ - name: Run ncp unit test |
|
| 121 |
+ run: ./unittests/test_ncp.exe |
|
| 257 | 122 |
|
| 258 |
- - name: Run packet idunit test |
|
| 259 |
- run: ./unittests/packet_id_testdriver.exe |
|
| 123 |
+ - name: Run packet id unit test |
|
| 124 |
+ run: ./unittests/test_packet_id.exe |
|
| 260 | 125 |
|
| 261 |
- - name: Run pktunit test |
|
| 262 |
- run: ./unittests/pkt_testdriver.exe |
|
| 126 |
+ - name: Run pkt unit test |
|
| 127 |
+ run: ./unittests/test_pkt.exe |
|
| 263 | 128 |
|
| 264 |
- - name: Run providerunit test |
|
| 265 |
- run: ./unittests/provider_testdriver.exe |
|
| 129 |
+ - name: Run provider unit test |
|
| 130 |
+ run: ./unittests/test_provider.exe |
|
| 266 | 131 |
|
| 267 | 132 |
ubuntu: |
| 268 | 133 |
strategy: |
| ... | ... |
@@ -411,60 +276,51 @@ jobs: |
| 411 | 411 |
strategy: |
| 412 | 412 |
fail-fast: false |
| 413 | 413 |
matrix: |
| 414 |
- plat: [ARM64, Win32, x64] |
|
| 415 |
- include: |
|
| 416 |
- - plat: ARM64 |
|
| 417 |
- triplet: arm64 |
|
| 418 |
- - plat: Win32 |
|
| 419 |
- triplet: x86 |
|
| 420 |
- - plat: x64 |
|
| 421 |
- triplet: x64 |
|
| 422 |
- |
|
| 423 |
- name: "msbuild - ${{matrix.triplet}} - openssl"
|
|
| 414 |
+ arch: [amd64, x86, arm64] |
|
| 415 |
+ |
|
| 416 |
+ name: "msbuild - ${{ matrix.arch }} - openssl"
|
|
| 424 | 417 |
env: |
| 425 | 418 |
BUILD_CONFIGURATION: Release |
| 426 |
- VCPKG_OVERLAY_PORTS: ${{ github.workspace }}/contrib/vcpkg-ports
|
|
| 427 |
- VCPKG_OVERLAY_TRIPLETS: ${{ github.workspace }}/contrib/vcpkg-triplets
|
|
| 428 | 419 |
|
| 429 | 420 |
runs-on: windows-latest |
| 430 | 421 |
steps: |
| 431 | 422 |
- uses: actions/checkout@v3 |
| 432 |
- |
|
| 433 |
- - name: Add MSBuild to PATH |
|
| 434 |
- uses: microsoft/setup-msbuild@v1.1 |
|
| 435 |
- |
|
| 436 |
- - name: Set up Python |
|
| 437 |
- uses: actions/setup-python@v4 |
|
| 438 |
- with: |
|
| 439 |
- python-version: '3.x' |
|
| 423 |
+ - uses: lukka/get-cmake@latest |
|
| 440 | 424 |
|
| 441 | 425 |
- name: Install rst2html |
| 442 |
- run: python -m pip install --upgrade pip rst2html |
|
| 426 |
+ run: python -m pip install --upgrade pip docutils |
|
| 443 | 427 |
|
| 444 | 428 |
- name: Restore artifacts, or setup vcpkg (do not install any package) |
| 445 | 429 |
uses: lukka/run-vcpkg@v10 |
| 446 | 430 |
with: |
| 447 | 431 |
vcpkgGitCommitId: 'd10d511f25620ca0f315cd83dcef6485efc63010' |
| 448 |
- vcpkgJsonGlob: '**/openvpn/vcpkg.json' |
|
| 449 |
- appendedCacheKey: '${{matrix.triplet}}'
|
|
| 432 |
+ vcpkgJsonGlob: '**/windows/vcpkg.json' |
|
| 433 |
+ appendedCacheKey: msvc_${{ matrix.arch }}
|
|
| 450 | 434 |
|
| 451 |
- - name: Run MSBuild consuming vcpkg.json |
|
| 452 |
- working-directory: ${{env.GITHUB_WORKSPACE}}
|
|
| 453 |
- run: | |
|
| 454 |
- # workaround for GHA runner bug where vcpkg installation is detected at c:\vcpkg |
|
| 455 |
- # see https://github.com/lukka/run-vcpkg/issues/170 |
|
| 456 |
- ${{ github.workspace }}/vcpkg/vcpkg.exe integrate install
|
|
| 457 |
- msbuild /m /p:Configuration=${{env.BUILD_CONFIGURATION}} /p:Platform="${{ matrix.plat }}" .
|
|
| 435 |
+ - name: Run CMake with vcpkg.json manifest (NO TESTS) |
|
| 436 |
+ uses: lukka/run-cmake@v10 |
|
| 437 |
+ if: ${{ matrix.arch == 'arm64' }}
|
|
| 438 |
+ with: |
|
| 439 |
+ configurePreset: win-${{ matrix.arch }}-release
|
|
| 440 |
+ buildPreset: win-${{ matrix.arch }}-release
|
|
| 441 |
+ |
|
| 442 |
+ - name: Run CMake with vcpkg.json manifest |
|
| 443 |
+ uses: lukka/run-cmake@v10 |
|
| 444 |
+ if: ${{ matrix.arch != 'arm64' }}
|
|
| 445 |
+ with: |
|
| 446 |
+ configurePreset: win-${{ matrix.arch }}-release
|
|
| 447 |
+ buildPreset: win-${{ matrix.arch }}-release
|
|
| 448 |
+ testPreset: win-${{ matrix.arch }}-release
|
|
| 458 | 449 |
|
| 459 |
- - name: Archive artifacts |
|
| 460 |
- uses: actions/upload-artifact@v3 |
|
| 450 |
+ - uses: actions/upload-artifact@v3 |
|
| 461 | 451 |
with: |
| 462 |
- name: artifacts-${{ matrix.plat }}
|
|
| 452 |
+ name: openvpn-msvc-${{ matrix.arch }}
|
|
| 463 | 453 |
path: | |
| 464 |
- ${{ matrix.plat }}-Output/${{env.BUILD_CONFIGURATION}}/*.exe
|
|
| 465 |
- ${{ matrix.plat }}-Output/${{env.BUILD_CONFIGURATION}}/*.dll
|
|
| 466 |
- ${{ matrix.plat }}-Output/${{env.BUILD_CONFIGURATION}}/*.pdb
|
|
| 467 |
- doc/openvpn.8.html |
|
| 454 |
+ ${{ github.workspace }}/out/**/*.exe
|
|
| 455 |
+ ${{ github.workspace }}/out/**/*.dll
|
|
| 456 |
+ !${{ github.workspace }}/out/**/test_*.exe
|
|
| 457 |
+ !${{ github.workspace }}/out/**/CMakeFiles/**
|
|
| 458 |
+ !${{ github.workspace }}/out/**/vcpkg_installed/**
|
|
| 468 | 459 |
|
| 469 | 460 |
trigger_openvpn_build: |
| 470 | 461 |
runs-on: windows-latest |
| ... | ... |
@@ -1,4 +1,5 @@ |
| 1 |
- cmake_minimum_required(VERSION 3.3) |
|
| 1 |
+cmake_minimum_required(VERSION 3.12) |
|
| 2 |
+set(CMAKE_CONFIGURATION_TYPES "Release;Debug;ASAN") |
|
| 2 | 3 |
project(openvpn) |
| 3 | 4 |
|
| 4 | 5 |
# This CMake file implements building OpenVPN with CMAKE |
| ... | ... |
@@ -11,10 +12,6 @@ project(openvpn) |
| 11 | 11 |
# and OpenSSL having version 1.1.1+ and generally does not offer the same |
| 12 | 12 |
# configurability like autoconf |
| 13 | 13 |
|
| 14 |
-# -DCMAKE_TOOLCHAIN_FILE=C:/Users/User/source/repos/vcpkg/scripts/buildsystems/vcpkg.cmake |
|
| 15 |
-#-DVCPKG_OVERLAY_PORTS=C:/Users/User/source/repos/openvpn/contrib/vcpkg-ports |
|
| 16 |
-#-GNinja |
|
| 17 |
- |
|
| 18 | 14 |
option(UNSUPPORTED_BUILDS "Allow unsupported builds" OFF) |
| 19 | 15 |
|
| 20 | 16 |
if (NOT WIN32 AND NOT ${UNSUPPORTED_BUILDS})
|
| ... | ... |
@@ -23,48 +20,83 @@ endif() |
| 23 | 23 |
|
| 24 | 24 |
option(MBED "BUILD with mbed" OFF) |
| 25 | 25 |
option(WOLFSSL "BUILD with wolfSSL" OFF) |
| 26 |
-if (MSVC) |
|
| 27 |
- option(USE_WERROR "Treat compiler warnings as errors (-Werror)" OFF) |
|
| 28 |
-else () |
|
| 29 |
- option(USE_WERROR "Treat compiler warnings as errors (-Werror)" ON) |
|
| 30 |
-endif () |
|
| 31 |
-option(PLUGIN_DIR "Location of the plugin directory" /usr/local/lib/openvpn/plugins) |
|
| 26 |
+option(ENABLE_LZ4 "BUILD with lz4" ON) |
|
| 27 |
+option(ENABLE_LZO "BUILD with lzo" ON) |
|
| 28 |
+option(ENABLE_PKCS11 "BUILD with pkcs11-helper" ON) |
|
| 29 |
+option(USE_WERROR "Treat compiler warnings as errors (-Werror)" ON) |
|
| 30 |
+ |
|
| 31 |
+set(PLUGIN_DIR /usr/local/lib/openvpn/plugins CACHE FILEPATH "Location of the plugin directory") |
|
| 32 | 32 |
|
| 33 | 33 |
# AddressSanitize - use CXX=clang++ CC=clang cmake -DCMAKE_BUILD_TYPE=asan to build with ASAN |
| 34 | 34 |
set(CMAKE_C_FLAGS_ASAN |
| 35 |
- "-fsanitize=address,undefined -fno-sanitize-recover=all -fno-optimize-sibling-calls -fsanitize-address-use-after-scope -fno-omit-frame-pointer -g -O1" |
|
| 36 |
- CACHE STRING "Flags used by the C compiler during AddressSanitizer builds." |
|
| 37 |
- FORCE) |
|
| 35 |
+ "-fsanitize=address,undefined -fno-sanitize-recover=all -fno-optimize-sibling-calls -fsanitize-address-use-after-scope -fno-omit-frame-pointer -g -O1" |
|
| 36 |
+ CACHE STRING "Flags used by the C compiler during AddressSanitizer builds." |
|
| 37 |
+ FORCE) |
|
| 38 | 38 |
set(CMAKE_CXX_FLAGS_ASAN |
| 39 |
- "-fsanitize=address,undefined -fno-sanitize-recover=all -fno-optimize-sibling-calls -fsanitize-address-use-after-scope -fno-omit-frame-pointer -g -O1" |
|
| 40 |
- CACHE STRING "Flags used by the C++ compiler during AddressSanitizer builds." |
|
| 41 |
- FORCE) |
|
| 39 |
+ "-fsanitize=address,undefined -fno-sanitize-recover=all -fno-optimize-sibling-calls -fsanitize-address-use-after-scope -fno-omit-frame-pointer -g -O1" |
|
| 40 |
+ CACHE STRING "Flags used by the C++ compiler during AddressSanitizer builds." |
|
| 41 |
+ FORCE) |
|
| 42 | 42 |
|
| 43 | 43 |
if (MSVC) |
| 44 |
- target_compile_options(${target} PRIVATE /W3)
|
|
| 44 |
+ add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE -D_WINSOCK_DEPRECATED_NO_WARNINGS) |
|
| 45 |
+ if (USE_WERROR) |
|
| 46 |
+ add_compile_options(/WX) |
|
| 47 |
+ endif () |
|
| 48 |
+ add_compile_options( |
|
| 49 |
+ /MP |
|
| 50 |
+ /W2 |
|
| 51 |
+ /sdl |
|
| 52 |
+ /Qspectre |
|
| 53 |
+ /guard:cf |
|
| 54 |
+ /FC |
|
| 55 |
+ /ZH:SHA_256 |
|
| 56 |
+ "$<$<CONFIG:Release>:/GL>" |
|
| 57 |
+ "$<$<CONFIG:Release>:/Oi>" |
|
| 58 |
+ "$<$<CONFIG:Release>:/Gy>" |
|
| 59 |
+ "$<$<CONFIG:Release>:/Zi>" |
|
| 60 |
+ ) |
|
| 61 |
+ add_link_options( |
|
| 62 |
+ "$<$<CONFIG:Release>:/LTCG:incremental>" |
|
| 63 |
+ "$<$<CONFIG:Release>:/DEBUG:FULL>" |
|
| 64 |
+ "$<$<CONFIG:Release>:/OPT:REF>" |
|
| 65 |
+ "$<$<CONFIG:Release>:/OPT:ICF>" |
|
| 66 |
+ ) |
|
| 67 |
+ if (${CMAKE_GENERATOR_PLATFORM} STREQUAL "x64" OR ${CMAKE_GENERATOR_PLATFORM} STREQUAL "x86")
|
|
| 68 |
+ add_link_options("$<$<CONFIG:Release>:/CETCOMPAT>")
|
|
| 69 |
+ endif() |
|
| 45 | 70 |
else () |
| 46 |
- add_compile_options(-Wall -Wuninitialized) |
|
| 71 |
+ set(CMAKE_C_FLAGS_RELEASE "-O2") |
|
| 72 |
+ set(CMAKE_CXX_FLAGS_RELEASE "-O2") |
|
| 73 |
+ set(CMAKE_C_FLAGS_DEBUG "-g -O1") |
|
| 74 |
+ set(CMAKE_CXX_FLAGS_DEBUG "-g -O1") |
|
| 75 |
+ add_compile_options(-Wall -Wuninitialized -Wno-stringop-truncation) |
|
| 47 | 76 |
# We are not ready for this |
| 48 |
- #add_compile_options(-Wsign-compare) |
|
| 77 |
+ #add_compile_options(-Wconversion -Wno-sign-conversion -Wsign-compare) |
|
| 78 |
+ if (USE_WERROR) |
|
| 79 |
+ add_compile_options(-Werror) |
|
| 80 |
+ endif () |
|
| 49 | 81 |
endif () |
| 50 | 82 |
|
| 51 |
-find_package(PkgConfig) |
|
| 52 |
-INCLUDE(CheckSymbolExists) |
|
| 53 |
-INCLUDE(CheckIncludeFiles) |
|
| 54 |
-INCLUDE(CheckTypeSize) |
|
| 55 |
-INCLUDE(CheckStructHasMember) |
|
| 83 |
+find_package(PkgConfig REQUIRED) |
|
| 84 |
+include(CheckSymbolExists) |
|
| 85 |
+include(CheckIncludeFiles) |
|
| 86 |
+include(CheckTypeSize) |
|
| 87 |
+include(CheckStructHasMember) |
|
| 88 |
+include(CTest) |
|
| 56 | 89 |
|
| 57 |
-set(OPENVPN_VERSION_MAJOR 2) |
|
| 58 |
-set(OPENVPN_VERSION_MINOR 6) |
|
| 59 |
-set(OPENVPN_VERSION_PATCH _git) |
|
| 90 |
+find_program(PYTHON NAMES python3 python) |
|
| 91 |
+execute_process( |
|
| 92 |
+ COMMAND ${PYTHON} ${CMAKE_CURRENT_SOURCE_DIR}/contrib/cmake/parse-version.m4.py ${CMAKE_CURRENT_SOURCE_DIR}/version.m4
|
|
| 93 |
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
|
| 94 |
+ ) |
|
| 95 |
+include(${CMAKE_CURRENT_BINARY_DIR}/version.cmake)
|
|
| 60 | 96 |
|
| 61 |
-if (NOT WIN32) |
|
| 62 |
- add_definitions(-DPLUGIN_LIBDIR=\"${PLUGIN_DIR}\")
|
|
| 63 |
-endif () |
|
| 64 |
- |
|
| 65 |
-# TODO remove later when msvc-config.h is removed and we can always include config.h |
|
| 66 |
-add_definitions(-DHAVE_CONFIG_H) |
|
| 97 |
+set(OPENVPN_VERSION_MAJOR ${PRODUCT_VERSION_MAJOR})
|
|
| 98 |
+set(OPENVPN_VERSION_MINOR ${PRODUCT_VERSION_MINOR})
|
|
| 99 |
+set(OPENVPN_VERSION_PATCH ${PRODUCT_VERSION_PATCH})
|
|
| 100 |
+set(OPENVPN_VERSION_RESOURCE ${PRODUCT_VERSION_RESOURCE})
|
|
| 67 | 101 |
|
| 102 |
+set(CMAKE_C_STANDARD 99) |
|
| 68 | 103 |
|
| 69 | 104 |
# Set the various defines for config.h.cmake.in |
| 70 | 105 |
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
| ... | ... |
@@ -97,139 +129,133 @@ elseif (WIN32) |
| 97 | 97 |
set(TARGET_WIN32 YES) |
| 98 | 98 |
endif () |
| 99 | 99 |
|
| 100 |
-CHECK_SYMBOL_EXISTS(chroot unistd.h HAVE_CHROOT) |
|
| 101 |
-CHECK_SYMBOL_EXISTS(chdir unistd.h HAVE_CHDIR) |
|
| 102 |
-CHECK_SYMBOL_EXISTS(dup unistd.h HAVE_DUP) |
|
| 103 |
-CHECK_SYMBOL_EXISTS(dup2 unistd.h HAVE_DUP2) |
|
| 104 |
-CHECK_SYMBOL_EXISTS(fork unistd.h HAVE_FORK) |
|
| 105 |
-CHECK_SYMBOL_EXISTS(execve unistd.h HAVE_EXECVE) |
|
| 106 |
-CHECK_SYMBOL_EXISTS(ftruncate unistd.h HAVE_FTRUNCATE) |
|
| 107 |
-CHECK_SYMBOL_EXISTS(setgid unistd.h HAVE_SETGID) |
|
| 108 |
-CHECK_SYMBOL_EXISTS(setuid unistd.h HAVE_SETUID) |
|
| 109 |
-CHECK_SYMBOL_EXISTS(getpeereid unistd.h HAVE_GETPEEREID) |
|
| 110 |
- |
|
| 111 |
-CHECK_SYMBOL_EXISTS(epoll_create sys/epoll.h HAVE_EPOLL_CREATE) |
|
| 112 |
- |
|
| 113 |
-CHECK_SYMBOL_EXISTS(gettimeofday sys/time.h HAVE_GETTIMEOFDAY) |
|
| 114 |
-CHECK_SYMBOL_EXISTS(basename libgen.h HAVE_BASENAME) |
|
| 115 |
-CHECK_SYMBOL_EXISTS(chsize io.h HAVE_CHSIZE) |
|
| 116 |
-CHECK_SYMBOL_EXISTS(daemon stdlib.h HAVE_DAEMON) |
|
| 117 |
-CHECK_SYMBOL_EXISTS(dirname libgen.h HAVE_DIRNAME) |
|
| 118 |
-CHECK_SYMBOL_EXISTS(getrlimit sys/resource.h HAVE_GETRLIMIT) |
|
| 119 |
-CHECK_SYMBOL_EXISTS(mlockall sys/mman.h HAVE_MLOCKALL) |
|
| 120 |
- |
|
| 121 |
-CHECK_SYMBOL_EXISTS(sendmsg sys/socket.h HAVE_SENDMSG) |
|
| 122 |
-CHECK_SYMBOL_EXISTS(recvmsg sys/socket.h HAVE_RECVMSG) |
|
| 123 |
-CHECK_SYMBOL_EXISTS(cmsghdr sys/socket.h HAVE_CMSGHDR) |
|
| 124 |
-CHECK_SYMBOL_EXISTS(openlog syslog.h HAVE_OPENLOG) |
|
| 125 |
-CHECK_SYMBOL_EXISTS(syslog syslog.h HAVE_SYSLOG) |
|
| 126 |
-CHECK_SYMBOL_EXISTS(getgrnam grp.h HAVE_GETGRNAM) |
|
| 127 |
-CHECK_SYMBOL_EXISTS(getpwnam pwd.h HAVE_GETPWNAM) |
|
| 128 |
-CHECK_SYMBOL_EXISTS(getsockname sys/socket.h HAVE_GETSOCKNAME) |
|
| 100 |
+check_symbol_exists(chroot unistd.h HAVE_CHROOT) |
|
| 101 |
+check_symbol_exists(chdir unistd.h HAVE_CHDIR) |
|
| 102 |
+check_symbol_exists(dup unistd.h HAVE_DUP) |
|
| 103 |
+check_symbol_exists(dup2 unistd.h HAVE_DUP2) |
|
| 104 |
+check_symbol_exists(fork unistd.h HAVE_FORK) |
|
| 105 |
+check_symbol_exists(execve unistd.h HAVE_EXECVE) |
|
| 106 |
+check_symbol_exists(ftruncate unistd.h HAVE_FTRUNCATE) |
|
| 107 |
+check_symbol_exists(setgid unistd.h HAVE_SETGID) |
|
| 108 |
+check_symbol_exists(setuid unistd.h HAVE_SETUID) |
|
| 109 |
+check_symbol_exists(getpeereid unistd.h HAVE_GETPEEREID) |
|
| 110 |
+ |
|
| 111 |
+check_symbol_exists(epoll_create sys/epoll.h HAVE_EPOLL_CREATE) |
|
| 112 |
+ |
|
| 113 |
+check_symbol_exists(gettimeofday sys/time.h HAVE_GETTIMEOFDAY) |
|
| 114 |
+check_symbol_exists(basename libgen.h HAVE_BASENAME) |
|
| 115 |
+check_symbol_exists(chsize io.h HAVE_CHSIZE) |
|
| 116 |
+check_symbol_exists(daemon stdlib.h HAVE_DAEMON) |
|
| 117 |
+check_symbol_exists(dirname libgen.h HAVE_DIRNAME) |
|
| 118 |
+check_symbol_exists(getrlimit sys/resource.h HAVE_GETRLIMIT) |
|
| 119 |
+check_symbol_exists(mlockall sys/mman.h HAVE_MLOCKALL) |
|
| 120 |
+ |
|
| 121 |
+check_symbol_exists(sendmsg sys/socket.h HAVE_SENDMSG) |
|
| 122 |
+check_symbol_exists(recvmsg sys/socket.h HAVE_RECVMSG) |
|
| 123 |
+check_symbol_exists(cmsghdr sys/socket.h HAVE_CMSGHDR) |
|
| 124 |
+check_symbol_exists(openlog syslog.h HAVE_OPENLOG) |
|
| 125 |
+check_symbol_exists(syslog syslog.h HAVE_SYSLOG) |
|
| 126 |
+check_symbol_exists(getgrnam grp.h HAVE_GETGRNAM) |
|
| 127 |
+check_symbol_exists(getpwnam pwd.h HAVE_GETPWNAM) |
|
| 128 |
+check_symbol_exists(getsockname sys/socket.h HAVE_GETSOCKNAME) |
|
| 129 | 129 |
|
| 130 | 130 |
# Some OS (e.g. FreeBSD) need some basic headers to allow |
| 131 | 131 |
# including network headers |
| 132 |
-SET(NETEXTRA sys/types.h) |
|
| 133 |
-CHECK_INCLUDE_FILES("${NETEXTRA};netinet/in.h" HAVE_NETINET_IN_H)
|
|
| 132 |
+set(NETEXTRA sys/types.h) |
|
| 133 |
+check_include_files("${NETEXTRA};netinet/in.h" HAVE_NETINET_IN_H)
|
|
| 134 | 134 |
|
| 135 | 135 |
if (HAVE_NETINET_IN_H) |
| 136 |
- LIST(APPEND NETEXTRA netinet/in.h) |
|
| 136 |
+ list(APPEND NETEXTRA netinet/in.h) |
|
| 137 | 137 |
endif () |
| 138 | 138 |
|
| 139 |
-CHECK_INCLUDE_FILES("${NETEXTRA};netinet/in6.h" HAVE_NETINET_IN_H)
|
|
| 140 |
-CHECK_INCLUDE_FILES(linux/if_tun.h HAVE_LINUX_IF_TUN_H) |
|
| 141 |
-CHECK_INCLUDE_FILES(linux/sockios.h HAVE_LINUX_SOCKIOS_H) |
|
| 142 |
-CHECK_INCLUDE_FILES(dlfcn.h HAVE_DLFCN_H) |
|
| 143 |
-CHECK_INCLUDE_FILES(fcntl.h HAVE_FCNTL_H) |
|
| 144 |
-CHECK_INCLUDE_FILES(dmalloc.h HAVE_DMALLOC_H) |
|
| 145 |
-CHECK_INCLUDE_FILES(err.h HAVE_ERR_H) |
|
| 146 |
-CHECK_INCLUDE_FILES(sys/epoll.h HAVE_SYS_EPOLL_H) |
|
| 147 |
-CHECK_INCLUDE_FILES(poll.h HAVE_POLL_H) |
|
| 148 |
-CHECK_INCLUDE_FILES(sys/socket.h HAVE_SYS_SOCKET_H) |
|
| 149 |
-CHECK_INCLUDE_FILES(sys/time.h HAVE_SYS_TIME_H) |
|
| 150 |
-CHECK_INCLUDE_FILES(netdb.h HAVE_NETDB_H) |
|
| 151 |
-CHECK_INCLUDE_FILES(unistd.h HAVE_UNISTD_H) |
|
| 152 |
-CHECK_INCLUDE_FILES(sys/un.h HAVE_SYS_UN_H) |
|
| 153 |
-CHECK_INCLUDE_FILES(libgen.h HAVE_LIBGEN_H) |
|
| 154 |
-CHECK_INCLUDE_FILES(net/if.h HAVE_NET_IF_H) |
|
| 155 |
-CHECK_INCLUDE_FILES("${NETEXTRA};netinet/ip.h" HAVE_NETINET_IP_H)
|
|
| 156 |
-CHECK_INCLUDE_FILES(arpa/inet.h HAVE_ARPA_INET_H) |
|
| 157 |
-CHECK_INCLUDE_FILES(net/if_utun.h HAVE_NET_UTUN_H) |
|
| 158 |
-CHECK_INCLUDE_FILES(sys/ioctl.h HAVE_SYS_IOCTL_H) |
|
| 159 |
-CHECK_INCLUDE_FILES(sys/inotify.h HAVE_SYS_INOTIFY_H) |
|
| 160 |
-CHECK_INCLUDE_FILES("${NETEXTRA};sys/uio.h" HAVE_SYS_UIO_H)
|
|
| 161 |
-CHECK_INCLUDE_FILES(syslog.h HAVE_SYSLOG_H) |
|
| 162 |
-CHECK_INCLUDE_FILES(sys/wait.h HAVE_SYS_WAIT_H) |
|
| 163 |
-CHECK_INCLUDE_FILES(grp.h HAVE_GRP_H) |
|
| 164 |
-CHECK_INCLUDE_FILES(pwd.h HAVE_PWD_H) |
|
| 165 |
-CHECK_INCLUDE_FILES(sys/mman.h HAVE_SYS_MMAN_H) |
|
| 166 |
- |
|
| 167 |
- |
|
| 168 |
-CHECK_INCLUDE_FILES("${NETEXTRA};resolv.h" HAVE_RESOLV_H)
|
|
| 169 |
-CHECK_INCLUDE_FILES("${NETEXTRA};net/if_tun.h" HAVE_NET_IF_TUN_H)
|
|
| 170 |
- |
|
| 171 |
-# Is this obscure header needed anywhere?! |
|
| 172 |
-CHECK_INCLUDE_FILES(netinet/in_systm.h HAVE_NETINET_IN_SYSTM_H) |
|
| 173 |
- |
|
| 174 |
- |
|
| 175 |
-SET(CMAKE_EXTRA_INCLUDE_FILES netinet/ip.h) |
|
| 176 |
-CHECK_TYPE_SIZE("struct in_pktinfo" IN_PKTINFO)
|
|
| 177 |
-CHECK_STRUCT_HAS_MEMBER("struct in_pktinfo" ipi_spec_dst netinet/ip.h HAVE_IPI_SPEC_DST)
|
|
| 178 |
-CHECK_TYPE_SIZE("struct msghdr" MSGHDR)
|
|
| 179 |
-SET(CMAKE_EXTRA_INCLUDE_FILES) |
|
| 139 |
+check_include_files("${NETEXTRA};netinet/in6.h" HAVE_NETINET_IN_H)
|
|
| 140 |
+check_include_files(linux/if_tun.h HAVE_LINUX_IF_TUN_H) |
|
| 141 |
+check_include_files(linux/sockios.h HAVE_LINUX_SOCKIOS_H) |
|
| 142 |
+check_include_files(dlfcn.h HAVE_DLFCN_H) |
|
| 143 |
+check_include_files(fcntl.h HAVE_FCNTL_H) |
|
| 144 |
+check_include_files(dmalloc.h HAVE_DMALLOC_H) |
|
| 145 |
+check_include_files(err.h HAVE_ERR_H) |
|
| 146 |
+check_include_files(sys/epoll.h HAVE_SYS_EPOLL_H) |
|
| 147 |
+check_include_files(poll.h HAVE_POLL_H) |
|
| 148 |
+check_include_files(sys/socket.h HAVE_SYS_SOCKET_H) |
|
| 149 |
+check_include_files(sys/time.h HAVE_SYS_TIME_H) |
|
| 150 |
+check_include_files(netdb.h HAVE_NETDB_H) |
|
| 151 |
+check_include_files(unistd.h HAVE_UNISTD_H) |
|
| 152 |
+check_include_files(sys/un.h HAVE_SYS_UN_H) |
|
| 153 |
+check_include_files(libgen.h HAVE_LIBGEN_H) |
|
| 154 |
+check_include_files(net/if.h HAVE_NET_IF_H) |
|
| 155 |
+check_include_files("${NETEXTRA};netinet/ip.h" HAVE_NETINET_IP_H)
|
|
| 156 |
+check_include_files(arpa/inet.h HAVE_ARPA_INET_H) |
|
| 157 |
+check_include_files(net/if_utun.h HAVE_NET_UTUN_H) |
|
| 158 |
+check_include_files(sys/ioctl.h HAVE_SYS_IOCTL_H) |
|
| 159 |
+check_include_files(sys/inotify.h HAVE_SYS_INOTIFY_H) |
|
| 160 |
+check_include_files("${NETEXTRA};sys/uio.h" HAVE_SYS_UIO_H)
|
|
| 161 |
+check_include_files(syslog.h HAVE_SYSLOG_H) |
|
| 162 |
+check_include_files(sys/wait.h HAVE_SYS_WAIT_H) |
|
| 163 |
+check_include_files(grp.h HAVE_GRP_H) |
|
| 164 |
+check_include_files(pwd.h HAVE_PWD_H) |
|
| 165 |
+check_include_files(sys/mman.h HAVE_SYS_MMAN_H) |
|
| 166 |
+ |
|
| 167 |
+ |
|
| 168 |
+check_include_files("${NETEXTRA};resolv.h" HAVE_RESOLV_H)
|
|
| 169 |
+check_include_files("${NETEXTRA};net/if_tun.h" HAVE_NET_IF_TUN_H)
|
|
| 170 |
+ |
|
| 171 |
+set(CMAKE_EXTRA_INCLUDE_FILES netinet/ip.h) |
|
| 172 |
+check_type_size("struct in_pktinfo" IN_PKTINFO)
|
|
| 173 |
+check_struct_has_member("struct in_pktinfo" ipi_spec_dst netinet/ip.h HAVE_IPI_SPEC_DST)
|
|
| 174 |
+check_type_size("struct msghdr" MSGHDR)
|
|
| 175 |
+set(CMAKE_EXTRA_INCLUDE_FILES) |
|
| 180 | 176 |
|
| 181 | 177 |
find_program(IFCONFIG_PATH ifconfig) |
| 182 | 178 |
find_program(IPROUTE_PATH ip) |
| 183 | 179 |
find_program(ROUTE_PATH route) |
| 184 | 180 |
|
| 181 |
+if (${ENABLE_LZ4})
|
|
| 182 |
+ pkg_search_module(liblz4 liblz4 REQUIRED IMPORTED_TARGET) |
|
| 183 |
+endif () |
|
| 185 | 184 |
|
| 186 |
-if (NOT WIN32) |
|
| 187 |
- set(ENABLE_LZ4 YES) |
|
| 188 |
- set(ENABLE_LZO YES) |
|
| 185 |
+if (${ENABLE_LZO})
|
|
| 186 |
+ pkg_search_module(lzo2 lzo2 REQUIRED IMPORTED_TARGET) |
|
| 187 |
+endif () |
|
| 188 |
+ |
|
| 189 |
+if (${ENABLE_PKCS11})
|
|
| 190 |
+ pkg_search_module(pkcs11-helper libpkcs11-helper-1 REQUIRED IMPORTED_TARGET) |
|
| 189 | 191 |
endif () |
| 190 | 192 |
|
| 191 | 193 |
function(add_library_deps target) |
| 192 | 194 |
if (${MBED})
|
| 193 |
- target_include_directories(${target} PRIVATE $ENV{HOME}/oss/mbedtls2/include)
|
|
| 194 |
- message("Building ${target} for mbed TLS")
|
|
| 195 |
- target_link_libraries(${target} PUBLIC -L$ENV{HOME}/oss/mbedtls2/library -L/usr/local/opt/lzo/lib -lmbedtls -lmbedx509 -lmbedcrypto)
|
|
| 195 |
+ target_link_libraries(${target} -lmbedtls -lmbedx509 -lmbedcrypto)
|
|
| 196 | 196 |
elseif (${WOLFSSL})
|
| 197 | 197 |
pkg_search_module(wolfssl wolfssl REQUIRED) |
| 198 | 198 |
target_link_libraries(${target} PUBLIC ${wolfssl_LINK_LIBRARIES})
|
| 199 | 199 |
target_include_directories(${target} PRIVATE ${wolfssl_INCLUDE_DIRS}/wolfssl)
|
| 200 |
- message("Building ${target} for WolfSSL: ${wolfssl_LINK_LIBRARIES} ${wolfssl_INCLUDE_DIRS}/wolfsll")
|
|
| 201 | 200 |
else () |
| 202 | 201 |
set(ENABLE_X509ALTUSERNAME YES) |
| 203 | 202 |
|
| 204 | 203 |
find_package(OpenSSL REQUIRED) |
| 205 |
- target_link_libraries(${target} PUBLIC OpenSSL::SSL)
|
|
| 206 |
- |
|
| 207 |
- message("Building ${target} for default OpenSSL")
|
|
| 208 |
- endif () |
|
| 209 |
- |
|
| 204 |
+ target_link_libraries(${target} PUBLIC OpenSSL::SSL OpenSSL::Crypto)
|
|
| 205 |
+ if (WIN32) |
|
| 206 |
+ target_link_libraries(${target} PUBLIC
|
|
| 207 |
+ ws2_32.lib crypt32.lib fwpuclnt.lib iphlpapi.lib |
|
| 208 |
+ wininet.lib setupapi.lib rpcrt4.lib wtsapi32.lib ncrypt.lib bcrypt.lib) |
|
| 209 |
+ endif () |
|
| 210 | 210 |
|
| 211 |
- if (${ENABLE_LZ4})
|
|
| 212 |
- pkg_search_module(liblz4 liblz4 REQUIRED IMPORTED_TARGET) |
|
| 213 |
- target_link_libraries(${target} PUBLIC PkgConfig::liblz4)
|
|
| 214 | 211 |
endif () |
| 215 | 212 |
|
| 216 |
- if (${ENABLE_LZO})
|
|
| 217 |
- pkg_search_module(lzo2 lzo2 REQUIRED IMPORTED_TARGET) |
|
| 218 |
- target_link_libraries(${target} PUBLIC PkgConfig::lzo2)
|
|
| 219 |
- endif () |
|
| 213 |
+ # optional dependencies |
|
| 214 |
+ target_link_libraries(${target} PUBLIC
|
|
| 215 |
+ $<TARGET_NAME_IF_EXISTS:PkgConfig::liblz4> |
|
| 216 |
+ $<TARGET_NAME_IF_EXISTS:PkgConfig::lzo2> |
|
| 217 |
+ $<TARGET_NAME_IF_EXISTS:PkgConfig::pkcs11-helper> |
|
| 218 |
+ ) |
|
| 220 | 219 |
|
| 221 | 220 |
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
| 222 |
- target_include_directories(${target} PUBLIC ${LIBNL_INCLUDE_DIRS})
|
|
| 223 |
- target_link_libraries(${target} PUBLIC ${LIBNL_LIBRARIES})
|
|
| 224 |
- endif () |
|
| 221 |
+ pkg_search_module(libcapng REQUIRED libcap-ng IMPORTED_TARGET) |
|
| 222 |
+ pkg_search_module(libnl REQUIRED libnl-genl-3.0 IMPORTED_TARGET) |
|
| 225 | 223 |
|
| 226 |
- if (USE_WERROR) |
|
| 227 |
- if (MSVC) |
|
| 228 |
- target_compile_options(${target} PRIVATE /WX)
|
|
| 229 |
- else () |
|
| 230 |
- target_compile_options(${target} PRIVATE -Werror)
|
|
| 231 |
- endif () |
|
| 224 |
+ target_link_libraries(${target} PUBLIC PkgConfig::libcapng PkgConfig::libnl)
|
|
| 232 | 225 |
endif () |
| 226 |
+ |
|
| 233 | 227 |
endfunction() |
| 234 | 228 |
|
| 235 | 229 |
if (${MBED})
|
| ... | ... |
@@ -245,240 +271,254 @@ endif () |
| 245 | 245 |
|
| 246 | 246 |
include_directories(${CMAKE_CURRENT_SOURCE_DIR} src/compat include)
|
| 247 | 247 |
|
| 248 |
-if (WIN32) |
|
| 249 |
- find_package(OpenSSL REQUIRED) |
|
| 250 |
- |
|
| 251 |
- link_libraries(OpenSSL::SSL OpenSSL::Crypto ws2_32.lib Crypt32.lib fwpuclnt.lib iphlpapi.lib |
|
| 252 |
- wininet.lib setupapi.lib rpcrt4.lib wtsapi32.lib Ncrypt.lib) |
|
| 253 |
- add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE -D _WINSOCK_DEPRECATED_NO_WARNINGS -D_CONSOLE) |
|
| 254 |
-endif () |
|
| 248 |
+add_custom_command( |
|
| 249 |
+ OUTPUT always_rebuild config-version.h |
|
| 250 |
+ COMMAND ${PYTHON} ${CMAKE_CURRENT_SOURCE_DIR}/contrib/cmake/git-version.py
|
|
| 251 |
+ ) |
|
| 252 |
+set(HAVE_CONFIG_VERSION_H YES) |
|
| 255 | 253 |
|
| 256 | 254 |
configure_file(config.h.cmake.in config.h) |
| 257 | 255 |
configure_file(include/openvpn-plugin.h.in openvpn-plugin.h) |
| 256 |
+# TODO remove later when msvc-config.h is removed and we can always include config.h |
|
| 257 |
+add_definitions(-DHAVE_CONFIG_H) |
|
| 258 | 258 |
|
| 259 | 259 |
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
| 260 | 260 |
|
| 261 |
-set(SOURCE_FILES |
|
| 262 |
- ${CMAKE_CURRENT_BINARY_DIR}/config.h
|
|
| 263 |
- ${CMAKE_CURRENT_BINARY_DIR}/openvpn-plugin.h
|
|
| 261 |
+add_subdirectory(doc) |
|
| 262 |
+add_subdirectory(src/openvpnmsica) |
|
| 263 |
+add_subdirectory(src/openvpnserv) |
|
| 264 |
+add_subdirectory(src/tapctl) |
|
| 264 | 265 |
|
| 265 |
- src/compat/compat-basename.c |
|
| 266 |
- src/compat/compat-daemon.c |
|
| 267 |
- src/compat/compat-dirname.c |
|
| 268 |
- src/compat/compat-gettimeofday.c |
|
| 269 |
- src/compat/compat-strsep.c |
|
| 270 |
- src/compat/compat-versionhelpers.h |
|
| 271 |
- src/openvpn/argv.c |
|
| 272 |
- src/openvpn/argv.h |
|
| 273 |
- src/openvpn/base64.c |
|
| 274 |
- src/openvpn/base64.h |
|
| 275 |
- src/openvpn/basic.h |
|
| 276 |
- src/openvpn/block_dns.h |
|
| 277 |
- src/openvpn/block_dns.c |
|
| 278 |
- src/openvpn/buffer.c |
|
| 279 |
- src/openvpn/buffer.h |
|
| 280 |
- src/openvpn/circ_list.h |
|
| 281 |
- src/openvpn/clinat.c |
|
| 282 |
- src/openvpn/clinat.h |
|
| 283 |
- src/openvpn/common.h |
|
| 284 |
- src/openvpn/comp-lz4.c |
|
| 285 |
- src/openvpn/comp-lz4.h |
|
| 286 |
- src/openvpn/comp.c |
|
| 287 |
- src/openvpn/comp.h |
|
| 288 |
- src/openvpn/compstub.c |
|
| 289 |
- src/openvpn/console.c |
|
| 290 |
- src/openvpn/console_builtin.c |
|
| 291 |
- src/openvpn/console.h |
|
| 292 |
- src/openvpn/crypto.c |
|
| 293 |
- src/openvpn/crypto.h |
|
| 294 |
- src/openvpn/crypto_backend.h |
|
| 295 |
- src/openvpn/crypto_openssl.c |
|
| 296 |
- src/openvpn/crypto_openssl.h |
|
| 297 |
- src/openvpn/crypto_mbedtls.c |
|
| 298 |
- src/openvpn/crypto_mbedtls.h |
|
| 299 |
- src/openvpn/cryptoapi.c |
|
| 300 |
- src/openvpn/cryptoapi.h |
|
| 301 |
- src/openvpn/dco.c |
|
| 302 |
- src/openvpn/dco.h |
|
| 303 |
- src/openvpn/dco_win.c |
|
| 304 |
- src/openvpn/dco_win.h |
|
| 305 |
- src/openvpn/dco_linux.c |
|
| 306 |
- src/openvpn/dco_linux.h |
|
| 307 |
- src/openvpn/dco_freebsd.c |
|
| 308 |
- src/openvpn/dco_freebsd.h |
|
| 309 |
- src/openvpn/dhcp.c |
|
| 310 |
- src/openvpn/dhcp.h |
|
| 311 |
- src/openvpn/dns.c |
|
| 312 |
- src/openvpn/dns.h |
|
| 313 |
- src/openvpn/errlevel.h |
|
| 314 |
- src/openvpn/env_set.c |
|
| 315 |
- src/openvpn/env_set.h |
|
| 316 |
- src/openvpn/error.c |
|
| 317 |
- src/openvpn/error.h |
|
| 318 |
- src/openvpn/event.c |
|
| 319 |
- src/openvpn/event.h |
|
| 320 |
- src/openvpn/fdmisc.c |
|
| 321 |
- src/openvpn/fdmisc.h |
|
| 322 |
- src/openvpn/forward.c |
|
| 323 |
- src/openvpn/forward.h |
|
| 324 |
- src/openvpn/fragment.c |
|
| 325 |
- src/openvpn/fragment.h |
|
| 326 |
- src/openvpn/gremlin.c |
|
| 327 |
- src/openvpn/gremlin.h |
|
| 328 |
- src/openvpn/helper.c |
|
| 329 |
- src/openvpn/helper.h |
|
| 330 |
- src/openvpn/httpdigest.c |
|
| 331 |
- src/openvpn/httpdigest.h |
|
| 332 |
- src/openvpn/init.c |
|
| 333 |
- src/openvpn/init.h |
|
| 334 |
- src/openvpn/integer.h |
|
| 335 |
- src/openvpn/interval.c |
|
| 336 |
- src/openvpn/interval.h |
|
| 337 |
- src/openvpn/list.c |
|
| 338 |
- src/openvpn/list.h |
|
| 339 |
- src/openvpn/lladdr.c |
|
| 340 |
- src/openvpn/lladdr.h |
|
| 341 |
- src/openvpn/lzo.c |
|
| 342 |
- src/openvpn/lzo.h |
|
| 343 |
- src/openvpn/manage.c |
|
| 344 |
- src/openvpn/manage.h |
|
| 345 |
- src/openvpn/mbuf.c |
|
| 346 |
- src/openvpn/mbuf.h |
|
| 347 |
- src/openvpn/memdbg.h |
|
| 348 |
- src/openvpn/misc.c |
|
| 349 |
- src/openvpn/misc.h |
|
| 350 |
- src/openvpn/mroute.c |
|
| 351 |
- src/openvpn/mroute.h |
|
| 352 |
- src/openvpn/mss.c |
|
| 353 |
- src/openvpn/mss.h |
|
| 354 |
- src/openvpn/mstats.c |
|
| 355 |
- src/openvpn/mstats.h |
|
| 356 |
- src/openvpn/mtcp.c |
|
| 357 |
- src/openvpn/mtcp.h |
|
| 358 |
- src/openvpn/mtu.c |
|
| 359 |
- src/openvpn/mtu.h |
|
| 360 |
- src/openvpn/mudp.c |
|
| 361 |
- src/openvpn/mudp.h |
|
| 362 |
- src/openvpn/multi.c |
|
| 363 |
- src/openvpn/multi.h |
|
| 364 |
- src/openvpn/ntlm.c |
|
| 365 |
- src/openvpn/ntlm.h |
|
| 366 |
- src/openvpn/occ.c |
|
| 367 |
- src/openvpn/occ.h |
|
| 368 |
- src/openvpn/openvpn.c |
|
| 369 |
- src/openvpn/openvpn.h |
|
| 370 |
- src/openvpn/options.c |
|
| 371 |
- src/openvpn/options.h |
|
| 372 |
- src/openvpn/options_util.c |
|
| 373 |
- src/openvpn/options_util.h |
|
| 374 |
- src/openvpn/otime.c |
|
| 375 |
- src/openvpn/otime.h |
|
| 376 |
- src/openvpn/ovpn_dco_win.h |
|
| 377 |
- src/openvpn/packet_id.c |
|
| 378 |
- src/openvpn/packet_id.h |
|
| 379 |
- src/openvpn/perf.c |
|
| 380 |
- src/openvpn/perf.h |
|
| 381 |
- src/openvpn/ping.c |
|
| 382 |
- src/openvpn/ping.h |
|
| 383 |
- src/openvpn/pkcs11.c |
|
| 384 |
- src/openvpn/pkcs11.h |
|
| 385 |
- src/openvpn/pkcs11_backend.h |
|
| 386 |
- src/openvpn/pkcs11_openssl.c |
|
| 387 |
- src/openvpn/pkcs11_mbedtls.c |
|
| 388 |
- src/openvpn/platform.c |
|
| 389 |
- src/openvpn/platform.h |
|
| 390 |
- src/openvpn/plugin.c |
|
| 391 |
- src/openvpn/plugin.h |
|
| 392 |
- src/openvpn/pool.c |
|
| 393 |
- src/openvpn/pool.h |
|
| 394 |
- src/openvpn/proto.c |
|
| 395 |
- src/openvpn/proto.h |
|
| 396 |
- src/openvpn/proxy.c |
|
| 397 |
- src/openvpn/proxy.h |
|
| 398 |
- src/openvpn/ps.c |
|
| 399 |
- src/openvpn/ps.h |
|
| 400 |
- src/openvpn/push.c |
|
| 401 |
- src/openvpn/push.h |
|
| 402 |
- src/openvpn/pushlist.h |
|
| 403 |
- src/openvpn/reliable.c |
|
| 404 |
- src/openvpn/reliable.h |
|
| 405 |
- src/openvpn/route.c |
|
| 406 |
- src/openvpn/route.h |
|
| 407 |
- src/openvpn/run_command.c |
|
| 408 |
- src/openvpn/run_command.h |
|
| 409 |
- src/openvpn/schedule.c |
|
| 410 |
- src/openvpn/schedule.h |
|
| 411 |
- src/openvpn/session_id.c |
|
| 412 |
- src/openvpn/session_id.h |
|
| 413 |
- src/openvpn/shaper.c |
|
| 414 |
- src/openvpn/shaper.h |
|
| 415 |
- src/openvpn/sig.c |
|
| 416 |
- src/openvpn/sig.h |
|
| 417 |
- src/openvpn/socket.c |
|
| 418 |
- src/openvpn/socket.h |
|
| 419 |
- src/openvpn/socks.c |
|
| 420 |
- src/openvpn/socks.h |
|
| 421 |
- src/openvpn/ssl.c |
|
| 422 |
- src/openvpn/ssl.h |
|
| 423 |
- src/openvpn/ssl_backend.h |
|
| 424 |
- src/openvpn/ssl_common.h |
|
| 425 |
- src/openvpn/ssl_openssl.c |
|
| 426 |
- src/openvpn/ssl_openssl.h |
|
| 427 |
- src/openvpn/ssl_mbedtls.c |
|
| 428 |
- src/openvpn/ssl_mbedtls.h |
|
| 429 |
- src/openvpn/ssl_verify.c |
|
| 430 |
- src/openvpn/ssl_verify.h |
|
| 431 |
- src/openvpn/ssl_verify_backend.h |
|
| 432 |
- src/openvpn/ssl_verify_openssl.c |
|
| 433 |
- src/openvpn/ssl_verify_openssl.h |
|
| 434 |
- src/openvpn/ssl_verify_mbedtls.c |
|
| 435 |
- src/openvpn/ssl_verify_mbedtls.h |
|
| 436 |
- src/openvpn/status.c |
|
| 437 |
- src/openvpn/status.h |
|
| 438 |
- src/openvpn/syshead.h |
|
| 439 |
- src/openvpn/tls_crypt.c |
|
| 440 |
- src/openvpn/tun.c |
|
| 441 |
- src/openvpn/tun.h |
|
| 442 |
- src/openvpn/networking_sitnl.c |
|
| 443 |
- src/openvpn/networking_freebsd.c |
|
| 444 |
- src/openvpn/auth_token.c |
|
| 445 |
- src/openvpn/auth_token.h |
|
| 446 |
- src/openvpn/ssl_ncp.c |
|
| 447 |
- src/openvpn/ssl_ncp.h |
|
| 448 |
- src/openvpn/ssl_pkt.c |
|
| 449 |
- src/openvpn/ssl_pkt.h |
|
| 450 |
- src/openvpn/ssl_util.c |
|
| 451 |
- src/openvpn/ssl_util.h |
|
| 452 |
- src/openvpn/vlan.c |
|
| 453 |
- src/openvpn/vlan.h |
|
| 454 |
- src/openvpn/win32.c |
|
| 455 |
- src/openvpn/win32-util.c |
|
| 456 |
- src/openvpn/win32.h |
|
| 457 |
- src/openvpn/win32-util.h |
|
| 458 |
- src/openvpn/xkey_helper.c |
|
| 459 |
- src/openvpn/xkey_provider.c |
|
| 460 |
- ) |
|
| 266 |
+set(SOURCE_FILES |
|
| 267 |
+ ${CMAKE_CURRENT_BINARY_DIR}/config.h
|
|
| 268 |
+ ${CMAKE_CURRENT_BINARY_DIR}/config-version.h
|
|
| 269 |
+ ${CMAKE_CURRENT_BINARY_DIR}/openvpn-plugin.h
|
|
| 270 |
+ |
|
| 271 |
+ src/compat/compat-basename.c |
|
| 272 |
+ src/compat/compat-daemon.c |
|
| 273 |
+ src/compat/compat-dirname.c |
|
| 274 |
+ src/compat/compat-gettimeofday.c |
|
| 275 |
+ src/compat/compat-strsep.c |
|
| 276 |
+ src/compat/compat-versionhelpers.h |
|
| 277 |
+ src/openvpn/argv.c |
|
| 278 |
+ src/openvpn/argv.h |
|
| 279 |
+ src/openvpn/base64.c |
|
| 280 |
+ src/openvpn/base64.h |
|
| 281 |
+ src/openvpn/basic.h |
|
| 282 |
+ src/openvpn/block_dns.h |
|
| 283 |
+ src/openvpn/block_dns.c |
|
| 284 |
+ src/openvpn/buffer.c |
|
| 285 |
+ src/openvpn/buffer.h |
|
| 286 |
+ src/openvpn/circ_list.h |
|
| 287 |
+ src/openvpn/clinat.c |
|
| 288 |
+ src/openvpn/clinat.h |
|
| 289 |
+ src/openvpn/common.h |
|
| 290 |
+ src/openvpn/comp-lz4.c |
|
| 291 |
+ src/openvpn/comp-lz4.h |
|
| 292 |
+ src/openvpn/comp.c |
|
| 293 |
+ src/openvpn/comp.h |
|
| 294 |
+ src/openvpn/compstub.c |
|
| 295 |
+ src/openvpn/console.c |
|
| 296 |
+ src/openvpn/console_builtin.c |
|
| 297 |
+ src/openvpn/console.h |
|
| 298 |
+ src/openvpn/crypto.c |
|
| 299 |
+ src/openvpn/crypto.h |
|
| 300 |
+ src/openvpn/crypto_backend.h |
|
| 301 |
+ src/openvpn/crypto_openssl.c |
|
| 302 |
+ src/openvpn/crypto_openssl.h |
|
| 303 |
+ src/openvpn/crypto_mbedtls.c |
|
| 304 |
+ src/openvpn/crypto_mbedtls.h |
|
| 305 |
+ src/openvpn/cryptoapi.c |
|
| 306 |
+ src/openvpn/cryptoapi.h |
|
| 307 |
+ src/openvpn/dco.c |
|
| 308 |
+ src/openvpn/dco.h |
|
| 309 |
+ src/openvpn/dco_win.c |
|
| 310 |
+ src/openvpn/dco_win.h |
|
| 311 |
+ src/openvpn/dco_linux.c |
|
| 312 |
+ src/openvpn/dco_linux.h |
|
| 313 |
+ src/openvpn/dco_freebsd.c |
|
| 314 |
+ src/openvpn/dco_freebsd.h |
|
| 315 |
+ src/openvpn/dhcp.c |
|
| 316 |
+ src/openvpn/dhcp.h |
|
| 317 |
+ src/openvpn/dns.c |
|
| 318 |
+ src/openvpn/dns.h |
|
| 319 |
+ src/openvpn/errlevel.h |
|
| 320 |
+ src/openvpn/env_set.c |
|
| 321 |
+ src/openvpn/env_set.h |
|
| 322 |
+ src/openvpn/error.c |
|
| 323 |
+ src/openvpn/error.h |
|
| 324 |
+ src/openvpn/event.c |
|
| 325 |
+ src/openvpn/event.h |
|
| 326 |
+ src/openvpn/fdmisc.c |
|
| 327 |
+ src/openvpn/fdmisc.h |
|
| 328 |
+ src/openvpn/forward.c |
|
| 329 |
+ src/openvpn/forward.h |
|
| 330 |
+ src/openvpn/fragment.c |
|
| 331 |
+ src/openvpn/fragment.h |
|
| 332 |
+ src/openvpn/gremlin.c |
|
| 333 |
+ src/openvpn/gremlin.h |
|
| 334 |
+ src/openvpn/helper.c |
|
| 335 |
+ src/openvpn/helper.h |
|
| 336 |
+ src/openvpn/httpdigest.c |
|
| 337 |
+ src/openvpn/httpdigest.h |
|
| 338 |
+ src/openvpn/init.c |
|
| 339 |
+ src/openvpn/init.h |
|
| 340 |
+ src/openvpn/integer.h |
|
| 341 |
+ src/openvpn/interval.c |
|
| 342 |
+ src/openvpn/interval.h |
|
| 343 |
+ src/openvpn/list.c |
|
| 344 |
+ src/openvpn/list.h |
|
| 345 |
+ src/openvpn/lladdr.c |
|
| 346 |
+ src/openvpn/lladdr.h |
|
| 347 |
+ src/openvpn/lzo.c |
|
| 348 |
+ src/openvpn/lzo.h |
|
| 349 |
+ src/openvpn/manage.c |
|
| 350 |
+ src/openvpn/manage.h |
|
| 351 |
+ src/openvpn/mbuf.c |
|
| 352 |
+ src/openvpn/mbuf.h |
|
| 353 |
+ src/openvpn/memdbg.h |
|
| 354 |
+ src/openvpn/misc.c |
|
| 355 |
+ src/openvpn/misc.h |
|
| 356 |
+ src/openvpn/mroute.c |
|
| 357 |
+ src/openvpn/mroute.h |
|
| 358 |
+ src/openvpn/mss.c |
|
| 359 |
+ src/openvpn/mss.h |
|
| 360 |
+ src/openvpn/mstats.c |
|
| 361 |
+ src/openvpn/mstats.h |
|
| 362 |
+ src/openvpn/mtcp.c |
|
| 363 |
+ src/openvpn/mtcp.h |
|
| 364 |
+ src/openvpn/mtu.c |
|
| 365 |
+ src/openvpn/mtu.h |
|
| 366 |
+ src/openvpn/mudp.c |
|
| 367 |
+ src/openvpn/mudp.h |
|
| 368 |
+ src/openvpn/multi.c |
|
| 369 |
+ src/openvpn/multi.h |
|
| 370 |
+ src/openvpn/ntlm.c |
|
| 371 |
+ src/openvpn/ntlm.h |
|
| 372 |
+ src/openvpn/occ.c |
|
| 373 |
+ src/openvpn/occ.h |
|
| 374 |
+ src/openvpn/openvpn.c |
|
| 375 |
+ src/openvpn/openvpn.h |
|
| 376 |
+ src/openvpn/openvpn_win32_resources.rc |
|
| 377 |
+ src/openvpn/options.c |
|
| 378 |
+ src/openvpn/options.h |
|
| 379 |
+ src/openvpn/options_util.c |
|
| 380 |
+ src/openvpn/options_util.h |
|
| 381 |
+ src/openvpn/otime.c |
|
| 382 |
+ src/openvpn/otime.h |
|
| 383 |
+ src/openvpn/ovpn_dco_win.h |
|
| 384 |
+ src/openvpn/packet_id.c |
|
| 385 |
+ src/openvpn/packet_id.h |
|
| 386 |
+ src/openvpn/perf.c |
|
| 387 |
+ src/openvpn/perf.h |
|
| 388 |
+ src/openvpn/ping.c |
|
| 389 |
+ src/openvpn/ping.h |
|
| 390 |
+ src/openvpn/pkcs11.c |
|
| 391 |
+ src/openvpn/pkcs11.h |
|
| 392 |
+ src/openvpn/pkcs11_backend.h |
|
| 393 |
+ src/openvpn/pkcs11_openssl.c |
|
| 394 |
+ src/openvpn/pkcs11_mbedtls.c |
|
| 395 |
+ src/openvpn/platform.c |
|
| 396 |
+ src/openvpn/platform.h |
|
| 397 |
+ src/openvpn/plugin.c |
|
| 398 |
+ src/openvpn/plugin.h |
|
| 399 |
+ src/openvpn/pool.c |
|
| 400 |
+ src/openvpn/pool.h |
|
| 401 |
+ src/openvpn/proto.c |
|
| 402 |
+ src/openvpn/proto.h |
|
| 403 |
+ src/openvpn/proxy.c |
|
| 404 |
+ src/openvpn/proxy.h |
|
| 405 |
+ src/openvpn/ps.c |
|
| 406 |
+ src/openvpn/ps.h |
|
| 407 |
+ src/openvpn/push.c |
|
| 408 |
+ src/openvpn/push.h |
|
| 409 |
+ src/openvpn/pushlist.h |
|
| 410 |
+ src/openvpn/reflect_filter.c |
|
| 411 |
+ src/openvpn/reflect_filter.h |
|
| 412 |
+ src/openvpn/reliable.c |
|
| 413 |
+ src/openvpn/reliable.h |
|
| 414 |
+ src/openvpn/route.c |
|
| 415 |
+ src/openvpn/route.h |
|
| 416 |
+ src/openvpn/run_command.c |
|
| 417 |
+ src/openvpn/run_command.h |
|
| 418 |
+ src/openvpn/schedule.c |
|
| 419 |
+ src/openvpn/schedule.h |
|
| 420 |
+ src/openvpn/session_id.c |
|
| 421 |
+ src/openvpn/session_id.h |
|
| 422 |
+ src/openvpn/shaper.c |
|
| 423 |
+ src/openvpn/shaper.h |
|
| 424 |
+ src/openvpn/sig.c |
|
| 425 |
+ src/openvpn/sig.h |
|
| 426 |
+ src/openvpn/socket.c |
|
| 427 |
+ src/openvpn/socket.h |
|
| 428 |
+ src/openvpn/socks.c |
|
| 429 |
+ src/openvpn/socks.h |
|
| 430 |
+ src/openvpn/ssl.c |
|
| 431 |
+ src/openvpn/ssl.h |
|
| 432 |
+ src/openvpn/ssl_backend.h |
|
| 433 |
+ src/openvpn/ssl_common.h |
|
| 434 |
+ src/openvpn/ssl_openssl.c |
|
| 435 |
+ src/openvpn/ssl_openssl.h |
|
| 436 |
+ src/openvpn/ssl_mbedtls.c |
|
| 437 |
+ src/openvpn/ssl_mbedtls.h |
|
| 438 |
+ src/openvpn/ssl_verify.c |
|
| 439 |
+ src/openvpn/ssl_verify.h |
|
| 440 |
+ src/openvpn/ssl_verify_backend.h |
|
| 441 |
+ src/openvpn/ssl_verify_openssl.c |
|
| 442 |
+ src/openvpn/ssl_verify_openssl.h |
|
| 443 |
+ src/openvpn/ssl_verify_mbedtls.c |
|
| 444 |
+ src/openvpn/ssl_verify_mbedtls.h |
|
| 445 |
+ src/openvpn/status.c |
|
| 446 |
+ src/openvpn/status.h |
|
| 447 |
+ src/openvpn/syshead.h |
|
| 448 |
+ src/openvpn/tls_crypt.c |
|
| 449 |
+ src/openvpn/tun.c |
|
| 450 |
+ src/openvpn/tun.h |
|
| 451 |
+ src/openvpn/networking_sitnl.c |
|
| 452 |
+ src/openvpn/networking_freebsd.c |
|
| 453 |
+ src/openvpn/auth_token.c |
|
| 454 |
+ src/openvpn/auth_token.h |
|
| 455 |
+ src/openvpn/ssl_ncp.c |
|
| 456 |
+ src/openvpn/ssl_ncp.h |
|
| 457 |
+ src/openvpn/ssl_pkt.c |
|
| 458 |
+ src/openvpn/ssl_pkt.h |
|
| 459 |
+ src/openvpn/ssl_util.c |
|
| 460 |
+ src/openvpn/ssl_util.h |
|
| 461 |
+ src/openvpn/vlan.c |
|
| 462 |
+ src/openvpn/vlan.h |
|
| 463 |
+ src/openvpn/win32.c |
|
| 464 |
+ src/openvpn/win32-util.c |
|
| 465 |
+ src/openvpn/win32.h |
|
| 466 |
+ src/openvpn/win32-util.h |
|
| 467 |
+ src/openvpn/xkey_helper.c |
|
| 468 |
+ src/openvpn/xkey_provider.c |
|
| 469 |
+ ) |
|
| 461 | 470 |
|
| 462 | 471 |
add_executable(openvpn ${SOURCE_FILES})
|
| 463 | 472 |
|
| 464 | 473 |
add_library_deps(openvpn) |
| 465 | 474 |
|
| 466 |
-if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
|
| 467 |
- target_link_libraries(openvpn PUBLIC -ldl) |
|
| 468 |
- |
|
| 469 |
- find_package(PkgConfig) |
|
| 470 |
- pkg_search_module(LIBNL REQUIRED libnl-genl-3.0) |
|
| 471 |
- |
|
| 472 |
- target_link_libraries(openvpn PUBLIC ${LIBNL_LIBRARIES})
|
|
| 473 |
- target_include_directories(openvpn PRIVATE ${LIBNL_INCLUDE_DIRS})
|
|
| 474 |
-endif () |
|
| 475 |
- |
|
| 476 |
- |
|
| 477 | 475 |
if (MINGW) |
| 476 |
+ target_compile_options(openvpn PRIVATE |
|
| 477 |
+ -DWIN32_LEAN_AND_MEAN |
|
| 478 |
+ -DNTDDI_VERSION=NTDDI_VISTA -D_WIN32_WINNT=_WIN32_WINNT_VISTA |
|
| 479 |
+ ) |
|
| 480 |
+ target_compile_options(openvpn PRIVATE -municode -UUNICODE) |
|
| 478 | 481 |
target_link_options(openvpn PRIVATE -municode) |
| 482 |
+endif() |
|
| 483 |
+ |
|
| 484 |
+if (MSVC) |
|
| 485 |
+ # we have our own manifest |
|
| 486 |
+ target_link_options(openvpn PRIVATE /MANIFEST:NO) |
|
| 487 |
+endif() |
|
| 488 |
+ |
|
| 489 |
+if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
|
| 490 |
+ target_link_libraries(openvpn PUBLIC -ldl) |
|
| 479 | 491 |
endif () |
| 480 | 492 |
|
| 481 | 493 |
if (NOT WIN32) |
| 494 |
+ target_compile_options(openvpn PRIVATE -DPLUGIN_LIBDIR=\"${PLUGIN_DIR}\")
|
|
| 495 |
+ |
|
| 482 | 496 |
find_library(resolv resolv) |
| 483 | 497 |
# some platform like BSDs already include resolver functionality in the libc and not have an extra resolv library |
| 484 | 498 |
if (${resolv} OR APPLE)
|
| ... | ... |
@@ -487,58 +527,155 @@ if (NOT WIN32) |
| 487 | 487 |
endif () |
| 488 | 488 |
|
| 489 | 489 |
|
| 490 |
-pkg_search_module(cmocka cmocka REQUIRED IMPORTED_TARGET) |
|
| 491 |
-enable_testing() |
|
| 490 |
+if (BUILD_TESTING) |
|
| 491 |
+ find_package(cmocka CONFIG) |
|
| 492 |
+ if (TARGET cmocka::cmocka) |
|
| 493 |
+ set(CMOCKA_LIBRARIES cmocka::cmocka) |
|
| 494 |
+ else () |
|
| 495 |
+ pkg_search_module(cmocka cmocka REQUIRED IMPORTED_TARGET) |
|
| 496 |
+ set(CMOCKA_LIBRARIES PkgConfig::cmocka) |
|
| 497 |
+ endif () |
|
| 492 | 498 |
|
| 493 |
-SET(unit_tests "test_packet_id" "test_crypto" "test_ncp" "test_auth_token" "test_misc" "test_buffer" "test_provider" "test_pkt") |
|
| 499 |
+ set(unit_tests |
|
| 500 |
+ "test_auth_token" |
|
| 501 |
+ "test_buffer" |
|
| 502 |
+ "test_crypto" |
|
| 503 |
+ "test_misc" |
|
| 504 |
+ "test_ncp" |
|
| 505 |
+ "test_packet_id" |
|
| 506 |
+ "test_pkt" |
|
| 507 |
+ "test_provider" |
|
| 508 |
+ ) |
|
| 494 | 509 |
|
| 495 |
-# These tests work on only on Linux since they depend on special linker features |
|
| 496 |
-if (WIN32) |
|
| 497 |
- LIST(APPEND unit_tests "test_cryptoapi") |
|
| 498 |
-elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
|
| 499 |
- LIST(APPEND unit_tests "test_networking" "test_tls_crypt" "test_argv") |
|
| 500 |
-endif () |
|
| 510 |
+ if (WIN32) |
|
| 511 |
+ list(APPEND unit_tests |
|
| 512 |
+ "test_cryptoapi" |
|
| 513 |
+ ) |
|
| 514 |
+ endif () |
|
| 515 |
+ |
|
| 516 |
+ if (NOT MSVC) |
|
| 517 |
+ # MSVC does not support --wrap |
|
| 518 |
+ list(APPEND unit_tests |
|
| 519 |
+ "test_argv" |
|
| 520 |
+ ) |
|
| 521 |
+ endif () |
|
| 522 |
+ |
|
| 523 |
+ # These tests work on only on Linux since they depend on special linker features |
|
| 524 |
+ if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
|
| 525 |
+ list(APPEND unit_tests |
|
| 526 |
+ "test_networking" |
|
| 527 |
+ "test_tls_crypt" |
|
| 528 |
+ ) |
|
| 529 |
+ endif () |
|
| 530 |
+ |
|
| 531 |
+ if (NOT WIN32 AND ${ENABLE_PKCS11})
|
|
| 532 |
+ set(_HAVE_SOFTHSM2 YES) |
|
| 533 |
+ find_program(P11TOOL p11tool) |
|
| 534 |
+ find_program(SOFTHSM2_UTIL softhsm2-util) |
|
| 535 |
+ find_library(SOFTHSM2_MODULE softhsm2 PATH_SUFFIXES softhsm) |
|
| 536 |
+ |
|
| 537 |
+ if (P11TOOL STREQUAL "P11TOOL-NOTFOUND") |
|
| 538 |
+ message(STATUS "p11tool not found, pkcs11 UT disabled") |
|
| 539 |
+ set(_HAVE_SOFTHSM2 NO) |
|
| 540 |
+ elseif (SOFTHSM2_UTIL STREQUAL "SOFTHSM2_UTIL-NOTFOUND") |
|
| 541 |
+ message(STATUS "softhsm2-util not found, pkcs11 UT disabled") |
|
| 542 |
+ set(_HAVE_SOFTHSM2 NO) |
|
| 543 |
+ elseif (SOFTHSM2_MODULE STREQUAL "SOFTHSM2_MODULE-NOTFOUND") |
|
| 544 |
+ message(STATUS "softhsm2 module not found, pkcs11 UT disabled") |
|
| 545 |
+ set(_HAVE_SOFTHSM2 NO) |
|
| 546 |
+ endif () |
|
| 501 | 547 |
|
| 548 |
+ if (_HAVE_SOFTHSM2) |
|
| 549 |
+ message(VERBOSE "pkcs11 UT enabled") |
|
| 550 |
+ list(APPEND unit_tests |
|
| 551 |
+ "test_pkcs11" |
|
| 552 |
+ ) |
|
| 553 |
+ endif () |
|
| 554 |
+ endif () |
|
| 502 | 555 |
|
| 503 |
-FOREACH (test_name ${unit_tests})
|
|
| 504 |
- add_executable(${test_name}
|
|
| 556 |
+ foreach (test_name ${unit_tests})
|
|
| 557 |
+ # test_networking needs special environment |
|
| 558 |
+ if (NOT ${test_name} STREQUAL "test_networking")
|
|
| 559 |
+ add_test(${test_name} ${test_name})
|
|
| 560 |
+ endif () |
|
| 561 |
+ add_executable(${test_name}
|
|
| 505 | 562 |
tests/unit_tests/openvpn/${test_name}.c
|
| 506 | 563 |
tests/unit_tests/openvpn/mock_msg.c |
| 564 |
+ tests/unit_tests/openvpn/mock_msg.h |
|
| 507 | 565 |
src/openvpn/platform.c |
| 508 |
- src/openvpn/crypto_mbedtls.c |
|
| 509 |
- src/openvpn/crypto_openssl.c |
|
| 510 |
- src/openvpn/crypto.c |
|
| 511 |
- src/openvpn/otime.c |
|
| 512 |
- src/openvpn/packet_id.c |
|
| 513 |
- src/openvpn/base64.c |
|
| 514 | 566 |
src/openvpn/win32-util.c |
| 515 |
- src/openvpn/mtu.c |
|
| 516 |
- src/openvpn/networking_sitnl.c |
|
| 517 |
- src/compat/compat-strsep.c |
|
| 518 | 567 |
src/compat/compat-gettimeofday.c |
| 519 |
- src/openvpn/ssl_util.c |
|
| 520 |
- src/openvpn/reliable.c |
|
| 521 |
- src/openvpn/session_id.c |
|
| 522 |
- src/openvpn/mss.c |
|
| 523 |
- src/openvpn/xkey_provider.c |
|
| 524 | 568 |
) |
| 525 | 569 |
|
| 526 |
- add_library_deps(${test_name})
|
|
| 527 |
- target_link_libraries(${test_name} PUBLIC PkgConfig::cmocka)
|
|
| 570 |
+ add_library_deps(${test_name})
|
|
| 571 |
+ target_link_libraries(${test_name} PUBLIC ${CMOCKA_LIBRARIES})
|
|
| 528 | 572 |
|
| 529 |
- target_include_directories(${test_name} PRIVATE src/openvpn)
|
|
| 573 |
+ target_include_directories(${test_name} PRIVATE src/openvpn)
|
|
| 530 | 574 |
|
| 531 |
- if (NOT ${test_name} STREQUAL "test_buffer")
|
|
| 532 |
- target_sources(${test_name} PRIVATE
|
|
| 575 |
+ if (NOT ${test_name} STREQUAL "test_buffer")
|
|
| 576 |
+ target_sources(${test_name} PRIVATE
|
|
| 533 | 577 |
src/openvpn/buffer.c |
| 534 | 578 |
) |
| 535 |
- endif () |
|
| 536 |
- add_test(NAME ${test_name} COMMAND ${test_name})
|
|
| 537 |
-ENDFOREACH () |
|
| 579 |
+ endif () |
|
| 580 |
+ |
|
| 581 |
+ endforeach() |
|
| 538 | 582 |
|
| 539 |
-target_sources(test_pkt PRIVATE |
|
| 583 |
+ target_sources(test_auth_token PRIVATE |
|
| 584 |
+ src/openvpn/base64.c |
|
| 585 |
+ src/openvpn/crypto_mbedtls.c |
|
| 586 |
+ src/openvpn/crypto_openssl.c |
|
| 587 |
+ src/openvpn/crypto.c |
|
| 588 |
+ src/openvpn/otime.c |
|
| 589 |
+ src/openvpn/packet_id.c |
|
| 590 |
+ ) |
|
| 591 |
+ |
|
| 592 |
+ target_sources(test_buffer PRIVATE |
|
| 593 |
+ tests/unit_tests/openvpn/mock_get_random.c |
|
| 594 |
+ ) |
|
| 595 |
+ |
|
| 596 |
+ target_sources(test_crypto PRIVATE |
|
| 597 |
+ src/openvpn/crypto_mbedtls.c |
|
| 598 |
+ src/openvpn/crypto_openssl.c |
|
| 599 |
+ src/openvpn/crypto.c |
|
| 600 |
+ src/openvpn/otime.c |
|
| 601 |
+ src/openvpn/packet_id.c |
|
| 602 |
+ src/openvpn/mtu.c |
|
| 603 |
+ src/openvpn/mss.c |
|
| 604 |
+ ) |
|
| 605 |
+ |
|
| 606 |
+ target_sources(test_misc PRIVATE |
|
| 607 |
+ tests/unit_tests/openvpn/mock_get_random.c |
|
| 608 |
+ src/openvpn/options_util.c |
|
| 609 |
+ src/openvpn/ssl_util.c |
|
| 610 |
+ ) |
|
| 611 |
+ |
|
| 612 |
+ target_sources(test_ncp PRIVATE |
|
| 613 |
+ src/openvpn/crypto_mbedtls.c |
|
| 614 |
+ src/openvpn/crypto_openssl.c |
|
| 615 |
+ src/openvpn/crypto.c |
|
| 616 |
+ src/openvpn/otime.c |
|
| 617 |
+ src/openvpn/packet_id.c |
|
| 618 |
+ src/openvpn/ssl_util.c |
|
| 619 |
+ src/compat/compat-strsep.c |
|
| 620 |
+ ) |
|
| 621 |
+ |
|
| 622 |
+ target_sources(test_packet_id PRIVATE |
|
| 623 |
+ tests/unit_tests/openvpn/mock_get_random.c |
|
| 624 |
+ src/openvpn/otime.c |
|
| 625 |
+ src/openvpn/packet_id.c |
|
| 626 |
+ src/openvpn/reliable.c |
|
| 627 |
+ src/openvpn/session_id.c |
|
| 628 |
+ ) |
|
| 629 |
+ |
|
| 630 |
+ target_sources(test_pkt PRIVATE |
|
| 540 | 631 |
src/openvpn/argv.c |
| 632 |
+ src/openvpn/base64.c |
|
| 633 |
+ src/openvpn/crypto_mbedtls.c |
|
| 634 |
+ src/openvpn/crypto_openssl.c |
|
| 635 |
+ src/openvpn/crypto.c |
|
| 541 | 636 |
src/openvpn/env_set.c |
| 637 |
+ src/openvpn/otime.c |
|
| 638 |
+ src/openvpn/packet_id.c |
|
| 542 | 639 |
src/openvpn/reliable.c |
| 543 | 640 |
src/openvpn/run_command.c |
| 544 | 641 |
src/openvpn/session_id.c |
| ... | ... |
@@ -546,46 +683,83 @@ target_sources(test_pkt PRIVATE |
| 546 | 546 |
src/openvpn/tls_crypt.c |
| 547 | 547 |
) |
| 548 | 548 |
|
| 549 |
-if (TARGET test_cryptoapi) |
|
| 550 |
- target_sources(test_cryptoapi PRIVATE |
|
| 551 |
- src/openvpn/xkey_helper.c |
|
| 552 |
- src/openvpn/xkey_provider.c |
|
| 553 |
- ) |
|
| 554 |
-endif () |
|
| 555 |
- |
|
| 556 |
-target_sources(test_provider PRIVATE |
|
| 549 |
+ target_sources(test_provider PRIVATE |
|
| 550 |
+ tests/unit_tests/openvpn/mock_get_random.c |
|
| 557 | 551 |
src/openvpn/xkey_provider.c |
| 558 | 552 |
src/openvpn/xkey_helper.c |
| 553 |
+ src/openvpn/base64.c |
|
| 559 | 554 |
) |
| 560 | 555 |
|
| 561 |
-target_sources(test_misc PRIVATE |
|
| 562 |
- src/openvpn/options_util.c |
|
| 563 |
- ) |
|
| 564 |
- |
|
| 565 |
-IF (TARGET test_tls_crypt) |
|
| 566 |
- target_sources(test_tls_crypt PRIVATE |
|
| 567 |
- src/openvpn/argv.c |
|
| 568 |
- src/openvpn/env_set.c |
|
| 569 |
- src/openvpn/run_command.c) |
|
| 570 |
-endif () |
|
| 571 |
- |
|
| 572 |
-if (TARGET test_argv) |
|
| 573 |
- target_sources(test_argv PRIVATE |
|
| 556 |
+ if (TARGET test_argv) |
|
| 557 |
+ target_link_options(test_argv PRIVATE -Wl,--wrap=parse_line) |
|
| 558 |
+ target_sources(test_argv PRIVATE |
|
| 559 |
+ tests/unit_tests/openvpn/mock_get_random.c |
|
| 574 | 560 |
src/openvpn/argv.c |
| 575 |
- src/openvpn/env_set.c |
|
| 576 |
- src/openvpn/run_command.c) |
|
| 577 |
-endif () |
|
| 561 |
+ ) |
|
| 562 |
+ endif () |
|
| 578 | 563 |
|
| 564 |
+ if (TARGET test_cryptoapi) |
|
| 565 |
+ target_sources(test_cryptoapi PRIVATE |
|
| 566 |
+ tests/unit_tests/openvpn/mock_get_random.c |
|
| 567 |
+ tests/unit_tests/openvpn/cert_data.h |
|
| 568 |
+ tests/unit_tests/openvpn/pkey_test_utils.c |
|
| 569 |
+ src/openvpn/xkey_provider.c |
|
| 570 |
+ src/openvpn/xkey_helper.c |
|
| 571 |
+ src/openvpn/base64.c |
|
| 572 |
+ ) |
|
| 573 |
+ endif () |
|
| 579 | 574 |
|
| 580 |
-FOREACH (test_name "networking" "tls_crypt" "argv") |
|
| 581 |
- if (TARGET test_${test_name})
|
|
| 582 |
- target_link_options(test_${test_name} PRIVATE -Wl,--wrap=parse_line)
|
|
| 575 |
+ if (TARGET test_networking) |
|
| 576 |
+ target_link_options(test_networking PRIVATE -Wl,--wrap=parse_line) |
|
| 577 |
+ target_compile_options(test_networking PRIVATE -UNDEBUG) |
|
| 578 |
+ target_sources(test_networking PRIVATE |
|
| 579 |
+ src/openvpn/networking_sitnl.c |
|
| 580 |
+ src/openvpn/crypto_mbedtls.c |
|
| 581 |
+ src/openvpn/crypto_openssl.c |
|
| 582 |
+ src/openvpn/crypto.c |
|
| 583 |
+ src/openvpn/otime.c |
|
| 584 |
+ src/openvpn/packet_id.c |
|
| 585 |
+ ) |
|
| 583 | 586 |
endif () |
| 584 |
-ENDFOREACH () |
|
| 585 | 587 |
|
| 586 |
-if (TARGET test_tls_crypt) |
|
| 587 |
- target_link_options("test_tls_crypt" PRIVATE
|
|
| 588 |
+ if (TARGET test_tls_crypt) |
|
| 589 |
+ target_link_options(test_tls_crypt PRIVATE -Wl,--wrap=parse_line) |
|
| 590 |
+ target_link_options(test_tls_crypt PRIVATE |
|
| 588 | 591 |
-Wl,--wrap=buffer_read_from_file |
| 589 | 592 |
-Wl,--wrap=buffer_write_file |
| 590 | 593 |
-Wl,--wrap=rand_bytes) |
| 591 |
-ENDIF () |
|
| 592 | 594 |
\ No newline at end of file |
| 595 |
+ target_sources(test_tls_crypt PRIVATE |
|
| 596 |
+ src/openvpn/argv.c |
|
| 597 |
+ src/openvpn/base64.c |
|
| 598 |
+ src/openvpn/crypto_mbedtls.c |
|
| 599 |
+ src/openvpn/crypto_openssl.c |
|
| 600 |
+ src/openvpn/crypto.c |
|
| 601 |
+ src/openvpn/env_set.c |
|
| 602 |
+ src/openvpn/otime.c |
|
| 603 |
+ src/openvpn/packet_id.c |
|
| 604 |
+ src/openvpn/run_command.c |
|
| 605 |
+ ) |
|
| 606 |
+ endif () |
|
| 607 |
+ |
|
| 608 |
+ if (TARGET test_pkcs11) |
|
| 609 |
+ target_compile_options(test_pkcs11 PRIVATE |
|
| 610 |
+ -DP11TOOL_PATH=\"${P11TOOL}\"
|
|
| 611 |
+ -DSOFTHSM2_MODULE_PATH=\"${SOFTHSM2_MODULE}\"
|
|
| 612 |
+ -DSOFTHSM2_UTIL_PATH=\"${SOFTHSM2_UTIL}\"
|
|
| 613 |
+ ) |
|
| 614 |
+ target_sources(test_pkcs11 PRIVATE |
|
| 615 |
+ tests/unit_tests/openvpn/mock_get_random.c |
|
| 616 |
+ tests/unit_tests/openvpn/pkey_test_utils.c |
|
| 617 |
+ src/openvpn/argv.c |
|
| 618 |
+ src/openvpn/base64.c |
|
| 619 |
+ src/openvpn/env_set.c |
|
| 620 |
+ src/openvpn/otime.c |
|
| 621 |
+ src/openvpn/pkcs11.c |
|
| 622 |
+ src/openvpn/pkcs11_openssl.c |
|
| 623 |
+ src/openvpn/run_command.c |
|
| 624 |
+ src/openvpn/xkey_helper.c |
|
| 625 |
+ src/openvpn/xkey_provider.c |
|
| 626 |
+ ) |
|
| 627 |
+ endif () |
|
| 628 |
+ |
|
| 629 |
+endif (BUILD_TESTING) |
| 593 | 630 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,228 @@ |
| 0 |
+{
|
|
| 1 |
+ "version": 3, |
|
| 2 |
+ "configurePresets": [ |
|
| 3 |
+ {
|
|
| 4 |
+ "name": "base", |
|
| 5 |
+ "hidden": true, |
|
| 6 |
+ "cacheVariables": {
|
|
| 7 |
+ "CMAKE_TOOLCHAIN_FILE": {
|
|
| 8 |
+ "value": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake",
|
|
| 9 |
+ "type": "FILEPATH" |
|
| 10 |
+ }, |
|
| 11 |
+ "VCPKG_OVERLAY_TRIPLETS": {
|
|
| 12 |
+ "value": "${sourceDir}/contrib/vcpkg-triplets",
|
|
| 13 |
+ "type": "FILEPATH" |
|
| 14 |
+ }, |
|
| 15 |
+ "VCPKG_OVERLAY_PORTS": {
|
|
| 16 |
+ "value": "${sourceDir}/contrib/vcpkg-ports",
|
|
| 17 |
+ "type": "FILEPATH" |
|
| 18 |
+ } |
|
| 19 |
+ } |
|
| 20 |
+ }, |
|
| 21 |
+ {
|
|
| 22 |
+ "name": "base-windows", |
|
| 23 |
+ "hidden": true, |
|
| 24 |
+ "binaryDir": "${sourceDir}/out/build/${presetName}",
|
|
| 25 |
+ "generator": "Visual Studio 17 2022", |
|
| 26 |
+ "cacheVariables": {
|
|
| 27 |
+ "VCPKG_MANIFEST_DIR": "${sourceDir}/contrib/vcpkg-manifests/windows",
|
|
| 28 |
+ "VCPKG_HOST_TRIPLET": "x64-windows" |
|
| 29 |
+ }, |
|
| 30 |
+ "vendor": { "microsoft.com/VisualStudioSettings/CMake/1.0": { "hostOS": [ "Windows" ] } }
|
|
| 31 |
+ }, |
|
| 32 |
+ {
|
|
| 33 |
+ "name": "base-mingw", |
|
| 34 |
+ "hidden": true, |
|
| 35 |
+ "generator": "Ninja Multi-Config", |
|
| 36 |
+ "cacheVariables": {
|
|
| 37 |
+ "CMAKE_SYSTEM_NAME": {
|
|
| 38 |
+ "value": "Windows", |
|
| 39 |
+ "type": "STRING" |
|
| 40 |
+ }, |
|
| 41 |
+ "VCPKG_MANIFEST_DIR": "${sourceDir}/contrib/vcpkg-manifests/mingw"
|
|
| 42 |
+ } |
|
| 43 |
+ }, |
|
| 44 |
+ {
|
|
| 45 |
+ "name": "x64", |
|
| 46 |
+ "hidden": true, |
|
| 47 |
+ "architecture": {
|
|
| 48 |
+ "value": "x64", |
|
| 49 |
+ "strategy": "set" |
|
| 50 |
+ }, |
|
| 51 |
+ "cacheVariables": {
|
|
| 52 |
+ "VCPKG_TARGET_TRIPLET": "x64-windows-ovpn" |
|
| 53 |
+ } |
|
| 54 |
+ }, |
|
| 55 |
+ {
|
|
| 56 |
+ "name": "x64-mingw", |
|
| 57 |
+ "hidden": true, |
|
| 58 |
+ "binaryDir": "out/build/mingw/x64", |
|
| 59 |
+ "cacheVariables": {
|
|
| 60 |
+ "CMAKE_C_COMPILER": {
|
|
| 61 |
+ "value": "x86_64-w64-mingw32-gcc", |
|
| 62 |
+ "type": "STRING" |
|
| 63 |
+ }, |
|
| 64 |
+ "CMAKE_CXX_COMPILER": {
|
|
| 65 |
+ "value": "x86_64-w64-mingw32-g++", |
|
| 66 |
+ "type": "STRING" |
|
| 67 |
+ }, |
|
| 68 |
+ "VCPKG_TARGET_TRIPLET": "x64-mingw-ovpn" |
|
| 69 |
+ } |
|
| 70 |
+ }, |
|
| 71 |
+ {
|
|
| 72 |
+ "name": "arm64", |
|
| 73 |
+ "hidden": true, |
|
| 74 |
+ "architecture": {
|
|
| 75 |
+ "value": "arm64", |
|
| 76 |
+ "strategy": "set" |
|
| 77 |
+ }, |
|
| 78 |
+ "cacheVariables": {
|
|
| 79 |
+ "VCPKG_TARGET_TRIPLET": "arm64-windows-ovpn" |
|
| 80 |
+ } |
|
| 81 |
+ }, |
|
| 82 |
+ {
|
|
| 83 |
+ "name": "x86", |
|
| 84 |
+ "hidden": true, |
|
| 85 |
+ "architecture": {
|
|
| 86 |
+ "value": "Win32", |
|
| 87 |
+ "strategy": "set" |
|
| 88 |
+ }, |
|
| 89 |
+ "cacheVariables": {
|
|
| 90 |
+ "VCPKG_TARGET_TRIPLET": "x86-windows-ovpn" |
|
| 91 |
+ } |
|
| 92 |
+ }, |
|
| 93 |
+ {
|
|
| 94 |
+ "name": "i686-mingw", |
|
| 95 |
+ "hidden": true, |
|
| 96 |
+ "binaryDir": "out/build/mingw/x86", |
|
| 97 |
+ "cacheVariables": {
|
|
| 98 |
+ "CMAKE_C_COMPILER": {
|
|
| 99 |
+ "value": "i686-w64-mingw32-gcc", |
|
| 100 |
+ "type": "STRING" |
|
| 101 |
+ }, |
|
| 102 |
+ "CMAKE_CXX_COMPILER": {
|
|
| 103 |
+ "value": "i686-w64-mingw32-g++", |
|
| 104 |
+ "type": "STRING" |
|
| 105 |
+ }, |
|
| 106 |
+ "VCPKG_TARGET_TRIPLET": "x86-mingw-ovpn" |
|
| 107 |
+ } |
|
| 108 |
+ }, |
|
| 109 |
+ {
|
|
| 110 |
+ "name": "debug", |
|
| 111 |
+ "hidden": true, |
|
| 112 |
+ "cacheVariables": {
|
|
| 113 |
+ "CMAKE_BUILD_TYPE": "Debug" |
|
| 114 |
+ } |
|
| 115 |
+ }, |
|
| 116 |
+ {
|
|
| 117 |
+ "name": "release", |
|
| 118 |
+ "hidden": true, |
|
| 119 |
+ "cacheVariables": {
|
|
| 120 |
+ "CMAKE_BUILD_TYPE": "Release" |
|
| 121 |
+ } |
|
| 122 |
+ }, |
|
| 123 |
+ {
|
|
| 124 |
+ "name": "mingw-x64", |
|
| 125 |
+ "inherits": [ "base", "base-mingw", "x64-mingw" ] |
|
| 126 |
+ }, |
|
| 127 |
+ {
|
|
| 128 |
+ "name": "mingw-x86", |
|
| 129 |
+ "inherits": [ "base", "base-mingw", "i686-mingw" ] |
|
| 130 |
+ }, |
|
| 131 |
+ {
|
|
| 132 |
+ "name": "win-amd64-release", |
|
| 133 |
+ "inherits": [ "base", "base-windows", "x64", "release" ] |
|
| 134 |
+ }, |
|
| 135 |
+ {
|
|
| 136 |
+ "name": "win-arm64-release", |
|
| 137 |
+ "inherits": [ "base", "base-windows", "arm64", "release" ] |
|
| 138 |
+ }, |
|
| 139 |
+ {
|
|
| 140 |
+ "name": "win-x86-release", |
|
| 141 |
+ "inherits": [ "base", "base-windows", "x86", "release" ] |
|
| 142 |
+ }, |
|
| 143 |
+ {
|
|
| 144 |
+ "name": "win-amd64-debug", |
|
| 145 |
+ "inherits": [ "base", "base-windows", "x64", "debug" ] |
|
| 146 |
+ }, |
|
| 147 |
+ {
|
|
| 148 |
+ "name": "win-arm64-debug", |
|
| 149 |
+ "inherits": [ "base", "base-windows", "arm64", "debug" ] |
|
| 150 |
+ }, |
|
| 151 |
+ {
|
|
| 152 |
+ "name": "win-x86-debug", |
|
| 153 |
+ "inherits": [ "base", "base-windows", "x86", "debug" ] |
|
| 154 |
+ }, |
|
| 155 |
+ {
|
|
| 156 |
+ "name": "unix-native", |
|
| 157 |
+ "generator": "Ninja Multi-Config", |
|
| 158 |
+ "binaryDir": "out/build/unix" |
|
| 159 |
+ } |
|
| 160 |
+ ], |
|
| 161 |
+ "buildPresets": [ |
|
| 162 |
+ {
|
|
| 163 |
+ "name": "mingw-x64", |
|
| 164 |
+ "configurePreset": "mingw-x64" |
|
| 165 |
+ }, |
|
| 166 |
+ {
|
|
| 167 |
+ "name": "mingw-x86", |
|
| 168 |
+ "configurePreset": "mingw-x86" |
|
| 169 |
+ }, |
|
| 170 |
+ {
|
|
| 171 |
+ "name": "win-amd64-release", |
|
| 172 |
+ "configurePreset": "win-amd64-release", |
|
| 173 |
+ "configuration": "Release" |
|
| 174 |
+ }, |
|
| 175 |
+ {
|
|
| 176 |
+ "name": "win-arm64-release", |
|
| 177 |
+ "configurePreset": "win-arm64-release", |
|
| 178 |
+ "configuration": "Release" |
|
| 179 |
+ }, |
|
| 180 |
+ {
|
|
| 181 |
+ "name": "win-x86-release", |
|
| 182 |
+ "configurePreset": "win-x86-release", |
|
| 183 |
+ "configuration": "Release" |
|
| 184 |
+ }, |
|
| 185 |
+ {
|
|
| 186 |
+ "name": "win-amd64-debug", |
|
| 187 |
+ "configurePreset": "win-amd64-debug", |
|
| 188 |
+ "configuration": "Debug" |
|
| 189 |
+ }, |
|
| 190 |
+ {
|
|
| 191 |
+ "name": "win-arm64-debug", |
|
| 192 |
+ "configurePreset": "win-arm64-debug", |
|
| 193 |
+ "configuration": "Debug" |
|
| 194 |
+ }, |
|
| 195 |
+ {
|
|
| 196 |
+ "name": "win-x86-debug", |
|
| 197 |
+ "configurePreset": "win-x86-debug", |
|
| 198 |
+ "configuration": "Debug" |
|
| 199 |
+ }, |
|
| 200 |
+ {
|
|
| 201 |
+ "name": "unix-native", |
|
| 202 |
+ "configurePreset": "unix-native" |
|
| 203 |
+ } |
|
| 204 |
+ ], |
|
| 205 |
+ "testPresets": [ |
|
| 206 |
+ {
|
|
| 207 |
+ "name": "win-amd64-release", |
|
| 208 |
+ "configurePreset": "win-amd64-release" |
|
| 209 |
+ }, |
|
| 210 |
+ {
|
|
| 211 |
+ "name": "win-x86-release", |
|
| 212 |
+ "configurePreset": "win-x86-release" |
|
| 213 |
+ }, |
|
| 214 |
+ {
|
|
| 215 |
+ "name": "win-amd64-debug", |
|
| 216 |
+ "configurePreset": "win-amd64-debug" |
|
| 217 |
+ }, |
|
| 218 |
+ {
|
|
| 219 |
+ "name": "win-x86-debug", |
|
| 220 |
+ "configurePreset": "win-x86-debug" |
|
| 221 |
+ }, |
|
| 222 |
+ {
|
|
| 223 |
+ "name": "unix-native", |
|
| 224 |
+ "configurePreset": "unix-native" |
|
| 225 |
+ } |
|
| 226 |
+ ] |
|
| 227 |
+} |
| ... | ... |
@@ -42,7 +42,7 @@ |
| 42 | 42 |
#define ENABLE_OFB_CFB_MODE |
| 43 | 43 |
|
| 44 | 44 |
/* Enable PKCS11 */ |
| 45 |
-/* #undef ENABLE_PKCS11 */ |
|
| 45 |
+#cmakedefine ENABLE_PKCS11 |
|
| 46 | 46 |
|
| 47 | 47 |
/* Enable plug-in support */ |
| 48 | 48 |
#define ENABLE_PLUGIN 1 |
| ... | ... |
@@ -83,6 +83,9 @@ |
| 83 | 83 |
/* struct cmsghdr needed for extended socket error support */ |
| 84 | 84 |
#cmakedefine HAVE_CMSGHDR |
| 85 | 85 |
|
| 86 |
+/* git version information in config-version.h */ |
|
| 87 |
+#cmakedefine HAVE_CONFIG_VERSION_H |
|
| 88 |
+ |
|
| 86 | 89 |
/* Define to 1 if you have the `daemon' function. */ |
| 87 | 90 |
#cmakedefine HAVE_DAEMON |
| 88 | 91 |
|
| ... | ... |
@@ -193,9 +196,6 @@ don't. */ |
| 193 | 193 |
/* Define to 1 if you have the <netinet/in.h> header file. */ |
| 194 | 194 |
#cmakedefine HAVE_NETINET_IN_H |
| 195 | 195 |
|
| 196 |
-/* Define to 1 if you have the <netinet/in_systm.h> header file. */ |
|
| 197 |
-#undef HAVE_NETINET_IN_SYSTM_H |
|
| 198 |
- |
|
| 199 | 196 |
/* Define to 1 if you have the <netinet/ip.h> header file. */ |
| 200 | 197 |
#cmakedefine HAVE_NETINET_IP_H |
| 201 | 198 |
|
| ... | ... |
@@ -398,14 +398,8 @@ don't. */ |
| 398 | 398 |
/* Path to route tool */ |
| 399 | 399 |
#define ROUTE_PATH "@ROUTE_PATH@" |
| 400 | 400 |
|
| 401 |
-/* OpenVPN major version - integer */ |
|
| 402 |
-#undef OPENVPN_VERSION_MAJOR |
|
| 403 |
- |
|
| 404 |
-/* OpenVPN minor version - integer */ |
|
| 405 |
-#undef OPENVPN_VERSION_MINOR |
|
| 406 |
- |
|
| 407 |
-/* OpenVPN patch level - may be a string or integer */ |
|
| 408 |
-#define OPENVPN_VERSION_PATCH "@OPENVPN_VERSION_PATCH@" |
|
| 401 |
+/* OpenVPN version in Windows resource format - string */ |
|
| 402 |
+#define OPENVPN_VERSION_RESOURCE @OPENVPN_VERSION_RESOURCE@ |
|
| 409 | 403 |
|
| 410 | 404 |
/* Name of package */ |
| 411 | 405 |
#define PACKAGE "openvpn" |
| ... | ... |
@@ -422,12 +416,6 @@ don't. */ |
| 422 | 422 |
/* Define to the version of this package. */ |
| 423 | 423 |
#define PACKAGE_VERSION "@OPENVPN_VERSION_MAJOR@.@OPENVPN_VERSION_MINOR@@OPENVPN_VERSION_PATCH@" |
| 424 | 424 |
|
| 425 |
-/* OpenVPN major version - integer */ |
|
| 426 |
-#define OPENVPN_VERSION_MAJOR @OPENVPN_VERSION_MAJOR@ |
|
| 427 |
- |
|
| 428 |
-/* OpenVPN minor version - integer */ |
|
| 429 |
-#define OPENVPN_VERSION_MINOR @OPENVPN_VERSION_MINOR@ |
|
| 430 |
- |
|
| 431 | 425 |
/* Path to systemd-ask-password tool */ |
| 432 | 426 |
#undef SYSTEMD_ASK_PASSWORD_PATH |
| 433 | 427 |
|
| ... | ... |
@@ -481,7 +469,6 @@ typedef SSIZE_T ssize_t; |
| 481 | 481 |
#define strncasecmp strnicmp |
| 482 | 482 |
#define strcasecmp _stricmp |
| 483 | 483 |
|
| 484 |
- |
|
| 485 | 484 |
#define S_IRUSR 0 |
| 486 | 485 |
#define S_IWUSR 0 |
| 487 | 486 |
#define R_OK 4 |
| 488 | 487 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,75 @@ |
| 0 |
+# |
|
| 1 |
+# OpenVPN -- An application to securely tunnel IP networks |
|
| 2 |
+# over a single UDP port, with support for SSL/TLS-based |
|
| 3 |
+# session authentication and key exchange, |
|
| 4 |
+# packet encryption, packet authentication, and |
|
| 5 |
+# packet compression. |
|
| 6 |
+# |
|
| 7 |
+# Copyright (C) 2022-2023 OpenVPN Inc <sales@openvpn.net> |
|
| 8 |
+# Copyright (C) 2022-2022 Lev Stipakov <lev@lestisoftware.fi> |
|
| 9 |
+# |
|
| 10 |
+# This program is free software; you can redistribute it and/or modify |
|
| 11 |
+# it under the terms of the GNU General Public License version 2 |
|
| 12 |
+# as published by the Free Software Foundation. |
|
| 13 |
+# |
|
| 14 |
+# This program is distributed in the hope that it will be useful, |
|
| 15 |
+# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 16 |
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 17 |
+# GNU General Public License for more details. |
|
| 18 |
+# |
|
| 19 |
+# You should have received a copy of the GNU General Public License along |
|
| 20 |
+# with this program; if not, write to the Free Software Foundation, Inc., |
|
| 21 |
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
|
| 22 |
+# |
|
| 23 |
+ |
|
| 24 |
+import os |
|
| 25 |
+import sys |
|
| 26 |
+import subprocess |
|
| 27 |
+ |
|
| 28 |
+def run_command(args): |
|
| 29 |
+ sp = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL) |
|
| 30 |
+ o, _ = sp.communicate() |
|
| 31 |
+ return o.decode("utf-8")[:-1]
|
|
| 32 |
+ |
|
| 33 |
+def get_branch_commit_id(): |
|
| 34 |
+ commit_id = run_command(["git", "rev-parse", "--short=16", "HEAD"]) |
|
| 35 |
+ if not commit_id: |
|
| 36 |
+ raise |
|
| 37 |
+ branch = run_command(["git", "describe", "--exact-match"]) |
|
| 38 |
+ if not branch: |
|
| 39 |
+ # this returns an array like ["master"] or ["release", "2.6"] |
|
| 40 |
+ branch = run_command(["git", "rev-parse", "--symbolic-full-name", "HEAD"]).split("/")[2:]
|
|
| 41 |
+ if not branch: |
|
| 42 |
+ branch = ["none"] |
|
| 43 |
+ branch = "/" .join(branch) # handle cases like release/2.6 |
|
| 44 |
+ |
|
| 45 |
+ return branch, commit_id |
|
| 46 |
+ |
|
| 47 |
+def main(): |
|
| 48 |
+ try: |
|
| 49 |
+ branch, commit_id = get_branch_commit_id() |
|
| 50 |
+ except: |
|
| 51 |
+ branch, commit_id = "unknown", "unknown" |
|
| 52 |
+ |
|
| 53 |
+ prev_content = "" |
|
| 54 |
+ |
|
| 55 |
+ name = os.path.join("%s" % (sys.argv[1] if len(sys.argv) > 1 else "."), "config-version.h")
|
|
| 56 |
+ try: |
|
| 57 |
+ with open(name, "r") as f: |
|
| 58 |
+ prev_content = f.read() |
|
| 59 |
+ except: |
|
| 60 |
+ # file doesn't exist |
|
| 61 |
+ pass |
|
| 62 |
+ |
|
| 63 |
+ content = "#define CONFIGURE_GIT_REVISION \"%s/%s\"\n" % (branch, commit_id) |
|
| 64 |
+ content += "#define CONFIGURE_GIT_FLAGS \"\"\n" |
|
| 65 |
+ |
|
| 66 |
+ if prev_content != content: |
|
| 67 |
+ print("Writing %s" % name)
|
|
| 68 |
+ with open(name, "w") as f: |
|
| 69 |
+ f.write(content) |
|
| 70 |
+ else: |
|
| 71 |
+ print("Content of %s hasn't changed" % name)
|
|
| 72 |
+ |
|
| 73 |
+if __name__ == "__main__": |
|
| 74 |
+ main() |
| 0 | 75 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,57 @@ |
| 0 |
+# |
|
| 1 |
+# OpenVPN -- An application to securely tunnel IP networks |
|
| 2 |
+# over a single UDP port, with support for SSL/TLS-based |
|
| 3 |
+# session authentication and key exchange, |
|
| 4 |
+# packet encryption, packet authentication, and |
|
| 5 |
+# packet compression. |
|
| 6 |
+# |
|
| 7 |
+# Copyright (C) 2022-2023 OpenVPN Inc <sales@openvpn.net> |
|
| 8 |
+# Copyright (C) 2022-2022 Lev Stipakov <lev@lestisoftware.fi> |
|
| 9 |
+# |
|
| 10 |
+# This program is free software; you can redistribute it and/or modify |
|
| 11 |
+# it under the terms of the GNU General Public License version 2 |
|
| 12 |
+# as published by the Free Software Foundation. |
|
| 13 |
+# |
|
| 14 |
+# This program is distributed in the hope that it will be useful, |
|
| 15 |
+# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 16 |
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 17 |
+# GNU General Public License for more details. |
|
| 18 |
+# |
|
| 19 |
+# You should have received a copy of the GNU General Public License along |
|
| 20 |
+# with this program; if not, write to the Free Software Foundation, Inc., |
|
| 21 |
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
|
| 22 |
+# |
|
| 23 |
+ |
|
| 24 |
+import os |
|
| 25 |
+import re |
|
| 26 |
+import sys |
|
| 27 |
+ |
|
| 28 |
+def main(): |
|
| 29 |
+ assert len(sys.argv) > 1 |
|
| 30 |
+ version_path = sys.argv[1] |
|
| 31 |
+ output = [] |
|
| 32 |
+ with open(version_path, 'r') as version_file: |
|
| 33 |
+ for line in version_file: |
|
| 34 |
+ match = re.match(r'[ \t]*define\(\[(.*)\],[ \t]*\[(.*)\]\)[ \t]*', line) |
|
| 35 |
+ if match is not None: |
|
| 36 |
+ output.append(match.expand(r'set(\1 \2)')) |
|
| 37 |
+ out_path = os.path.join("%s" % (sys.argv[2] if len(sys.argv) > 2 else "."), "version.cmake")
|
|
| 38 |
+ |
|
| 39 |
+ prev_content = "" |
|
| 40 |
+ try: |
|
| 41 |
+ with open(out_path, "r") as out_file: |
|
| 42 |
+ prev_content = out_file.read() |
|
| 43 |
+ except: |
|
| 44 |
+ # file doesn't exist |
|
| 45 |
+ pass |
|
| 46 |
+ |
|
| 47 |
+ content = "\n".join(output) + "\n" |
|
| 48 |
+ if prev_content != content: |
|
| 49 |
+ print("Writing %s" % out_path)
|
|
| 50 |
+ with open(out_path, "w") as out_file: |
|
| 51 |
+ out_file.write(content) |
|
| 52 |
+ else: |
|
| 53 |
+ print("Content of %s hasn't changed" % out_path)
|
|
| 54 |
+ |
|
| 55 |
+if __name__ == "__main__": |
|
| 56 |
+ main() |
| 0 | 57 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,13 @@ |
| 0 |
+{
|
|
| 1 |
+ "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg/master/scripts/vcpkg.schema.json", |
|
| 2 |
+ "name": "openvpn", |
|
| 3 |
+ "version": "2.7", |
|
| 4 |
+ "dependencies": [ |
|
| 5 |
+ "openssl", |
|
| 6 |
+ "tap-windows6", |
|
| 7 |
+ "lzo", |
|
| 8 |
+ "lz4", |
|
| 9 |
+ "pkcs11-helper", |
|
| 10 |
+ "cmocka" |
|
| 11 |
+ ] |
|
| 12 |
+} |
| 0 | 13 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,20 @@ |
| 0 |
+{
|
|
| 1 |
+ "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg/master/scripts/vcpkg.schema.json", |
|
| 2 |
+ "name": "openvpn", |
|
| 3 |
+ "version": "2.7", |
|
| 4 |
+ "dependencies": [ |
|
| 5 |
+ {
|
|
| 6 |
+ "name": "openssl", |
|
| 7 |
+ "features": ["tools"] |
|
| 8 |
+ }, |
|
| 9 |
+ "tap-windows6", |
|
| 10 |
+ "lzo", |
|
| 11 |
+ "lz4", |
|
| 12 |
+ "pkcs11-helper", |
|
| 13 |
+ "cmocka", |
|
| 14 |
+ {
|
|
| 15 |
+ "name": "pkgconf", |
|
| 16 |
+ "host": true |
|
| 17 |
+ } |
|
| 18 |
+ ] |
|
| 19 |
+} |
| ... | ... |
@@ -28,12 +28,28 @@ if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW) |
| 28 | 28 |
OPENSSL_HOME=${CURRENT_PACKAGES_DIR}/../openssl_${TARGET_TRIPLET}
|
| 29 | 29 |
) |
| 30 | 30 |
|
| 31 |
- file(INSTALL ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/lib/pkcs11-helper.dll.lib DESTINATION ${CURRENT_PACKAGES_DIR}/lib)
|
|
| 32 |
- file(INSTALL ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/lib/pkcs11-helper.dll.lib DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib)
|
|
| 31 |
+ file(INSTALL ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/lib/pkcs11-helper.dll.lib DESTINATION ${CURRENT_PACKAGES_DIR}/lib RENAME pkcs11-helper.lib)
|
|
| 32 |
+ file(INSTALL ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/lib/pkcs11-helper.dll.lib DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib RENAME pkcs11-helper.lib)
|
|
| 33 | 33 |
|
| 34 | 34 |
file(INSTALL ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/lib/libpkcs11-helper-1.dll DESTINATION ${CURRENT_PACKAGES_DIR}/bin)
|
| 35 | 35 |
file(INSTALL ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/lib/libpkcs11-helper-1.dll DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin)
|
| 36 | 36 |
|
| 37 |
+ set(PACKAGE_VERSION "${VERSION}")
|
|
| 38 |
+ set(libdir [[${prefix}/lib]])
|
|
| 39 |
+ set(exec_prefix [[${prefix}]])
|
|
| 40 |
+ set(PKCS11H_FEATURES key_prompt openssl engine_crypto_cryptoapi engine_crypto_openssl debug threading token data certificate slotevent engine_crypto) |
|
| 41 |
+ set(LIBS -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32) |
|
| 42 |
+ if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release") |
|
| 43 |
+ set(includedir [[${prefix}/include]])
|
|
| 44 |
+ set(outfile "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/libpkcs11-helper-1.pc")
|
|
| 45 |
+ configure_file("${SOURCE_PATH}/lib/libpkcs11-helper-1.pc.in" "${outfile}" @ONLY)
|
|
| 46 |
+ endif() |
|
| 47 |
+ if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") |
|
| 48 |
+ set(includedir [[${prefix}/../include]])
|
|
| 49 |
+ set(outfile "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/libpkcs11-helper-1.pc")
|
|
| 50 |
+ configure_file("${SOURCE_PATH}/lib/libpkcs11-helper-1.pc.in" "${outfile}" @ONLY)
|
|
| 51 |
+ endif() |
|
| 52 |
+ |
|
| 37 | 53 |
file(INSTALL ${SOURCE_PATH}/include/pkcs11-helper-1.0 DESTINATION ${CURRENT_PACKAGES_DIR}/include/)
|
| 38 | 54 |
|
| 39 | 55 |
else() |
| ... | ... |
@@ -45,11 +61,11 @@ else() |
| 45 | 45 |
--disable-crypto-engine-polarssl --disable-crypto-engine-mbedtls |
| 46 | 46 |
) |
| 47 | 47 |
vcpkg_install_make() |
| 48 |
- vcpkg_fixup_pkgconfig() |
|
| 49 | 48 |
|
| 50 | 49 |
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
|
| 51 | 50 |
endif() |
| 52 | 51 |
|
| 52 |
+vcpkg_fixup_pkgconfig() |
|
| 53 | 53 |
vcpkg_copy_pdbs() |
| 54 | 54 |
|
| 55 | 55 |
file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
|
| 56 | 56 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,80 @@ |
| 0 |
+set(_GENERATE_HTML_DOC YES) |
|
| 1 |
+set(_GENERATE_MAN_DOC YES) |
|
| 2 |
+find_program(RST2HTML NAMES rst2html rst2html.py) |
|
| 3 |
+find_program(RST2MAN NAMES rst2man rst2man.py) |
|
| 4 |
+ |
|
| 5 |
+if (RST2HTML STREQUAL "RST2HTML-NOTFOUND") |
|
| 6 |
+ message(STATUS "rst2html not found, not generating HTML documentation") |
|
| 7 |
+ set(_GENERATE_HTML_DOC NO) |
|
| 8 |
+endif () |
|
| 9 |
+if (RST2MAN STREQUAL "RST2MAN-NOTFOUND") |
|
| 10 |
+ message(STATUS "rst2man not found, not generating HTML documentation") |
|
| 11 |
+ set(_GENERATE_MAN_DOC NO) |
|
| 12 |
+endif () |
|
| 13 |
+ |
|
| 14 |
+set(OPENVPN_SECTIONS |
|
| 15 |
+ man-sections/advanced-options.rst |
|
| 16 |
+ man-sections/cipher-negotiation.rst |
|
| 17 |
+ man-sections/client-options.rst |
|
| 18 |
+ man-sections/connection-profiles.rst |
|
| 19 |
+ man-sections/encryption-options.rst |
|
| 20 |
+ man-sections/generic-options.rst |
|
| 21 |
+ man-sections/inline-files.rst |
|
| 22 |
+ man-sections/link-options.rst |
|
| 23 |
+ man-sections/log-options.rst |
|
| 24 |
+ man-sections/management-options.rst |
|
| 25 |
+ man-sections/network-config.rst |
|
| 26 |
+ man-sections/pkcs11-options.rst |
|
| 27 |
+ man-sections/plugin-options.rst |
|
| 28 |
+ man-sections/protocol-options.rst |
|
| 29 |
+ man-sections/proxy-options.rst |
|
| 30 |
+ man-sections/renegotiation.rst |
|
| 31 |
+ man-sections/signals.rst |
|
| 32 |
+ man-sections/script-options.rst |
|
| 33 |
+ man-sections/server-options.rst |
|
| 34 |
+ man-sections/tls-options.rst |
|
| 35 |
+ man-sections/unsupported-options.rst |
|
| 36 |
+ man-sections/virtual-routing-and-forwarding.rst |
|
| 37 |
+ man-sections/vpn-network-options.rst |
|
| 38 |
+ man-sections/windows-options.rst |
|
| 39 |
+ ) |
|
| 40 |
+ |
|
| 41 |
+set(OPENVPN_EXAMPLES_SECTIONS |
|
| 42 |
+ man-sections/example-fingerprint.rst |
|
| 43 |
+ man-sections/examples.rst |
|
| 44 |
+ ) |
|
| 45 |
+ |
|
| 46 |
+set(RST_FLAGS --strict) |
|
| 47 |
+ |
|
| 48 |
+if (_GENERATE_HTML_DOC) |
|
| 49 |
+ list(APPEND ALL_DOCS openvpn.8.html openvpn-examples.5.html) |
|
| 50 |
+ add_custom_command( |
|
| 51 |
+ OUTPUT openvpn.8.html |
|
| 52 |
+ COMMAND ${PYTHON} ${RST2HTML} ${RST_FLAGS} ${CMAKE_CURRENT_SOURCE_DIR}/openvpn.8.rst ${CMAKE_CURRENT_BINARY_DIR}/openvpn.8.html
|
|
| 53 |
+ MAIN_DEPENDENCY openvpn.8.rst |
|
| 54 |
+ DEPENDS ${OPENVPN_SECTIONS}
|
|
| 55 |
+ ) |
|
| 56 |
+ add_custom_command( |
|
| 57 |
+ OUTPUT openvpn-examples.5.html |
|
| 58 |
+ COMMAND ${PYTHON} ${RST2HTML} ${RST_FLAGS} ${CMAKE_CURRENT_SOURCE_DIR}/openvpn-examples.5.rst ${CMAKE_CURRENT_BINARY_DIR}/openvpn-examples.5.html
|
|
| 59 |
+ MAIN_DEPENDENCY openvpn-examples.5.rst |
|
| 60 |
+ DEPENDS ${OPENVPN_EXAMPLES_SECTIONS}
|
|
| 61 |
+ ) |
|
| 62 |
+endif () |
|
| 63 |
+if (_GENERATE_MAN_DOC) |
|
| 64 |
+ list(APPEND ALL_DOCS openvpn.8 openvpn-examples.5) |
|
| 65 |
+ add_custom_command( |
|
| 66 |
+ OUTPUT openvpn.8 |
|
| 67 |
+ COMMAND ${PYTHON} ${RST2MAN} ${RST_FLAGS} ${CMAKE_CURRENT_SOURCE_DIR}/openvpn.8.rst ${CMAKE_CURRENT_BINARY_DIR}/openvpn.8
|
|
| 68 |
+ MAIN_DEPENDENCY openvpn.8.rst |
|
| 69 |
+ DEPENDS ${OPENVPN_SECTIONS}
|
|
| 70 |
+ ) |
|
| 71 |
+ add_custom_command( |
|
| 72 |
+ OUTPUT openvpn-examples.5 |
|
| 73 |
+ COMMAND ${PYTHON} ${RST2MAN} ${RST_FLAGS} ${CMAKE_CURRENT_SOURCE_DIR}/openvpn-examples.5.rst ${CMAKE_CURRENT_BINARY_DIR}/openvpn-examples.5
|
|
| 74 |
+ MAIN_DEPENDENCY openvpn-examples.5.rst |
|
| 75 |
+ DEPENDS ${OPENVPN_EXAMPLES_SECTIONS}
|
|
| 76 |
+ ) |
|
| 77 |
+endif () |
|
| 78 |
+ |
|
| 79 |
+add_custom_target(documentation ALL DEPENDS ${ALL_DOCS})
|
| 70 | 71 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,36 @@ |
| 0 |
+if (NOT WIN32) |
|
| 1 |
+ return () |
|
| 2 |
+endif () |
|
| 3 |
+ |
|
| 4 |
+project(openvpnmsica) |
|
| 5 |
+ |
|
| 6 |
+add_library(openvpnmsica SHARED) |
|
| 7 |
+ |
|
| 8 |
+target_include_directories(openvpnmsica PRIVATE |
|
| 9 |
+ ${CMAKE_CURRENT_BINARY_DIR}/../../
|
|
| 10 |
+ ../../include/ |
|
| 11 |
+ ../compat/ |
|
| 12 |
+ ) |
|
| 13 |
+target_sources(openvpnmsica PRIVATE |
|
| 14 |
+ dllmain.c |
|
| 15 |
+ msiex.c msiex.h |
|
| 16 |
+ msica_arg.c msica_arg.h |
|
| 17 |
+ openvpnmsica.c openvpnmsica.h |
|
| 18 |
+ ../tapctl/basic.h |
|
| 19 |
+ ../tapctl/error.c ../tapctl/error.h |
|
| 20 |
+ ../tapctl/tap.c ../tapctl/tap.h |
|
| 21 |
+ openvpnmsica_resources.rc |
|
| 22 |
+ ) |
|
| 23 |
+target_compile_options(openvpnmsica PRIVATE |
|
| 24 |
+ -D_UNICODE |
|
| 25 |
+ -UNTDDI_VERSION |
|
| 26 |
+ -D_WIN32_WINNT=_WIN32_WINNT_VISTA |
|
| 27 |
+ ) |
|
| 28 |
+target_link_libraries(openvpnmsica |
|
| 29 |
+ advapi32.lib ole32.lib msi.lib setupapi.lib iphlpapi.lib shell32.lib shlwapi.lib version.lib newdev.lib) |
|
| 30 |
+if (MINGW) |
|
| 31 |
+ target_compile_options(openvpnmsica PRIVATE -municode) |
|
| 32 |
+ target_link_options(openvpnmsica PRIVATE -municode) |
|
| 33 |
+ target_link_options(openvpnmsica PRIVATE |
|
| 34 |
+ -Wl,--kill-at) |
|
| 35 |
+endif () |
| 40 | 43 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,34 @@ |
| 0 |
+if (NOT WIN32) |
|
| 1 |
+ return () |
|
| 2 |
+endif () |
|
| 3 |
+ |
|
| 4 |
+project(openvpnserv) |
|
| 5 |
+ |
|
| 6 |
+add_executable(openvpnserv) |
|
| 7 |
+ |
|
| 8 |
+target_include_directories(openvpnserv PRIVATE |
|
| 9 |
+ ${CMAKE_CURRENT_BINARY_DIR}/../../
|
|
| 10 |
+ ../../include/ |
|
| 11 |
+ ../openvpn/ |
|
| 12 |
+ ../compat/ |
|
| 13 |
+ ) |
|
| 14 |
+target_sources(openvpnserv PRIVATE |
|
| 15 |
+ common.c |
|
| 16 |
+ interactive.c |
|
| 17 |
+ service.c service.h |
|
| 18 |
+ validate.c validate.h |
|
| 19 |
+ ../openvpn/block_dns.c ../openvpn/block_dns.h |
|
| 20 |
+ openvpnserv_resources.rc |
|
| 21 |
+ ../openvpn/ring_buffer.h |
|
| 22 |
+ ) |
|
| 23 |
+target_compile_options(openvpnserv PRIVATE |
|
| 24 |
+ -D_UNICODE |
|
| 25 |
+ -UNTDDI_VERSION |
|
| 26 |
+ -D_WIN32_WINNT=_WIN32_WINNT_VISTA |
|
| 27 |
+ ) |
|
| 28 |
+target_link_libraries(openvpnserv |
|
| 29 |
+ advapi32.lib userenv.lib iphlpapi.lib fwpuclnt.lib rpcrt4.lib shlwapi.lib netapi32.lib ws2_32.lib ntdll.lib) |
|
| 30 |
+if (MINGW) |
|
| 31 |
+ target_compile_options(openvpnserv PRIVATE -municode) |
|
| 32 |
+ target_link_options(openvpnserv PRIVATE -municode) |
|
| 33 |
+endif () |
| 25 | 28 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,31 @@ |
| 0 |
+if (NOT WIN32) |
|
| 1 |
+ return () |
|
| 2 |
+endif () |
|
| 3 |
+ |
|
| 4 |
+project(tapctl) |
|
| 5 |
+ |
|
| 6 |
+add_executable(tapctl) |
|
| 7 |
+ |
|
| 8 |
+target_include_directories(tapctl PRIVATE |
|
| 9 |
+ ${CMAKE_CURRENT_BINARY_DIR}/../../
|
|
| 10 |
+ ../../include/ |
|
| 11 |
+ ../compat/ |
|
| 12 |
+ ) |
|
| 13 |
+target_sources(tapctl PRIVATE |
|
| 14 |
+ basic.h |
|
| 15 |
+ error.c error.h |
|
| 16 |
+ main.c |
|
| 17 |
+ tap.c tap.h |
|
| 18 |
+ tapctl_resources.rc |
|
| 19 |
+ ) |
|
| 20 |
+target_compile_options(tapctl PRIVATE |
|
| 21 |
+ -D_UNICODE |
|
| 22 |
+ -UNTDDI_VERSION |
|
| 23 |
+ -D_WIN32_WINNT=_WIN32_WINNT_VISTA |
|
| 24 |
+ ) |
|
| 25 |
+target_link_libraries(tapctl |
|
| 26 |
+ advapi32.lib ole32.lib setupapi.lib) |
|
| 27 |
+if (MINGW) |
|
| 28 |
+ target_compile_options(tapctl PRIVATE -municode) |
|
| 29 |
+ target_link_options(tapctl PRIVATE -municode) |
|
| 30 |
+endif () |