summaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorSimon Rettberg2014-02-06 20:39:57 +0100
committerSimon Rettberg2014-02-06 20:39:57 +0100
commit909bab46a61d358d948c2784e48e3c144ade9c1a (patch)
treecbb4e9a9f659f5907371cfc66836ca9a0b23d6c8 /CMakeLists.txt
parentRemove silly debug message boxes (diff)
downloadprintergui-909bab46a61d358d948c2784e48e3c144ade9c1a.tar.gz
printergui-909bab46a61d358d948c2784e48e3c144ade9c1a.tar.xz
printergui-909bab46a61d358d948c2784e48e3c144ade9c1a.zip
Lots of changes: Two binaries (selection/pw auth), qmake -> cmake, gitignore, more error handling
1. We now have two binaries: One pops up when the print job comes in so you can select the printer, duplex, copies, etc... The other one pops up when used as a backend and handles authentication by asking for username and password (WORK IN PROGRESS!). This is to better handle things like smb printing 2. We use cmake everywhere, and now that we want two binaries it made sense to switch. 3. Gitignore, well, what to say 4. Show an error message when calling ghostscript for grayscale conversion failed, insted of just doing nothing and not even closing the GUI. 5. Keep the printergui open for a few seconds after printing, but hide the window. Later we want to check in the password gui if the printergui is open to make sure we really should run, and maybe even exchange some information.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt138
1 files changed, 138 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..7530b78
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,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)
+