From bf8668c1199984497bf2d27db07f70b670bc54e7 Mon Sep 17 00:00:00 2001 From: Sergiy Lavrynenko Date: Fri, 22 Oct 2021 12:34:34 +0300 Subject: [PATCH 1/2] SKALE-4672 added release and release-with-debug build modes --- CMakeLists.txt | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9218ec3d..6280f9e0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -42,6 +42,33 @@ set( HUNTER_ENABLED OFF ) option(BUILD_TESTS "Build tests" ON) option(BUILD_WITH_FPIC "Build with -fPIC" OFF) +option( BLS_PROFILING "Build for profiling" OFF ) +if( SKALED_PROFILING OR CONSENSUS_PROFILING ) + set( BLS_PROFILING ON ) +endif() +if( BLS_PROFILING ) + set( CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} -pg" ) + set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pg" ) + set( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pg" ) + set( CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -pg" ) +endif() + +if( CMAKE_BUILD_TYPE STREQUAL "Release" ) + set( CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} -O3" ) + set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3" ) +elseif( CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo" ) + set( CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} -O3" ) + set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3" ) +elseif( CMAKE_BUILD_TYPE STREQUAL "MinSizeRel" ) + set( CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} -Os" ) + set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Os" ) +elseif( CMAKE_BUILD_TYPE STREQUAL "Debug" ) + set( CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} -O0" ) + set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0" ) +else() + message( INFO "---- CMAKE_BUILD_TYPE = ${DEPS_INSTALL_ROOT} is not supported explicitly" ) +endif() + if(BUILD_TESTS) enable_testing() endif() @@ -114,7 +141,10 @@ else() if (EMSCRIPTEN) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -std=c++17")#-Werror -Wall -Wparentheses -Wunused -Wunreachable-code -Wextra -Wno-error=int-in-bool-context else() - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wall -Wparentheses -Wunused -Wunreachable-code -Wextra -Wno-error=int-in-bool-context -fPIC -std=c++17") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wunreachable-code -Wextra -Wno-error=int-in-bool-context -fPIC -std=c++17") + if( CMAKE_BUILD_TYPE STREQUAL "Debug" ) + set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wparentheses -Wunused" ) + endif() endif() endif() From eabe0a492707477c6ba48e73e1f3c096162db391 Mon Sep 17 00:00:00 2001 From: Sergiy Lavrynenko Date: Fri, 22 Oct 2021 14:23:40 +0300 Subject: [PATCH 2/2] SKALE-4672 message output fix in cmake --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6280f9e0..02a88910 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -66,7 +66,7 @@ elseif( CMAKE_BUILD_TYPE STREQUAL "Debug" ) set( CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} -O0" ) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0" ) else() - message( INFO "---- CMAKE_BUILD_TYPE = ${DEPS_INSTALL_ROOT} is not supported explicitly" ) + message( INFO "---- CMAKE_BUILD_TYPE = ${CMAKE_BUILD_TYPE} is not supported explicitly" ) endif() if(BUILD_TESTS)