CMake: added DEV_DEBUG option

This commit is contained in:
SChernykh 2024-10-29 11:33:46 +01:00
parent c9193c53d9
commit 3c4cf098a9
5 changed files with 14 additions and 9 deletions

View file

@ -271,8 +271,8 @@ jobs:
strategy:
matrix:
config:
- {os: macos-13, flags: "-Og -ftrapv"}
- {os: macos-14, flags: "-Og -ftrapv -target arm64-apple-macos-11"}
- {os: macos-13, flags: ""}
- {os: macos-14, flags: "-target arm64-apple-macos-11"}
steps:
- name: Checkout repository
@ -312,7 +312,7 @@ jobs:
run: |
mkdir build
cd build
cmake .. -DCMAKE_C_COMPILER="$(brew --prefix llvm@15)/bin/clang" -DCMAKE_CXX_COMPILER="$(brew --prefix llvm@15)/bin/clang++" -DCMAKE_AR="$(brew --prefix llvm@15)/bin/llvm-ar" -DCMAKE_RANLIB="$(brew --prefix llvm@15)/bin/llvm-ranlib" -DCMAKE_C_FLAGS='${{ matrix.config.flags }}' -DCMAKE_CXX_FLAGS='${{ matrix.config.flags }}' -DWITH_LTO=OFF -DSTATIC_LIBS=ON -DDEV_TEST_SYNC=ON
cmake .. -DCMAKE_C_COMPILER="$(brew --prefix llvm@15)/bin/clang" -DCMAKE_CXX_COMPILER="$(brew --prefix llvm@15)/bin/clang++" -DCMAKE_AR="$(brew --prefix llvm@15)/bin/llvm-ar" -DCMAKE_RANLIB="$(brew --prefix llvm@15)/bin/llvm-ranlib" -DCMAKE_C_FLAGS='${{ matrix.config.flags }}' -DCMAKE_CXX_FLAGS='${{ matrix.config.flags }}' -DWITH_LTO=OFF -DSTATIC_LIBS=ON -DDEV_TEST_SYNC=ON -DDEV_DEBUG=ON
make -j4 p2pool
- name: Run p2pool

View file

@ -26,6 +26,7 @@ option(DEV_WITH_UBSAN "[Developer only] Compile with undefined behavior sanitize
option(DEV_WITH_ASAN "[Developer only] Compile with address sanitizer" OFF)
option(DEV_CLANG_TIDY "[Developer only] Compile for clang-tidy" OFF)
option(DEV_TRACK_MEMORY "[Developer only] Track memory allocations" OFF)
option(DEV_DEBUG "[Developer only] Compile a debug build" OFF)
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT p2pool)
@ -83,6 +84,10 @@ if (DEV_TRACK_MEMORY)
add_definitions(-DDEV_TRACK_MEMORY)
endif()
if (DEV_DEBUG)
add_definitions(-DDEV_DEBUG)
endif()
include(cmake/flags.cmake)
set(HEADERS

View file

@ -27,8 +27,8 @@ if (CMAKE_CXX_COMPILER_ID MATCHES GNU)
set(WARNING_FLAGS "-w")
endif()
if (DEV_WITH_TSAN OR DEV_WITH_UBSAN OR DEV_WITH_ASAN)
set(OPTIMIZATION_FLAGS "-Og -g")
if (DEV_WITH_TSAN OR DEV_WITH_UBSAN OR DEV_WITH_ASAN OR DEV_DEBUG)
set(OPTIMIZATION_FLAGS "-Og -g -ftrapv")
else()
set(OPTIMIZATION_FLAGS "-O3 -ffast-math -s")
endif()
@ -99,8 +99,8 @@ elseif (CMAKE_CXX_COMPILER_ID MATCHES Clang)
set(WARNING_FLAGS "-w")
endif()
if (DEV_WITH_MSAN)
set(OPTIMIZATION_FLAGS "-Og -g")
if (DEV_WITH_MSAN OR DEV_DEBUG)
set(OPTIMIZATION_FLAGS "-Og -g -ftrapv")
else()
set(OPTIMIZATION_FLAGS "-O3 -ffast-math -funroll-loops -fmerge-all-constants")
endif()

View file

@ -92,7 +92,7 @@
#define __has_feature(x) 0
#endif
#if defined(_DEBUG) || defined(__SANITIZE_ADDRESS__) || __has_feature(address_sanitizer) || defined(__SANITIZE_THREAD__) || __has_feature(thread_sanitizer)
#if defined(_DEBUG) || defined(DEV_DEBUG) || defined(__SANITIZE_ADDRESS__) || __has_feature(address_sanitizer) || defined(__SANITIZE_THREAD__) || __has_feature(thread_sanitizer)
#define P2POOL_DEBUGGING 1
#endif

View file

@ -20,7 +20,7 @@
#include "uv_util.h"
#include "wallet.h"
#ifdef _DEBUG
#if defined(_DEBUG) || defined(DEV_DEBUG)
#define POOL_BLOCK_DEBUG 1
#else
#define POOL_BLOCK_DEBUG 0