Browse Source

CMake: add ASAN build configuration

Add ASAN build configuration, based on debug with ASAN
enabled. This might help finding crashes like in
https://github.com/OpenVPN/openvpn-gui/issues/548

Signed-off-by: Lev Stipakov <lev@openvpn.net>
pull/652/head
Lev Stipakov 1 year ago committed by Lev Stipakov
parent
commit
441280a8ff
  1. 19
      .github/workflows/msbuild.yml
  2. 23
      CMakeLists.txt
  3. 5
      CMakePresets.json

19
.github/workflows/msbuild.yml

@ -31,6 +31,9 @@ jobs:
strategy:
matrix:
arch: [x86, x64, arm64]
conf:
- name: ""
value: "release"
ovpn3:
- preset: ""
name: ""
@ -38,8 +41,13 @@ jobs:
- preset: -ovpn3
name: "- ovpn3"
upload_name: "_ovpn3"
include:
- conf:
name: " ASAN"
value: "asan"
arch: x64
name: 'msvc - ${{matrix.arch}} ${{ matrix.ovpn3.name }}'
name: 'msvc - ${{matrix.arch}} ${{ matrix.ovpn3.name }}${{ matrix.conf.name }}'
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
@ -55,14 +63,14 @@ jobs:
uses: lukka/run-cmake@v10
with:
configurePreset: '${{ matrix.arch }}${{ matrix.ovpn3.preset }}'
buildPreset: '${{ matrix.arch }}-release${{ matrix.ovpn3.preset }}'
buildPreset: '${{ matrix.arch }}-${{ matrix.conf.value }}${{ matrix.ovpn3.preset }}'
- uses: actions/upload-artifact@v3
with:
name: openvpn-gui_${{ matrix.arch }}${{ matrix.ovpn3.upload_name }}
name: openvpn-gui_${{ matrix.arch }}_${{ matrix.conf }}${{ matrix.ovpn3.upload_name }}
path: |
out/build/${{ matrix.arch }}${{ matrix.ovpn3.preset }}/Release/*.dll
out/build/${{ matrix.arch }}${{ matrix.ovpn3.preset }}/Release/*.exe
out/build/${{ matrix.arch }}${{ matrix.ovpn3.preset }}/${{ matrix.conf.value }}/*.dll
out/build/${{ matrix.arch }}${{ matrix.ovpn3.preset }}/${{ matrix.conf.value }}/*.exe
mingw:
strategy:
@ -107,4 +115,3 @@ jobs:
- name: make
run: make
working-directory: openvpn-gui

23
CMakeLists.txt

@ -28,8 +28,24 @@ add_executable(${PROJECT_NAME} WIN32
res/openvpn-gui-res.rc)
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DDEBUG")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS} /guard:cf /Qspectre")
if(MSVC)
list(APPEND CMAKE_CONFIGURATION_TYPES Asan)
endif(MSVC)
set(CMAKE_C_FLAGS_ASAN
"${CMAKE_C_FLAGS_DEBUG} /fsanitize=address" CACHE STRING
"Flags used by the C compiler during AddressSanitizer builds." FORCE)
set(CMAKE_EXE_LINKER_FLAGS_ASAN
"${CMAKE_EXE_LINKER_FLAGS_DEBUG}" CACHE STRING
"Flags used by the linker during AddressSanitizer builds." FORCE)
set(CMAKE_SHARED_LINKER_FLAGS_ASAN
"${CMAKE_SHARED_LINKER_FLAGS_DEBUG}" CACHE STRING
"Flags used by the linker during AddressSanitizer builds." FORCE)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /guard:cf /Qspectre")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /guard:cf /DYNAMICBASE")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4996 /wd4267 /wd4244")
@ -160,5 +176,6 @@ if(MSVC)
"$<$<CONFIG:Release>:/OPT:ICF>")
endif(MSVC)
set_target_properties(${TEST_PLAP_EXE} PROPERTIES
LINK_FLAGS " /MANIFEST:EMBED /MANIFESTINPUT:${CMAKE_SOURCE_DIR}/plap/test-plap.manifest ")
target_link_options(${TEST_PLAP_EXE} PRIVATE
"/MANIFEST:EMBED"
"/MANIFESTINPUT:${CMAKE_SOURCE_DIR}/plap/test-plap.manifest")

5
CMakePresets.json

@ -76,6 +76,11 @@
"configurePreset": "x64",
"configuration": "Debug"
},
{
"name": "x64-asan",
"configurePreset": "x64",
"configuration": "Asan"
},
{
"name": "x86-debug",
"configurePreset": "x86",

Loading…
Cancel
Save