summaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
blob: 7530b78170f1abf0f95c6482622f152cb26d3b70 (plain) (blame)
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
################################################################################
# General
################################################################################

PROJECT(printergui)
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.0)

# set compiler optimizations for debug and release
IF (CMAKE_BUILD_TYPE STREQUAL "")
	SET(CMAKE_BUILD_TYPE Debug)
ENDIF()
SET(CMAKE_C_FLAGS_DEBUG "-O0 -g -Wall -Wunused -Wunreachable-code -pedantic")
SET(CMAKE_C_FLAGS_RELEASE "-O2")
SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g -Wall")
SET(CMAKE_CXX_FLAGS_RELEASE "-O2" )

# local cmake modules
SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)

# this command finds libraries and sets all required variables
FIND_PACKAGE(Qt4 REQUIRED)
FIND_PACKAGE(Cups REQUIRED)

# some includes
INCLUDE_DIRECTORIES(
	${CMAKE_SOURCE_DIR}
	${CMAKE_BINARY_DIR}
)

################################################################################
# Variables
################################################################################

# printergui (maingui)
FILE(GLOB MAINGUI_SRCS
	src/maingui/*.cpp
)

# password gui (printpwgui
FILE(GLOB PWGUI_SRCS
	src/pwgui/*.cpp
)

################################################################################
# Qt
################################################################################

# .ui files
FILE(GLOB MAINGUI_UIS
	src/maingui/*.ui
)

FILE(GLOB PWGUI_UIS
	src/pwgui/*.ui
)

# .qrc files
#SET(MAINGUI_RCS pvsmgr.qrc)
#SET(PWGUI_RCS pvsclient.qrc)

# includes all header files that should be treated with moc
SET(MAINGUI_MOC_HDRS
	src/maingui/printergui.h
)

SET(PWGUI_MOC_HDRS
	src/pwgui/pwgui.h
)

# i18n
#FILE(GLOB MAINGUI_TSS
#	i18n/server/*.ts
#)

#FILE(GLOB PWGUI_TSS
#	i18n/client/*.ts
#)


# include Qt modules
#SET(QT_USE_QTDBUS TRUE)
#SET(QT_USE_QTNETWORK TRUE)
#SET(QT_USE_QTWEBKIT TRUE)

# add some useful macros and variables
# (QT_USE_FILE is a variable defined by FIND_PACKAGE( Qt4 ) that contains
# a path to CMake script)
INCLUDE(${QT_USE_FILE})

# this will run rcc on .qrc files
#QT4_ADD_RESOURCES(MAINGUI_RC_SRCS ${MAINGUI_RCS})
#QT4_ADD_RESOURCES(PWGUI_RC_SRCS ${PWGUI_RCS})

# this will run uic on .ui files
QT4_WRAP_UI(MAINGUI_UI_HDRS ${MAINGUI_UIS})
QT4_WRAP_UI(PWGUI_UI_HDRS ${PWGUI_UIS})

# this will run moc
QT4_WRAP_CPP(MAINGUI_MOC_SRCS ${MAINGUI_MOC_HDRS})
QT4_WRAP_CPP(PWGUI_MOC_SRCS ${PWGUI_MOC_HDRS})

# i18n, run lupdate and lrelease)
#QT4_CREATE_TRANSLATION(MAINGUI_QMS ${MAINGUI_SRCS} ${MAINGUI_UI_HDRS} ${MAINGUI_TSS})
#QT4_CREATE_TRANSLATION(PWGUI_QMS ${PWGUI_SRCS} ${PWGUI_UI_HDRS} ${PWGUI_TSS})

################################################################################
# Build
################################################################################

ADD_EXECUTABLE(printergui
    ${MAINGUI_SRCS}
    ${MAINGUI_MOC_SRCS}
    ${MAINGUI_UI_HDRS}
    ${MAINGUI_RC_SRCS}
    ${MAINGUI_QMS}
)

ADD_EXECUTABLE(printpwgui
    ${PWGUI_SRCS}
    ${PWGUI_MOC_SRCS}
    ${PWGUI_UI_HDRS}
    ${PWGUI_RC_SRCS}
    ${PWGUI_QMS}
)

# link
TARGET_LINK_LIBRARIES(printergui
    ${QT_LIBRARIES}
    ${CUPS_LIBRARIES}
)

TARGET_LINK_LIBRARIES(printpwgui
    ${QT_LIBRARIES}
)

# install
INSTALL(TARGETS printergui printpwgui RUNTIME DESTINATION bin)