diff mbox

[v2] package/pkg-cmake: use MinSizeRel for size optimized build

Message ID 1453058751-9489-1-git-send-email-joerg.krause@embedded.rocks
State Superseded
Headers show

Commit Message

Jörg Krause Jan. 17, 2016, 7:25 p.m. UTC
MinSizeRel sets the gcc compiler optimization level to '-Os' whereas Release
sets it to '-O3'.

Signed-off-by: Jörg Krause <joerg.krause@embedded.rocks>
---
Changes v2:
 - fix typo
---
 package/pkg-cmake.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Samuel Martin Jan. 17, 2016, 9:39 p.m. UTC | #1
Hi Jörg,

On Sun, Jan 17, 2016 at 8:25 PM, Jörg Krause
<joerg.krause@embedded.rocks> wrote:
> MinSizeRel sets the gcc compiler optimization level to '-Os' whereas Release
> sets it to '-O3'.
>
> Signed-off-by: Jörg Krause <joerg.krause@embedded.rocks>
> ---
> Changes v2:
>  - fix typo
> ---
>  package/pkg-cmake.mk | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/package/pkg-cmake.mk b/package/pkg-cmake.mk
> index 81dcfcc..43da079 100644
> --- a/package/pkg-cmake.mk
> +++ b/package/pkg-cmake.mk
> @@ -87,7 +87,7 @@ define $(2)_CONFIGURE_CMDS
>         PATH=$$(BR_PATH) \
>         $$($$(PKG)_CONF_ENV) $$(HOST_DIR)/usr/bin/cmake $$($$(PKG)_SRCDIR) \
>                 -DCMAKE_TOOLCHAIN_FILE="$$(HOST_DIR)/usr/share/buildroot/toolchainfile.cmake" \
> -               -DCMAKE_BUILD_TYPE=$$(if $$(BR2_ENABLE_DEBUG),Debug,Release) \
> +               -DCMAKE_BUILD_TYPE=$$(if $$(BR2_ENABLE_DEBUG),Debug,$$(if $$(BR2_OPTIMIZE_S),MinSizeRel,Release)) \

This looks good! :-)
Could you update the doc [1] as well?

[1] https://git.busybox.net/buildroot/tree/docs/manual/adding-packages-cmake.txt#n103

Regards,
diff mbox

Patch

diff --git a/package/pkg-cmake.mk b/package/pkg-cmake.mk
index 81dcfcc..43da079 100644
--- a/package/pkg-cmake.mk
+++ b/package/pkg-cmake.mk
@@ -87,7 +87,7 @@  define $(2)_CONFIGURE_CMDS
 	PATH=$$(BR_PATH) \
 	$$($$(PKG)_CONF_ENV) $$(HOST_DIR)/usr/bin/cmake $$($$(PKG)_SRCDIR) \
 		-DCMAKE_TOOLCHAIN_FILE="$$(HOST_DIR)/usr/share/buildroot/toolchainfile.cmake" \
-		-DCMAKE_BUILD_TYPE=$$(if $$(BR2_ENABLE_DEBUG),Debug,Release) \
+		-DCMAKE_BUILD_TYPE=$$(if $$(BR2_ENABLE_DEBUG),Debug,$$(if $$(BR2_OPTIMIZE_S),MinSizeRel,Release)) \
 		-DCMAKE_INSTALL_PREFIX="/usr" \
 		-DCMAKE_COLOR_MAKEFILE=OFF \
 		-DBUILD_DOC=OFF \