Dear Stefan, thank you for writing us! (I'll answer below) On 8/10/20 1:01 PM, Hannes Hauswedell wrote:
-------- Forwarded Message -------- Subject: Fwd: cmake default without -O3 and order of args/options in cmake call Date: Sun, 9 Aug 2020 18:03:47 +0200 From: Stefan Kurtz <kurtz@zbh.uni-hamburg.de> Reply-To: kurtz@zbh.uni-hamburg.de Organization: Universitaet Hamburg To: eqan-dev-owner@lists.fu-berlin.de CC: Hannes Hauswedell <hannes.hauswedell@fu-berlin.de> As suggested on the seqan web pages I had send an E-mail to eqan-dev@lists.fu-berlin.de, but I received the following message: --- Your message has been rejected, probably because you are not subscribed to the mailing list and the list's policy is to prohibit non-members from posting to it. If you think that your messages are being rejected in error, contact the mailing list owner at seqan-dev-owner@lists.fu-berlin.de. -- Please forward the message to the Seqan developers. Kind regards, Stefan Kurtz -------- Forwarded Message -------- Reply-To: kurtz@zbh.uni-hamburg.de To: seqan-dev@lists.fu-berlin.de From: Stefan Kurtz <kurtz@zbh.uni-hamburg.de> Subject: cmake default without -O3 and order of args/options in cmake call Organization: Universitaet Hamburg Message-ID: <cb4e36e9-814a-db1e-461a-c853efcc4300@zbh.uni-hamburg.de> Date: Sun, 9 Aug 2020 17:56:49 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:68.0) Gecko/20100101 Thunderbird/68.11.0 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------6508A45FC9F37F3913E7BE76" Content-Language: en-US Dear Seqan3-developers, this email refers to the 'Quick Setup (Cmake)' section of SeqAn3 3.0.2. 1) I followed the description for the Cmake-setup and noticed in the example CMakeList.txt shown at the end of https://docs.seqan.de/seqan/3-master-user/setup.html that compiler optimization options such as -O3 is missing, which will lead to poor performance for users who do not recognize it. I know use add_compile_options(-DNDEBUG -Wall -Wextra -Wunused-parameter -Wunused-variable -pedantic -Werror -O3) in CmakeLists.txt.
Thank you for pointing this out. It is a known fact / best practice in the CMake community that `-DCMAKE_BUILD_TYPE=Release` must be specified to enable optimized builds, e.g. `cmake -DCMAKE_BUILD_TYPE=Release <seqan3-source-path> `, but since our documentations should be accessible for "new" C++ programmers or "new" CMake users, we should add a section that teaches how to enable Release builds.
The best-practice in CMake for header-only libraries, like SeqAn2 or SeqAn3, is to specify only the minimal required flags that are needed to compile any given source that uses SeqAn. Additional flags, like hardening options or performance options is up to the application developer and/or package maintainer. The rational is simple, if we would add the `-O3` flag to our cmake export, no-one could do a debug-build any more, because we then would dictate you to always have the `-O3` flag in your Makefile.
2) The cmake-setup specifies that one has to call cmake ../source -DCMAKE_CXX_COMPILER=/path/to/executable/g++-7 The help pages of cmake version 3.16.3 on macOS and cmake version 3.10.2 on Linux state that options come before arguments, but only the macOS version enforces this. So on my macOS system only cmake -DCMAKE_CXX_COMPILER=/path/to/executable/g++-7 ../source works. To simplify the use for macOS, it is probably better use this order in the cmake-setup section (and elsewhere) which works on both platforms.
Thank you for this, too :) I created this issue: https://github.com/seqan/seqan3/issues/2017 So if you have a github account, we could move any further discussion there.
Kind regards, Stefan Kurtz