Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Using cmake-utils in ebuilds
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
Gentooya
n00b
n00b


Joined: 15 Nov 2013
Posts: 26

PostPosted: Mon Feb 24, 2014 12:24 pm    Post subject: Using cmake-utils in ebuilds Reply with quote

Good afternoon

I'm trying to build an ebuild file that initiates my CMAKE based build environment to build my software.

Here is my code for src_configure()
Code:

        einfo "Source configured and placed in ${S}."
        CMAKE_USE_DIR=${S}
        BUILD_DIR=${CMAKE_USE_DIR}
        local mycmakeargs=(
              "-DCMAKE_INSTALL_PREFIX=/usr/local"
              $(cmake-utils_use debug)
        )
        # symbol information for debugging
        if use debug; then
           append-cflags -g
        fi
        cmake-utils_src_configure


Basically my question is about the CFLAGS I want to set with this code. Basically I want to have a -DDEBUG=ON when the debug use flag is set. And I also want to append a "-g" when the debug use flag is set. Both flags are not set with this code though. How would the correct code look like? Can anyone help with this?

The other question I have is that in my CMakeLists.txt I have options, like
Code:

option(TESTS_ENABLED "TESTS_ENABLED" OFF)

How can I set/unset these from my ebuilds? I cannot find the right function for this. Any help would be greatly appreciated.


Last edited by Gentooya on Wed Feb 26, 2014 9:43 am; edited 2 times in total
Back to top
View user's profile Send private message
Gentooya
n00b
n00b


Joined: 15 Nov 2013
Posts: 26

PostPosted: Wed Feb 26, 2014 9:41 am    Post subject: Reply with quote

No one can help on this?
Back to top
View user's profile Send private message
Gentooya
n00b
n00b


Joined: 15 Nov 2013
Posts: 26

PostPosted: Thu Feb 27, 2014 9:55 am    Post subject: Reply with quote

By now I have found out that the above code works, in particular when also including flag-o-matic.

The only thing that does not work yet is to set CMAKE options from ebuild files. Anyone can help on how to do that?

Many thanks for any pointers.
Back to top
View user's profile Send private message
Gentooya
n00b
n00b


Joined: 15 Nov 2013
Posts: 26

PostPosted: Mon Mar 24, 2014 3:33 pm    Post subject: Reply with quote

I still haven't solved the problem of setting CMAKE options from ebuild files. Can anyone help on this?
Back to top
View user's profile Send private message
bkircher
n00b
n00b


Joined: 27 Mar 2014
Posts: 2

PostPosted: Thu Mar 27, 2014 9:21 pm    Post subject: Reply with quote

It seems that the corresponding eclass does not support CMake variables (i.e., like -DCMAKE_BUILD_TYPE=Fubar) to be set from within an ebuild.

We ran into a similar issue at work this week and we might (actually it is in this sprint) fix that and try to push this upstream, i.e., back to Gentoo.

However, don't hold your breath until then.
Back to top
View user's profile Send private message
bkircher
n00b
n00b


Joined: 27 Mar 2014
Posts: 2

PostPosted: Mon Mar 31, 2014 4:06 pm    Post subject: Reply with quote

No need to add functionality. It is already there.

As the name suggests, use mycmakeargs eclass variable in src_configure phase.

For instance, take a look at /usr/portage/dev-libs/soprano/*.ebuild:

<snip>
src_configure() {
# ...

local mycmakeargs=(
-DSOPRANO_BUILD_TESTS=OFF
-DCMAKE_SKIP_RPATH=OFF
-DSOPRANO_DISABLE_SESAME2_BACKEND=ON
-DSOPRANO_DISABLE_CLUCENE_INDEX=ON
$(cmake-utils_use !dbus SOPRANO_DISABLE_DBUS)
$(cmake-utils_use !raptor SOPRANO_DISABLE_RAPTOR_PARSER)
$(cmake-utils_use !redland SOPRANO_DISABLE_RAPTOR_SERIALIZER)
$(cmake-utils_use !redland SOPRANO_DISABLE_REDLAND_BACKEND)
$(cmake-utils_use !virtuoso SOPRANO_DISABLE_VIRTUOSO_BACKEND)
$(cmake-utils_use doc SOPRANO_BUILD_API_DOCS)
$(cmake-utils_use test SOPRANO_BUILD_TESTS)

cmake-utils_src_configure
}
</snip>

This is a good usage example of cmake-utils and flag-o-matic.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum