forked from Boomaga/boomaga
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
138 lines (111 loc) · 4.97 KB
/
CMakeLists.txt
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
# BEGIN_COMMON_COPYRIGHT_HEADER
# (c)LGPL2+
#
#
# Copyright: 2012-2013 Boomaga team https://github.com/Boomaga
# Authors:
# Alexander Sokoloff <[email protected]>
#
# This program or library is free software; you can redistribute it
# and/or modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library 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
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General
# Public License along with this library; if not, write to the
# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301 USA
#
# END_COMMON_COPYRIGHT_HEADER
cmake_minimum_required( VERSION 2.6 )
project(boomaga)
set(MAJOR_VERSION 0)
set(MINOR_VERSION 9)
set(PATCH_VERSION 1)
set(FULL_VERSION ${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION})
add_definitions(-DMAJOR_VERSION=\"${MAJOR_VERSION}\")
add_definitions(-DMINOR_VERSION=\"${MINOR_VERSION}\")
add_definitions(-DPATCH_VERSION=\"${PATCH_VERSION}\")
add_definitions(-DFULL_VERSION=\"${FULL_VERSION}\")
include("cmake/tools.cmake")
statusMessage("boomaga ver. ${FULL_VERSION}")
statusMessage(" ")
find_program(CUPS_CONFIG_EXECUTABLE NAMES cups-config)
if(CUPS_CONFIG_EXECUTABLE)
exec_program(${CUPS_CONFIG_EXECUTABLE} ARGS --serverbin OUTPUT_VARIABLE CUPS_SERVERBIN)
set(DEF_CUPS_BACKEND_DIR "${CUPS_SERVERBIN}/backend")
set(DEF_CUPS_FILTER_DIR "${CUPS_SERVERBIN}/filter")
else(CUPS_CONFIG_EXECUTABLE)
message(FATAL_ERROR "Can't find cups-config. Are CUPS development packages installed?")
endif(CUPS_CONFIG_EXECUTABLE)
# Linux ***************************************
if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
set(DEF_CUPS_PPD_DIR /usr/share/ppd/boomaga)
set(DEF_DBUS_MACINE_ID_DIR /var/lib/dbus)
set(DEF_DBUS_SERVICE_DIR ${CMAKE_INSTALL_PREFIX}/share/dbus-1/services)
# FreeBSD *************************************
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
set(DEF_CUPS_PPD_DIR /usr/local/share/cups/model)
set(DEF_DBUS_MACINE_ID_DIR /var/db/dbus)
set(DEF_DBUS_SERVICE_DIR ${CMAKE_INSTALL_PREFIX}/share/dbus-1/services)
endif()
set(GUI_DIR ${CMAKE_INSTALL_PREFIX}/bin)
add_definitions(-DGUI_DIR=\"${GUI_DIR}\")
set(NONGUI_DIR ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/boomaga)
add_definitions(-DNONGUI_DIR=\"${NONGUI_DIR}\")
getQtVersion(QT_VERSION)
###########################################################
setByDefault(INSTANCE_NAME "boomaga")
setFirstUpper(CUPS_BACKEND_NAME "${INSTANCE_NAME}")
setByDefault(CUPS_BACKEND_URI "${INSTANCE_NAME}:/")
setByDefault(CUPS_BACKEND_INFO "${CUPS_BACKEND_NAME}")
setByDefault(CUPS_BACKEND_MODEL "${CUPS_BACKEND_NAME} printer")
setByDefault(CUPS_BACKEND_DESCRIPTION "Virtual ${INSTANCE_NAME} printer")
setByDefault(CUPS_BACKEND_MANUFACTURER "Generic")
setByDefault(GUI_PROGRAM ${GUI_DIR}/${INSTANCE_NAME})
setByDefault(GUI_SHARE_DIR ${CMAKE_INSTALL_PREFIX}/share/${INSTANCE_NAME})
setByDefault(CUPS_BACKEND_DIR ${DEF_CUPS_BACKEND_DIR})
setByDefault(CUPS_FILTER_DIR ${DEF_CUPS_FILTER_DIR})
setByDefault(CUPS_PPD_DIR ${DEF_CUPS_PPD_DIR})
setByDefault(DBUS_MACINE_ID_DIR ${DEF_DBUS_MACINE_ID_DIR})
setByDefault(DBUS_SERVICE_DIR ${DEF_DBUS_SERVICE_DIR})
statusMessage(" ")
statusMessage("You can change the following directories using cmake options like:")
statusMessage("-DCUPS_PPD_DIR=your_path")
statusMessage(" ")
statusMessage(" CUPS_BACKEND_DIR = ${CUPS_BACKEND_DIR}")
statusMessage(" CUPS_FILTER_DIR = ${CUPS_FILTER_DIR}")
statusMessage(" CUPS_PPD_DIR = ${CUPS_PPD_DIR}")
statusMessage(" DBUS_MACINE_ID_DIR = ${DBUS_MACINE_ID_DIR}")
statusMessage(" DBUS_SERVICE_DIR = ${DBUS_SERVICE_DIR}")
statusMessage(" ")
statusMessage(" You can change the following options using cmake options:")
statusMessage(" INSTANCE_NAME = ${INSTANCE_NAME}")
statusMessage(" CUPS_BACKEND_URI = ${CUPS_BACKEND_URI}")
statusMessage(" CUPS_BACKEND_INFO = ${CUPS_BACKEND_INFO}")
statusMessage(" CUPS_BACKEND_MODEL = ${CUPS_BACKEND_MODEL}")
statusMessage(" CUPS_BACKEND_DESCRIPTION = ${CUPS_BACKEND_DESCRIPTION}")
statusMessage(" CUPS_BACKEND_MANUFACTURER = ${CUPS_BACKEND_MANUFACTURER}")
add_subdirectory(cups)
add_subdirectory(gui)
install(FILES boomaga.1.gz DESTINATION share/man/man1)
########## Add make dist target ################
SET(CPACK_PACKAGE_VERSION "${FULL_VERSION}")
SET(CPACK_SOURCE_GENERATOR "TBZ2")
SET(CPACK_SOURCE_PACKAGE_FILE_NAME "boomaga-${CPACK_PACKAGE_VERSION}")
SET(CPACK_IGNORE_FILES
\\\\.git
build
CMakeLists.txt.user
\\\\~
)
SET(CPACK_SOURCE_IGNORE_FILES ${CPACK_IGNORE_FILES})
INCLUDE(CPack)
# simulate autotools' "make dist"
add_custom_target(dist COMMAND ${CMAKE_MAKE_PROGRAM} package_source)
showStatus()