Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v2] package/pkg-cmake.mk: add ccache support for host packages
@ 2014-12-14 19:12 Samuel Martin
  2014-12-21 21:53 ` Thomas Petazzoni
  0 siblings, 1 reply; 2+ messages in thread
From: Samuel Martin @ 2014-12-14 19:12 UTC (permalink / raw)
  To: buildroot

This ccache support for host-cmake-package uses the same logic as the
one done for the target packages in the toolchainfile.cmake file.

Signed-off-by: Samuel Martin <s.martin49@gmail.com>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

---
changes v1->v2:
- rebase
- no longer an RFC
- set some make vars. to simplify the logic (ThomasP).
---
 package/pkg-cmake.mk | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/package/pkg-cmake.mk b/package/pkg-cmake.mk
index 231d0ba..c0eeb43 100644
--- a/package/pkg-cmake.mk
+++ b/package/pkg-cmake.mk
@@ -20,6 +20,17 @@
 #
 ################################################################################
 
+# Set compiler variables.
+ifeq ($(BR2_CCACHE),y)
+CMAKE_HOST_C_COMPILER="$(HOST_DIR)/usr/bin/ccache"
+CMAKE_HOST_CXX_COMPILER="$(HOST_DIR)/usr/bin/ccache"
+CMAKE_HOST_C_COMPILER_ARG1="$(HOSTCC)"
+CMAKE_HOST_CXX_COMPILER_ARG1="$(HOSTCXX)"
+else
+CMAKE_HOST_C_COMPILER="$$(HOSTCC)"
+CMAKE_HOST_CXX_COMPILER="$$(HOSTCXX)"
+endif
+
 ################################################################################
 # inner-cmake-package -- defines how the configuration, compilation and
 # installation of a CMake package should be done, implements a few hooks to
@@ -95,6 +106,13 @@ define $(2)_CONFIGURE_CMDS
 		-DCMAKE_C_FLAGS="$$(HOST_CFLAGS)" \
 		-DCMAKE_CXX_FLAGS="$$(HOST_CXXFLAGS)" \
 		-DCMAKE_EXE_LINKER_FLAGS="$$(HOST_LDFLAGS)" \
+		-DCMAKE_ASM_COMPILER="$$(HOSTAS)" \
+		-DCMAKE_C_COMPILER="$$(CMAKE_HOST_C_COMPILER) \
+		-DCMAKE_C_COMCXX_COMPILER="$$(CMAKE_HOST_CXX_COMPILER) \
+		$(if $$(CMAKE_HOST_C_COMPILER_ARG1),\
+			-DCMAKE_C_COMPILER_ARG1=$$(CMAKE_HOST_C_COMPILER_ARG1) \
+			-DCMAKE_CXX_COMPILER_ARG1=$$(CMAKE_HOST_CXX_COMPILER_ARG1) \
+		) \
 		-DCMAKE_COLOR_MAKEFILE=OFF \
 		-DBUILD_DOC=OFF \
 		-DBUILD_DOCS=OFF \
-- 
2.1.3

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

* [Buildroot] [PATCH v2] package/pkg-cmake.mk: add ccache support for host packages
  2014-12-14 19:12 [Buildroot] [PATCH v2] package/pkg-cmake.mk: add ccache support for host packages Samuel Martin
@ 2014-12-21 21:53 ` Thomas Petazzoni
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Petazzoni @ 2014-12-21 21:53 UTC (permalink / raw)
  To: buildroot

Dear Samuel Martin,

On Sun, 14 Dec 2014 20:12:01 +0100, Samuel Martin wrote:
> This ccache support for host-cmake-package uses the same logic as the
> one done for the target packages in the toolchainfile.cmake file.
> 
> Signed-off-by: Samuel Martin <s.martin49@gmail.com>
> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

Seriously, do you test your patches before sending them?

> +# Set compiler variables.
> +ifeq ($(BR2_CCACHE),y)
> +CMAKE_HOST_C_COMPILER="$(HOST_DIR)/usr/bin/ccache"
> +CMAKE_HOST_CXX_COMPILER="$(HOST_DIR)/usr/bin/ccache"
> +CMAKE_HOST_C_COMPILER_ARG1="$(HOSTCC)"

This should have been HOSTCC_NOCCACHE.

> +CMAKE_HOST_CXX_COMPILER_ARG1="$(HOSTCXX)"

This should have been HOSTCXX_NOCCACHE.

Otherwise, HOSTCC and HOSTCXX already contains
"$(HOST_DIR)/usr/bin/ccache /usr/bin/gcc".


> +		-DCMAKE_C_COMPILER="$$(CMAKE_HOST_C_COMPILER) \

Missing closing double quote.

> +		-DCMAKE_C_COMCXX_COMPILER="$$(CMAKE_HOST_CXX_COMPILER) \

Really C_COMCXX_COMPILER ?

This was really a completely crappy and untested patch. How do you want
us to trust your future submissions if you submit such things?

I've applied after fixing this mess.

Thanks,

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

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

end of thread, other threads:[~2014-12-21 21:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-14 19:12 [Buildroot] [PATCH v2] package/pkg-cmake.mk: add ccache support for host packages Samuel Martin
2014-12-21 21:53 ` Thomas Petazzoni

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