Mir

Merge lp:~alan-griffiths/mir/use-cmake-better into lp:mir

Proposed by Alan Griffiths
Status: Rejected
Rejected by: Daniel van Vugt
Proposed branch: lp:~alan-griffiths/mir/use-cmake-better
Merge into: lp:mir
Diff against target: 91 lines (+19/-5)
5 files modified
CMakeLists.txt (+16/-2)
cmake/MirCommon.cmake (+1/-0)
examples/CMakeLists.txt (+1/-1)
playground/CMakeLists.txt (+0/-1)
src/utils/CMakeLists.txt (+1/-1)
To merge this branch: bzr merge lp:~alan-griffiths/mir/use-cmake-better
Reviewer Review Type Date Requested Status
Chris Halse Rogers Needs Information
Mir CI Bot continuous-integration Needs Fixing
Review via email: mp+314082@code.launchpad.net

Commit message

Use CMake's CMAKE_CXX_STANDARD/CMAKE_C_STANDARD instead of directly setting the -std= compiler directive

Description of the change

Use CMake's CMAKE_CXX_STANDARD/CMAKE_C_STANDARD instead of directly setting the -std= compiler directive

These were introduced in CMake 3.1 and are therefore available for all supported platforms.

To post a comment you must log in.
Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :
review: Needs Fixing (continuous-integration)
3903. By Alan Griffiths

Hack the precompiled header hack

3904. By Alan Griffiths

Don't warn for gcc extensions we shouldn't be using

Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :

FAILED: Continuous integration, rev:3903
https://mir-jenkins.ubuntu.com/job/mir-ci/2517/
Executed test runs:
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-mir/3278/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/3345
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/3337
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/3337
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=yakkety/3337
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=yakkety/3307/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/3307
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/3307/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=yakkety/3307
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=yakkety/3307/artifact/output/*zip*/output.zip
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/3307/console
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/3307/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/3307
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/3307/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/mir-ci/2517/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :

FAILED: Continuous integration, rev:3904
https://mir-jenkins.ubuntu.com/job/mir-ci/2518/
Executed test runs:
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-mir/3279/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/3346
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/3338
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/3338
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=yakkety/3338
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=yakkety/3308
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=yakkety/3308/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/3308
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/3308/artifact/output/*zip*/output.zip
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=yakkety/3308/console
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/3308/console
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/3308/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/3308
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/3308/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/mir-ci/2518/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

"17:11:46 CMake 3.1 or higher is required. You are running version 3.0.2"

Rats! We're still building V+O.

Revision history for this message
Brandon Schaefer (brandontschaefer) wrote :

I like the changes! But dang V+O :(

Revision history for this message
Chris Halse Rogers (raof) wrote :

Why are we suppressing -Wno-gnu-folding-constant? If we shouldn't be using that extension, shouldn't we *be* warning about its use?

review: Needs Information
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Yeah vivid is a bit too old still: https://launchpad.net/ubuntu/+source/cmake
and a newer cmake is not in the overlay PPA.

Given that, plus this is an increase in code size, plus some could argue that -std=XXX is more widely known and better understood, I shall reject it.

Unmerged revisions

3904. By Alan Griffiths

Don't warn for gcc extensions we shouldn't be using

3903. By Alan Griffiths

Hack the precompiled header hack

3902. By Alan Griffiths

Use CMake's CMAKE_CXX_STANDARD/CMAKE_C_STANDARD instead of directly setting the -std= compiler directive

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2016-12-13 06:00:32 +0000
3+++ CMakeLists.txt 2017-01-04 16:56:15 +0000
4@@ -19,7 +19,7 @@
5
6 project(Mir)
7
8-cmake_minimum_required(VERSION 2.8)
9+cmake_minimum_required(VERSION 3.1)
10
11 cmake_policy(SET CMP0015 NEW)
12 cmake_policy(SET CMP0022 NEW)
13@@ -60,8 +60,15 @@
14 # Enable cmake-gui to display a drop down list for CMAKE_BUILD_TYPE
15 set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "${build_types}")
16
17+set(CMAKE_CXX_STANDARD 14)
18+set(CMAKE_CXX_STANDARD_REQUIRED on)
19+set(CMAKE_CXX_EXTENSIONS off)
20+
21+set(CMAKE_C_STANDARD 99)
22+set(CMAKE_C_STANDARD_REQUIRED on)
23+
24 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread -g -Werror -Wall -pedantic -Wextra -fPIC")
25-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread -g -std=c++14 -Werror -Wall -fno-strict-aliasing -pedantic -Wnon-virtual-dtor -Wextra -fPIC")
26+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread -g -Werror -Wall -fno-strict-aliasing -pedantic -Wnon-virtual-dtor -Wextra -fPIC")
27 set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--as-needed")
28 set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,--as-needed")
29 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--as-needed")
30@@ -69,6 +76,13 @@
31 include(CheckCXXCompilerFlag)
32 check_cxx_compiler_flag(-Wmismatched-tags HAS_W_MISMATCHED_TAGS)
33
34+include(CheckCCompilerFlag)
35+check_c_compiler_flag(-Wno-gnu-folding-constant HAS_W_NO_GNU_FOLDING_CONSTANT)
36+
37+if(HAS_W_NO_GNU_FOLDING_CONSTANT)
38+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-gnu-folding-constant")
39+endif()
40+
41 if(HAS_W_MISMATCHED_TAGS)
42 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-mismatched-tags")
43 endif()
44
45=== modified file 'cmake/MirCommon.cmake'
46--- cmake/MirCommon.cmake 2016-12-13 06:00:32 +0000
47+++ cmake/MirCommon.cmake 2017-01-04 16:56:15 +0000
48@@ -200,6 +200,7 @@
49 GENERATE
50 OUTPUT "${FLAGS_FILE}"
51 CONTENT "
52+ -std=c++${CMAKE_CXX_STANDARD}
53 ${CMAKE_CXX_FLAGS}
54 ${CMAKE_CXX_FLAGS_${UC_BUILD_TYPE}}
55 ${TARGET_INCLUDE_DIRECTORIES_STRING}
56
57=== modified file 'examples/CMakeLists.txt'
58--- examples/CMakeLists.txt 2016-08-19 07:49:12 +0000
59+++ examples/CMakeLists.txt 2017-01-04 16:56:15 +0000
60@@ -10,7 +10,7 @@
61 ${Boost_LIBRARIES}
62 )
63
64-set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 -Wall -fno-strict-aliasing -Wextra")
65+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -fno-strict-aliasing -Wextra")
66
67 add_library(eglapp STATIC
68 eglapp.c
69
70=== modified file 'playground/CMakeLists.txt'
71--- playground/CMakeLists.txt 2016-11-14 00:28:49 +0000
72+++ playground/CMakeLists.txt 2017-01-04 16:56:15 +0000
73@@ -20,7 +20,6 @@
74
75 add_subdirectory(demo-shell/)
76
77-set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99")
78 mir_add_wrapped_executable(mir_demo_client_prerendered_frames
79 mir_demo_client_prerendered_frames.c
80 )
81
82=== modified file 'src/utils/CMakeLists.txt'
83--- src/utils/CMakeLists.txt 2016-07-18 07:38:38 +0000
84+++ src/utils/CMakeLists.txt 2017-01-04 16:56:15 +0000
85@@ -1,5 +1,5 @@
86 set(CMAKE_C_FLAGS
87- "${CMAKE_C_FLAGS} -std=c99 -Wall -fno-strict-aliasing -Wextra"
88+ "${CMAKE_C_FLAGS} -Wall -fno-strict-aliasing -Wextra"
89 )
90
91 include_directories(

Subscribers

People subscribed via source and target branches