~ci-train-bot/miral/miral-ubuntu-yakkety-2068

90 by Alan Griffiths
Relax cmake version
1
cmake_minimum_required(VERSION 3.0)
1 by Alan Griffiths
Initial import of example code
2
project(miral)
3
105.1.2 by Brandon Schaefer
Default to /usr vs /usr/local
4
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
5
    set(CMAKE_INSTALL_PREFIX "/usr" CACHE PATH "/usr install prefix" FORCE)
6
endif()
7
260.2.4 by Alan Griffiths
Fix CMakeLists.txt to match
8
include (GNUInstallDirs)
289.2.1 by Alan Griffiths
Fix clang build post 0,24
9
include(CheckCXXCompilerFlag)
260.2.4 by Alan Griffiths
Fix CMakeLists.txt to match
10
1 by Alan Griffiths
Initial import of example code
11
cmake_policy(SET CMP0015 NEW)
12
cmake_policy(SET CMP0022 NEW)
13
100 by Alan Griffiths
Quck and dirty import of old spinner
14
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
15
1 by Alan Griffiths
Initial import of example code
16
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
17
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
18
257.1.1 by Alan Griffiths
A few more build options including defaults that work for clang
19
set(MIRAL_COMPILER_FLAGS "-pthread -g -Werror -Wall -pedantic -Wextra -fPIC")
20
set(MIRAL_LINKER_FLAGS   "-Wl,-z,defs")
21
289.2.1 by Alan Griffiths
Fix clang build post 0,24
22
check_cxx_compiler_flag(-Wno-mismatched-tags MIRAL_COMPILE_WITH_W_NO_MISMATCHED_TAGS)
23
if (MIRAL_COMPILE_WITH_W_NO_MISMATCHED_TAGS)
24
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-mismatched-tags")
25
endif()
26
257.1.1 by Alan Griffiths
A few more build options including defaults that work for clang
27
set(CMAKE_C_FLAGS   "${CMAKE_C_FLAGS} ${MIRAL_COMPILER_FLAGS}")
28
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${MIRAL_COMPILER_FLAGS} -Wnon-virtual-dtor -std=c++14")
29
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${MIRAL_LINKER_FLAGS}")
30
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${MIRAL_LINKER_FLAGS}")
31
set(CMAKE_EXE_LINKER_FLAGS    "${CMAKE_EXE_LINKER_FLAGS} ${MIRAL_LINKER_FLAGS}")
1 by Alan Griffiths
Initial import of example code
32
33
include(FindPkgConfig)
34
35
pkg_check_modules(MIRCLIENT mirclient>=0.20 REQUIRED)
36
152.3.1 by Alan Griffiths
A bit of tidy-up of Mir dependencies
37
include_directories(include SYSTEM ${MIRCLIENT_INCLUDE_DIRS})
1 by Alan Griffiths
Initial import of example code
38
158.1.1 by Alan Griffiths
Install headers and pkg-config support
39
set(MIRAL_VERSION_MAJOR 0)
40
set(MIRAL_VERSION_MINOR 1)
41
set(MIRAL_VERSION_PATCH 0)
42
43
set(MIRAL_VERSION ${MIRAL_VERSION_MAJOR}.${MIRAL_VERSION_MINOR}.${MIRAL_VERSION_PATCH})
44
1 by Alan Griffiths
Initial import of example code
45
add_subdirectory(miral)
93 by Alan Griffiths
Rename miral-shell
46
add_subdirectory(miral-shell)
134 by Alan Griffiths
Split miral-kiosk into separate directory
47
add_subdirectory(miral-kiosk)
171.1.1 by Alan Griffiths
Start of MRUWindowList
48
226.2.1 by Alan Griffiths
use MIRTEST_VERSION to determine MIRAL_ENABLE_TESTS default
49
pkg_check_modules(MIRTEST mirtest)
50
if(NOT MIRTEST_FOUND)
51
    message(WARNING "mirtest-dev package not installed - tests cannot be built")
52
else()
53
    if (MIRTEST_VERSION VERSION_LESS 0.24)
247.1.2 by Alan Griffiths
Mention both mirtest-dev bugs
54
        # building the tests is disabled by default because the mirtest-dev package is broken on xenial
55
        # (lp:1583536 and lp:1603080)
226.2.1 by Alan Griffiths
use MIRTEST_VERSION to determine MIRAL_ENABLE_TESTS default
56
        option(MIRAL_ENABLE_TESTS "Build tests" off)
57
    else()
58
        option(MIRAL_ENABLE_TESTS "Build tests" on)
59
    endif()
60
171.1.10 by Alan Griffiths
Tidy up instructions and CMakeLists.txt
61
if (MIRAL_ENABLE_TESTS)
247.1.1 by Alan Griffiths
Fix "make test"
62
    enable_testing()
286.1.2 by Alan Griffiths
Work with -DMIRAL_ENABLE_QT=on -DMIRAL_ENABLE_TESTS=on
63
    find_package(GMock REQUIRED)
247.1.1 by Alan Griffiths
Fix "make test"
64
    add_subdirectory(test)
171.1.10 by Alan Griffiths
Tidy up instructions and CMakeLists.txt
65
endif()
226.2.1 by Alan Griffiths
use MIRTEST_VERSION to determine MIRAL_ENABLE_TESTS default
66
endif()
248.1.1 by Alan Griffiths
Add doxygen skeleton
67
286.1.2 by Alan Griffiths
Work with -DMIRAL_ENABLE_QT=on -DMIRAL_ENABLE_TESTS=on
68
option(MIRAL_ENABLE_QT "Build Qt integration" OFF)
69
if (MIRAL_ENABLE_QT)
70
    add_subdirectory(miral-qt)
71
endif()
72
248.1.1 by Alan Griffiths
Add doxygen skeleton
73
include (cmake/Doxygen.cmake)
307.4.1 by Alan Griffiths
Add a build target to regenerate symbols map
74
75
if(TARGET doc)
76
    add_custom_target(symbols
77
        ${CMAKE_SOURCE_DIR}/scripts/process_doxygen_xml.py ${CMAKE_BINARY_DIR}/doc/xml/*.xml > ${CMAKE_SOURCE_DIR}/miral/symbols.map
78
        DEPENDS doc)
79
endif()