Skip to content

Commit

Permalink
Merge pull request #162 from skalenetwork/feature/SKALE-4672-release-…
Browse files Browse the repository at this point in the history
…mode-support

SKALE-4672 added release and release-with-debug build modes
  • Loading branch information
sergiy-skalelabs authored Oct 22, 2021
2 parents dc7eb83 + eabe0a4 commit 35ac049
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ${CMAKE_BUILD_TYPE} is not supported explicitly" )
endif()

if(BUILD_TESTS)
enable_testing()
endif()
Expand Down Expand Up @@ -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()

Expand Down

0 comments on commit 35ac049

Please sign in to comment.