CMakeLists.txt 15.3 KB
Newer Older
Adrien Béraud's avatar
Adrien Béraud committed
1
CMAKE_MINIMUM_REQUIRED(VERSION 3.1.0)
2 3 4 5 6 7 8 9 10 11 12 13

# First, check is the compiler is new enough, most version of Clang are fine
# until problems arise, checking for GCC is enough
IF (CMAKE_COMPILER_IS_GNUCC)
   EXECUTE_PROCESS(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION)
   IF (GCC_VERSION VERSION_GREATER 4.8 OR GCC_VERSION VERSION_EQUAL 4.8)
      MESSAGE(STATUS "Found GCC version >= 4.8: " ${GCC_VERSION})
   ELSE()
      MESSAGE(FATAL_ERROR "Your version of GCC is too old, please install GCC 4.8 or later")
   ENDIF()
ENDIF()

Adrien Béraud's avatar
Adrien Béraud committed
14
set (CMAKE_CXX_STANDARD 14)
15

16
# set project name and version
17
PROJECT(ring-client-gnome)
Guillaume Roguez's avatar
Guillaume Roguez committed
18 19
SET(PROJECT_VERSION_MAJOR 1)
SET(PROJECT_VERSION_MINOR 0)
Guillaume Roguez's avatar
Guillaume Roguez committed
20
SET(PROJECT_VERSION_PATCH 0)
21

22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
# set build date
IF( NOT ("$ENV{SOURCE_DATE_EPOCH}" STREQUAL ""))
  EXECUTE_PROCESS(
    COMMAND date -u -d "1970-01-01 UTC $ENV{SOURCE_DATE_EPOCH} seconds" "+%Y-%m-%d %H:%M:%S UTC"
    OUTPUT_VARIABLE RING_CLIENT_BUILD_DATE
    OUTPUT_STRIP_TRAILING_WHITESPACE
    )
ELSEIF( "${RING_CLIENT_BUILD_DATE}" STREQUAL "")
  EXECUTE_PROCESS(
    COMMAND date -u "+%Y-%m-%d %H:%M:%S UTC"
    OUTPUT_VARIABLE RING_CLIENT_BUILD_DATE
    OUTPUT_STRIP_TRAILING_WHITESPACE
    )
ENDIF()

37 38 39
# add the binary tree to the search path for include files
# so that we will find config.h
INCLUDE_DIRECTORIES("${PROJECT_BINARY_DIR}")
40

41 42
LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")

43
# include custom cmake modules
44
INCLUDE(${CMAKE_SOURCE_DIR}/cmake/GResources.cmake)
45
INCLUDE(${CMAKE_SOURCE_DIR}/cmake/GSettings.cmake)
46 47 48 49 50 51 52

# make sure we're using Qt5
SET(ENABLE_QT5 true)

# for now, set debug as default
SET(CMAKE_BUILD_TYPE Debug)

53 54 55 56 57 58 59
# during packaging the CMAKE_INSTALL_PREFIX is used to specify where to install the files, but it
# may not be the same as where the package will put them, use RING_INSTALL_PREFIX to let the client
# know at runtime where to expect installed files to be located
SET(RING_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}
  CACHE PATH "prefix where the package will be installed on the user's system (eg: /usr/local); defaults to the CMAKE_INSTALL_PREFIX"
)

60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
# Check if LRC's location is manually specified with -DLibRingClient_PROJECT_DIR
IF(LibRingClient_PROJECT_DIR)
   SET(LIB_RING_CLIENT_INCLUDE_DIR ${LibRingClient_PROJECT_DIR}/src)
   # TODO: maybe allow a way to specify a different build dir
   SET(LIB_RING_LIBRARY_INCLUDE_DIR ${LibRingClient_PROJECT_DIR}/build)

   # check for the existence of the directories;
   # if the dirs have missing or outdated files then we will just get build/link errors
   IF(EXISTS "${LIB_RING_CLIENT_INCLUDE_DIR}/")
      MESSAGE("will expect lrc headers in ${LIB_RING_CLIENT_INCLUDE_DIR}")
      IF(EXISTS "${LIB_RING_LIBRARY_INCLUDE_DIR}/")
         MESSAGE("will expect lrc libraries in " ${LIB_RING_LIBRARY_INCLUDE_DIR})
         SET(LibRingClient_FOUND true)
         SET(LIB_RING_CLIENT_LIBRARY ringclient)
      ELSE()
         MESSAGE( FATAL_ERROR "${LIB_RING_LIBRARY_INCLUDE_DIR} does not exist")
      ENDIF(EXISTS "${LIB_RING_LIBRARY_INCLUDE_DIR}/")
   ELSE()
      MESSAGE( FATAL_ERROR "${LIB_RING_CLIENT_INCLUDE_DIR} does not exist")
   ENDIF(EXISTS "${LIB_RING_CLIENT_INCLUDE_DIR}/")
ELSE(LibRingClient_PROJECT_DIR)
   FIND_PACKAGE(LibRingClient REQUIRED)
ENDIF(LibRingClient_PROJECT_DIR)

84 85 86
# find packages
FIND_PACKAGE(PkgConfig REQUIRED)
PKG_CHECK_MODULES(GTK3 REQUIRED gtk+-3.0>=3.10)
Stepan Salenikovich's avatar
Stepan Salenikovich committed
87
PKG_CHECK_MODULES(GLIB REQUIRED glib-2.0>=2.40)
88
FIND_PACKAGE(Qt5Core REQUIRED)
89 90
PKG_CHECK_MODULES(CLUTTER REQUIRED clutter-1.0)
PKG_CHECK_MODULES(CLUTTERGTK REQUIRED clutter-gtk-1.0)
91
PKG_CHECK_MODULES(EBOOK REQUIRED libebook-1.2>=3.10)
92
PKG_CHECK_MODULES(LIBNOTIFY libnotify>=0.7.6) #optional
Nicolas Jager's avatar
Nicolas Jager committed
93 94 95
IF( LIBNOTIFY_FOUND )
    pkg_check_modules(CANBERRA REQUIRED libcanberra-gtk3>=0.25)
ENDIF()
96
FIND_PACKAGE(Gettext) #optional for translations
aviau's avatar
aviau committed
97
PKG_CHECK_MODULES(LIBQRENCODE libqrencode>=3.4)
Lubomir Rintel's avatar
Lubomir Rintel committed
98
PKG_CHECK_MODULES(LIBNM libnm>=1.0) #optional to detect changes in the network
99
PKG_CHECK_MODULES(APPINDICATOR appindicator3-0.1) #optional, ideal for use with Unity
aviau's avatar
aviau committed
100

aviau's avatar
aviau committed
101
PKG_CHECK_MODULES(WEBKIT webkit2gtk-4.0)
102
IF(NOT WEBKIT_FOUND)
aviau's avatar
aviau committed
103 104 105
    PKG_CHECK_MODULES(WEBKIT REQUIRED webkit2gtk-3.0)
ENDIF()

106 107 108
# include libs
INCLUDE_DIRECTORIES(${GTK3_INCLUDE_DIRS})
INCLUDE_DIRECTORIES(${LIB_RING_CLIENT_INCLUDE_DIR})
Stepan Salenikovich's avatar
Stepan Salenikovich committed
109
INCLUDE_DIRECTORIES(SYSTEM ${Qt5Core_INCLUDE_DIRS} )
110 111
INCLUDE_DIRECTORIES(${CLUTTER_INCLUDE_DIRS})
INCLUDE_DIRECTORIES(${CLUTTERGTK_INCLUDE_DIRS})
112
INCLUDE_DIRECTORIES(${EBOOK_INCLUDE_DIRS})
113
INCLUDE_DIRECTORIES(${LIBNOTIFY_INCLUDE_DIRS})
Stepan Salenikovich's avatar
Stepan Salenikovich committed
114
INCLUDE_DIRECTORIES(${APPINDICATOR_INCLUDE_DIRS})
115
INCLUDE_DIRECTORIES(${LIBNM_INCLUDE_DIRS})
aviau's avatar
aviau committed
116
INCLUDE_DIRECTORIES(${WEBKIT_INCLUDE_DIRS})
117
INCLUDE_DIRECTORIES(${CANBERRA_INCLUDE_DIRS})
118 119 120

# link libs
LINK_DIRECTORIES(${GTK3_LIBRARY_DIRS})
121 122 123 124
LINK_DIRECTORIES(${LIB_RING_LIBRARY_INCLUDE_DIR})
LINK_DIRECTORIES(${Qt5Core_LIBRARY_DIRS} )
LINK_DIRECTORIES(${CLUTTER_LIBRARY_DIRS})
LINK_DIRECTORIES(${CLUTTERGTK_LIBRARY_DIRS})
125
LINK_DIRECTORIES(${EBOOK_LIBRARY_DIRS})
126
LINK_DIRECTORIES(${LIBNOTIFY_LIBRARY_DIRS})
Stepan Salenikovich's avatar
Stepan Salenikovich committed
127
LINK_DIRECTORIES(${APPINDICATOR_LIBRARY_DIRS})
128
LINK_DIRECTORIES(${LIBNM_LIBRARY_DIRS})
aviau's avatar
aviau committed
129
LINK_DIRECTORIES(${WEBKIT_LIBRARY_DIRS})
130
LINK_DIRECTORIES(${CANBERRA_LIBRARY_DIRS})
131

132 133
# lib compiler flags
ADD_DEFINITIONS(${GTK3_CFLAGS})
134
ADD_DEFINITIONS(${GTK3_CFLAGS_OTHER})
135 136 137 138
ADD_DEFINITIONS(${LIB_RING_LIBRARY_CFLAGS})
ADD_DEFINITIONS(${Qt5Core_CFLAGS})
ADD_DEFINITIONS(${CLUTTER_CFLAGS})
ADD_DEFINITIONS(${CLUTTERGTK_CFLAGS})
139
ADD_DEFINITIONS(${EBOOK_CFLAGS})
140
ADD_DEFINITIONS(${LIBNOTIFY_CFLAGS})
Stepan Salenikovich's avatar
Stepan Salenikovich committed
141
ADD_DEFINITIONS(${APPINDICATOR_CFLAGS})
142
ADD_DEFINITIONS(${LIBNM_CFLAGS})
aviau's avatar
aviau committed
143
ADD_DEFINITIONS(${WEBKIT_CFLAGS})
144
ADD_DEFINITIONS(${CANBERRA_CFLAGS})
145

Guillaume Roguez's avatar
Guillaume Roguez committed
146 147 148 149 150 151 152 153 154
IF(NOT ${ENABLE_STATIC} MATCHES false)
  SET(QT5_MODULE_PATH ${QT5_PATH}/lib/cmake)
  FIND_PACKAGE(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED Core DBus)
  FIND_PACKAGE(Qt5DBus REQUIRED)
  INCLUDE_DIRECTORIES(SYSTEM ${Qt5DBus_INCLUDE_DIRS} )
  LINK_DIRECTORIES(${Qt5DBus_LIBRARY_DIRS} )
  ADD_DEFINITIONS(${Qt5DBus_CFLAGS})
ENDIF()

155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213
# warnings
ADD_DEFINITIONS(
   -Wall
   -Wextra
   -Wno-cpp
   -Wmissing-noreturn
   -Wpointer-arith
   -Wcast-align
   -Wwrite-strings
   -Wformat-nonliteral
   -Wformat-security
   -Wswitch-enum
   -Winit-self
   -Wmissing-include-dirs
   -Wundef
   -Wmissing-format-attribute
   -Wno-reorder
   -Wunused
   -Wuninitialized
   -Woverloaded-virtual
   -Wsuggest-attribute=const
   -Wunused-value
   -Wdouble-promotion
   -Wnonnull
   -Wsequence-point
   -Wunused-but-set-parameter
   -Wsizeof-pointer-memaccess
   -Wvarargs
)

# more warnings
IF (CMAKE_COMPILER_IS_GNUCC)
   IF (GCC_VERSION VERSION_GREATER 4.9 OR GCC_VERSION VERSION_EQUAL 4.9)
      ADD_DEFINITIONS(
         -Wconditionally-supported
         -Wdate-time
         -Wdelete-incomplete
         -Wfloat-conversion
      )
   ENDIF()

   IF (GCC_VERSION VERSION_GREATER 5.0 OR GCC_VERSION VERSION_EQUAL 5.0)
      ADD_DEFINITIONS(
         -Wsuggest-override
         -Wsuggest-final-types
         -Wsuggest-final-methods
         -Wbool-compare
         -Wformat-signedness
         -Wlogical-not-parentheses
         -Wnormalized
         -Wshift-count-negative
         -Wshift-count-overflow
         -Wsized-deallocation
         -Wsizeof-array-argument
      )
   ENDIF()

ENDIF()

214 215 216 217 218 219 220 221 222
# get git version on every build
SET(GIT_REVISION_INPUT_FILE ${PROJECT_SOURCE_DIR}/src/revision.h.in)
SET(GIT_REVISION_OUTPUT_FILE ${PROJECT_BINARY_DIR}/revision.h)

ADD_CUSTOM_TARGET(
   git_revision ALL
   COMMAND ${CMAKE_COMMAND}
      -DGIT_REVISION_INPUT_FILE=${GIT_REVISION_INPUT_FILE}
      -DGIT_REVISION_OUTPUT_FILE=${GIT_REVISION_OUTPUT_FILE}
223
      -DRING_CLIENT_BUILD_DATE=${RING_CLIENT_BUILD_DATE}
224 225 226 227 228 229 230 231 232
      -P ${CMAKE_SOURCE_DIR}/cmake/GitRevision.cmake
   COMMENT "generating ${GIT_REVISION_OUTPUT_FILE}"
)

ADD_CUSTOM_COMMAND(
   OUTPUT ${GIT_REVISION_OUTPUT_FILE}
   DEPENDS git_revision
)

233 234 235
# source files to compile
SET( SRC_FILES
   src/main.cpp
236 237 238 239
   src/ring_client.h
   src/ring_client.cpp
   src/ring_client_options.h
   src/ring_client_options.c
240 241
   src/ringmainwindow.h
   src/ringmainwindow.cpp
242 243
   src/incomingcallview.h
   src/incomingcallview.cpp
Stepan Salenikovich's avatar
Stepan Salenikovich committed
244 245
   src/currentcallview.h
   src/currentcallview.cpp
246 247 248 249
   src/models/gtkaccessproxymodel.h
   src/models/gtkaccessproxymodel.cpp
   src/models/gtkqtreemodel.h
   src/models/gtkqtreemodel.cpp
Stepan Salenikovich's avatar
Stepan Salenikovich committed
250
   src/utils/drawing.h
251
   src/utils/drawing.cpp
252 253
   src/video/video_widget.h
   src/video/video_widget.cpp
254 255
   src/accountview.h
   src/accountview.cpp
aviau's avatar
aviau committed
256 257 258 259
   src/accountcreationwizard.h
   src/accountcreationwizard.cpp
   src/accountmigrationview.h
   src/accountmigrationview.cpp
260 261
   src/accountgeneraltab.h
   src/accountgeneraltab.cpp
aviau's avatar
aviau committed
262 263
   src/usernameregistrationbox.h
   src/usernameregistrationbox.cpp
264 265
   src/accountaudiotab.h
   src/accountaudiotab.cpp
aviau's avatar
aviau committed
266 267
   src/accountdevicestab.h
   src/accountdevicestab.cpp
268 269
   src/accountvideotab.h
   src/accountvideotab.cpp
Stepan Salenikovich's avatar
Stepan Salenikovich committed
270 271
   src/accountadvancedtab.h
   src/accountadvancedtab.cpp
272 273
   src/accountsecuritytab.h
   src/accountsecuritytab.cpp
274 275
   src/models/activeitemproxymodel.h
   src/models/activeitemproxymodel.cpp
276
   src/defines.h
Stepan Salenikovich's avatar
Stepan Salenikovich committed
277 278
   src/video/xrectsel.h
   src/video/xrectsel.c
279 280
   src/dialogs.h
   src/dialogs.c
281 282
   src/mediasettingsview.h
   src/mediasettingsview.cpp
283 284
   src/generalsettingsview.h
   src/generalsettingsview.cpp
285 286
   src/backends/edscontactbackend.h
   src/backends/edscontactbackend.cpp
287 288
   src/native/pixbufmanipulator.h
   src/native/pixbufmanipulator.cpp
289 290 291 292
   src/utils/models.h
   src/utils/models.cpp
   src/utils/calling.h
   src/utils/calling.cpp
293 294
   src/ringnotify.h
   src/ringnotify.cpp
295 296
   src/utils/files.h
   src/utils/files.cpp
297
   ${GIT_REVISION_OUTPUT_FILE}
298 299
   src/utils/accounts.h
   src/utils/accounts.cpp
Stepan Salenikovich's avatar
Stepan Salenikovich committed
300 301 302 303
   src/choosecontactview.h
   src/choosecontactview.cpp
   src/editcontactview.h
   src/editcontactview.cpp
304 305
   src/native/dbuserrorhandler.h
   src/native/dbuserrorhandler.cpp
306 307
   src/ringwelcomeview.h
   src/ringwelcomeview.cpp
aviau's avatar
aviau committed
308 309
   src/webkitchatcontainer.h
   src/webkitchatcontainer.cpp
310 311
   src/chatview.h
   src/chatview.cpp
312 313
   src/avatarmanipulation.h
   src/avatarmanipulation.cpp
314 315
   src/accountimportexportview.h
   src/accountimportexportview.cpp
316 317
   src/cc-crop-area.h
   src/cc-crop-area.c
318 319
   src/models/namenumberfilterproxymodel.h
   src/models/namenumberfilterproxymodel.cpp
320 321 322 323
   src/accountbanstab.h
   src/accountbanstab.cpp
   src/bannedcontactsview.h
   src/bannedcontactsview.cpp
324 325
   src/conversationsview.h
   src/conversationsview.cpp
Sébastien Blin's avatar
Sébastien Blin committed
326 327 328
   src/conversationpopupmenu.h
   src/conversationpopupmenu.cpp
   src/accountcontainer.h
329 330
)

331 332 333 334
# compile glib resource files to c code
GLIB_COMPILE_RESOURCES( GLIB_RESOURCES_RING
   SOURCE
      pixmaps/pixmaps.gresource.xml
335
      ui/ui.gresource.xml
aviau's avatar
aviau committed
336
      web/web.gresource.xml
337
      sounds/sounds.gresource.xml
338 339
)

340 341 342 343 344
# IF(${ENABLE_TEST} MATCHES true)
#    ADD_SUBDIRECTORY( src/test)
# ENDIF()

# for translations
345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368
IF (GETTEXT_FOUND)

  # get all translation files; they're expected to be named using the following convention:
  # '<lang code>[_<country code].po'
  # eg: fr_CA.po (the country code is optional)
  FILE(GLOB PO_FILES ${CMAKE_SOURCE_DIR}/po/*.po)

  # Install each of the translation files
  FOREACH(PO_FILE IN LISTS PO_FILES)
    # extract the language (and optional country code) from the filename
    GET_FILENAME_COMPONENT(LANG ${PO_FILE} NAME_WE)
    GETTEXT_PROCESS_PO_FILES(${LANG} ALL PO_FILES ${PO_FILE})

    SET(TRANSLATIONS_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/share/locale/${LANG}/LC_MESSAGES)

    # install to share/locale and rename each to ring-client-gnome.mo
    INSTALL(
      FILES ${PROJECT_BINARY_DIR}/${LANG}.gmo
      DESTINATION ${TRANSLATIONS_INSTALL_DIR}
      RENAME ${PROJECT_NAME}.mo
    )
  ENDFOREACH(PO_FILE)

ENDIF(GETTEXT_FOUND)
369

370 371 372
# install and compile glib gsettings schema
add_schema("cx.ring.RingGnome.gschema.xml" GSCHEMA_RING)

373
ADD_EXECUTABLE(gnome-ring ${GLIB_RESOURCES_RING} ${GSCHEMA_RING} ${SRC_FILES})
374

Guillaume Roguez's avatar
Guillaume Roguez committed
375
IF(NOT ${ENABLE_STATIC} MATCHES false)
376
TARGET_LINK_LIBRARIES(gnome-ring
377 378
   ${LIB_RING_CLIENT_LIBRARY}
   ${GTK3_LIBRARIES}
Guillaume Roguez's avatar
Guillaume Roguez committed
379 380
   ${Qt5Core_LIBRARIES}
   ${Qt5DBus_LIBRARIES}
381
   ${CLUTTER_LIBRARIES}
Guillaume Roguez's avatar
Guillaume Roguez committed
382
   ${CLUTTERGTK_LIBRARIES}
383
   ${EBOOK_LIBRARIES}
384
   ${LIBNOTIFY_LIBRARIES}
Stepan Salenikovich's avatar
Stepan Salenikovich committed
385
   ${APPINDICATOR_LIBRARIES}
386
   ${LIBNM_LIBRARIES}
aviau's avatar
aviau committed
387
   ${WEBKIT_LIBRARIES}
388
   ${LIBQRENCODE_LIBRARIES}
389
   ${CANBERRA_LIBRARIES}
Guillaume Roguez's avatar
Guillaume Roguez committed
390 391 392 393
   -lpthread
   -lrt
   )
ELSE()
394
TARGET_LINK_LIBRARIES(gnome-ring
Guillaume Roguez's avatar
Guillaume Roguez committed
395 396 397 398 399
   ${LIB_RING_CLIENT_LIBRARY}
   ${GTK3_LIBRARIES}
   ${Qt5Core_LIBRARIES}
   ${CLUTTER_LIBRARIES}
   ${CLUTTERGTK_LIBRARIES}
400
   ${EBOOK_LIBRARIES}
401
   ${LIBNOTIFY_LIBRARIES}
Stepan Salenikovich's avatar
Stepan Salenikovich committed
402
   ${APPINDICATOR_LIBRARIES}
403
   ${LIBNM_LIBRARIES}
aviau's avatar
aviau committed
404
   ${WEBKIT_LIBRARIES}
405
   ${LIBQRENCODE_LIBRARIES}
406
   ${CANBERRA_LIBRARIES}
Guillaume Roguez's avatar
Guillaume Roguez committed
407 408
   )
ENDIF()
409

410 411 412
# configure libnotify variable for config.h file
IF( LIBNOTIFY_FOUND )
   SET(USE_LIBNOTIFY 1)
413
   SET(USE_CANBERRA 1)
414 415 416 417
ELSE()
   SET(USE_LIBNOTIFY 0)
ENDIF()

418 419 420 421 422 423 424
# configure libnm variable for config.h file
IF( LIBNM_FOUND )
   SET(USE_LIBNM 1)
ELSE()
   SET(USE_LIBNM 0)
ENDIF()

425 426 427 428 429 430 431
# configure appindicator variable for config.h file
IF( APPINDICATOR_FOUND )
    SET(HAVE_APPINDICATOR 1)
ELSE()
    SET(HAVE_APPINDICATOR 0)
ENDIF()

432 433 434 435 436 437 438
# configure libcanberra variable for config.h file
IF( CANBERRA_FOUND )
   SET(USE_CANBERRA 1)
ELSE()
   SET(USE_CANBERRA 0)
ENDIF()

439 440 441 442 443 444
# create config header file to pass cmake settings to source code
CONFIGURE_FILE (
   "${PROJECT_SOURCE_DIR}/src/config.h.in"
   "${PROJECT_BINARY_DIR}/config.h"
)

445
INSTALL(TARGETS gnome-ring
446 447
   RUNTIME DESTINATION bin
)
448

449
# install .desktop in XDG desktop dir so that it is recognized by the system
450
INSTALL(FILES ${PROJECT_SOURCE_DIR}/gnome-ring.desktop
451 452 453
    DESTINATION ${CMAKE_INSTALL_PREFIX}/share/applications
)

454 455 456 457 458
# install audio files
INSTALL(FILES ${PROJECT_SOURCE_DIR}/sounds/ringtone_notify.wav
    DESTINATION ${CMAKE_INSTALL_PREFIX}/share/sounds/gnome-ring
)

459
# install .desktop in the gnome-ring data dir, so that it can be copied to the
460
# autostart dir by the client
461
INSTALL(FILES ${PROJECT_SOURCE_DIR}/gnome-ring.desktop.autostart
462
   DESTINATION
463
      ${CMAKE_INSTALL_PREFIX}/share/gnome-ring/
464 465 466 467 468
   PERMISSIONS
      WORLD_READ
      OWNER_WRITE
      OWNER_READ
      GROUP_READ
469
   RENAME
470
      gnome-ring.desktop
471 472
)

473 474 475 476
INSTALL(FILES pixmaps/ring.svg
    DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/scalable/apps
)

477
INSTALL(FILES gnome-ring.appdata.xml
478 479
    DESTINATION ${CMAKE_INSTALL_PREFIX}/share/appdata/
)
480

481
# install shell script which will launch "ring"
482 483
INSTALL(
   FILES
aviau's avatar
aviau committed
484
      "${PROJECT_SOURCE_DIR}/src/ring.cx"
485 486 487 488 489 490 491 492 493 494
   DESTINATION
      ${CMAKE_INSTALL_PREFIX}/bin
   PERMISSIONS
      WORLD_READ
      OWNER_WRITE
      OWNER_READ
      GROUP_READ
      OWNER_EXECUTE
      GROUP_EXECUTE
      WORLD_EXECUTE
495 496
)

497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513
# add a target to generate API documentation with Doxygen
FIND_PACKAGE(Doxygen)
IF(DOXYGEN_FOUND)
    CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/doc/Doxyfile.in ${CMAKE_CURRENT_SOURCE_DIR}/doc/Doxyfile @ONLY)
    ADD_CUSTOM_TARGET(doc
        COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/doc/Doxyfile
        WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/doc
        COMMENT "Generating API documentation with Doxygen" VERBATIM
    )

    # create doc/README.md symlink to README since Doxygen doesn't understand file with no extension
    ADD_CUSTOM_COMMAND(
        TARGET doc
        PRE_BUILD
        COMMAND ln -sf ${CMAKE_CURRENT_SOURCE_DIR}/README ${CMAKE_CURRENT_SOURCE_DIR}/doc/README.md
    )
ENDIF(DOXYGEN_FOUND)
514 515 516 517 518 519 520 521 522

# uninstall target
CONFIGURE_FILE(
    "${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
    "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
    IMMEDIATE @ONLY)

ADD_CUSTOM_TARGET(uninstall
    COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)