Skip to contentSkip to conversation

toolchainfile.cmake: fix lifetime

PATCH New Samuel Martin 3 participants 8 messages Feb 16, 2012 – Feb 18, 2012 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 toolchainfile.cmake: fix lifetime

This file must be consistent with the toolchain, so manage it lifetime in the same way of the toolchain directory.

---
 Makefile                  |   10 ++++++----
 package/Makefile.cmake.in |    2 +-
 2 files changed, 7 insertions(+), 5 deletions(-)
Makefile +6 -4
index 7d8dd2e..927925c 100644
@@ -1,7 +1,7 @@
 # Makefile for buildroot2
 #
 # Copyright (C) 1999-2005 by Erik Andersen <[email protected]>
-# Copyright (C) 2006-2011 by the Buildroot developers <[email protected]>
+# Copyright (C) 2006-2012 by the Buildroot developers <[email protected]>
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -282,6 +282,7 @@ STAMP_DIR:=$(BASE_DIR)/stamps
 BINARIES_DIR:=$(BASE_DIR)/images
 TARGET_DIR:=$(BASE_DIR)/target
 TOOLCHAIN_DIR=$(BASE_DIR)/toolchain
+CMAKE_TOOLCHAIN_FILE=$(BASE_DIR)/toolchainfile.cmake
 TARGET_SKELETON=$(TOPDIR)/fs/skeleton
 
 ifeq ($(BR2_CCACHE),y)
@@ -368,7 +369,7 @@ $(TARGETS_ALL): __real_tgt_%: $(BASE_TARGETS) %
 dirs: $(DL_DIR) $(TOOLCHAIN_DIR) $(BUILD_DIR) $(STAGING_DIR) $(TARGET_DIR) \
 	$(HOST_DIR) $(BINARIES_DIR) $(STAMP_DIR)
 
-$(BASE_TARGETS): dirs $(O)/toolchainfile.cmake
+$(BASE_TARGETS): dirs $(CMAKE_TOOLCHAIN_FILE)
 
 $(BUILD_DIR)/buildroot-config/auto.conf: $(CONFIG_DIR)/.config
 	$(MAKE) $(EXTRAMAKEARGS) HOSTCC="$(HOSTCC_NOCCACHE)" HOSTCXX="$(HOSTCXX_NOCCACHE)" silentoldconfig
@@ -377,7 +378,7 @@ prepare: $(BUILD_DIR)/buildroot-config/auto.conf
 
 world: prepare dirs dependencies $(BASE_TARGETS) $(TARGETS_ALL)
 
-$(O)/toolchainfile.cmake:
+$(CMAKE_TOOLCHAIN_FILE):
 	@echo -en "\
 	set(CMAKE_SYSTEM_NAME Linux)\n\
 	set(CMAKE_C_COMPILER $(TARGET_CC_NOCCACHE))\n\
@@ -626,7 +627,8 @@ endif
 
 clean:
 	rm -rf $(STAGING_DIR) $(TARGET_DIR) $(BINARIES_DIR) $(HOST_DIR) \
-		$(STAMP_DIR) $(BUILD_DIR) $(TOOLCHAIN_DIR) $(BASE_DIR)/staging
+		$(STAMP_DIR) $(BUILD_DIR) $(TOOLCHAIN_DIR) $(CMAKE_TOOLCHAIN_FILE) \
+		$(BASE_DIR)/staging
 
 distclean: clean
 ifeq ($(DL_DIR),$(TOPDIR)/dl)
package/Makefile.cmake.in +1 -1
index 38e459b..8a81c3b 100644
@@ -72,7 +72,7 @@ define $(2)_CONFIGURE_CMDS
 	(cd $$($$(PKG)_BUILDDIR) && \
 	rm -f CMakeCache.txt && \
 	$$($$(PKG)_CONF_ENV) $(HOST_DIR)/usr/bin/cmake $$($$(PKG)_SRCDIR) \
-		-DCMAKE_TOOLCHAIN_FILE="$$(BASE_DIR)/toolchainfile.cmake" \
+		-DCMAKE_TOOLCHAIN_FILE="$$(CMAKE_TOOLCHAIN_FILE)" \
 		-DCMAKE_INSTALL_PREFIX="/usr" \
 		$$($$(PKG)_CONF_OPT) \
 	)
Signature · 1 line
1.7.9.1
#1 lore raw

PATCH 1/1 toolchainfile.cmake: fix lifetime

Hi all,

Note that another way to correctly mange the lifetime of the toolchainfile.cmake file could be to store it in the TOOLCHAIN_DIR.

Regards,

Sam

2012/2/16 Samuel Martin <[email protected]>:

Quoted 74 lines

This file must be consistent with the toolchain, so manage it lifetime in the same way of the toolchain directory.

---
?Makefile ? ? ? ? ? ? ? ? ?| ? 10 ++++++----
?package/Makefile.cmake.in | ? ?2 +-
?2 files changed, 7 insertions(+), 5 deletions(-)

Makefile +0 -0
index 7d8dd2e..927925c 100644
@@ -1,7 +1,7 @@

?# Makefile for buildroot2
?#
?# Copyright (C) 1999-2005 by Erik Andersen <[email protected]>

Makefile +1 -1
-# Copyright (C) 2006-2011 by the Buildroot developers <[email protected]>
+# Copyright (C) 2006-2012 by the Buildroot developers <[email protected]>

?#
?# This program is free software; you can redistribute it and/or modify ?# it under the terms of the GNU General Public License as published by

Makefile +0 -0
@@ -282,6 +282,7 @@ STAMP_DIR:=$(BASE_DIR)/stamps

?BINARIES_DIR:=$(BASE_DIR)/images ?TARGET_DIR:=$(BASE_DIR)/target ?TOOLCHAIN_DIR=$(BASE_DIR)/toolchain +CMAKE_TOOLCHAIN_FILE=$(BASE_DIR)/toolchainfile.cmake ?TARGET_SKELETON=$(TOPDIR)/fs/skeleton

?ifeq ($(BR2_CCACHE),y)

Makefile +1 -1
@@ -368,7 +369,7 @@ $(TARGETS_ALL): __real_tgt_%: $(BASE_TARGETS) %
 ?dirs: $(DL_DIR) $(TOOLCHAIN_DIR) $(BUILD_DIR) $(STAGING_DIR) $(TARGET_DIR) \
 ? ? ? ?$(HOST_DIR) $(BINARIES_DIR) $(STAMP_DIR)
 
-$(BASE_TARGETS): dirs $(O)/toolchainfile.cmake
+$(BASE_TARGETS): dirs $(CMAKE_TOOLCHAIN_FILE)
 

?$(BUILD_DIR)/buildroot-config/auto.conf: $(CONFIG_DIR)/.config
? ? ? ?$(MAKE) $(EXTRAMAKEARGS) HOSTCC="$(HOSTCC_NOCCACHE)" HOSTCXX="$(HOSTCXX_NOCCACHE)" silentoldconfig

Makefile +1 -1
@@ -377,7 +378,7 @@ prepare: $(BUILD_DIR)/buildroot-config/auto.conf
 
 ?world: prepare dirs dependencies $(BASE_TARGETS) $(TARGETS_ALL)
 
-$(O)/toolchainfile.cmake:
+$(CMAKE_TOOLCHAIN_FILE):
 ? ? ? ?@echo -en "\
 ? ? ? ?set(CMAKE_SYSTEM_NAME Linux)\n\
 ? ? ? ?set(CMAKE_C_COMPILER $(TARGET_CC_NOCCACHE))\n\
@@ -626,7 +627,8 @@ endif
 

?clean:
? ? ? ?rm -rf $(STAGING_DIR) $(TARGET_DIR) $(BINARIES_DIR) $(HOST_DIR) \
- ? ? ? ? ? ? ? $(STAMP_DIR) $(BUILD_DIR) $(TOOLCHAIN_DIR) $(BASE_DIR)/staging
+ ? ? ? ? ? ? ? $(STAMP_DIR) $(BUILD_DIR) $(TOOLCHAIN_DIR) $(CMAKE_TOOLCHAIN_FILE) \
+ ? ? ? ? ? ? ? $(BASE_DIR)/staging

?distclean: clean
?ifeq ($(DL_DIR),$(TOPDIR)/dl)

package/Makefile.cmake.in +1 -2
index 38e459b..8a81c3b 100644
@@ -72,7 +72,7 @@ define $(2)_CONFIGURE_CMDS
 ? ? ? ?(cd $$($$(PKG)_BUILDDIR) && \
 ? ? ? ?rm -f CMakeCache.txt && \
 ? ? ? ?$$($$(PKG)_CONF_ENV) $(HOST_DIR)/usr/bin/cmake $$($$(PKG)_SRCDIR) \
- ? ? ? ? ? ? ? -DCMAKE_TOOLCHAIN_FILE="$$(BASE_DIR)/toolchainfile.cmake" \
+ ? ? ? ? ? ? ? -DCMAKE_TOOLCHAIN_FILE="$$(CMAKE_TOOLCHAIN_FILE)" \
 ? ? ? ? ? ? ? ?-DCMAKE_INSTALL_PREFIX="/usr" \
 ? ? ? ? ? ? ? ?$$($$(PKG)_CONF_OPT) \
 ? ? ? ?)
--

1.7.9.1

#2 lore raw

PATCH 1/1 toolchainfile.cmake: fix lifetime

Quoted 2 lines · On Thursday 16 February 2012 09:59:16 Samuel Martin wrote:

Note that another way to correctly mange the lifetime of the toolchainfile.cmake file could be to store it in the TOOLCHAIN_DIR.

I would prefer that. I don't like the way it looks now, with the .cmake
file lying around in the output directory.

Regards,
Arnout

Signature · 6 lines
Arnout Vandecappelle                               arnout at mind be
Senior Embedded Software Architect                 +32-16-286540
Essensium/Mind                                     http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium                BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
#3 lore raw

PATCH 1/1 toolchainfile.cmake: fix lifetime

Le Thu, 16 Feb 2012 10:47:26 +0100,
Arnout Vandecappelle <[email protected]> a ?crit :

Quoted 2 lines

I would prefer that. I don't like the way it looks now, with
the .cmake file lying around in the output directory.

No, not in $(TOOLCHAIN_DIR), because the CMake toolchain file must be part of our SDK, so it should be moved somewhere into $(HOST_DIR).

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#4 lore raw

PATCH 1/1 toolchainfile.cmake: fix lifetime

Quoted 8 lines · On Thursday 16 February 2012 15:38:21 Thomas Petazzoni wrote:

Le Thu, 16 Feb 2012 10:47:26 +0100,
Arnout Vandecappelle <[email protected]> a ?crit :

Quoted 2 lines

I would prefer that. I don't like the way it looks now, with
the .cmake file lying around in the output directory.

No, not in $(TOOLCHAIN_DIR), because the CMake toolchain file must be part of our SDK, so it should be moved somewhere into $(HOST_DIR).

True. How about $(HOST_DIR)/usr/$(REAL_GNU_TARGET_NAME)/ (right
beside the sysroot)?

Regards,
Arnout

Signature · 6 lines
Arnout Vandecappelle                               arnout at mind be
Senior Embedded Software Architect                 +32-16-286540
Essensium/Mind                                     http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium                BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
#5 lore raw

PATCH 1/1 toolchainfile.cmake: Fix location

This pacth moves the toolchainfile.cmake in the host tree, as well as making it generated after the toolchain generation or import and checks (depending on the backend used).

This ensures the correctness and consistency between the actual toolchain and the toolchainfile.cmake file describing it.

---
 Makefile                  |   17 +++++++++++------
 package/Makefile.cmake.in |    2 +-
 2 files changed, 12 insertions(+), 7 deletions(-)
Makefile +11 -6
index 7d8dd2e..58db7bb 100644
@@ -1,7 +1,7 @@
 # Makefile for buildroot2
 #
 # Copyright (C) 1999-2005 by Erik Andersen <[email protected]>
-# Copyright (C) 2006-2011 by the Buildroot developers <[email protected]>
+# Copyright (C) 2006-2012 by the Buildroot developers <[email protected]>
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -282,8 +282,12 @@ STAMP_DIR:=$(BASE_DIR)/stamps
 BINARIES_DIR:=$(BASE_DIR)/images
 TARGET_DIR:=$(BASE_DIR)/target
 TOOLCHAIN_DIR=$(BASE_DIR)/toolchain
+CMAKE_TOOLCHAIN_DIR=$(HOST_DIR)/usr/$(REAL_GNU_TARGET_NAME)
+CMAKE_TOOLCHAIN_FILE=$(CMAKE_TOOLCHAIN_DIR)/toolchainfile.cmake
 TARGET_SKELETON=$(TOPDIR)/fs/skeleton
 
+BASE_TARGETS += $(CMAKE_TOOLCHAIN_FILE)
+
 ifeq ($(BR2_CCACHE),y)
 CCACHE:=$(HOST_DIR)/usr/bin/ccache
 CCACHE_CACHE_DIR=$(HOME)/.buildroot-ccache
@@ -366,9 +370,9 @@ HOST_SOURCE += $(addsuffix -source,$(sort $(TARGETS_HOST_DEPS) $(HOST_DEPS)))
 $(TARGETS_ALL): __real_tgt_%: $(BASE_TARGETS) %
 
 dirs: $(DL_DIR) $(TOOLCHAIN_DIR) $(BUILD_DIR) $(STAGING_DIR) $(TARGET_DIR) \
-	$(HOST_DIR) $(BINARIES_DIR) $(STAMP_DIR)
+	$(HOST_DIR) $(BINARIES_DIR) $(STAMP_DIR) $(CMAKE_TOOLCHAIN_DIR)
 
-$(BASE_TARGETS): dirs $(O)/toolchainfile.cmake
+$(BASE_TARGETS): dirs
 
 $(BUILD_DIR)/buildroot-config/auto.conf: $(CONFIG_DIR)/.config
 	$(MAKE) $(EXTRAMAKEARGS) HOSTCC="$(HOSTCC_NOCCACHE)" HOSTCXX="$(HOSTCXX_NOCCACHE)" silentoldconfig
@@ -377,7 +381,7 @@ prepare: $(BUILD_DIR)/buildroot-config/auto.conf
 
 world: prepare dirs dependencies $(BASE_TARGETS) $(TARGETS_ALL)
 
-$(O)/toolchainfile.cmake:
+$(CMAKE_TOOLCHAIN_FILE): $(CMAKE_TOOLCHAIN_DIR)
 	@echo -en "\
 	set(CMAKE_SYSTEM_NAME Linux)\n\
 	set(CMAKE_C_COMPILER $(TARGET_CC_NOCCACHE))\n\
@@ -405,7 +409,7 @@ $(O)/toolchainfile.cmake:
 # dependencies anywhere else
 #
 #############################################################
-$(DL_DIR) $(TOOLCHAIN_DIR) $(BUILD_DIR) $(HOST_DIR) $(BINARIES_DIR) $(STAMP_DIR):
+$(DL_DIR) $(TOOLCHAIN_DIR) $(BUILD_DIR) $(HOST_DIR) $(BINARIES_DIR) $(STAMP_DIR) $(CMAKE_TOOLCHAIN_DIR):
 	@mkdir -p $@
 
 $(STAGING_DIR):
@@ -626,7 +630,8 @@ endif
 
 clean:
 	rm -rf $(STAGING_DIR) $(TARGET_DIR) $(BINARIES_DIR) $(HOST_DIR) \
-		$(STAMP_DIR) $(BUILD_DIR) $(TOOLCHAIN_DIR) $(BASE_DIR)/staging
+		$(STAMP_DIR) $(BUILD_DIR) $(TOOLCHAIN_DIR) $(BASE_DIR)/staging \
+		$(CMAKE_TOOLCHAIN_FILE)
 
 distclean: clean
 ifeq ($(DL_DIR),$(TOPDIR)/dl)
package/Makefile.cmake.in +1 -1
index 38e459b..8a81c3b 100644
@@ -72,7 +72,7 @@ define $(2)_CONFIGURE_CMDS
 	(cd $$($$(PKG)_BUILDDIR) && \
 	rm -f CMakeCache.txt && \
 	$$($$(PKG)_CONF_ENV) $(HOST_DIR)/usr/bin/cmake $$($$(PKG)_SRCDIR) \
-		-DCMAKE_TOOLCHAIN_FILE="$$(BASE_DIR)/toolchainfile.cmake" \
+		-DCMAKE_TOOLCHAIN_FILE="$$(CMAKE_TOOLCHAIN_FILE)" \
 		-DCMAKE_INSTALL_PREFIX="/usr" \
 		$$($$(PKG)_CONF_OPT) \
 	)
Signature · 1 line
1.7.9.1
#6 lore raw

PATCH 1/1 toolchainfile.cmake: Fix location

Quoted 1 line · On Friday 17 February 2012 09:23:55 Samuel Martin wrote:

This pacth moves the toolchainfile.cmake in the host tree, as well

       ^^^^^ patch :-)
Quoted 7 lines

as making it generated after the toolchain generation or import and checks (depending on the backend used).

This ensures the correctness and consistency between the actual toolchain and the toolchainfile.cmake file describing it.

Signature · 9 lines
Arnout Vandecappelle                               arnout at mind be
Senior Embedded Software Architect                 +32-16-286540
Essensium/Mind                                     http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium                BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20120218/6a3bf685/attachment-0001.html>
#7 lore raw

PATCH 1/1 toolchainfile.cmake: fix lifetime

In reply to Samuel Martin

Le Thu, 16 Feb 2012 09:53:45 +0100,
Samuel Martin <[email protected]> a ?crit :

Quoted 4 lines

This file must be consistent with the toolchain, so manage it lifetime in the same way of the toolchain directory.

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com