build: Change default build from -O2 -g to -Os -g

This commit is contained in:
Gabriel Ferreira
2024-02-27 15:34:27 +01:00
parent b921650795
commit 9b62087072
3 changed files with 8 additions and 5 deletions

View File

@@ -159,6 +159,9 @@ macro(process_options)
STREQUAL "default"
)
set(cmakeBuildType relwithdebinfo)
string(REPLACE "-O2" "-Os" CMAKE_CXX_FLAGS_RELWITHDEBINFO
"${CMAKE_CXX_FLAGS_RELWITHDEBINFO}"
)
set(CMAKE_CXX_FLAGS_DEFAULT ${CMAKE_CXX_FLAGS_RELWITHDEBINFO})
add_definitions(-DNS3_BUILD_PROFILE_DEBUG)
elseif(${cmakeBuildType} STREQUAL "release")

View File

@@ -173,7 +173,7 @@ The mapping of the ``ns3`` build profiles into the CMake build types is the foll
+=========================+========================+===============================+=================================+
| debug | debug | | -g |
+-------------------------+------------------------+-------------------------------+---------------------------------+
| default | default | | -O2 -g |
| default | default | | -Os -g |
+-------------------------+------------------------+-------------------------------+---------------------------------+
| release | release | | -O3 |
+-------------------------+------------------------+-------------------------------+---------------------------------+
@@ -235,9 +235,9 @@ build types and output executable and libraries names, which will receive a suff
+==================+===================+
| DEBUG | -g |
+------------------+-------------------+
| DEFAULT | -O2 -g -DNDEBUG |
| DEFAULT | -Os -g -DNDEBUG |
+------------------+-------------------+
| RELWITHDEBINFO | -O2 -g -DNDEBUG |
| RELWITHDEBINFO | -Os -g -DNDEBUG |
+------------------+-------------------+
| RELEASE | -O3 -DNDEBUG |
+------------------+-------------------+
@@ -1965,7 +1965,7 @@ Installing the packages can take a while, and it can look like it hanged.
--
-- Copying /ns-3-dev/cmake-build-release/_deps/armadillo-src/include/ to /ns-3-dev/cmake-build-release/_deps/armadillo-build/tmp/include/
-- Generating /ns-3-dev/cmake-build-release/_deps/armadillo-build/tmp/include/config.hpp
-- CMAKE_CXX_FLAGS = -fsanitize=address,leak,undefined -O2
-- CMAKE_CXX_FLAGS = -fsanitize=address,leak,undefined -Os
-- CMAKE_SHARED_LINKER_FLAGS = -Wl,--no-as-needed
-- CMAKE_REQUIRED_INCLUDES = /usr/include;/usr/include/superlu
--

View File

@@ -795,7 +795,7 @@ The build profile controls the use of logging, assertions, and compiler optimiza
| Wrapper | | | | |
| Macro | | | | |
+----------+---------------------------------+-----------------------------+-------------------------------+---------------------------------+
| Compiler | ``-Og -g`` | ``-O2 -g`` | ``-O3`` | ``-O3`` |
| Compiler | ``-Og -g`` | ``-Os -g`` | ``-O3`` | ``-O3`` |
| Flags | | | | ``-march=native`` |
| | | | | ``-mtune=native`` |
+----------+---------------------------------+-----------------------------+-------------------------------+---------------------------------+