diff --git a/crypto3/CMakeLists.txt b/crypto3/CMakeLists.txt index f2a775346f..7bb24b42fa 100644 --- a/crypto3/CMakeLists.txt +++ b/crypto3/CMakeLists.txt @@ -23,8 +23,12 @@ option(BUILD_BENCH_TESTS "Build performance benchmark tests" FALSE) option(BUILD_DOCS "Build with configuring Doxygen documentation compiler" FALSE) option(SANITIZE "Build sanitizers" FALSE) -if(${CMAKE_BUILD_TYPE} STREQUAL "Debug") - set(CMAKE_CXX_FLAGS "-ggdb -O0") +if(DEFINED CMAKE_BUILD_TYPE AND ${CMAKE_BUILD_TYPE} STREQUAL "Debug") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0") + if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ggdb") # gdb only works well with gcc + endif() + set(BOOST_FORCEINLINE "OFF") # improves debugging traces endif() if(${SANITIZE}) diff --git a/evm-assigner/lib/assigner/CMakeLists.txt b/evm-assigner/lib/assigner/CMakeLists.txt index 89d54eb966..ee29059aab 100644 --- a/evm-assigner/lib/assigner/CMakeLists.txt +++ b/evm-assigner/lib/assigner/CMakeLists.txt @@ -2,8 +2,12 @@ cmake_minimum_required(VERSION 3.22 FATAL_ERROR) option(BUILD_ASSIGNER_TESTS "Build unit tests" FALSE) -if(${CMAKE_BUILD_TYPE} STREQUAL "Debug") - set(CMAKE_CXX_FLAGS "-ggdb -O0") +if(DEFINED CMAKE_BUILD_TYPE AND ${CMAKE_BUILD_TYPE} STREQUAL "Debug") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0") + if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ggdb") # gdb only works well with gcc + endif() + set(BOOST_FORCEINLINE "OFF") # improves debugging traces endif() set(evmone_sources diff --git a/parallel-crypto3/CMakeLists.txt b/parallel-crypto3/CMakeLists.txt index e4906392e2..8b1507249a 100644 --- a/parallel-crypto3/CMakeLists.txt +++ b/parallel-crypto3/CMakeLists.txt @@ -3,8 +3,12 @@ project(parallel-crypto3) find_package(CM) -if(${CMAKE_BUILD_TYPE} STREQUAL "Debug") - set(CMAKE_CXX_FLAGS "-ggdb -O0") +if(DEFINED CMAKE_BUILD_TYPE AND ${CMAKE_BUILD_TYPE} STREQUAL "Debug") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0") + if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ggdb") # gdb only works well with gcc + endif() + set(BOOST_FORCEINLINE "OFF") # improves debugging traces endif() # This is useful due to some build systems (Ninja in particular) are piping diff --git a/proof-producer/CMakeLists.txt b/proof-producer/CMakeLists.txt index 8814ebf72a..bf07df9ecc 100644 --- a/proof-producer/CMakeLists.txt +++ b/proof-producer/CMakeLists.txt @@ -10,9 +10,13 @@ cmake_minimum_required(VERSION 3.22 FATAL_ERROR) -if(${CMAKE_BUILD_TYPE} STREQUAL "Debug") - set(CMAKE_CXX_FLAGS "-ggdb -O0") +if(DEFINED CMAKE_BUILD_TYPE AND ${CMAKE_BUILD_TYPE} STREQUAL "Debug") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0") set(ZK_PLACEHOLDER_DEBUG_ENABLED TRUE) + if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ggdb") # gdb only works well with gcc + endif() + set(BOOST_FORCEINLINE "OFF") # improves debugging traces endif() find_package(CM REQUIRED) diff --git a/transpiler/CMakeLists.txt b/transpiler/CMakeLists.txt index fc385b0532..fcabfbf505 100644 --- a/transpiler/CMakeLists.txt +++ b/transpiler/CMakeLists.txt @@ -12,8 +12,12 @@ find_package(CM REQUIRED) include(CMConfig) include(CMSetupVersion) -if(${CMAKE_BUILD_TYPE} STREQUAL "Debug") - set(CMAKE_CXX_FLAGS "-ggdb -O0") +if(DEFINED CMAKE_BUILD_TYPE AND ${CMAKE_BUILD_TYPE} STREQUAL "Debug") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0") + if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ggdb") # gdb only works well with gcc + endif() + set(BOOST_FORCEINLINE "OFF") # improves debugging traces endif() cm_workspace(crypto3) diff --git a/zkevm-framework/CMakeLists.txt b/zkevm-framework/CMakeLists.txt index b3ae9dba09..c63ce2134b 100644 --- a/zkevm-framework/CMakeLists.txt +++ b/zkevm-framework/CMakeLists.txt @@ -10,8 +10,12 @@ include(GNUInstallDirs) option(BUILD_DOCS "Build documentation" FALSE) option(ENABLE_TESTS "Enable tests" FALSE) -if(${CMAKE_BUILD_TYPE} STREQUAL "Debug") - set(CMAKE_CXX_FLAGS "-ggdb -O0") +if(DEFINED CMAKE_BUILD_TYPE AND ${CMAKE_BUILD_TYPE} STREQUAL "Debug") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0") + if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ggdb") # gdb only works well with gcc + endif() + set(BOOST_FORCEINLINE "OFF") # improves debugging traces endif() add_subdirectory(libs)