On 2021-05-12 18:26, Roberto Cornacchia wrote:
> I was wondering,
>
> -DCMAKE_BUILD_TYPE=Release (or RelWithDebInfo) doesn't seem to enable
> -O2 on gcc.
>
> Is there a good reason for it or was it just forgotten?
Hi Roberto,
I usually configure like this (everything other than CMAKE_BUILD_TYPE
should not matter for this issue):
cd build/
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$(pwd)/install/
-GNinja -DCMAKE_EXPORT_COMPILE_COMMANDS=1 ../
If I then compile like this:
VERBOSE=1 cmake --build .
I get the following:
[...]
[282/485] /usr/bin/cc -DLIBGDK -D_GNU_SOURCE -D_XOPEN_SOURCE
-Dbat_EXPORTS -I../common/stream -I../common/utils -I../gdk -I.
-I../common/options -Werror -Wall -Wextra
-Werror-implicit-function-declaration -Wpointer-arith -Wundef -Wformat=2
-Wformat-overflow=1 -Wno-format-truncation -Wno-format-nonliteral
-Wno-cast-function-type -Winit-self -Winvalid-pch -Wmissing-declarations
-Wmissing-format-attribute -Wmissing-prototypes
-Wno-missing-field-initializers -Wold-style-definition -Wpacked
-Wunknown-pragmas -Wvariadic-macros -Wstack-protector
-fstack-protector-all -Wpacked-bitfield-compat -Wsync-nand
-Wjump-misses-init -Wmissing-include-dirs -Wlogical-op -Wduplicated-cond
-Wduplicated-branches -Wrestrict -Wnested-externs -Wmissing-noreturn
-Wuninitialized -Wno-char-subscripts -Wunreachable-code -O3 -DNDEBUG
-fPIC -std=gnu99 -MD -MT gdk/CMakeFiles/bat.dir/gdk_analytic_func.c.o
-MF gdk/CMakeFiles/bat.dir/gdk_analytic_func.c.o.d -o
gdk/CMakeFiles/bat.dir/gdk_analytic_func.c.o -c
../gdk/gdk_analytic_func.c
[...]
which includes the -O3 optimization flag. This is on default branch, but
I am pretty sure it works similarly in all branches. If you have
configured the build directory for a debug build type previously (cmake
-DCMAKE_BUILD_TYPE=Debug) this might be the reason why it is not
working. Try a new directory with a fresh cmake execution.
Best regards,
Panos.
_______________________________________________
users-list mailing list
users-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/users-list