Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 00/14] CMake infrastructure refactoring
@ 2014-04-23 22:48 Samuel Martin
  2014-04-23 22:48 ` [Buildroot] [PATCH 01/14] pkg-cmake.mk: replace "echo -en" with printf Samuel Martin
                   ` (13 more replies)
  0 siblings, 14 replies; 30+ messages in thread
From: Samuel Martin @ 2014-04-23 22:48 UTC (permalink / raw)
  To: buildroot

Hi all,

Here is a series reviving a couple of patches (pending for a long while in
patchwork) about the CMake infrastructure (patch 4/14 and 5/14) and some new
ones cleaning up this infrastructure, so some packages as well.

Yours,
Samuel

Samuel Martin (14):
  pkg-cmake.mk: replace "echo -en" with printf
  pkg-cmake.mk: remove unneeded quotes in the generated
    toolchainfile.cmake
  pkg-cmake.mk: rework toolchainfile.cmake
  pkg-cmake.mk: do not hardcode absolute path in toolchainfile.cmake
  pkg-cmake.mk: enable ccache for cmake packages
  pkg-cmake.mk: cosmetic changes in the generated toolchainfile.cmake
    file
  pkg-cmake.mk: set additional variables in toolchainfile.cmake
  rpi-userland: cleanup *_CONF_OPT
  pkg-cmake.mk: globally disable BUILD_TESTING flag
  pkg-cmake.mk: globally drive the CMAKE_BUILD_TYPE flag using
    BR2_ENABLE_DEBUG
  openpowerlink: do not override CMAKE_BUILD_TYPE
  opencv: do not override CMAKE_BUILD_TYPE
  flann: do not override CMAKE_BUILD_TYPE
  qhull: do not override CMAKE_BUILD_TYPE

 package/flann/flann.mk                 |  1 -
 package/opencv/opencv.mk               |  1 -
 package/openpowerlink/openpowerlink.mk |  6 ---
 package/pkg-cmake.mk                   | 80 ++++++++++++++++++++++++++++------
 package/qhull/qhull.mk                 |  1 -
 package/rpi-userland/rpi-userland.mk   |  2 +-
 6 files changed, 67 insertions(+), 24 deletions(-)

--
1.9.2

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [Buildroot] [PATCH 01/14] pkg-cmake.mk: replace "echo -en" with printf
  2014-04-23 22:48 [Buildroot] [PATCH 00/14] CMake infrastructure refactoring Samuel Martin
@ 2014-04-23 22:48 ` Samuel Martin
  2014-04-24 20:26   ` Arnout Vandecappelle
  2014-04-23 22:48 ` [Buildroot] [PATCH 02/14] pkg-cmake.mk: remove unneeded quotes in the generated toolchainfile.cmake Samuel Martin
                   ` (12 subsequent siblings)
  13 siblings, 1 reply; 30+ messages in thread
From: Samuel Martin @ 2014-04-23 22:48 UTC (permalink / raw)
  To: buildroot

Signed-off-by: Samuel Martin <s.martin49@gmail.com>
Cc: Arnout Vandecappelle <arnout@mind.be>

---
changes v1 -> v2
- new patch
---
 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 bf3db90..edda14a 100644
--- a/package/pkg-cmake.mk
+++ b/package/pkg-cmake.mk
@@ -160,7 +160,7 @@ host-cmake-package = $(call inner-cmake-package,host-$(pkgname),$(call UPPERCASE
 
 $(HOST_DIR)/usr/share/buildroot/toolchainfile.cmake:
 	@mkdir -p $(@D)
-	@echo -en "\
+	@printf "\
 	set(CMAKE_SYSTEM_NAME Linux)\n\
 	set(CMAKE_C_COMPILER $(TARGET_CC_NOCCACHE))\n\
 	set(CMAKE_CXX_COMPILER $(TARGET_CXX_NOCCACHE))\n\
-- 
1.9.2

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [Buildroot] [PATCH 02/14] pkg-cmake.mk: remove unneeded quotes in the generated toolchainfile.cmake
  2014-04-23 22:48 [Buildroot] [PATCH 00/14] CMake infrastructure refactoring Samuel Martin
  2014-04-23 22:48 ` [Buildroot] [PATCH 01/14] pkg-cmake.mk: replace "echo -en" with printf Samuel Martin
@ 2014-04-23 22:48 ` Samuel Martin
  2014-04-24 20:34   ` Arnout Vandecappelle
  2014-04-23 22:48 ` [Buildroot] [PATCH 03/14] pkg-cmake.mk: rework toolchainfile.cmake Samuel Martin
                   ` (11 subsequent siblings)
  13 siblings, 1 reply; 30+ messages in thread
From: Samuel Martin @ 2014-04-23 22:48 UTC (permalink / raw)
  To: buildroot

Since Buildroot does not support space in paths (at least neither in the
Buildroot installation location, nor in the output directory).

Signed-off-by: Samuel Martin <s.martin49@gmail.com>

---
changes v1 -> v2:
- new patch
---
 package/pkg-cmake.mk | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/package/pkg-cmake.mk b/package/pkg-cmake.mk
index edda14a..963a423 100644
--- a/package/pkg-cmake.mk
+++ b/package/pkg-cmake.mk
@@ -167,10 +167,10 @@ $(HOST_DIR)/usr/share/buildroot/toolchainfile.cmake:
 	set(CMAKE_C_FLAGS \"\$${CMAKE_C_FLAGS} $(TARGET_CFLAGS)\" CACHE STRING \"Buildroot CFLAGS\" FORCE)\n\
 	set(CMAKE_CXX_FLAGS \"\$${CMAKE_CXX_FLAGS} $(TARGET_CXXFLAGS)\" CACHE STRING \"Buildroot CXXFLAGS\" FORCE)\n\
 	set(CMAKE_INSTALL_SO_NO_EXE 0)\n\
-	set(CMAKE_PROGRAM_PATH \"$(HOST_DIR)/usr/bin\")\n\
-	set(CMAKE_FIND_ROOT_PATH \"$(STAGING_DIR)\")\n\
+	set(CMAKE_PROGRAM_PATH $(HOST_DIR)/usr/bin)\n\
+	set(CMAKE_FIND_ROOT_PATH $(STAGING_DIR))\n\
 	set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)\n\
 	set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)\n\
 	set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)\n\
-	set(ENV{PKG_CONFIG_SYSROOT_DIR} \"$(STAGING_DIR)\")\n\
+	set(ENV{PKG_CONFIG_SYSROOT_DIR} $(STAGING_DIR))\n\
 	" > $@
-- 
1.9.2

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [Buildroot] [PATCH 03/14] pkg-cmake.mk: rework toolchainfile.cmake
  2014-04-23 22:48 [Buildroot] [PATCH 00/14] CMake infrastructure refactoring Samuel Martin
  2014-04-23 22:48 ` [Buildroot] [PATCH 01/14] pkg-cmake.mk: replace "echo -en" with printf Samuel Martin
  2014-04-23 22:48 ` [Buildroot] [PATCH 02/14] pkg-cmake.mk: remove unneeded quotes in the generated toolchainfile.cmake Samuel Martin
@ 2014-04-23 22:48 ` Samuel Martin
  2014-04-24 20:59   ` Arnout Vandecappelle
  2014-04-23 22:48 ` [Buildroot] [PATCH 04/14] pkg-cmake.mk: do not hardcode absolute path in toolchainfile.cmake Samuel Martin
                   ` (10 subsequent siblings)
  13 siblings, 1 reply; 30+ messages in thread
From: Samuel Martin @ 2014-04-23 22:48 UTC (permalink / raw)
  To: buildroot

Signed-off-by: Samuel Martin <s.martin49@gmail.com>
Cc: Arnout Vandecappelle <arnout@mind.be>

---
changes v1 -> v2:
- new patch
---
 package/pkg-cmake.mk | 30 ++++++++++++++++--------------
 1 file changed, 16 insertions(+), 14 deletions(-)

diff --git a/package/pkg-cmake.mk b/package/pkg-cmake.mk
index 963a423..af8ecf5 100644
--- a/package/pkg-cmake.mk
+++ b/package/pkg-cmake.mk
@@ -158,19 +158,21 @@ host-cmake-package = $(call inner-cmake-package,host-$(pkgname),$(call UPPERCASE
 # Generation of the CMake toolchain file
 ################################################################################
 
+define TOOLCHAINFILE_CMAKE
+set(CMAKE_SYSTEM_NAME Linux)
+set(CMAKE_C_COMPILER $(TARGET_CC_NOCCACHE))
+set(CMAKE_CXX_COMPILER $(TARGET_CXX_NOCCACHE))
+set(CMAKE_C_FLAGS "$${CMAKE_C_FLAGS} $(TARGET_CFLAGS)" CACHE STRING "Buildroot CFLAGS" FORCE)
+set(CMAKE_CXX_FLAGS "$${CMAKE_CXX_FLAGS} $(TARGET_CXXFLAGS)" CACHE STRING "Buildroot CXXFLAGS" FORCE)
+set(CMAKE_INSTALL_SO_NO_EXE 0)
+set(CMAKE_PROGRAM_PATH $(HOST_DIR)/usr/bin)
+set(CMAKE_FIND_ROOT_PATH $(STAGING_DIR))
+set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
+set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
+set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
+set(ENV{PKG_CONFIG_SYSROOT_DIR} $(STAGING_DIR))
+endef
+
 $(HOST_DIR)/usr/share/buildroot/toolchainfile.cmake:
 	@mkdir -p $(@D)
-	@printf "\
-	set(CMAKE_SYSTEM_NAME Linux)\n\
-	set(CMAKE_C_COMPILER $(TARGET_CC_NOCCACHE))\n\
-	set(CMAKE_CXX_COMPILER $(TARGET_CXX_NOCCACHE))\n\
-	set(CMAKE_C_FLAGS \"\$${CMAKE_C_FLAGS} $(TARGET_CFLAGS)\" CACHE STRING \"Buildroot CFLAGS\" FORCE)\n\
-	set(CMAKE_CXX_FLAGS \"\$${CMAKE_CXX_FLAGS} $(TARGET_CXXFLAGS)\" CACHE STRING \"Buildroot CXXFLAGS\" FORCE)\n\
-	set(CMAKE_INSTALL_SO_NO_EXE 0)\n\
-	set(CMAKE_PROGRAM_PATH $(HOST_DIR)/usr/bin)\n\
-	set(CMAKE_FIND_ROOT_PATH $(STAGING_DIR))\n\
-	set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)\n\
-	set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)\n\
-	set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)\n\
-	set(ENV{PKG_CONFIG_SYSROOT_DIR} $(STAGING_DIR))\n\
-	" > $@
+	@printf '$(subst $(sep),\n,$(TOOLCHAINFILE_CMAKE))' > $@
-- 
1.9.2

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [Buildroot] [PATCH 04/14] pkg-cmake.mk: do not hardcode absolute path in toolchainfile.cmake
  2014-04-23 22:48 [Buildroot] [PATCH 00/14] CMake infrastructure refactoring Samuel Martin
                   ` (2 preceding siblings ...)
  2014-04-23 22:48 ` [Buildroot] [PATCH 03/14] pkg-cmake.mk: rework toolchainfile.cmake Samuel Martin
@ 2014-04-23 22:48 ` Samuel Martin
  2014-04-24 22:10   ` Arnout Vandecappelle
  2014-04-23 22:48 ` [Buildroot] [PATCH 05/14] pkg-cmake.mk: enable ccache for cmake packages Samuel Martin
                   ` (9 subsequent siblings)
  13 siblings, 1 reply; 30+ messages in thread
From: Samuel Martin @ 2014-04-23 22:48 UTC (permalink / raw)
  To: buildroot

The patch allows sharing or moving the toolchains.

This is a step toward making the toolchain/sdk relocatable.

Closes #6818

Signed-off-by: Samuel Martin <s.martin49@gmail.com>
Cc: Uwe Strempel <u.strempel@googlemail.com>
Cc: Arnout Vandecappelle <arnout@mind.be>

---
changes v1 -> v2:
- rebase
- use CMAKE_CURRENT_LIST_DIR instead of get_filename_component()
- rewrite subst call in a more natural way (Arnout)
---
 package/pkg-cmake.mk | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/package/pkg-cmake.mk b/package/pkg-cmake.mk
index af8ecf5..b2ac2df 100644
--- a/package/pkg-cmake.mk
+++ b/package/pkg-cmake.mk
@@ -159,18 +159,19 @@ host-cmake-package = $(call inner-cmake-package,host-$(pkgname),$(call UPPERCASE
 ################################################################################
 
 define TOOLCHAINFILE_CMAKE
+string(REPLACE /usr/share/buildroot "" _HOST_DIR $${CMAKE_CURRENT_LIST_DIR})
 set(CMAKE_SYSTEM_NAME Linux)
-set(CMAKE_C_COMPILER $(TARGET_CC_NOCCACHE))
-set(CMAKE_CXX_COMPILER $(TARGET_CXX_NOCCACHE))
+set(CMAKE_C_COMPILER $(subst $(HOST_DIR),$${_HOST_DIR},$(TARGET_CROSS))gcc)
+set(CMAKE_CXX_COMPILER $(subst $(HOST_DIR),$${_HOST_DIR},$(TARGET_CROSS))g++)
 set(CMAKE_C_FLAGS "$${CMAKE_C_FLAGS} $(TARGET_CFLAGS)" CACHE STRING "Buildroot CFLAGS" FORCE)
 set(CMAKE_CXX_FLAGS "$${CMAKE_CXX_FLAGS} $(TARGET_CXXFLAGS)" CACHE STRING "Buildroot CXXFLAGS" FORCE)
 set(CMAKE_INSTALL_SO_NO_EXE 0)
-set(CMAKE_PROGRAM_PATH $(HOST_DIR)/usr/bin)
-set(CMAKE_FIND_ROOT_PATH $(STAGING_DIR))
+set(CMAKE_PROGRAM_PATH $${_HOST_DIR}/usr/bin)
+set(CMAKE_FIND_ROOT_PATH $${_HOST_DIR}/$(STAGING_SUBDIR))
 set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
 set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
 set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
-set(ENV{PKG_CONFIG_SYSROOT_DIR} $(STAGING_DIR))
+set(ENV{PKG_CONFIG_SYSROOT_DIR} $${_HOST_DIR}/$(STAGING_SUBDIR))
 endef
 
 $(HOST_DIR)/usr/share/buildroot/toolchainfile.cmake:
-- 
1.9.2

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [Buildroot] [PATCH 05/14] pkg-cmake.mk: enable ccache for cmake packages
  2014-04-23 22:48 [Buildroot] [PATCH 00/14] CMake infrastructure refactoring Samuel Martin
                   ` (3 preceding siblings ...)
  2014-04-23 22:48 ` [Buildroot] [PATCH 04/14] pkg-cmake.mk: do not hardcode absolute path in toolchainfile.cmake Samuel Martin
@ 2014-04-23 22:48 ` Samuel Martin
  2014-04-24 22:39   ` Arnout Vandecappelle
  2014-04-23 22:48 ` [Buildroot] [PATCH 06/14] pkg-cmake.mk: cosmetic changes in the generated toolchainfile.cmake file Samuel Martin
                   ` (8 subsequent siblings)
  13 siblings, 1 reply; 30+ messages in thread
From: Samuel Martin @ 2014-04-23 22:48 UTC (permalink / raw)
  To: buildroot

This patch updates the generated toolchainfile.cmake to use ccache.

When toolchainfile.cmake is used inside Buildroot, using ccache during
the build is driven by a CMake knob: USE_CCACHE, automatically set by
the cmake-package infrastructure and reflecting the BR2_CCACHE value.

Since this toolchainefile.cmake file can be used outside Buildroot, and
this file also set a couple of things (among these: the sysroot cflag,
some pkg-config environment variables), it is important to set the
compiler variables as well to keep the consistency of the
cross-compilation configuration.
So, when it is used outside Buildroot, using ccache for the build is
driven by the ccache program availability.

Note that using ccache for the build is achieved by setting the *_ARG1
CMake variables to let CMake use ccache without failing in detecting
the compiler.

Signed-off-by: Samuel Martin <s.martin49@gmail.com>
Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net>
Cc: Luca Ceresoli <luca@lucaceresoli.net>

---
changes v2 -> v3 (Samuel):
- rebase
- inline the -DUSE_CCACHE=... in the configure commands.
- always set the compiler variables, even when called for outside
  Buildroot.
- update commit message

changes v1 -> v2 (Luca):
- totally reimplemented based on Samuel's suggestion;
- added dependency on host-ccache for cmake packages if ccache is
  enabled.
---
 package/pkg-cmake.mk | 35 +++++++++++++++++++++++++++++++++--
 1 file changed, 33 insertions(+), 2 deletions(-)

diff --git a/package/pkg-cmake.mk b/package/pkg-cmake.mk
index b2ac2df..a032426 100644
--- a/package/pkg-cmake.mk
+++ b/package/pkg-cmake.mk
@@ -66,6 +66,7 @@ define $(2)_CONFIGURE_CMDS
 		-DCMAKE_INSTALL_PREFIX="/usr" \
 		-DCMAKE_COLOR_MAKEFILE=OFF \
 		-DBUILD_SHARED_LIBS=$(if $(BR2_PREFER_STATIC_LIB),OFF,ON) \
+		-DUSE_CCACHE=$(if $(BR2_CCACHE),ON,OFF) \
 		$$($$(PKG)_CONF_OPT) \
 	)
 endef
@@ -83,6 +84,7 @@ define $(2)_CONFIGURE_CMDS
 		-DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY="BOTH" \
 		-DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE="BOTH" \
 		-DCMAKE_INSTALL_PREFIX="$$(HOST_DIR)/usr" \
+		-DUSE_CCACHE=$(if $(BR2_CCACHE),ON,OFF) \
 		$$($$(PKG)_CONF_OPT) \
 	)
 endef
@@ -161,8 +163,6 @@ host-cmake-package = $(call inner-cmake-package,host-$(pkgname),$(call UPPERCASE
 define TOOLCHAINFILE_CMAKE
 string(REPLACE /usr/share/buildroot "" _HOST_DIR $${CMAKE_CURRENT_LIST_DIR})
 set(CMAKE_SYSTEM_NAME Linux)
-set(CMAKE_C_COMPILER $(subst $(HOST_DIR),$${_HOST_DIR},$(TARGET_CROSS))gcc)
-set(CMAKE_CXX_COMPILER $(subst $(HOST_DIR),$${_HOST_DIR},$(TARGET_CROSS))g++)
 set(CMAKE_C_FLAGS "$${CMAKE_C_FLAGS} $(TARGET_CFLAGS)" CACHE STRING "Buildroot CFLAGS" FORCE)
 set(CMAKE_CXX_FLAGS "$${CMAKE_CXX_FLAGS} $(TARGET_CXXFLAGS)" CACHE STRING "Buildroot CXXFLAGS" FORCE)
 set(CMAKE_INSTALL_SO_NO_EXE 0)
@@ -172,6 +172,37 @@ set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
 set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
 set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
 set(ENV{PKG_CONFIG_SYSROOT_DIR} $${_HOST_DIR}/$(STAGING_SUBDIR))
+# This toolchain file can be used both inside and outside Buildroot.
+# * When used inside Buildroot, ccache support is explicitly driven using the
+#   USE_CCACHE variable.
+# * When used outside Buildroot (i.e. when USE_CCACHE is not defined), ccache
+#   support is automatically enabled if the ccache program is available.
+if(DEFINED USE_CCACHE)
+	if(USE_CCACHE)
+		set(CMAKE_ASM_COMPILER $(subst $(HOST_DIR),$${_HOST_DIR},$(TARGET_CROSS))gcc)
+		set(CMAKE_C_COMPILER $${_HOST_DIR}/usr/bin/ccache)
+		set(CMAKE_CXX_COMPILER $${_HOST_DIR}/usr/bin/ccache)
+		set(CMAKE_C_COMPILER_ARG1 $(subst $(HOST_DIR),$${_HOST_DIR},$(TARGET_CROSS))gcc)
+		set(CMAKE_CXX_COMPILER_ARG1 $(subst $(HOST_DIR),$${_HOST_DIR},$(TARGET_CROSS))g++)
+	else()
+		set(CMAKE_C_COMPILER $(subst $(HOST_DIR),$${_HOST_DIR},$(TARGET_CROSS))gcc)
+		set(CMAKE_CXX_COMPILER $(subst $(HOST_DIR),$${_HOST_DIR},$(TARGET_CROSS))g++)
+	endif()
+else()
+	find_program(CCACHE ccache)
+	if(CCACHE)
+		set(CMAKE_ASM_COMPILER $(subst $(HOST_DIR),$${_HOST_DIR},$(TARGET_CROSS))gcc)
+		set(CMAKE_C_COMPILER $${CCACHE})
+		set(CMAKE_CXX_COMPILER $${CCACHE})
+		set(CMAKE_C_COMPILER_ARG1 $(subst $(HOST_DIR),$${_HOST_DIR},$(TARGET_CROSS))gcc)
+		set(CMAKE_CXX_COMPILER_ARG1 $(subst $(HOST_DIR),$${_HOST_DIR},$(TARGET_CROSS))g++)
+		message(STATUS "ccache program has been found and will be used for the build.")
+		message(STATUS "  To disable ccache, add -DUSE_CCACHE=OFF on the cmake command line.")
+	else()
+		set(CMAKE_C_COMPILER $(subst $(HOST_DIR),$${_HOST_DIR},$(TARGET_CROSS))gcc)
+		set(CMAKE_CXX_COMPILER $(subst $(HOST_DIR),$${_HOST_DIR},$(TARGET_CROSS))g++)
+	endif()
+endif()
 endef
 
 $(HOST_DIR)/usr/share/buildroot/toolchainfile.cmake:
-- 
1.9.2

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [Buildroot] [PATCH 06/14] pkg-cmake.mk: cosmetic changes in the generated toolchainfile.cmake file
  2014-04-23 22:48 [Buildroot] [PATCH 00/14] CMake infrastructure refactoring Samuel Martin
                   ` (4 preceding siblings ...)
  2014-04-23 22:48 ` [Buildroot] [PATCH 05/14] pkg-cmake.mk: enable ccache for cmake packages Samuel Martin
@ 2014-04-23 22:48 ` Samuel Martin
  2014-04-24  3:47   ` Baruch Siach
  2014-04-23 22:48 ` [Buildroot] [PATCH 07/14] pkg-cmake.mk: set additional variables in toolchainfile.cmake Samuel Martin
                   ` (7 subsequent siblings)
  13 siblings, 1 reply; 30+ messages in thread
From: Samuel Martin @ 2014-04-23 22:48 UTC (permalink / raw)
  To: buildroot

Signed-off-by: Samuel Martin <s.martin49@gmail.com>

---
changes v1 -> v2:
- new patch
---
 package/pkg-cmake.mk | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/package/pkg-cmake.mk b/package/pkg-cmake.mk
index a032426..19f7843 100644
--- a/package/pkg-cmake.mk
+++ b/package/pkg-cmake.mk
@@ -161,17 +161,25 @@ host-cmake-package = $(call inner-cmake-package,host-$(pkgname),$(call UPPERCASE
 ################################################################################
 
 define TOOLCHAINFILE_CMAKE
+#
+# Automatically generated file; DO NOT EDIT.
+# CMake toolchain file for Buildroot
+#
+
 string(REPLACE /usr/share/buildroot "" _HOST_DIR $${CMAKE_CURRENT_LIST_DIR})
+
 set(CMAKE_SYSTEM_NAME Linux)
 set(CMAKE_C_FLAGS "$${CMAKE_C_FLAGS} $(TARGET_CFLAGS)" CACHE STRING "Buildroot CFLAGS" FORCE)
 set(CMAKE_CXX_FLAGS "$${CMAKE_CXX_FLAGS} $(TARGET_CXXFLAGS)" CACHE STRING "Buildroot CXXFLAGS" FORCE)
 set(CMAKE_INSTALL_SO_NO_EXE 0)
+
 set(CMAKE_PROGRAM_PATH $${_HOST_DIR}/usr/bin)
 set(CMAKE_FIND_ROOT_PATH $${_HOST_DIR}/$(STAGING_SUBDIR))
 set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
 set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
 set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
 set(ENV{PKG_CONFIG_SYSROOT_DIR} $${_HOST_DIR}/$(STAGING_SUBDIR))
+
 # This toolchain file can be used both inside and outside Buildroot.
 # * When used inside Buildroot, ccache support is explicitly driven using the
 #   USE_CCACHE variable.
-- 
1.9.2

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [Buildroot] [PATCH 07/14] pkg-cmake.mk: set additional variables in toolchainfile.cmake
  2014-04-23 22:48 [Buildroot] [PATCH 00/14] CMake infrastructure refactoring Samuel Martin
                   ` (5 preceding siblings ...)
  2014-04-23 22:48 ` [Buildroot] [PATCH 06/14] pkg-cmake.mk: cosmetic changes in the generated toolchainfile.cmake file Samuel Martin
@ 2014-04-23 22:48 ` Samuel Martin
  2014-04-24 22:41   ` Arnout Vandecappelle
  2014-04-23 22:48 ` [Buildroot] [PATCH 08/14] rpi-userland: cleanup *_CONF_OPT Samuel Martin
                   ` (6 subsequent siblings)
  13 siblings, 1 reply; 30+ messages in thread
From: Samuel Martin @ 2014-04-23 22:48 UTC (permalink / raw)
  To: buildroot

Set binutils programs CMake variables in the toolchainfile.cmake file.

This variables must be cached, otherwise they are wrongly set, resulting
empty, which will make the builds fail.

Signed-off-by: Samuel Martin <s.martin49@gmail.com>

---
changes v1 -> v2:
- new patch
---
 package/pkg-cmake.mk | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/package/pkg-cmake.mk b/package/pkg-cmake.mk
index 19f7843..d6dadbe 100644
--- a/package/pkg-cmake.mk
+++ b/package/pkg-cmake.mk
@@ -211,6 +211,14 @@ else()
 		set(CMAKE_CXX_COMPILER $(subst $(HOST_DIR),$${_HOST_DIR},$(TARGET_CROSS))g++)
 	endif()
 endif()
+
+set(CMAKE_LINKER  $(subst $(HOST_DIR),$${_HOST_DIR},$(TARGET_CROSS))ld      CACHE FILEPATH \"\" FORCE)
+set(CMAKE_AR      $(subst $(HOST_DIR),$${_HOST_DIR},$(TARGET_CROSS))ar      CACHE FILEPATH \"\" FORCE)
+set(CMAKE_RANLIB  $(subst $(HOST_DIR),$${_HOST_DIR},$(TARGET_CROSS))ranlib  CACHE FILEPATH \"\" FORCE)
+set(CMAKE_NM      $(subst $(HOST_DIR),$${_HOST_DIR},$(TARGET_CROSS))nm      CACHE FILEPATH \"\" FORCE)
+set(CMAKE_OBJCOPY $(subst $(HOST_DIR),$${_HOST_DIR},$(TARGET_CROSS))objcopy CACHE FILEPATH \"\" FORCE)
+set(CMAKE_OBJDUMP $(subst $(HOST_DIR),$${_HOST_DIR},$(TARGET_CROSS))objdump CACHE FILEPATH \"\" FORCE)
+set(CMAKE_STRIP   $(subst $(HOST_DIR),$${_HOST_DIR},$(TARGET_CROSS))strip   CACHE FILEPATH \"\" FORCE)
 endef
 
 $(HOST_DIR)/usr/share/buildroot/toolchainfile.cmake:
-- 
1.9.2

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [Buildroot] [PATCH 08/14] rpi-userland: cleanup *_CONF_OPT
  2014-04-23 22:48 [Buildroot] [PATCH 00/14] CMake infrastructure refactoring Samuel Martin
                   ` (6 preceding siblings ...)
  2014-04-23 22:48 ` [Buildroot] [PATCH 07/14] pkg-cmake.mk: set additional variables in toolchainfile.cmake Samuel Martin
@ 2014-04-23 22:48 ` Samuel Martin
  2014-04-23 22:48 ` [Buildroot] [PATCH 09/14] pkg-cmake.mk: globally disable BUILD_TESTING flag Samuel Martin
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 30+ messages in thread
From: Samuel Martin @ 2014-04-23 22:48 UTC (permalink / raw)
  To: buildroot

rpi-userland does not need -DBUILD_SHARED_LIBS=OFF to be passed to
correclty build its static libraries; so remove this cmake flag from the
configure options.

Signed-off-by: Samuel Martin <s.martin49@gmail.com>
Cc: "Yann E. MORIN" <yann.morin.1998@free.fr>

---
changes v1 -> v2:
- new patch
---
 package/rpi-userland/rpi-userland.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/rpi-userland/rpi-userland.mk b/package/rpi-userland/rpi-userland.mk
index 7188dcf..bec5d46 100644
--- a/package/rpi-userland/rpi-userland.mk
+++ b/package/rpi-userland/rpi-userland.mk
@@ -9,7 +9,7 @@ RPI_USERLAND_SITE = $(call github,raspberrypi,userland,$(RPI_USERLAND_VERSION))
 RPI_USERLAND_LICENSE = BSD-3c
 RPI_USERLAND_LICENSE_FILES = LICENCE
 RPI_USERLAND_INSTALL_STAGING = YES
-RPI_USERLAND_CONF_OPT = -DVMCS_INSTALL_PREFIX=/usr -DBUILD_SHARED_LIBS=OFF
+RPI_USERLAND_CONF_OPT = -DVMCS_INSTALL_PREFIX=/usr
 
 define RPI_USERLAND_POST_TARGET_CLEANUP
     rm -Rf $(TARGET_DIR)/usr/src
-- 
1.9.2

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [Buildroot] [PATCH 09/14] pkg-cmake.mk: globally disable BUILD_TESTING flag
  2014-04-23 22:48 [Buildroot] [PATCH 00/14] CMake infrastructure refactoring Samuel Martin
                   ` (7 preceding siblings ...)
  2014-04-23 22:48 ` [Buildroot] [PATCH 08/14] rpi-userland: cleanup *_CONF_OPT Samuel Martin
@ 2014-04-23 22:48 ` Samuel Martin
  2014-04-24 22:45   ` Arnout Vandecappelle
  2014-04-23 22:48 ` [Buildroot] [PATCH 10/14] pkg-cmake.mk: globally drive the CMAKE_BUILD_TYPE flag using BR2_ENABLE_DEBUG Samuel Martin
                   ` (4 subsequent siblings)
  13 siblings, 1 reply; 30+ messages in thread
From: Samuel Martin @ 2014-04-23 22:48 UTC (permalink / raw)
  To: buildroot

This CMake flag is used to enable tests. It may not disable the test
programs from being built, but it controls the test execution.

Since we don't care about building the tests (and usually disable them
when possible), make sure Buildroot won't try to run them.

Signed-off-by: Samuel Martin <s.martin49@gmail.com>

---
changes v1 -> v2:
- new patch
---
 package/pkg-cmake.mk | 1 +
 1 file changed, 1 insertion(+)

diff --git a/package/pkg-cmake.mk b/package/pkg-cmake.mk
index d6dadbe..e0efccb 100644
--- a/package/pkg-cmake.mk
+++ b/package/pkg-cmake.mk
@@ -65,6 +65,7 @@ define $(2)_CONFIGURE_CMDS
 		-DCMAKE_TOOLCHAIN_FILE="$$(HOST_DIR)/usr/share/buildroot/toolchainfile.cmake" \
 		-DCMAKE_INSTALL_PREFIX="/usr" \
 		-DCMAKE_COLOR_MAKEFILE=OFF \
+		-DBUILD_TESTING=OFF \
 		-DBUILD_SHARED_LIBS=$(if $(BR2_PREFER_STATIC_LIB),OFF,ON) \
 		-DUSE_CCACHE=$(if $(BR2_CCACHE),ON,OFF) \
 		$$($$(PKG)_CONF_OPT) \
-- 
1.9.2

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [Buildroot] [PATCH 10/14] pkg-cmake.mk: globally drive the CMAKE_BUILD_TYPE flag using BR2_ENABLE_DEBUG
  2014-04-23 22:48 [Buildroot] [PATCH 00/14] CMake infrastructure refactoring Samuel Martin
                   ` (8 preceding siblings ...)
  2014-04-23 22:48 ` [Buildroot] [PATCH 09/14] pkg-cmake.mk: globally disable BUILD_TESTING flag Samuel Martin
@ 2014-04-23 22:48 ` Samuel Martin
  2014-04-24 22:46   ` Arnout Vandecappelle
  2014-04-23 22:48 ` [Buildroot] [PATCH 11/14] openpowerlink: do not override CMAKE_BUILD_TYPE Samuel Martin
                   ` (3 subsequent siblings)
  13 siblings, 1 reply; 30+ messages in thread
From: Samuel Martin @ 2014-04-23 22:48 UTC (permalink / raw)
  To: buildroot

This CMake flag is usually used to adjust compiler flags (like: -Ox, -g,
etc).

So, it makes sense for Buildroot to globally drive this CMake flags in
the cmake-package infrastructure.

However, if a package prefer overriding this default setting, it still
can via the <PKG>_CONF_OPT variable.

Signed-off-by: Samuel Martin <s.martin49@gmail.com>

---
changes v1 -> v2:
- new patch
---
 package/pkg-cmake.mk | 1 +
 1 file changed, 1 insertion(+)

diff --git a/package/pkg-cmake.mk b/package/pkg-cmake.mk
index e0efccb..1c52a53 100644
--- a/package/pkg-cmake.mk
+++ b/package/pkg-cmake.mk
@@ -63,6 +63,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_INSTALL_PREFIX="/usr" \
 		-DCMAKE_COLOR_MAKEFILE=OFF \
 		-DBUILD_TESTING=OFF \
-- 
1.9.2

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [Buildroot] [PATCH 11/14] openpowerlink: do not override CMAKE_BUILD_TYPE
  2014-04-23 22:48 [Buildroot] [PATCH 00/14] CMake infrastructure refactoring Samuel Martin
                   ` (9 preceding siblings ...)
  2014-04-23 22:48 ` [Buildroot] [PATCH 10/14] pkg-cmake.mk: globally drive the CMAKE_BUILD_TYPE flag using BR2_ENABLE_DEBUG Samuel Martin
@ 2014-04-23 22:48 ` Samuel Martin
  2014-04-23 22:48 ` [Buildroot] [PATCH 12/14] opencv: " Samuel Martin
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 30+ messages in thread
From: Samuel Martin @ 2014-04-23 22:48 UTC (permalink / raw)
  To: buildroot

This flag is already correctly set by the cmake-package infrastructure.

Signed-off-by: Samuel Martin <s.martin49@gmail.com>

---
changes v1 -> v2:
- new patch
---
 package/openpowerlink/openpowerlink.mk | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/package/openpowerlink/openpowerlink.mk b/package/openpowerlink/openpowerlink.mk
index 37a06e5..db3ac74 100644
--- a/package/openpowerlink/openpowerlink.mk
+++ b/package/openpowerlink/openpowerlink.mk
@@ -26,12 +26,6 @@ OPENPOWERLINK_CONF_OPT = -DCMAKE_SYSTEM_PROCESSOR=$(OPENPOWERLINK_ARCH)
 # so force static lib to build libpowerlink.a
 OPENPOWERLINK_CONF_OPT += -DBUILD_SHARED_LIBS=OFF
 
-ifeq ($(BR2_ENABLE_DEBUG),y)
-OPENPOWERLINK_CONF_OPT += -DCMAKE_BUILD_TYPE=Debug
-else
-OPENPOWERLINK_CONF_OPT += -DCMAKE_BUILD_TYPE=Release
-endif
-
 OPENPOWERLINK_CONF_OPT += -DCFG_DEBUG_LVL=$(call qstrip,$(BR2_PACKAGE_OPENPOWERLINK_DEBUG_LEVEL))
 
 ifeq ($(BR2_PACKAGE_OPENPOWERLINK_LIBPCAP),y)
-- 
1.9.2

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [Buildroot] [PATCH 12/14] opencv: do not override CMAKE_BUILD_TYPE
  2014-04-23 22:48 [Buildroot] [PATCH 00/14] CMake infrastructure refactoring Samuel Martin
                   ` (10 preceding siblings ...)
  2014-04-23 22:48 ` [Buildroot] [PATCH 11/14] openpowerlink: do not override CMAKE_BUILD_TYPE Samuel Martin
@ 2014-04-23 22:48 ` Samuel Martin
  2014-04-23 22:48 ` [Buildroot] [PATCH 13/14] flann: " Samuel Martin
  2014-04-23 22:48 ` [Buildroot] [PATCH 14/14] qhull: " Samuel Martin
  13 siblings, 0 replies; 30+ messages in thread
From: Samuel Martin @ 2014-04-23 22:48 UTC (permalink / raw)
  To: buildroot

This flag is already correctly set by the cmake-package infrastructure.

Signed-off-by: Samuel Martin <s.martin49@gmail.com>

---
changes v1 -> v2:
- new patch
---
 package/opencv/opencv.mk | 1 -
 1 file changed, 1 deletion(-)

diff --git a/package/opencv/opencv.mk b/package/opencv/opencv.mk
index 42f9b0a..3fcba80 100644
--- a/package/opencv/opencv.mk
+++ b/package/opencv/opencv.mk
@@ -10,7 +10,6 @@ OPENCV_SOURCE  = OpenCV-$(OPENCV_VERSION).tar.bz2
 OPENCV_INSTALL_STAGING = YES
 
 OPENCV_CONF_OPT += \
-	-DCMAKE_BUILD_TYPE=$(if $(BR2_ENABLE_DEBUG),Debug,Release)   \
 	-DBUILD_WITH_STATIC_CRT=OFF                                  \
 	-DBUILD_DOCS=OFF                                             \
 	-DBUILD_EXAMPLES=OFF                                         \
-- 
1.9.2

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [Buildroot] [PATCH 13/14] flann: do not override CMAKE_BUILD_TYPE
  2014-04-23 22:48 [Buildroot] [PATCH 00/14] CMake infrastructure refactoring Samuel Martin
                   ` (11 preceding siblings ...)
  2014-04-23 22:48 ` [Buildroot] [PATCH 12/14] opencv: " Samuel Martin
@ 2014-04-23 22:48 ` Samuel Martin
  2014-04-23 22:48 ` [Buildroot] [PATCH 14/14] qhull: " Samuel Martin
  13 siblings, 0 replies; 30+ messages in thread
From: Samuel Martin @ 2014-04-23 22:48 UTC (permalink / raw)
  To: buildroot

This flag is already correctly set by the cmake-package infrastructure.

Signed-off-by: Samuel Martin <s.martin49@gmail.com>

---
changes v1 -> v2:
- new patch
---
 package/flann/flann.mk | 1 -
 1 file changed, 1 deletion(-)

diff --git a/package/flann/flann.mk b/package/flann/flann.mk
index 6f95f19..cddd2aa 100644
--- a/package/flann/flann.mk
+++ b/package/flann/flann.mk
@@ -10,7 +10,6 @@ FLANN_INSTALL_STAGING = YES
 FLANN_LICENSE = BSD-3c
 FLANN_LICENSE_FILES = COPYING
 FLANN_CONF_OPT = \
-	-DCMAKE_BUILD_TYPE=Release \
 	-DBUILD_C_BINDINGS=ON \
 	-DBUILD_PYTHON_BINDINGS=OFF \
 	-DBUILD_MATLAB_BINDINGS=OFF \
-- 
1.9.2

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [Buildroot] [PATCH 14/14] qhull: do not override CMAKE_BUILD_TYPE
  2014-04-23 22:48 [Buildroot] [PATCH 00/14] CMake infrastructure refactoring Samuel Martin
                   ` (12 preceding siblings ...)
  2014-04-23 22:48 ` [Buildroot] [PATCH 13/14] flann: " Samuel Martin
@ 2014-04-23 22:48 ` Samuel Martin
  13 siblings, 0 replies; 30+ messages in thread
From: Samuel Martin @ 2014-04-23 22:48 UTC (permalink / raw)
  To: buildroot

This flag is already correctly set by the cmake-package infrastructure.

Signed-off-by: Samuel Martin <s.martin49@gmail.com>

---
changes v1 -> v2:
- new patch
---
 package/qhull/qhull.mk | 1 -
 1 file changed, 1 deletion(-)

diff --git a/package/qhull/qhull.mk b/package/qhull/qhull.mk
index f2bc771..3451775 100644
--- a/package/qhull/qhull.mk
+++ b/package/qhull/qhull.mk
@@ -9,6 +9,5 @@ QHULL_SITE = git://gitorious.org/qhull/qhull.git
 QHULL_INSTALL_STAGING = YES
 QHULL_LICENSE = BSD-Style
 QHULL_LICENSE_FILES = COPYING.txt
-QHULL_CONF_OPT = -DCMAKE_BUILD_TYPE=Release
 
 $(eval $(cmake-package))
-- 
1.9.2

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [Buildroot] [PATCH 06/14] pkg-cmake.mk: cosmetic changes in the generated toolchainfile.cmake file
  2014-04-23 22:48 ` [Buildroot] [PATCH 06/14] pkg-cmake.mk: cosmetic changes in the generated toolchainfile.cmake file Samuel Martin
@ 2014-04-24  3:47   ` Baruch Siach
  2014-05-28 19:07     ` Samuel Martin
  0 siblings, 1 reply; 30+ messages in thread
From: Baruch Siach @ 2014-04-24  3:47 UTC (permalink / raw)
  To: buildroot

Hi Samuel,

On Thu, Apr 24, 2014 at 12:48:25AM +0200, Samuel Martin wrote:
> Signed-off-by: Samuel Martin <s.martin49@gmail.com>
> 
> ---
> changes v1 -> v2:
> - new patch
> ---
>  package/pkg-cmake.mk | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/package/pkg-cmake.mk b/package/pkg-cmake.mk
> index a032426..19f7843 100644
> --- a/package/pkg-cmake.mk
> +++ b/package/pkg-cmake.mk
> @@ -161,17 +161,25 @@ host-cmake-package = $(call inner-cmake-package,host-$(pkgname),$(call UPPERCASE
>  ################################################################################
>  
>  define TOOLCHAINFILE_CMAKE
> +#
> +# Automatically generated file; DO NOT EDIT.
> +# CMake toolchain file for Buildroot
> +#
> +
>  string(REPLACE /usr/share/buildroot "" _HOST_DIR $${CMAKE_CURRENT_LIST_DIR})
> +
>  set(CMAKE_SYSTEM_NAME Linux)
>  set(CMAKE_C_FLAGS "$${CMAKE_C_FLAGS} $(TARGET_CFLAGS)" CACHE STRING "Buildroot CFLAGS" FORCE)
>  set(CMAKE_CXX_FLAGS "$${CMAKE_CXX_FLAGS} $(TARGET_CXXFLAGS)" CACHE STRING "Buildroot CXXFLAGS" FORCE)
>  set(CMAKE_INSTALL_SO_NO_EXE 0)
> +
>  set(CMAKE_PROGRAM_PATH $${_HOST_DIR}/usr/bin)
>  set(CMAKE_FIND_ROOT_PATH $${_HOST_DIR}/$(STAGING_SUBDIR))
>  set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
>  set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
>  set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
>  set(ENV{PKG_CONFIG_SYSROOT_DIR} $${_HOST_DIR}/$(STAGING_SUBDIR))
> +
>  # This toolchain file can be used both inside and outside Buildroot.
>  # * When used inside Buildroot, ccache support is explicitly driven using the
>  #   USE_CCACHE variable.

Shouldn't this be squashed into patch #3?

baruch

-- 
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [Buildroot] [PATCH 01/14] pkg-cmake.mk: replace "echo -en" with printf
  2014-04-23 22:48 ` [Buildroot] [PATCH 01/14] pkg-cmake.mk: replace "echo -en" with printf Samuel Martin
@ 2014-04-24 20:26   ` Arnout Vandecappelle
  2014-04-24 20:31     ` Peter Korsgaard
  0 siblings, 1 reply; 30+ messages in thread
From: Arnout Vandecappelle @ 2014-04-24 20:26 UTC (permalink / raw)
  To: buildroot

On 24/04/14 00:48, Samuel Martin wrote:
> Signed-off-by: Samuel Martin <s.martin49@gmail.com>
> Cc: Arnout Vandecappelle <arnout@mind.be>

 Commit message could have been clarified with

printf is POSIX-compliant, echo -e is not.

 Still,

Acked-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>


 Regards,
 Arnout

> 
> ---
> changes v1 -> v2
> - new patch
> ---
>  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 bf3db90..edda14a 100644
> --- a/package/pkg-cmake.mk
> +++ b/package/pkg-cmake.mk
> @@ -160,7 +160,7 @@ host-cmake-package = $(call inner-cmake-package,host-$(pkgname),$(call UPPERCASE
>  
>  $(HOST_DIR)/usr/share/buildroot/toolchainfile.cmake:
>  	@mkdir -p $(@D)
> -	@echo -en "\
> +	@printf "\
>  	set(CMAKE_SYSTEM_NAME Linux)\n\
>  	set(CMAKE_C_COMPILER $(TARGET_CC_NOCCACHE))\n\
>  	set(CMAKE_CXX_COMPILER $(TARGET_CXX_NOCCACHE))\n\
> 


-- 
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
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

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [Buildroot] [PATCH 01/14] pkg-cmake.mk: replace "echo -en" with printf
  2014-04-24 20:26   ` Arnout Vandecappelle
@ 2014-04-24 20:31     ` Peter Korsgaard
  0 siblings, 0 replies; 30+ messages in thread
From: Peter Korsgaard @ 2014-04-24 20:31 UTC (permalink / raw)
  To: buildroot

>>>>> "Arnout" == Arnout Vandecappelle <arnout@mind.be> writes:

 > On 24/04/14 00:48, Samuel Martin wrote:
 >> Signed-off-by: Samuel Martin <s.martin49@gmail.com>
 >> Cc: Arnout Vandecappelle <arnout@mind.be>

 >  Commit message could have been clarified with

 > printf is POSIX-compliant, echo -e is not.

Committed with that added, thanks.

It would also be good to get rid of the other instances of this in the
tree:

git grep -l 'echo -e'
package/acpid/acpid.mk
package/eudev/S10udev
package/pkg-utils.mk
package/udev/S10udev

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [Buildroot] [PATCH 02/14] pkg-cmake.mk: remove unneeded quotes in the generated toolchainfile.cmake
  2014-04-23 22:48 ` [Buildroot] [PATCH 02/14] pkg-cmake.mk: remove unneeded quotes in the generated toolchainfile.cmake Samuel Martin
@ 2014-04-24 20:34   ` Arnout Vandecappelle
  0 siblings, 0 replies; 30+ messages in thread
From: Arnout Vandecappelle @ 2014-04-24 20:34 UTC (permalink / raw)
  To: buildroot

On 24/04/14 00:48, Samuel Martin wrote:
> Since Buildroot does not support space in paths (at least neither in the
> Buildroot installation location, nor in the output directory).

 But is that sufficient reason to remove the quotes? I think not... We
don't support space in paths because make doesn't, not because we don't
_want_ to.

 So, NAK for me. Unless there is some other reason why those quotes are
in the way, but since they're still there a couple of lines above (and
needed there) it's NAK for me.

 Unless you can give a better explanation why you'd prefer no quotes.


 Regards,
 Arnout

> 
> Signed-off-by: Samuel Martin <s.martin49@gmail.com>
> 
> ---
> changes v1 -> v2:
> - new patch
> ---
>  package/pkg-cmake.mk | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/package/pkg-cmake.mk b/package/pkg-cmake.mk
> index edda14a..963a423 100644
> --- a/package/pkg-cmake.mk
> +++ b/package/pkg-cmake.mk
> @@ -167,10 +167,10 @@ $(HOST_DIR)/usr/share/buildroot/toolchainfile.cmake:
>  	set(CMAKE_C_FLAGS \"\$${CMAKE_C_FLAGS} $(TARGET_CFLAGS)\" CACHE STRING \"Buildroot CFLAGS\" FORCE)\n\
>  	set(CMAKE_CXX_FLAGS \"\$${CMAKE_CXX_FLAGS} $(TARGET_CXXFLAGS)\" CACHE STRING \"Buildroot CXXFLAGS\" FORCE)\n\
>  	set(CMAKE_INSTALL_SO_NO_EXE 0)\n\
> -	set(CMAKE_PROGRAM_PATH \"$(HOST_DIR)/usr/bin\")\n\
> -	set(CMAKE_FIND_ROOT_PATH \"$(STAGING_DIR)\")\n\
> +	set(CMAKE_PROGRAM_PATH $(HOST_DIR)/usr/bin)\n\
> +	set(CMAKE_FIND_ROOT_PATH $(STAGING_DIR))\n\
>  	set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)\n\
>  	set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)\n\
>  	set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)\n\
> -	set(ENV{PKG_CONFIG_SYSROOT_DIR} \"$(STAGING_DIR)\")\n\
> +	set(ENV{PKG_CONFIG_SYSROOT_DIR} $(STAGING_DIR))\n\
>  	" > $@
> 


-- 
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
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

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [Buildroot] [PATCH 03/14] pkg-cmake.mk: rework toolchainfile.cmake
  2014-04-23 22:48 ` [Buildroot] [PATCH 03/14] pkg-cmake.mk: rework toolchainfile.cmake Samuel Martin
@ 2014-04-24 20:59   ` Arnout Vandecappelle
  0 siblings, 0 replies; 30+ messages in thread
From: Arnout Vandecappelle @ 2014-04-24 20:59 UTC (permalink / raw)
  To: buildroot

On 24/04/14 00:48, Samuel Martin wrote:
> Signed-off-by: Samuel Martin <s.martin49@gmail.com>
> Cc: Arnout Vandecappelle <arnout@mind.be>

 More explicit commit log:

By putting the content of toolchainfile.cmake in a separate define, we
can remove a lot of the quoting and it becomes much more similar to the
resulting file.

 Otherwise, looks good to me except for the quoting.

> 
> ---
> changes v1 -> v2:
> - new patch
> ---
>  package/pkg-cmake.mk | 30 ++++++++++++++++--------------
>  1 file changed, 16 insertions(+), 14 deletions(-)
> 
> diff --git a/package/pkg-cmake.mk b/package/pkg-cmake.mk
> index 963a423..af8ecf5 100644
> --- a/package/pkg-cmake.mk
> +++ b/package/pkg-cmake.mk
> @@ -158,19 +158,21 @@ host-cmake-package = $(call inner-cmake-package,host-$(pkgname),$(call UPPERCASE
>  # Generation of the CMake toolchain file
>  ################################################################################
>  
> +define TOOLCHAINFILE_CMAKE
> +set(CMAKE_SYSTEM_NAME Linux)
> +set(CMAKE_C_COMPILER $(TARGET_CC_NOCCACHE))
> +set(CMAKE_CXX_COMPILER $(TARGET_CXX_NOCCACHE))

 Amendment to the comment I made on the previous patch 2/14: the quoting
of these two should of course be consistent with the quoting of
PROGRAM_PATH and FIND_ROOT_PATH. So I would say to add quotes.



 Regards,
 Arnout

> +set(CMAKE_C_FLAGS "$${CMAKE_C_FLAGS} $(TARGET_CFLAGS)" CACHE STRING "Buildroot CFLAGS" FORCE)
> +set(CMAKE_CXX_FLAGS "$${CMAKE_CXX_FLAGS} $(TARGET_CXXFLAGS)" CACHE STRING "Buildroot CXXFLAGS" FORCE)
> +set(CMAKE_INSTALL_SO_NO_EXE 0)
> +set(CMAKE_PROGRAM_PATH $(HOST_DIR)/usr/bin)
> +set(CMAKE_FIND_ROOT_PATH $(STAGING_DIR))
> +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
> +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
> +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
> +set(ENV{PKG_CONFIG_SYSROOT_DIR} $(STAGING_DIR))
> +endef
> +
>  $(HOST_DIR)/usr/share/buildroot/toolchainfile.cmake:
>  	@mkdir -p $(@D)
> -	@printf "\
> -	set(CMAKE_SYSTEM_NAME Linux)\n\
> -	set(CMAKE_C_COMPILER $(TARGET_CC_NOCCACHE))\n\
> -	set(CMAKE_CXX_COMPILER $(TARGET_CXX_NOCCACHE))\n\
> -	set(CMAKE_C_FLAGS \"\$${CMAKE_C_FLAGS} $(TARGET_CFLAGS)\" CACHE STRING \"Buildroot CFLAGS\" FORCE)\n\
> -	set(CMAKE_CXX_FLAGS \"\$${CMAKE_CXX_FLAGS} $(TARGET_CXXFLAGS)\" CACHE STRING \"Buildroot CXXFLAGS\" FORCE)\n\
> -	set(CMAKE_INSTALL_SO_NO_EXE 0)\n\
> -	set(CMAKE_PROGRAM_PATH $(HOST_DIR)/usr/bin)\n\
> -	set(CMAKE_FIND_ROOT_PATH $(STAGING_DIR))\n\
> -	set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)\n\
> -	set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)\n\
> -	set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)\n\
> -	set(ENV{PKG_CONFIG_SYSROOT_DIR} $(STAGING_DIR))\n\
> -	" > $@
> +	@printf '$(subst $(sep),\n,$(TOOLCHAINFILE_CMAKE))' > $@
> 


-- 
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
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

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [Buildroot] [PATCH 04/14] pkg-cmake.mk: do not hardcode absolute path in toolchainfile.cmake
  2014-04-23 22:48 ` [Buildroot] [PATCH 04/14] pkg-cmake.mk: do not hardcode absolute path in toolchainfile.cmake Samuel Martin
@ 2014-04-24 22:10   ` Arnout Vandecappelle
  0 siblings, 0 replies; 30+ messages in thread
From: Arnout Vandecappelle @ 2014-04-24 22:10 UTC (permalink / raw)
  To: buildroot

On 24/04/14 00:48, Samuel Martin wrote:
> The patch allows sharing or moving the toolchains.
> 
> This is a step toward making the toolchain/sdk relocatable.
> 
> Closes #6818
> 
> Signed-off-by: Samuel Martin <s.martin49@gmail.com>
> Cc: Uwe Strempel <u.strempel@googlemail.com>
> Cc: Arnout Vandecappelle <arnout@mind.be>
> 
> ---
> changes v1 -> v2:
> - rebase
> - use CMAKE_CURRENT_LIST_DIR instead of get_filename_component()
> - rewrite subst call in a more natural way (Arnout)
> ---
>  package/pkg-cmake.mk | 11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/package/pkg-cmake.mk b/package/pkg-cmake.mk
> index af8ecf5..b2ac2df 100644
> --- a/package/pkg-cmake.mk
> +++ b/package/pkg-cmake.mk
> @@ -159,18 +159,19 @@ host-cmake-package = $(call inner-cmake-package,host-$(pkgname),$(call UPPERCASE
>  ################################################################################
>  
>  define TOOLCHAINFILE_CMAKE
> +string(REPLACE /usr/share/buildroot "" _HOST_DIR $${CMAKE_CURRENT_LIST_DIR})

 _HOST_DIR is not sufficiently explanatory. How about RELOCATED_HOST_DIR?

 This could benefit from some explanatory comment (took me some time to
figure it out, at least).

# In order to allow the toolchain to be relocated, we calculated the
# HOST_DIR based on this file's location: $(HOST_DIR)/usr/share/buildroot
# In all the other variables, HOST_DIR will be replaced by
# RELOCATED_HOST_DIR

>  set(CMAKE_SYSTEM_NAME Linux)
> -set(CMAKE_C_COMPILER $(TARGET_CC_NOCCACHE))
> -set(CMAKE_CXX_COMPILER $(TARGET_CXX_NOCCACHE))
> +set(CMAKE_C_COMPILER $(subst $(HOST_DIR),$${_HOST_DIR},$(TARGET_CROSS))gcc)

 Why is this using $(TARGET_CROSS)gcc instead of the original
$(TARGET_CC_NOCACHE) ?


 Regards,
 Arnout

> +set(CMAKE_CXX_COMPILER $(subst $(HOST_DIR),$${_HOST_DIR},$(TARGET_CROSS))g++)
>  set(CMAKE_C_FLAGS "$${CMAKE_C_FLAGS} $(TARGET_CFLAGS)" CACHE STRING "Buildroot CFLAGS" FORCE)
>  set(CMAKE_CXX_FLAGS "$${CMAKE_CXX_FLAGS} $(TARGET_CXXFLAGS)" CACHE STRING "Buildroot CXXFLAGS" FORCE)
>  set(CMAKE_INSTALL_SO_NO_EXE 0)
> -set(CMAKE_PROGRAM_PATH $(HOST_DIR)/usr/bin)
> -set(CMAKE_FIND_ROOT_PATH $(STAGING_DIR))
> +set(CMAKE_PROGRAM_PATH $${_HOST_DIR}/usr/bin)
> +set(CMAKE_FIND_ROOT_PATH $${_HOST_DIR}/$(STAGING_SUBDIR))
>  set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
>  set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
>  set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
> -set(ENV{PKG_CONFIG_SYSROOT_DIR} $(STAGING_DIR))
> +set(ENV{PKG_CONFIG_SYSROOT_DIR} $${_HOST_DIR}/$(STAGING_SUBDIR))
>  endef
>  
>  $(HOST_DIR)/usr/share/buildroot/toolchainfile.cmake:
> 


-- 
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
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

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [Buildroot] [PATCH 05/14] pkg-cmake.mk: enable ccache for cmake packages
  2014-04-23 22:48 ` [Buildroot] [PATCH 05/14] pkg-cmake.mk: enable ccache for cmake packages Samuel Martin
@ 2014-04-24 22:39   ` Arnout Vandecappelle
  2014-05-29 11:03     ` Samuel Martin
  0 siblings, 1 reply; 30+ messages in thread
From: Arnout Vandecappelle @ 2014-04-24 22:39 UTC (permalink / raw)
  To: buildroot

On 24/04/14 00:48, Samuel Martin wrote:
> This patch updates the generated toolchainfile.cmake to use ccache.
> 
> When toolchainfile.cmake is used inside Buildroot, using ccache during
> the build is driven by a CMake knob: USE_CCACHE, automatically set by
> the cmake-package infrastructure and reflecting the BR2_CCACHE value.
> 
> Since this toolchainefile.cmake file can be used outside Buildroot, and
> this file also set a couple of things (among these: the sysroot cflag,
> some pkg-config environment variables), it is important to set the
> compiler variables as well to keep the consistency of the
> cross-compilation configuration.
> So, when it is used outside Buildroot, using ccache for the build is
> driven by the ccache program availability.

 I don't understand this. We can just use br-ccache when it's called from
outside buildroot as well, no?


> 
> Note that using ccache for the build is achieved by setting the *_ARG1
> CMake variables to let CMake use ccache without failing in detecting
> the compiler.
> 
> Signed-off-by: Samuel Martin <s.martin49@gmail.com>
> Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net>
> Cc: Luca Ceresoli <luca@lucaceresoli.net>
> 
> ---
> changes v2 -> v3 (Samuel):
> - rebase
> - inline the -DUSE_CCACHE=... in the configure commands.
> - always set the compiler variables, even when called for outside
>   Buildroot.
> - update commit message
> 
> changes v1 -> v2 (Luca):
> - totally reimplemented based on Samuel's suggestion;
> - added dependency on host-ccache for cmake packages if ccache is
>   enabled.
> ---
>  package/pkg-cmake.mk | 35 +++++++++++++++++++++++++++++++++--
>  1 file changed, 33 insertions(+), 2 deletions(-)
> 
> diff --git a/package/pkg-cmake.mk b/package/pkg-cmake.mk
> index b2ac2df..a032426 100644
> --- a/package/pkg-cmake.mk
> +++ b/package/pkg-cmake.mk
> @@ -66,6 +66,7 @@ define $(2)_CONFIGURE_CMDS
>  		-DCMAKE_INSTALL_PREFIX="/usr" \
>  		-DCMAKE_COLOR_MAKEFILE=OFF \
>  		-DBUILD_SHARED_LIBS=$(if $(BR2_PREFER_STATIC_LIB),OFF,ON) \
> +		-DUSE_CCACHE=$(if $(BR2_CCACHE),ON,OFF) \
>  		$$($$(PKG)_CONF_OPT) \
>  	)
>  endef
> @@ -83,6 +84,7 @@ define $(2)_CONFIGURE_CMDS
>  		-DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY="BOTH" \
>  		-DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE="BOTH" \
>  		-DCMAKE_INSTALL_PREFIX="$$(HOST_DIR)/usr" \
> +		-DUSE_CCACHE=$(if $(BR2_CCACHE),ON,OFF) \
>  		$$($$(PKG)_CONF_OPT) \
>  	)
>  endef
> @@ -161,8 +163,6 @@ host-cmake-package = $(call inner-cmake-package,host-$(pkgname),$(call UPPERCASE
>  define TOOLCHAINFILE_CMAKE
>  string(REPLACE /usr/share/buildroot "" _HOST_DIR $${CMAKE_CURRENT_LIST_DIR})
>  set(CMAKE_SYSTEM_NAME Linux)
> -set(CMAKE_C_COMPILER $(subst $(HOST_DIR),$${_HOST_DIR},$(TARGET_CROSS))gcc)
> -set(CMAKE_CXX_COMPILER $(subst $(HOST_DIR),$${_HOST_DIR},$(TARGET_CROSS))g++)
>  set(CMAKE_C_FLAGS "$${CMAKE_C_FLAGS} $(TARGET_CFLAGS)" CACHE STRING "Buildroot CFLAGS" FORCE)
>  set(CMAKE_CXX_FLAGS "$${CMAKE_CXX_FLAGS} $(TARGET_CXXFLAGS)" CACHE STRING "Buildroot CXXFLAGS" FORCE)
>  set(CMAKE_INSTALL_SO_NO_EXE 0)
> @@ -172,6 +172,37 @@ set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
>  set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
>  set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
>  set(ENV{PKG_CONFIG_SYSROOT_DIR} $${_HOST_DIR}/$(STAGING_SUBDIR))
> +# This toolchain file can be used both inside and outside Buildroot.
> +# * When used inside Buildroot, ccache support is explicitly driven using the
> +#   USE_CCACHE variable.
> +# * When used outside Buildroot (i.e. when USE_CCACHE is not defined), ccache
> +#   support is automatically enabled if the ccache program is available.
> +if(DEFINED USE_CCACHE)
> +	if(USE_CCACHE)
> +		set(CMAKE_ASM_COMPILER $(subst $(HOST_DIR),$${_HOST_DIR},$(TARGET_CROSS))gcc)
> +		set(CMAKE_C_COMPILER $${_HOST_DIR}/usr/bin/ccache)
> +		set(CMAKE_CXX_COMPILER $${_HOST_DIR}/usr/bin/ccache)
> +		set(CMAKE_C_COMPILER_ARG1 $(subst $(HOST_DIR),$${_HOST_DIR},$(TARGET_CROSS))gcc)
> +		set(CMAKE_CXX_COMPILER_ARG1 $(subst $(HOST_DIR),$${_HOST_DIR},$(TARGET_CROSS))g++)
> +	else()
> +		set(CMAKE_C_COMPILER $(subst $(HOST_DIR),$${_HOST_DIR},$(TARGET_CROSS))gcc)
> +		set(CMAKE_CXX_COMPILER $(subst $(HOST_DIR),$${_HOST_DIR},$(TARGET_CROSS))g++)
> +	endif()

 I don't see why this USE_CCACHE condition should be dynamic. If
BR2_CCACHE is set, then we can _always_ use ccache, no? So:

ifeq($(BR2_CCACHE),y)
define TOOLCHAINFILE_CMAKE_CCACHE
set(CMAKE_C_COMPILER $${_HOST_DIR}/usr/bin/ccache)
set(CMAKE_CXX_COMPILER $${_HOST_DIR}/usr/bin/ccache)
...
endef
else # BR2_CCACHE
define TOOLCHAINFILE_CMAKE_CCACHE
...
endef
endif


> +else()
> +	find_program(CCACHE ccache)

 Note that if we don't set PATH explicitly to point to the host dir, this
will point to the system's ccache instead of buildroot ccache.


 Regards,
 Arnout


> +	if(CCACHE)
> +		set(CMAKE_ASM_COMPILER $(subst $(HOST_DIR),$${_HOST_DIR},$(TARGET_CROSS))gcc)
> +		set(CMAKE_C_COMPILER $${CCACHE})
> +		set(CMAKE_CXX_COMPILER $${CCACHE})
> +		set(CMAKE_C_COMPILER_ARG1 $(subst $(HOST_DIR),$${_HOST_DIR},$(TARGET_CROSS))gcc)
> +		set(CMAKE_CXX_COMPILER_ARG1 $(subst $(HOST_DIR),$${_HOST_DIR},$(TARGET_CROSS))g++)
> +		message(STATUS "ccache program has been found and will be used for the build.")
> +		message(STATUS "  To disable ccache, add -DUSE_CCACHE=OFF on the cmake command line.")
> +	else()
> +		set(CMAKE_C_COMPILER $(subst $(HOST_DIR),$${_HOST_DIR},$(TARGET_CROSS))gcc)
> +		set(CMAKE_CXX_COMPILER $(subst $(HOST_DIR),$${_HOST_DIR},$(TARGET_CROSS))g++)
> +	endif()
> +endif()
>  endef
>  
>  $(HOST_DIR)/usr/share/buildroot/toolchainfile.cmake:
> 


-- 
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
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

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [Buildroot] [PATCH 07/14] pkg-cmake.mk: set additional variables in toolchainfile.cmake
  2014-04-23 22:48 ` [Buildroot] [PATCH 07/14] pkg-cmake.mk: set additional variables in toolchainfile.cmake Samuel Martin
@ 2014-04-24 22:41   ` Arnout Vandecappelle
  2014-05-28 19:09     ` Samuel Martin
  0 siblings, 1 reply; 30+ messages in thread
From: Arnout Vandecappelle @ 2014-04-24 22:41 UTC (permalink / raw)
  To: buildroot

On 24/04/14 00:48, Samuel Martin wrote:
> Set binutils programs CMake variables in the toolchainfile.cmake file.
> 
> This variables must be cached, otherwise they are wrongly set, resulting
> empty, which will make the builds fail.

 Can you point to a specific build failure?


 Regards,
 Arnout

> 
> Signed-off-by: Samuel Martin <s.martin49@gmail.com>
> 
> ---
> changes v1 -> v2:
> - new patch
> ---
>  package/pkg-cmake.mk | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/package/pkg-cmake.mk b/package/pkg-cmake.mk
> index 19f7843..d6dadbe 100644
> --- a/package/pkg-cmake.mk
> +++ b/package/pkg-cmake.mk
> @@ -211,6 +211,14 @@ else()
>  		set(CMAKE_CXX_COMPILER $(subst $(HOST_DIR),$${_HOST_DIR},$(TARGET_CROSS))g++)
>  	endif()
>  endif()
> +
> +set(CMAKE_LINKER  $(subst $(HOST_DIR),$${_HOST_DIR},$(TARGET_CROSS))ld      CACHE FILEPATH \"\" FORCE)
> +set(CMAKE_AR      $(subst $(HOST_DIR),$${_HOST_DIR},$(TARGET_CROSS))ar      CACHE FILEPATH \"\" FORCE)
> +set(CMAKE_RANLIB  $(subst $(HOST_DIR),$${_HOST_DIR},$(TARGET_CROSS))ranlib  CACHE FILEPATH \"\" FORCE)
> +set(CMAKE_NM      $(subst $(HOST_DIR),$${_HOST_DIR},$(TARGET_CROSS))nm      CACHE FILEPATH \"\" FORCE)
> +set(CMAKE_OBJCOPY $(subst $(HOST_DIR),$${_HOST_DIR},$(TARGET_CROSS))objcopy CACHE FILEPATH \"\" FORCE)
> +set(CMAKE_OBJDUMP $(subst $(HOST_DIR),$${_HOST_DIR},$(TARGET_CROSS))objdump CACHE FILEPATH \"\" FORCE)
> +set(CMAKE_STRIP   $(subst $(HOST_DIR),$${_HOST_DIR},$(TARGET_CROSS))strip   CACHE FILEPATH \"\" FORCE)
>  endef
>  
>  $(HOST_DIR)/usr/share/buildroot/toolchainfile.cmake:
> 


-- 
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
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

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [Buildroot] [PATCH 09/14] pkg-cmake.mk: globally disable BUILD_TESTING flag
  2014-04-23 22:48 ` [Buildroot] [PATCH 09/14] pkg-cmake.mk: globally disable BUILD_TESTING flag Samuel Martin
@ 2014-04-24 22:45   ` Arnout Vandecappelle
  2014-05-28 19:17     ` Samuel Martin
  0 siblings, 1 reply; 30+ messages in thread
From: Arnout Vandecappelle @ 2014-04-24 22:45 UTC (permalink / raw)
  To: buildroot

On 24/04/14 00:48, Samuel Martin wrote:
> This CMake flag is used to enable tests. It may not disable the test
> programs from being built, but it controls the test execution.
> 
> Since we don't care about building the tests (and usually disable them
> when possible), make sure Buildroot won't try to run them.
> 
> Signed-off-by: Samuel Martin <s.martin49@gmail.com>
> 
> ---
> changes v1 -> v2:
> - new patch
> ---
>  package/pkg-cmake.mk | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/package/pkg-cmake.mk b/package/pkg-cmake.mk
> index d6dadbe..e0efccb 100644
> --- a/package/pkg-cmake.mk
> +++ b/package/pkg-cmake.mk
> @@ -65,6 +65,7 @@ define $(2)_CONFIGURE_CMDS
>  		-DCMAKE_TOOLCHAIN_FILE="$$(HOST_DIR)/usr/share/buildroot/toolchainfile.cmake" \
>  		-DCMAKE_INSTALL_PREFIX="/usr" \
>  		-DCMAKE_COLOR_MAKEFILE=OFF \
> +		-DBUILD_TESTING=OFF \

 Shouldn't this be done for the host variant as well?

>  		-DBUILD_SHARED_LIBS=$(if $(BR2_PREFER_STATIC_LIB),OFF,ON) \

 Not really related to this patch, but is there a specific reason why
some options are set in the toolchainfile.cmake and some are set on the
command line?


 Regards,
 Arnout

>  		-DUSE_CCACHE=$(if $(BR2_CCACHE),ON,OFF) \
>  		$$($$(PKG)_CONF_OPT) \
> 


-- 
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
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

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [Buildroot] [PATCH 10/14] pkg-cmake.mk: globally drive the CMAKE_BUILD_TYPE flag using BR2_ENABLE_DEBUG
  2014-04-23 22:48 ` [Buildroot] [PATCH 10/14] pkg-cmake.mk: globally drive the CMAKE_BUILD_TYPE flag using BR2_ENABLE_DEBUG Samuel Martin
@ 2014-04-24 22:46   ` Arnout Vandecappelle
  2014-05-28  8:42     ` Maxime Hadjinlian
  0 siblings, 1 reply; 30+ messages in thread
From: Arnout Vandecappelle @ 2014-04-24 22:46 UTC (permalink / raw)
  To: buildroot

On 24/04/14 00:48, Samuel Martin wrote:
> This CMake flag is usually used to adjust compiler flags (like: -Ox, -g,
> etc).
> 
> So, it makes sense for Buildroot to globally drive this CMake flags in
> the cmake-package infrastructure.
> 
> However, if a package prefer overriding this default setting, it still
> can via the <PKG>_CONF_OPT variable.
> 
> Signed-off-by: Samuel Martin <s.martin49@gmail.com>

Reviewed-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>


 Regards,
 Arnout

> 
> ---
> changes v1 -> v2:
> - new patch
> ---
>  package/pkg-cmake.mk | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/package/pkg-cmake.mk b/package/pkg-cmake.mk
> index e0efccb..1c52a53 100644
> --- a/package/pkg-cmake.mk
> +++ b/package/pkg-cmake.mk
> @@ -63,6 +63,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_INSTALL_PREFIX="/usr" \
>  		-DCMAKE_COLOR_MAKEFILE=OFF \
>  		-DBUILD_TESTING=OFF \
> 


-- 
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
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

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [Buildroot] [PATCH 10/14] pkg-cmake.mk: globally drive the CMAKE_BUILD_TYPE flag using BR2_ENABLE_DEBUG
  2014-04-24 22:46   ` Arnout Vandecappelle
@ 2014-05-28  8:42     ` Maxime Hadjinlian
  0 siblings, 0 replies; 30+ messages in thread
From: Maxime Hadjinlian @ 2014-05-28  8:42 UTC (permalink / raw)
  To: buildroot

Hi all,

Tested-by: Maxime Hadjinlian <maxime.hadjinlian@gmail.com>

On Fri, Apr 25, 2014 at 12:46 AM, Arnout Vandecappelle <arnout@mind.be> wrote:
> On 24/04/14 00:48, Samuel Martin wrote:
>> This CMake flag is usually used to adjust compiler flags (like: -Ox, -g,
>> etc).
>>
>> So, it makes sense for Buildroot to globally drive this CMake flags in
>> the cmake-package infrastructure.
>>
>> However, if a package prefer overriding this default setting, it still
>> can via the <PKG>_CONF_OPT variable.
>>
>> Signed-off-by: Samuel Martin <s.martin49@gmail.com>
>
> Reviewed-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
>
>
>  Regards,
>  Arnout
>
>>
>> ---
>> changes v1 -> v2:
>> - new patch
>> ---
>>  package/pkg-cmake.mk | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/package/pkg-cmake.mk b/package/pkg-cmake.mk
>> index e0efccb..1c52a53 100644
>> --- a/package/pkg-cmake.mk
>> +++ b/package/pkg-cmake.mk
>> @@ -63,6 +63,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_INSTALL_PREFIX="/usr" \
>>               -DCMAKE_COLOR_MAKEFILE=OFF \
>>               -DBUILD_TESTING=OFF \
>>
>
>
> --
> Arnout Vandecappelle                          arnout at mind be
> Senior Embedded Software Architect            +32-16-286500
> 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
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [Buildroot] [PATCH 06/14] pkg-cmake.mk: cosmetic changes in the generated toolchainfile.cmake file
  2014-04-24  3:47   ` Baruch Siach
@ 2014-05-28 19:07     ` Samuel Martin
  0 siblings, 0 replies; 30+ messages in thread
From: Samuel Martin @ 2014-05-28 19:07 UTC (permalink / raw)
  To: buildroot

Baruch, all,

On Thu, Apr 24, 2014 at 5:47 AM, Baruch Siach <baruch@tkos.co.il> wrote:
> Hi Samuel,
>
> On Thu, Apr 24, 2014 at 12:48:25AM +0200, Samuel Martin wrote:
>> Signed-off-by: Samuel Martin <s.martin49@gmail.com>
>>
>> ---
>> changes v1 -> v2:
>> - new patch
>> ---
>>  package/pkg-cmake.mk | 8 ++++++++
>>  1 file changed, 8 insertions(+)
>>
>> diff --git a/package/pkg-cmake.mk b/package/pkg-cmake.mk
>> index a032426..19f7843 100644
>> --- a/package/pkg-cmake.mk
>> +++ b/package/pkg-cmake.mk
>> @@ -161,17 +161,25 @@ host-cmake-package = $(call inner-cmake-package,host-$(pkgname),$(call UPPERCASE
>>  ################################################################################
>>
>>  define TOOLCHAINFILE_CMAKE
>> +#
>> +# Automatically generated file; DO NOT EDIT.
>> +# CMake toolchain file for Buildroot
>> +#
>> +
>>  string(REPLACE /usr/share/buildroot "" _HOST_DIR $${CMAKE_CURRENT_LIST_DIR})
>> +
>>  set(CMAKE_SYSTEM_NAME Linux)
>>  set(CMAKE_C_FLAGS "$${CMAKE_C_FLAGS} $(TARGET_CFLAGS)" CACHE STRING "Buildroot CFLAGS" FORCE)
>>  set(CMAKE_CXX_FLAGS "$${CMAKE_CXX_FLAGS} $(TARGET_CXXFLAGS)" CACHE STRING "Buildroot CXXFLAGS" FORCE)
>>  set(CMAKE_INSTALL_SO_NO_EXE 0)
>> +
>>  set(CMAKE_PROGRAM_PATH $${_HOST_DIR}/usr/bin)
>>  set(CMAKE_FIND_ROOT_PATH $${_HOST_DIR}/$(STAGING_SUBDIR))
>>  set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
>>  set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
>>  set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
>>  set(ENV{PKG_CONFIG_SYSROOT_DIR} $${_HOST_DIR}/$(STAGING_SUBDIR))
>> +
>>  # This toolchain file can be used both inside and outside Buildroot.
>>  # * When used inside Buildroot, ccache support is explicitly driven using the
>>  #   USE_CCACHE variable.
>
> Shouldn't this be squashed into patch #3?

Will do.

Regards,

-- 
Samuel

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [Buildroot] [PATCH 07/14] pkg-cmake.mk: set additional variables in toolchainfile.cmake
  2014-04-24 22:41   ` Arnout Vandecappelle
@ 2014-05-28 19:09     ` Samuel Martin
  0 siblings, 0 replies; 30+ messages in thread
From: Samuel Martin @ 2014-05-28 19:09 UTC (permalink / raw)
  To: buildroot

Arnout, all,

On Fri, Apr 25, 2014 at 12:41 AM, Arnout Vandecappelle <arnout@mind.be> wrote:
> On 24/04/14 00:48, Samuel Martin wrote:
>> Set binutils programs CMake variables in the toolchainfile.cmake file.
>>
>> This variables must be cached, otherwise they are wrongly set, resulting
>> empty, which will make the builds fail.
>
>  Can you point to a specific build failure?

None.
It is just a use-case I have, but I can workaround some other way.
I'll drop this patch.

Regards,

-- 
Samuel

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [Buildroot] [PATCH 09/14] pkg-cmake.mk: globally disable BUILD_TESTING flag
  2014-04-24 22:45   ` Arnout Vandecappelle
@ 2014-05-28 19:17     ` Samuel Martin
  0 siblings, 0 replies; 30+ messages in thread
From: Samuel Martin @ 2014-05-28 19:17 UTC (permalink / raw)
  To: buildroot

Arnout, all,

On Fri, Apr 25, 2014 at 12:45 AM, Arnout Vandecappelle <arnout@mind.be> wrote:
> On 24/04/14 00:48, Samuel Martin wrote:
>> This CMake flag is used to enable tests. It may not disable the test
>> programs from being built, but it controls the test execution.
>>
>> Since we don't care about building the tests (and usually disable them
>> when possible), make sure Buildroot won't try to run them.
>>
>> Signed-off-by: Samuel Martin <s.martin49@gmail.com>
>>
>> ---
>> changes v1 -> v2:
>> - new patch
>> ---
>>  package/pkg-cmake.mk | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/package/pkg-cmake.mk b/package/pkg-cmake.mk
>> index d6dadbe..e0efccb 100644
>> --- a/package/pkg-cmake.mk
>> +++ b/package/pkg-cmake.mk
>> @@ -65,6 +65,7 @@ define $(2)_CONFIGURE_CMDS
>>               -DCMAKE_TOOLCHAIN_FILE="$$(HOST_DIR)/usr/share/buildroot/toolchainfile.cmake" \
>>               -DCMAKE_INSTALL_PREFIX="/usr" \
>>               -DCMAKE_COLOR_MAKEFILE=OFF \
>> +             -DBUILD_TESTING=OFF \
>
>  Shouldn't this be done for the host variant as well?

Yes. Good catch!

>
>>               -DBUILD_SHARED_LIBS=$(if $(BR2_PREFER_STATIC_LIB),OFF,ON) \
>
>  Not really related to this patch, but is there a specific reason why
> some options are set in the toolchainfile.cmake and some are set on the
> command line?

Here is how I see this:
- the toolchainfile.cmake is only about the toolchain/target
properties (programs and sysroot location), not about the way one
wants to build a project.
- the options on the command line describe how one want to build its
project, enabling the build of this or that sub-project, toggling
tests, if the binaries should include debug symbols, and so on and so
forth.

To me, it's kind of similar rules applied to choose between the
'select'-'depends on' statements (and the need of comments) in the
Config.in files.

Regards,

-- 
Samuel

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [Buildroot] [PATCH 05/14] pkg-cmake.mk: enable ccache for cmake packages
  2014-04-24 22:39   ` Arnout Vandecappelle
@ 2014-05-29 11:03     ` Samuel Martin
  0 siblings, 0 replies; 30+ messages in thread
From: Samuel Martin @ 2014-05-29 11:03 UTC (permalink / raw)
  To: buildroot

Arnout, all,

On Fri, Apr 25, 2014 at 12:39 AM, Arnout Vandecappelle <arnout@mind.be> wrote:
> On 24/04/14 00:48, Samuel Martin wrote:
>> This patch updates the generated toolchainfile.cmake to use ccache.
>>
>> When toolchainfile.cmake is used inside Buildroot, using ccache during
>> the build is driven by a CMake knob: USE_CCACHE, automatically set by
>> the cmake-package infrastructure and reflecting the BR2_CCACHE value.
>>
>> Since this toolchainefile.cmake file can be used outside Buildroot, and
>> this file also set a couple of things (among these: the sysroot cflag,
>> some pkg-config environment variables), it is important to set the
>> compiler variables as well to keep the consistency of the
>> cross-compilation configuration.
>> So, when it is used outside Buildroot, using ccache for the build is
>> driven by the ccache program availability.
>
>  I don't understand this. We can just use br-ccache when it's called from
> outside buildroot as well, no?

One may want to use ccache in Buildroot to build its rootfs, but not
when building its project.
Does this use-case make sense?

>
>
>>
>> Note that using ccache for the build is achieved by setting the *_ARG1/cc
>> CMake variables to let CMake use ccache without failing in detecting
>> the compiler.
>>
>> Signed-off-by: Samuel Martin <s.martin49@gmail.com>
>> Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net>
>> Cc: Luca Ceresoli <luca@lucaceresoli.net>
>>
>> ---
>> changes v2 -> v3 (Samuel):
>> - rebase
>> - inline the -DUSE_CCACHE=... in the configure commands.
>> - always set the compiler variables, even when called for outside
>>   Buildroot.
>> - update commit message
>>
>> changes v1 -> v2 (Luca):
>> - totally reimplemented based on Samuel's suggestion;
>> - added dependency on host-ccache for cmake packages if ccache is
>>   enabled.
>> ---
>>  package/pkg-cmake.mk | 35 +++++++++++++++++++++++++++++++++--
>>  1 file changed, 33 insertions(+), 2 deletions(-)
>>
>> diff --git a/package/pkg-cmake.mk b/package/pkg-cmake.mk
>> index b2ac2df..a032426 100644
>> --- a/package/pkg-cmake.mk
>> +++ b/package/pkg-cmake.mk
>> @@ -66,6 +66,7 @@ define $(2)_CONFIGURE_CMDS
>>               -DCMAKE_INSTALL_PREFIX="/usr" \
>>               -DCMAKE_COLOR_MAKEFILE=OFF \
>>               -DBUILD_SHARED_LIBS=$(if $(BR2_PREFER_STATIC_LIB),OFF,ON) \
>> +             -DUSE_CCACHE=$(if $(BR2_CCACHE),ON,OFF) \
>>               $$($$(PKG)_CONF_OPT) \
>>       )
>>  endef
>> @@ -83,6 +84,7 @@ define $(2)_CONFIGURE_CMDS
>>               -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY="BOTH" \
>>               -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE="BOTH" \
>>               -DCMAKE_INSTALL_PREFIX="$$(HOST_DIR)/usr" \
>> +             -DUSE_CCACHE=$(if $(BR2_CCACHE),ON,OFF) \
>>               $$($$(PKG)_CONF_OPT) \
>>       )
>>  endef
>> @@ -161,8 +163,6 @@ host-cmake-package = $(call inner-cmake-package,host-$(pkgname),$(call UPPERCASE
>>  define TOOLCHAINFILE_CMAKE
>>  string(REPLACE /usr/share/buildroot "" _HOST_DIR $${CMAKE_CURRENT_LIST_DIR})
>>  set(CMAKE_SYSTEM_NAME Linux)
>> -set(CMAKE_C_COMPILER $(subst $(HOST_DIR),$${_HOST_DIR},$(TARGET_CROSS))gcc)
>> -set(CMAKE_CXX_COMPILER $(subst $(HOST_DIR),$${_HOST_DIR},$(TARGET_CROSS))g++)
>>  set(CMAKE_C_FLAGS "$${CMAKE_C_FLAGS} $(TARGET_CFLAGS)" CACHE STRING "Buildroot CFLAGS" FORCE)
>>  set(CMAKE_CXX_FLAGS "$${CMAKE_CXX_FLAGS} $(TARGET_CXXFLAGS)" CACHE STRING "Buildroot CXXFLAGS" FORCE)
>>  set(CMAKE_INSTALL_SO_NO_EXE 0)
>> @@ -172,6 +172,37 @@ set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
>>  set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
>>  set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
>>  set(ENV{PKG_CONFIG_SYSROOT_DIR} $${_HOST_DIR}/$(STAGING_SUBDIR))
>> +# This toolchain file can be used both inside and outside Buildroot.
>> +# * When used inside Buildroot, ccache support is explicitly driven using the
>> +#   USE_CCACHE variable.
>> +# * When used outside Buildroot (i.e. when USE_CCACHE is not defined), ccache
>> +#   support is automatically enabled if the ccache program is available.
>> +if(DEFINED USE_CCACHE)
>> +     if(USE_CCACHE)
>> +             set(CMAKE_ASM_COMPILER $(subst $(HOST_DIR),$${_HOST_DIR},$(TARGET_CROSS))gcc)
>> +             set(CMAKE_C_COMPILER $${_HOST_DIR}/usr/bin/ccache)
>> +             set(CMAKE_CXX_COMPILER $${_HOST_DIR}/usr/bin/ccache)
>> +             set(CMAKE_C_COMPILER_ARG1 $(subst $(HOST_DIR),$${_HOST_DIR},$(TARGET_CROSS))gcc)
>> +             set(CMAKE_CXX_COMPILER_ARG1 $(subst $(HOST_DIR),$${_HOST_DIR},$(TARGET_CROSS))g++)
>> +     else()
>> +             set(CMAKE_C_COMPILER $(subst $(HOST_DIR),$${_HOST_DIR},$(TARGET_CROSS))gcc)
>> +             set(CMAKE_CXX_COMPILER $(subst $(HOST_DIR),$${_HOST_DIR},$(TARGET_CROSS))g++)
>> +     endif()
>
>  I don't see why this USE_CCACHE condition should be dynamic. If
> BR2_CCACHE is set, then we can _always_ use ccache, no? So:
>
> ifeq($(BR2_CCACHE),y)
> define TOOLCHAINFILE_CMAKE_CCACHE
> set(CMAKE_C_COMPILER $${_HOST_DIR}/usr/bin/ccache)
> set(CMAKE_CXX_COMPILER $${_HOST_DIR}/usr/bin/ccache)
> ...
> endef
> else # BR2_CCACHE
> define TOOLCHAINFILE_CMAKE_CCACHE
> ...
> endef
> endif
>

The idea behind this is to always get the same toolchainfile.cmake
generated (except for the target tuple).
In the end we could also use a toolchainfile.cmake.in file, then just
replace the '$(TARGET_CROSS)' using sed.

>
>> +else()
>> +     find_program(CCACHE ccache)
>
>  Note that if we don't set PATH explicitly to point to the host dir, this
> will point to the system's ccache instead of buildroot ccache.

Right, good catch!
I see 2 ways to solve this:
- extend PATH env. var., but this will be valib for all others programs;
- use the HINTS or PATHS option of find_program().
  Funnily, when ccache is available in the system:
  - using find_program(CCACHE ccache HINTS $${_HOST_DIR}/usr/bin) will
find set CCACHE to $${_HOST_DIR}/usr/bin/ccache;
  - whereas find_program(CCACHE ccache PATHS $${_HOST_DIR}/usr/bin)
will find set CCACHE to /usr/bin/ccache

I'll use find_program(... HINTS ...)


Regards,

-- 
Samuel

^ permalink raw reply	[flat|nested] 30+ messages in thread

end of thread, other threads:[~2014-05-29 11:03 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-23 22:48 [Buildroot] [PATCH 00/14] CMake infrastructure refactoring Samuel Martin
2014-04-23 22:48 ` [Buildroot] [PATCH 01/14] pkg-cmake.mk: replace "echo -en" with printf Samuel Martin
2014-04-24 20:26   ` Arnout Vandecappelle
2014-04-24 20:31     ` Peter Korsgaard
2014-04-23 22:48 ` [Buildroot] [PATCH 02/14] pkg-cmake.mk: remove unneeded quotes in the generated toolchainfile.cmake Samuel Martin
2014-04-24 20:34   ` Arnout Vandecappelle
2014-04-23 22:48 ` [Buildroot] [PATCH 03/14] pkg-cmake.mk: rework toolchainfile.cmake Samuel Martin
2014-04-24 20:59   ` Arnout Vandecappelle
2014-04-23 22:48 ` [Buildroot] [PATCH 04/14] pkg-cmake.mk: do not hardcode absolute path in toolchainfile.cmake Samuel Martin
2014-04-24 22:10   ` Arnout Vandecappelle
2014-04-23 22:48 ` [Buildroot] [PATCH 05/14] pkg-cmake.mk: enable ccache for cmake packages Samuel Martin
2014-04-24 22:39   ` Arnout Vandecappelle
2014-05-29 11:03     ` Samuel Martin
2014-04-23 22:48 ` [Buildroot] [PATCH 06/14] pkg-cmake.mk: cosmetic changes in the generated toolchainfile.cmake file Samuel Martin
2014-04-24  3:47   ` Baruch Siach
2014-05-28 19:07     ` Samuel Martin
2014-04-23 22:48 ` [Buildroot] [PATCH 07/14] pkg-cmake.mk: set additional variables in toolchainfile.cmake Samuel Martin
2014-04-24 22:41   ` Arnout Vandecappelle
2014-05-28 19:09     ` Samuel Martin
2014-04-23 22:48 ` [Buildroot] [PATCH 08/14] rpi-userland: cleanup *_CONF_OPT Samuel Martin
2014-04-23 22:48 ` [Buildroot] [PATCH 09/14] pkg-cmake.mk: globally disable BUILD_TESTING flag Samuel Martin
2014-04-24 22:45   ` Arnout Vandecappelle
2014-05-28 19:17     ` Samuel Martin
2014-04-23 22:48 ` [Buildroot] [PATCH 10/14] pkg-cmake.mk: globally drive the CMAKE_BUILD_TYPE flag using BR2_ENABLE_DEBUG Samuel Martin
2014-04-24 22:46   ` Arnout Vandecappelle
2014-05-28  8:42     ` Maxime Hadjinlian
2014-04-23 22:48 ` [Buildroot] [PATCH 11/14] openpowerlink: do not override CMAKE_BUILD_TYPE Samuel Martin
2014-04-23 22:48 ` [Buildroot] [PATCH 12/14] opencv: " Samuel Martin
2014-04-23 22:48 ` [Buildroot] [PATCH 13/14] flann: " Samuel Martin
2014-04-23 22:48 ` [Buildroot] [PATCH 14/14] qhull: " Samuel Martin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox