Merge lp://qastaging/~thomas-voss/unity-mir/switch-to-cmake-take-2 into lp://qastaging/unity-mir

Proposed by Thomas Voß
Status: Merged
Approved by: Gerry Boland
Approved revision: 167
Merged at revision: 162
Proposed branch: lp://qastaging/~thomas-voss/unity-mir/switch-to-cmake-take-2
Merge into: lp://qastaging/unity-mir
Diff against target: 498 lines (+251/-141)
17 files modified
CMakeLists.txt (+64/-0)
data/CMakeLists.txt (+7/-0)
data/unity-mir.pc.in (+10/-0)
debian/control (+1/-0)
debian/rules (+0/-3)
src/CMakeLists.txt (+2/-0)
src/modules/CMakeLists.txt (+1/-0)
src/modules/Unity/Application/Application.pro (+0/-58)
src/modules/Unity/Application/CMakeLists.txt (+89/-0)
src/modules/Unity/Application/dbuswindowstack.h (+2/-2)
src/modules/Unity/CMakeLists.txt (+1/-0)
src/modules/modules.pro (+0/-3)
src/src.pro (+0/-6)
src/unity-mir/CMakeLists.txt (+72/-0)
src/unity-mir/logging.h (+2/-0)
src/unity-mir/unity-mir.pro (+0/-67)
unity-mir.pro (+0/-2)
To merge this branch: bzr merge lp://qastaging/~thomas-voss/unity-mir/switch-to-cmake-take-2
Reviewer Review Type Date Requested Status
Gerry Boland (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Albert Astals Cid (community) Approve
Jussi Pakkanen (community) Approve
Review via email: mp+200967@code.qastaging.launchpad.net

Commit message

Switch to cmake.

Description of the change

Switch to cmake.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Jussi Pakkanen (jpakkane) wrote :

Here's some I came up with.

First of all there's this:

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror -Wall -pedantic -Wextra -fPIC -pthread")

First of all there's the fPIC, which should not be necessary. Tvoss said this was a typo so it should just be removed.

Second of all, the code specifies -std=c++11 for C++ but not any specific version for C. Maybe it should be -std=c99 because the definitions (stdint etc) go hand in hand.

Third, specifying -pthread manually works, but is not the recommended way to do it. Instead you should do this:

find_package(Threads REQUIRED)
target_link_libraries(threaded-target ${CMAKE_THREAD_LIBS_INIT})

This piece is a bit ugly:

IF(CMAKE_BUILD_TYPE MATCHES [cC][oO][vV][eE][rR][aA][gG][eE])

In other projects (libcolumbus, scopes, etc) we have standardised on doing this:

string(TOLOWER "${CMAKE_BUILD_TYPE}" cmake_build_type_lower)

and then using the lowercased version everywhere. You might consider doing the same, it's a lot nicer.

A few files do not have a newline at the end of file.

Instead of ${GLIB_LIBRARIES} you should use ${GLIB_LDFLAGS}. That brings in the -L flags as well so packages installed to non-standard locations will work.

Pkg-config checks for Qt5 and some others are duplicated. These should be done only once at some top level file.

review: Needs Fixing
Revision history for this message
Jussi Pakkanen (jpakkane) wrote :

Also, having -Werror on always is really unpleasant when you are developing. Especially when debugging you need to do unclean things every now and then. Werror interferes with that quite badly.

For unity-scopes-api we enable -Werror only on release and package builds. You might consider the same. We use a CMake option for this, so something along the lines of:

option(Werror "Treat warnings as errors" ON)
if (Werror)
    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror")
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
endif()

164. By Thomas Voß

Address reviewer comments.

Revision history for this message
Thomas Voß (thomas-voss) wrote :

Thanks for the review and the suggestions.

> Here's some I came up with.
>
> First of all there's this:
>
> set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror -Wall -pedantic -Wextra -fPIC
> -pthread")
>
> First of all there's the fPIC, which should not be necessary. Tvoss said this
> was a typo so it should just be removed.
>

Fixed.

> Second of all, the code specifies -std=c++11 for C++ but not any specific
> version for C. Maybe it should be -std=c99 because the definitions (stdint
> etc) go hand in hand.
>
> Third, specifying -pthread manually works, but is not the recommended way to
> do it. Instead you should do this:
>

Fixed.

> find_package(Threads REQUIRED)
> target_link_libraries(threaded-target ${CMAKE_THREAD_LIBS_INIT})
>

Fixed.

> This piece is a bit ugly:
>
> IF(CMAKE_BUILD_TYPE MATCHES [cC][oO][vV][eE][rR][aA][gG][eE])
>
> In other projects (libcolumbus, scopes, etc) we have standardised on doing
> this:
>
> string(TOLOWER "${CMAKE_BUILD_TYPE}" cmake_build_type_lower)
>
> and then using the lowercased version everywhere. You might consider doing the
> same, it's a lot nicer.
>

Fixed.

> A few files do not have a newline at the end of file.
>
> Instead of ${GLIB_LIBRARIES} you should use ${GLIB_LDFLAGS}. That brings in
> the -L flags as well so packages installed to non-standard locations will
> work.
>

Fixed.

> Pkg-config checks for Qt5 and some others are duplicated. These should be done
> only once at some top level file.

Fixed.

Revision history for this message
Thomas Voß (thomas-voss) wrote :

> Also, having -Werror on always is really unpleasant when you are developing.
> Especially when debugging you need to do unclean things every now and then.
> Werror interferes with that quite badly.
>
> For unity-scopes-api we enable -Werror only on release and package builds. You
> might consider the same. We use a CMake option for this, so something along
> the lines of:
>
> option(Werror "Treat warnings as errors" ON)
> if (Werror)
> set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror")
> set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
> endif()

Fixed.

Revision history for this message
Gerry Boland (gerboland) wrote :

Would you consider adding this line to src/unity-mir/logging.h

#pragma GCC diagnostic ignored "-Wformat"

to silence all the warnings about the DLOG() macro. I plan to replace those macros with qCDebug when Qt5.2 lands.

165. By Thomas Voß

Add missing newlines.

Revision history for this message
Jussi Pakkanen (jpakkane) wrote :

-Wall seems to have dropped away from this:

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 -pedantic -Wextra")

Other than that, looks good to me.

review: Approve
166. By Thomas Voß

Re-add -Wall for C compiler flags.
Add pragma to silence warnings about logging macros.

Revision history for this message
Thomas Voß (thomas-voss) wrote :

> Would you consider adding this line to src/unity-mir/logging.h
>
> #pragma GCC diagnostic ignored "-Wformat"
>
> to silence all the warnings about the DLOG() macro. I plan to replace those
> macros with qCDebug when Qt5.2 lands.

Fixed. But I would rather not wait for logging macros and instead switch to a reporting approach that would allow us to export to lttng, too. We can take that discussion to a follow-up MP, though.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
167. By Thomas Voß

Adjust version to 1.0.0.

Revision history for this message
Albert Astals Cid (aacid) wrote :

Looks good to me, would prefer someone with more unity-mir knowledge to approve though :-)

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Gerry Boland (gerboland) wrote :

Built, tested and works. Thanking you!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches