mirror of
https://git.jami.net/savoirfairelinux/jami-client-qt.git
synced 2025-08-23 16:23:55 +02:00
build: support enabling ASAN for daemon + contrib + client
Change-Id: Ie014285e46feb82577125b68677b19d94005789f
This commit is contained in:
parent
885f05ba12
commit
be85034d78
3 changed files with 32 additions and 3 deletions
|
@ -36,6 +36,14 @@ if(WITH_WEBENGINE)
|
||||||
add_definitions(-DWITH_WEBENGINE)
|
add_definitions(-DWITH_WEBENGINE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
option(ENABLE_ASAN "Enable address sanitization" OFF)
|
||||||
|
if(ENABLE_ASAN AND NOT MSVC)
|
||||||
|
message(STATUS "Address sanitization enabled for client")
|
||||||
|
# Add AddressSanitizer flags for both compiler and linker
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fno-omit-frame-pointer")
|
||||||
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address")
|
||||||
|
endif()
|
||||||
|
|
||||||
# init some variables for includes, libs, etc.
|
# init some variables for includes, libs, etc.
|
||||||
set(CLIENT_INCLUDE_DIRS, "")
|
set(CLIENT_INCLUDE_DIRS, "")
|
||||||
set(CLIENT_LINK_DIRS, "")
|
set(CLIENT_LINK_DIRS, "")
|
||||||
|
@ -43,7 +51,10 @@ set(CLIENT_LIBS, "")
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 17)
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
set(CMAKE_CXX_FLAGS_DEBUG "-Og -ggdb")
|
if(NOT MSVC)
|
||||||
|
set(CMAKE_CXX_FLAGS_DEBUG "-Og -ggdb")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
set(CMAKE_AUTOMOC ON)
|
set(CMAKE_AUTOMOC ON)
|
||||||
set(CMAKE_AUTORCC ON)
|
set(CMAKE_AUTORCC ON)
|
||||||
|
|
5
build.py
5
build.py
|
@ -28,6 +28,7 @@ import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
|
import re
|
||||||
|
|
||||||
OSX_DISTRIBUTION_NAME = "osx"
|
OSX_DISTRIBUTION_NAME = "osx"
|
||||||
WIN32_DISTRIBUTION_NAME = "win32"
|
WIN32_DISTRIBUTION_NAME = "win32"
|
||||||
|
@ -392,6 +393,8 @@ def run_install(args):
|
||||||
install_args.append('-u')
|
install_args.append('-u')
|
||||||
if args.debug:
|
if args.debug:
|
||||||
install_args.append('-d')
|
install_args.append('-d')
|
||||||
|
if args.asan:
|
||||||
|
install_args.append('-A')
|
||||||
if args.no_libwrap:
|
if args.no_libwrap:
|
||||||
install_args.append('-W')
|
install_args.append('-W')
|
||||||
if args.no_webengine:
|
if args.no_webengine:
|
||||||
|
@ -719,6 +722,8 @@ def parse_args():
|
||||||
ap.add_argument('--global-install', default=False, action='store_true')
|
ap.add_argument('--global-install', default=False, action='store_true')
|
||||||
ap.add_argument('--debug', default=False, action='store_true',
|
ap.add_argument('--debug', default=False, action='store_true',
|
||||||
help='Build with debug support; run in GDB')
|
help='Build with debug support; run in GDB')
|
||||||
|
ap.add_argument('--asan', default=False, action='store_true',
|
||||||
|
help='Build both daemon and client with ASAN')
|
||||||
ap.add_argument('--background', default=False, action='store_true')
|
ap.add_argument('--background', default=False, action='store_true')
|
||||||
ap.add_argument('--no-priv-install', dest='priv_install',
|
ap.add_argument('--no-priv-install', dest='priv_install',
|
||||||
default=True, action='store_false')
|
default=True, action='store_false')
|
||||||
|
|
|
@ -43,9 +43,10 @@ proc='1'
|
||||||
priv_install=true
|
priv_install=true
|
||||||
enable_libwrap=true
|
enable_libwrap=true
|
||||||
enable_webengine=true
|
enable_webengine=true
|
||||||
|
asan=
|
||||||
arch=''
|
arch=''
|
||||||
|
|
||||||
while getopts gsc:dQ:P:p:uWwa: OPT; do
|
while getopts gsc:dQ:P:p:uWwa:A OPT; do
|
||||||
case "$OPT" in
|
case "$OPT" in
|
||||||
g)
|
g)
|
||||||
global='true'
|
global='true'
|
||||||
|
@ -77,6 +78,9 @@ while getopts gsc:dQ:P:p:uWwa: OPT; do
|
||||||
a)
|
a)
|
||||||
arch="${OPTARG}"
|
arch="${OPTARG}"
|
||||||
;;
|
;;
|
||||||
|
A)
|
||||||
|
asan='true'
|
||||||
|
;;
|
||||||
\?)
|
\?)
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
|
@ -116,7 +120,7 @@ else
|
||||||
mkdir -p contrib/native
|
mkdir -p contrib/native
|
||||||
(
|
(
|
||||||
cd contrib/native
|
cd contrib/native
|
||||||
../bootstrap ${prefix:+"--prefix=$prefix"}
|
../bootstrap ${prefix:+"--prefix=$prefix"} ${asan:+"--enable-asan"}
|
||||||
make -j"${proc}"
|
make -j"${proc}"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -135,6 +139,10 @@ else
|
||||||
CONFIGURE_FLAGS+=" --enable-debug"
|
CONFIGURE_FLAGS+=" --enable-debug"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ "${asan}" = "true" ]; then
|
||||||
|
CONFIGURE_FLAGS+=" --enable-asan"
|
||||||
|
fi
|
||||||
|
|
||||||
# Build the daemon itself.
|
# Build the daemon itself.
|
||||||
test -f configure || ./autogen.sh
|
test -f configure || ./autogen.sh
|
||||||
|
|
||||||
|
@ -183,6 +191,11 @@ client_cmake_flags=(-DCMAKE_BUILD_TYPE="${BUILD_TYPE}"
|
||||||
-DCMAKE_PREFIX_PATH="${qtpath}"
|
-DCMAKE_PREFIX_PATH="${qtpath}"
|
||||||
-DENABLE_LIBWRAP="${enable_libwrap}"
|
-DENABLE_LIBWRAP="${enable_libwrap}"
|
||||||
-DWITH_WEBENGINE="${enable_webengine}")
|
-DWITH_WEBENGINE="${enable_webengine}")
|
||||||
|
|
||||||
|
if [ "${asan}" = "true" ]; then
|
||||||
|
client_cmake_flags+=(-DENABLE_ASAN=true)
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||||
#detect arch for macos
|
#detect arch for macos
|
||||||
CMAKE_OSX_ARCHITECTURES="arm64"
|
CMAKE_OSX_ARCHITECTURES="arm64"
|
||||||
|
|
Loading…
Add table
Reference in a new issue