Patchwork [1/3] cmake.bbclass: fix qmake and rpath issues

login
register
mail settings
Submitter Otavio Salvador
Date May 10, 2011, 2:51 p.m.
Message ID <1305039119-1469-1-git-send-email-otavio@ossystems.com.br>
Download mbox | patch
Permalink /patch/3663/
State New, archived
Headers show

Comments

Otavio Salvador - May 10, 2011, 2:51 p.m.
Sync with OE at 3b7d83362027fde4f6850533ab83277d95dda961 however
without changing the way of generating the toolchain file and making
it branding agnostic.

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
---
 meta/classes/cmake.bbclass  |   14 ++++++++++++--
 meta/classes/native.bbclass |    4 ++++
 2 files changed, 16 insertions(+), 2 deletions(-)
Saul Wold - May 10, 2011, 7:59 p.m.
On 05/10/2011 07:51 AM, Otavio Salvador wrote:
> Sync with OE at 3b7d83362027fde4f6850533ab83277d95dda961 however
> without changing the way of generating the toolchain file and making
> it branding agnostic.
>
> Signed-off-by: Otavio Salvador<otavio@ossystems.com.br>
> ---
>   meta/classes/cmake.bbclass  |   14 ++++++++++++--
>   meta/classes/native.bbclass |    4 ++++
>   2 files changed, 16 insertions(+), 2 deletions(-)
>
> diff --git a/meta/classes/cmake.bbclass b/meta/classes/cmake.bbclass
> index a4b0c12..011c232 100644
> --- a/meta/classes/cmake.bbclass
> +++ b/meta/classes/cmake.bbclass
> @@ -24,15 +24,18 @@ OECMAKE_CXX_FLAGS ?= "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS} ${TARGET_CPPFLAGS} -f
>   OECMAKE_C_FLAGS_RELEASE ?= "${SELECTED_OPTIMIZATION} -DNDEBUG"
>   OECMAKE_CXX_FLAGS_RELEASE ?= "${SELECTED_OPTIMIZATION} -DNDEBUG"
>
> +OECMAKE_RPATH ?= ""
> +
>   cmake_do_generate_toolchain_file() {
>   	cat>  ${WORKDIR}/toolchain.cmake<<EOF
>   # CMake system name must be something like "Linux".
>   # This is important for cross-compiling.
>   set( CMAKE_SYSTEM_NAME `echo ${SDK_OS} | sed 's/^./\u&/'` )
> +set( CMAKE_SYSTEM_PROCESSOR ${TARGET_ARCH} )
>   set( CMAKE_C_COMPILER ${OECMAKE_C_COMPILER} )
>   set( CMAKE_CXX_COMPILER ${OECMAKE_CXX_COMPILER} )
> -set( CMAKE_C_FLAGS "${OECMAKE_C_FLAGS}" CACHE STRING "poky CFLAGS" )
> -set( CMAKE_CXX_FLAGS "${OECMAKE_CXX_FLAGS}" CACHE STRING "poky CXXFLAGS" )
> +set( CMAKE_C_FLAGS "${OECMAKE_C_FLAGS}" CACHE STRING "CFLAGS" )
> +set( CMAKE_CXX_FLAGS "${OECMAKE_CXX_FLAGS}" CACHE STRING "CXXFLAGS" )
>   set( CMAKE_C_FLAGS_RELEASE "${OECMAKE_C_FLAGS_RELEASE}" CACHE STRING "CFLAGS for release" )
>   set( CMAKE_CXX_FLAGS_RELEASE "${OECMAKE_CXX_FLAGS_RELEASE}" CACHE STRING "CXXFLAGS for release" )
>
> @@ -43,6 +46,13 @@ set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY )
>   set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY )
>   set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY )
>
> +# Use qt.conf settings
> +set( ENV{QT_CONF_PATH} ${WORKDIR}/qt.conf )
> +
> +# We need to set the rpath to the correct directory as cmake does not provide any
> +# directory as rpath by default
> +set( CMAKE_INSTALL_RPATH ${OECMAKE_RPATH} )
> +
>   # Use native cmake modules
>   set( CMAKE_MODULE_PATH ${STAGING_DATADIR}/cmake/Modules/ )
>   EOF
> diff --git a/meta/classes/native.bbclass b/meta/classes/native.bbclass
> index d9e67f6..e06f02a 100644
> --- a/meta/classes/native.bbclass
> +++ b/meta/classes/native.bbclass
> @@ -11,6 +11,10 @@ PACKAGES_DYNAMIC = ""
>   PACKAGES_DYNAMIC_virtclass-native = ""
>   PACKAGE_ARCH = "${BUILD_ARCH}"
>
> +# used by cmake class
> +OECMAKE_RPATH = "${libdir}"
> +OECMAKE_RPATH_virtclass-native = "${libdir}"
> +
In Richard's email he proposed one or the other be set, why do you need 
to set both here?  If both need to be set then you don't need the override.

Sau!
>   BASE_PACKAGE_ARCH = "${BUILD_ARCH}"
>   BASEPKG_HOST_SYS = "${BUILD_ARCH}${BUILD_VENDOR}-${BUILD_OS}"
>   BASEPKG_TARGET_SYS = "${BUILD_ARCH}${BUILD_VENDOR}-${BUILD_OS}"
Otavio Salvador - May 10, 2011, 8:04 p.m.
On Tue, May 10, 2011 at 16:59, Saul Wold <sgw@linux.intel.com> wrote:
> In Richard's email he proposed one or the other be set, why do you need to
> set both here?  If both need to be set then you don't need the override.

Because they're different no? Otherwise native.bbclass has those for others too:

...
PACKAGES = ""
PACKAGES_virtclass-native = ""
PACKAGES_DYNAMIC = ""
PACKAGES_DYNAMIC_virtclass-native = ""
...

Seems logical, no?
Richard Purdie - May 11, 2011, 3:14 p.m.
On Tue, 2011-05-10 at 17:04 -0300, Otavio Salvador wrote:
> On Tue, May 10, 2011 at 16:59, Saul Wold <sgw@linux.intel.com> wrote:
> > In Richard's email he proposed one or the other be set, why do you need to
> > set both here?  If both need to be set then you don't need the override.
> 
> Because they're different no? Otherwise native.bbclass has those for others too:
> 
> ...
> PACKAGES = ""
> PACKAGES_virtclass-native = ""
> PACKAGES_DYNAMIC = ""
> PACKAGES_DYNAMIC_virtclass-native = ""
> ...
> 
> Seems logical, no?

What I'm proposing is that native.bbclass should probably set the
override even when its not being used as a BBCLASSEXTEND.

All things considered lets make that a separate change and I'll take
this as is though because as you point out, there are other variables
with this issue too.

Cheers,

Richard
Richard Purdie - May 11, 2011, 3:15 p.m.
On Tue, 2011-05-10 at 14:51 +0000, Otavio Salvador wrote:
> Sync with OE at 3b7d83362027fde4f6850533ab83277d95dda961 however
> without changing the way of generating the toolchain file and making
> it branding agnostic.
> 
> Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
> ---
>  meta/classes/cmake.bbclass  |   14 ++++++++++++--
>  meta/classes/native.bbclass |    4 ++++
>  2 files changed, 16 insertions(+), 2 deletions(-)

I've merged this to master, thanks.

Richard

Patch

diff --git a/meta/classes/cmake.bbclass b/meta/classes/cmake.bbclass
index a4b0c12..011c232 100644
--- a/meta/classes/cmake.bbclass
+++ b/meta/classes/cmake.bbclass
@@ -24,15 +24,18 @@  OECMAKE_CXX_FLAGS ?= "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS} ${TARGET_CPPFLAGS} -f
 OECMAKE_C_FLAGS_RELEASE ?= "${SELECTED_OPTIMIZATION} -DNDEBUG"
 OECMAKE_CXX_FLAGS_RELEASE ?= "${SELECTED_OPTIMIZATION} -DNDEBUG"
 
+OECMAKE_RPATH ?= ""
+
 cmake_do_generate_toolchain_file() {
 	cat > ${WORKDIR}/toolchain.cmake <<EOF
 # CMake system name must be something like "Linux".
 # This is important for cross-compiling.
 set( CMAKE_SYSTEM_NAME `echo ${SDK_OS} | sed 's/^./\u&/'` )
+set( CMAKE_SYSTEM_PROCESSOR ${TARGET_ARCH} )
 set( CMAKE_C_COMPILER ${OECMAKE_C_COMPILER} )
 set( CMAKE_CXX_COMPILER ${OECMAKE_CXX_COMPILER} )
-set( CMAKE_C_FLAGS "${OECMAKE_C_FLAGS}" CACHE STRING "poky CFLAGS" )
-set( CMAKE_CXX_FLAGS "${OECMAKE_CXX_FLAGS}" CACHE STRING "poky CXXFLAGS" )
+set( CMAKE_C_FLAGS "${OECMAKE_C_FLAGS}" CACHE STRING "CFLAGS" )
+set( CMAKE_CXX_FLAGS "${OECMAKE_CXX_FLAGS}" CACHE STRING "CXXFLAGS" )
 set( CMAKE_C_FLAGS_RELEASE "${OECMAKE_C_FLAGS_RELEASE}" CACHE STRING "CFLAGS for release" )
 set( CMAKE_CXX_FLAGS_RELEASE "${OECMAKE_CXX_FLAGS_RELEASE}" CACHE STRING "CXXFLAGS for release" )
 
@@ -43,6 +46,13 @@  set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY )
 set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY )
 set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY )
 
+# Use qt.conf settings
+set( ENV{QT_CONF_PATH} ${WORKDIR}/qt.conf )
+
+# We need to set the rpath to the correct directory as cmake does not provide any
+# directory as rpath by default
+set( CMAKE_INSTALL_RPATH ${OECMAKE_RPATH} )
+
 # Use native cmake modules
 set( CMAKE_MODULE_PATH ${STAGING_DATADIR}/cmake/Modules/ )
 EOF
diff --git a/meta/classes/native.bbclass b/meta/classes/native.bbclass
index d9e67f6..e06f02a 100644
--- a/meta/classes/native.bbclass
+++ b/meta/classes/native.bbclass
@@ -11,6 +11,10 @@  PACKAGES_DYNAMIC = ""
 PACKAGES_DYNAMIC_virtclass-native = ""
 PACKAGE_ARCH = "${BUILD_ARCH}"
 
+# used by cmake class
+OECMAKE_RPATH = "${libdir}"
+OECMAKE_RPATH_virtclass-native = "${libdir}"
+
 BASE_PACKAGE_ARCH = "${BUILD_ARCH}"
 BASEPKG_HOST_SYS = "${BUILD_ARCH}${BUILD_VENDOR}-${BUILD_OS}"
 BASEPKG_TARGET_SYS = "${BUILD_ARCH}${BUILD_VENDOR}-${BUILD_OS}"