-
Notifications
You must be signed in to change notification settings - Fork 34
/
CMakeLists.txt
147 lines (114 loc) · 5.02 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
139
140
141
142
143
144
145
146
147
# BEGIN_COMMON_COPYRIGHT_HEADER
# (c)LGPL2+
#
#
# Copyright: 2012-2018 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 3.0.0)
cmake_policy(SET CMP0028 NEW)
project(boomaga)
set(MAJOR_VERSION 3)
set(MINOR_VERSION 0)
set(PATCH_VERSION 0)
#set(BETA_VERSION beta5)
set(FULL_VERSION ${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION})
if (BETA_VERSION)
set(FULL_VERSION ${FULL_VERSION}.${BETA_VERSION})
endif()
add_definitions(-DMAJOR_VERSION=${MAJOR_VERSION})
add_definitions(-DMINOR_VERSION=${MINOR_VERSION})
add_definitions(-DPATCH_VERSION=${PATCH_VERSION})
add_definitions(-DFULL_VERSION=\"${FULL_VERSION}\")
set (CMAKE_CXX_STANDARD 11)
include("cmake/tools.cmake")
include("cmake/status_message.cmake")
include("cmake/cxx_standard.cmake")
status_message("boomaga ver. ${FULL_VERSION}")
status_message(" ")
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
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")
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_SERVICE_DIR ${CMAKE_INSTALL_PREFIX}/share/dbus-1/services)
set(USE_DBUS TRUE)
set(GUI_DIR ${CMAKE_INSTALL_PREFIX}/bin)
set(NONGUI_DIR ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/boomaga)
# FreeBSD *************************************
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
set(DEF_CUPS_PPD_DIR /usr/local/share/cups/model)
set(DEF_DBUS_SERVICE_DIR ${CMAKE_INSTALL_PREFIX}/share/dbus-1/services)
set(USE_DBUS TRUE)
set(GUI_DIR ${CMAKE_INSTALL_PREFIX}/bin)
set(NONGUI_DIR ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/boomaga)
# MacOS ***************************************
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
set(MAC_APP_ID "io.github.Boomaga")
set(MAC_SPOOL_DIR "/var/spool/${MAC_APP_ID}")
set(DEF_CUPS_PPD_DIR ${CMAKE_INSTALL_PREFIX}/Library/Printers/PPDs/Contents/Resources)
set(GUI_DIR ${CMAKE_INSTALL_PREFIX}/Applications/Boomaga.app/Contents/MacOS)
set(NONGUI_DIR ${CMAKE_INSTALL_PREFIX}/Applications/Boomaga.app/Contents/MacOS)
set(USE_DBUS FALSE)
endif()
set(AUTOREMOVE_EXT "autoremove")
add_definitions(-DAUTOREMOVE_EXT=\"${AUTOREMOVE_EXT}\")
add_definitions(-DGUI_DIR=\"${GUI_DIR}\")
add_definitions(-DNONGUI_DIR=\"${NONGUI_DIR}\")
if (USE_DBUS)
add_definitions(-DUSE_DBUS=1)
endif()
###########################################################
setFirstUpper(CUPS_BACKEND_NAME "boomaga")
setByDefault(CUPS_BACKEND_URI "boomaga:/")
setByDefault(CUPS_BACKEND_INFO "${CUPS_BACKEND_NAME}")
setByDefault(CUPS_BACKEND_MODEL "${CUPS_BACKEND_NAME} printer")
setByDefault(CUPS_BACKEND_DESCRIPTION "Virtual boomaga printer")
setByDefault(CUPS_BACKEND_MANUFACTURER "Generic")
setByDefault(GUI_PROGRAM ${GUI_DIR}/boomaga)
setByDefault(GUI_SHARE_DIR ${CMAKE_INSTALL_PREFIX}/share/boomaga)
setByDefault(CUPS_BACKEND_DIR "${DEF_CUPS_BACKEND_DIR}")
setByDefault(CUPS_PPD_DIR "${DEF_CUPS_PPD_DIR}")
setByDefault(DBUS_SERVICE_DIR "${DEF_DBUS_SERVICE_DIR}")
status_message(" ")
status_message("You can change the following directories using cmake options like:")
status_message("-DCUPS_PPD_DIR=your_path")
status_message(" ")
status_message(" CUPS_BACKEND_DIR = ${CUPS_BACKEND_DIR}")
status_message(" CUPS_PPD_DIR = ${CUPS_PPD_DIR}")
status_message(" DBUS_SERVICE_DIR = ${DBUS_SERVICE_DIR}")
status_message(" ")
status_message(" You can change the following options using cmake options:")
status_message(" CUPS_BACKEND_URI = ${CUPS_BACKEND_URI}")
status_message(" CUPS_BACKEND_INFO = ${CUPS_BACKEND_INFO}")
status_message(" CUPS_BACKEND_MODEL = ${CUPS_BACKEND_MODEL}")
status_message(" CUPS_BACKEND_DESCRIPTION = ${CUPS_BACKEND_DESCRIPTION}")
status_message(" CUPS_BACKEND_MANUFACTURER = ${CUPS_BACKEND_MANUFACTURER}")
status_message(" ")
add_subdirectory(src/backend)
add_subdirectory(src/boomaga)
add_subdirectory(selinux)
show_status()