ALT Linux Team development discussions
 help / color / mirror / Atom feed
From: Arseny Maslennikov <arseny@altlinux.org>
To: ALT Linux Team development discussions <devel@lists.altlinux.org>
Subject: Re: [devel] cmake затирает уровень оптимизации опцией по умолчанию
Date: Sat, 16 Oct 2021 20:17:42 +0300
Message-ID: <YWsJNkMsTfeQEs+W@cello> (raw)
In-Reply-To: <947b9e60-010e-18e0-239c-fcb7f888b4a9@basealt.ru>

[-- Attachment #1: Type: text/plain, Size: 2282 bytes --]

> On 16.10.2021 23:02, Arseny Maslennikov wrote:
> > On Sat, Oct 16, 2021 at 10:46:19PM +0700, Илья Курдюков wrote:
> > > Заметил при сборке python3-module-PySide2, что макрос %cmake устанавливает
> > > CMAKE_CXX_FLAGS, в который включается -O%_optlevel. Но потом этот -On
> > > затирается флагом -O2, который содержится в CMAKE_CXX_FLAGS_RELEASE ("-O2
> > > -DNDEBUG" по умолчанию).
> > > 
> > > Не надо ли тогда в %cmake добавить -DCMAKE_CXX_FLAGS_RELEASE="-DNDEBUG" ?
> > Не все собирают с -DCMAKE_BUILD_TYPE=Release.
> > Если, например, явно собирать с -DCMAKE_BUILD_TYPE=RelWithDebInfo,
> > флаги в CMAKE_CXX_FLAGS_RELEASE будут неактуальны.

On Sat, Oct 16, 2021 at 11:12:28PM +0700, Илья Курдюков wrote:
> Там в CMakeLists везде проставлено:
> 
> set(CMAKE_BUILD_TYPE Release CACHE STRING "Build Type")
Там Release — это значение по умолчанию, судя по вашим словам, у
конкретного апстрима; заданное в командной строке другое значение его
перебьёт.
> 
> Это какая-то редкость?
Апстримы пишут, как хотят, в меру своего разумения. ;]

> |CMAKE_CXX_FLAGS_RELWITHDEBINFO тоже должен ставить опцию -O2. Полагаю что
> если |CMAKE_BUILD_TYPE никто не трогал, то
> используется|CMAKE_CXX_FLAGS_DEBUG установленный в -g? |||

Из https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_FLAGS.html:
>> The flags in this variable will be passed to the compiler before those
>> in the per-configuration CMAKE_<LANG>_FLAGS_<CONFIG> variant, and before
>> flags added by the add_compile_options() or target_compile_options()
>> commands.

Вот в meson для этого придумали --buildtype=plain, который означает
"никаких оптфлагов не дописывать". У нас в макросах он и передаётся.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  parent reply	other threads:[~2021-10-16 17:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-16 13:54 ` [devel] Fwd: [#287372] FAILED del=glibc Anton Farygin
2021-10-16 15:46   ` [devel] cmake затирает уровень оптимизации опцией по умолчанию Илья Курдюков
2021-10-16 16:02     ` Arseny Maslennikov
2021-10-16 17:17         ` Arseny Maslennikov [this message]
2021-10-16 17:53   ` [devel] Fwd: [#287372] FAILED del=glibc arbars
2021-10-18 16:29   ` Gleb Fotengauer-Malinovskiy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YWsJNkMsTfeQEs+W@cello \
    --to=arseny@altlinux.org \
    --cc=devel@lists.altlinux.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

ALT Linux Team development discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/devel/0 devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 devel devel/ http://lore.altlinux.org/devel \
		devel@altlinux.org devel@altlinux.ru devel@lists.altlinux.org devel@lists.altlinux.ru devel@linux.iplabs.ru mandrake-russian@linuxteam.iplabs.ru sisyphus@linuxteam.iplabs.ru
	public-inbox-index devel

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git