File: CMakeLists.txt

package info (click to toggle)
lifeograph 1.4.0-1
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 3,572 kB
  • ctags: 2,270
  • sloc: cpp: 18,877; xml: 55; makefile: 17
file content (167 lines) | stat: -rw-r--r-- 6,492 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
#    Copyright (C) 2013-2016 Ahmet Öztürk (aoz_2@yahoo.com)
#
#    This file is part of Lifeograph.
#
#    Lifeograph is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    Lifeograph is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with Lifeograph.  If not, see <http://www.gnu.org/licenses/>.


cmake_minimum_required( VERSION 2.6 )
project( Lifeograph )

include( ${PROJECT_SOURCE_DIR}/cmake/definitions.cmake )

add_definitions( -Wall -DHAVE_CONFIG_H )

# DEBUG BUILD
if( ${CMAKE_BUILD_TYPE} MATCHES Debug )
    set( DEBUG_BUILD 1 )
else()
    set( DEBUG_BUILD 0 )
endif()

# PACKAGES
find_package( PkgConfig REQUIRED )

find_program( INTLTOOL "intltool-merge" )
if( ${INTLTOOL} MATCHES "INTLTOOL-NOTFOUND" )
    message( "Program needed for building Lifeograph not found: intltool" )
    return()
endif()

find_library( GCRYPT gcrypt )
if( ${GCRYPT} MATCHES "GCRYPT-NOTFOUND" )
    message( "Dev module needed for building Lifeograph not found: gcrypt" )
    return()
endif()

pkg_check_modules( GTKMM REQUIRED gtkmm-3.0>=3.12 )
if( NOT GTKMM_FOUND )
    message( "Dev module needed for building Lifeograph not found: gtkmm-3.0 (>=3.12)" )
    return()
endif()

pkg_check_modules( ENCHANT REQUIRED enchant )
if( NOT ENCHANT_FOUND )
    message( "Dev module needed for building Lifeograph not found: enchant" )
    return()
endif()

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

# CONFIGURATION HEADER FILE
configure_file( ${PROJECT_SOURCE_DIR}/config.h.in ${LOCAL_INCL_DIR}/config.h )

# add path of config.h
include_directories( ${LOCAL_INCL_DIR} )

include_directories( ${GTKMM_INCLUDE_DIRS} ${ENCHANT_INCLUDE_DIRS} )

#link_directories( ${GTKMM_LIBRARY_DIRS} ${ENCHANT_LIBRARY_DIRS} )

set( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${BIN_DIR} )

# TRANSLATION FILE OPTIONS INVOKED MANUALLY WHEN REQUIRED
add_custom_command( OUTPUT ${pot_file}
                    COMMAND intltool-update -p -g ${PACKAGE_NAME}
                    DEPENDS ${SOURCE_FILES}
                    WORKING_DIRECTORY ${po_dir} )

add_custom_target( update-translations
                   COMMAND ${CMAKE_COMMAND} -P ${PROJECT_SOURCE_DIR}/cmake/msgmerge.cmake
                   DEPENDS ${pot_file}
                   WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} )

# TRANSLATION FILE OPTIONS DURING BUILD
# based on Remmina code at https://github.com/FreeRDP/Remmina/blob/master/cmake/GETTEXT.cmake
set( GETTEXT_MSGFMT_EXECUTABLE msgfmt )
set( mo_files )

if( NOT EXISTS ${MO_DIR} )
    file( MAKE_DIRECTORY ${MO_DIR} )
endif()

file( GLOB po_files ${po_dir}/*.po )
foreach( po_file ${po_files} )
    get_filename_component( lang ${po_file} NAME_WE )
    set( mo_file ${MO_DIR}/${lang}.mo )
    add_custom_command( OUTPUT ${mo_file}
                        COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${mo_file} ${po_file}
                        DEPENDS ${po_file} )
    install( FILES ${mo_file}
             DESTINATION share/locale/${lang}/LC_MESSAGES
             RENAME ${PACKAGE_NAME}.mo )
    set( mo_files ${mo_files} ${mo_file} )
endforeach()

add_custom_command( OUTPUT ${desktop_file}
                    COMMAND intltool-merge -d -u -q po ${desktop_file_in} ${desktop_file}
                    DEPENDS ${desktop_file_in} )

add_custom_target( format-translations ALL DEPENDS ${mo_files} ${desktop_file} )

# TARGETS
add_executable( ${PACKAGE_NAME} ${SOURCE_FILES} )

target_link_libraries( ${PACKAGE_NAME} ${GTKMM_LIBRARIES} ${ENCHANT_LIBRARIES} ${GCRYPT} )

# CUSTOM TARGETS
if( ${CMAKE_BUILD_TYPE} MATCHES Debug )
# BACKUP
    add_custom_target( BACKUP ALL
                       COMMAND ${CMAKE_COMMAND} -P ${PROJECT_SOURCE_DIR}/cmake/backup.cmake
                       DEPENDS ${BIN_DIR}/${PACKAGE_NAME}
                       WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} )

# rev_no.h and build_time.h
    add_custom_target( TARGET_STAMP_HEADERS
                       COMMAND ${CMAKE_COMMAND} -P ${PROJECT_SOURCE_DIR}/cmake/rev_no.cmake
                       WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} )

	add_dependencies( ${PACKAGE_NAME} TARGET_STAMP_HEADERS )
endif()

# INSTALL
install( TARGETS ${PACKAGE_NAME} DESTINATION bin )

install( FILES lifeograph.appdata.xml DESTINATION share/appdata )


install( FILES icons/lifeograph-48.png DESTINATION share/pixmaps RENAME lifeograph.png )
install( FILES icons/lifeograph-256.png DESTINATION share/icons/hicolor/256x256/apps RENAME lifeograph.png )
install( FILES icons/lifeograph-128.png DESTINATION share/icons/hicolor/128x128/apps RENAME lifeograph.png )
install( FILES icons/lifeograph-64.png DESTINATION share/icons/hicolor/64x64/apps RENAME lifeograph.png )
install( FILES icons/lifeograph-48.png DESTINATION share/icons/hicolor/48x48/apps RENAME lifeograph.png )
install( FILES icons/lifeograph-32.png DESTINATION share/icons/hicolor/32x32/apps RENAME lifeograph.png )
install( FILES icons/lifeograph-24.png DESTINATION share/icons/hicolor/24x24/apps RENAME lifeograph.png )
install( FILES icons/lifeograph-22.png DESTINATION share/icons/hicolor/22x22/apps RENAME lifeograph.png )
install( FILES icons/lifeograph-16.png DESTINATION share/icons/hicolor/16x16/apps RENAME lifeograph.png )
install( FILES icons/scalable/lifeograph.svg DESTINATION share/icons/hicolor/scalable/apps )
install( FILES icons/scalable/lifeograph-symbolic.svg DESTINATION share/icons/hicolor/scalable/apps )
install( DIRECTORY icons/png/ DESTINATION share/${PACKAGE_NAME}/icons )

install( FILES ui/lifeograph.ui DESTINATION share/${PACKAGE_NAME}/ui )
install( FILES ui/import.ui DESTINATION share/${PACKAGE_NAME}/ui )

install( DIRECTORY diaries/ DESTINATION share/${PACKAGE_NAME}/diaries )

# xdg: mime info
install( CODE "execute_process( COMMAND ${CMAKE_COMMAND} -P ${PROJECT_SOURCE_DIR}/cmake/xdg.cmake
								WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} )" )

# UNINSTALL
add_custom_target( uninstall
                   COMMAND ${CMAKE_COMMAND} -DDESTDIR=${CMAKE_INSTALL_PREFIX}
                   -P ${PROJECT_SOURCE_DIR}/cmake/uninstall.cmake
                   WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} )