-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
143 lines (110 loc) · 4.61 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
project(MARMEAS)
cmake_minimum_required(VERSION 2.8.0)
set (CMAKE_CXX_FLAGS_INIT "")
set (CMAKE_CXX_FLAGS_DEBUG_INIT "-g")
set(V_MAJOR 0 CACHE STRING "Major Version?")
set(V_MINOR 0 CACHE STRING "Minor Version?")
set(V_PATCH 0 CACHE STRING "Patch Version?")
set(V_BUILD 0 CACHE STRING "Build Number?")
set(MARMEAS_PLUGIN_INSTALL_DIR "lib/marmeas-plugin" CACHE STRING "Plugin Install Dir")
set(VERSION = ${V_MAJOR}.${V_MINOR})
if (UNIX)
set(MARMEAS_HELP_INSTALL_DIR "share/doc/marmeas")
endif (UNIX)
if (WIN32)
set(MARMEAS_HELP_INSTALL_DIR "doc")
endif (WIN32)
set ( ORGANISATION pixmeter )
message("++ Generator: ${CMAKE_GENERATOR}")
message("++ Compiler: ${CMAKE_CXX_COMPILER}")
message("++ Target OS: ${CMAKE_SYSTEM_NAME}")
message("++ Target Processor: ${CMAKE_SYSTEM_PROCESSOR}")
message("++ Build Type: ${CMAKE_BUILD_TYPE}")
include(UseDoxygen OPTIONAL)
set (QT_USE_QTXML TRUE)
set (QT_USE_QTHELP TRUE)
set (QT_USE_QTSQL FALSE)
set (QT_USE_QTNETWORKS FALSE)
find_package(Qt4 REQUIRED)
message("++ QT Libraries: ${QT_LIBRARIES}")
message("++ IS Unix : ${UNIX}")
message("++ IS Windows : ${WIN32}")
set(includeDir
${CMAKE_SOURCE_DIR}/include
${CMAKE_SOURCE_DIR}/include/marmeas_core
${CMAKE_SOURCE_DIR}/include/marmeas_gui
${CMAKE_SOURCE_DIR}/src # allow direct access for unit testing
)
message("++ QT_USE_FILE : ${QT_USE_FILE}")
include ( ${QT_USE_FILE} )
message("++ QT Libraries : ${QT_LIBRARIES}")
#------------------------------------------------------------------------------
# section: install
#------------------------------------------------------------------------------
if (UNIX)
set(CMAKE_INSTALL_PREFIX "/usr")
# create appropriated desktop entries
if( NOT APPLE )
if( NOT DESKTOP_ENTRY )
set( DESKTOP_ENTRY marmeas.desktop )
endif( NOT DESKTOP_ENTRY )
add_custom_command( OUTPUT ${DESKTOP_ENTRY}
COMMAND touch ${DESKTOP_ENTRY}
COMMAND sh ${CMAKE_SOURCE_DIR}/marmeas-desktop.sh ${CMAKE_INSTALL_PREFIX} ${VERSION}>${DESKTOP_ENTRY}
DEPENDS ${CMAKE_SOURCE_DIR}/marmeas-desktop.sh
COMMENT "Generating desktop entry file"
)
add_custom_target( DESKTOP_ENTRY_FILE ALL
DEPENDS ${DESKTOP_ENTRY}
)
set( APP_ICON ${CMAKE_SOURCE_DIR}/src/resources/marmeas.png )
install( FILES ${APP_ICON} DESTINATION share/icons )
install( FILES ${CMAKE_BINARY_DIR}/${DESKTOP_ENTRY} DESTINATION share/applications/desktop )
install( FILES ${CMAKE_SOURCE_DIR}/marmeas.conf DESTINATION /etc/xdg/${ORGANISATION} )
endif( NOT APPLE )
endif (UNIX)
message("++ Install Prefix: ${CMAKE_INSTALL_PREFIX}")
message("++ Plugin Install Dir: ${MARMEAS_PLUGIN_INSTALL_DIR}")
#------------------------------------------------------------------------------
# section: packaging
#------------------------------------------------------------------------------
#
# set(CPACK_SET_DESTDIR "OFF")
set(CPACK_SET_DESTDIR "ON")
set(CPACK_PACKAGE_NAME "marmeas")
SET(CPACK_PACKAGE_VERSION_MAJOR ${V_MAJOR})
SET(CPACK_PACKAGE_VERSION_MINOR ${V_MINOR})
SET(CPACK_PACKAGE_VERSION_PATCH ${V_PATCH})
SET(CPACK_PACKAGE_BUILD ${V_BUILD})
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "marking and measurement of objects on images")
set(CPACK_PACKAGE_VENDOR "marmeas development team")
#set(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_SOURCE_DIR}/license.txt)
if (UNIX)
SET(CPACK_SOURCE_GENERATOR TBZ2)
SET(CPACK_GENERATOR DEB)
#SET(CPACK_PACKAGE_INSTALL_DIRECTORY "/")
set(CPACK_PACKAGING_INSTALL_PREFIX "usr")
#set(CPACK_PACKAGING_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})
#set(CPACK_PACKAGE_DEFAULT_LOCATION "/usr")
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "amd64")
set(CPACK_DEBIAN_PACKAGE_DEPENDS "")
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Volker Kempert <[email protected]>")
# set(CPACK_PACKAGE_DESCRIPTION_FILE ${CMAKE_SOURCE_DIR}/package-description.txt)
set(CPACK_DEBIAN_PACKAGE_SECTION "contrib/libs")
SET(CPACK_PACKAGE_FILE_NAME ${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}-${CPACK_PACKAGE_VERSION_PATCH}.${CPACK_PACKAGE_BUILD}.${CPACK_DEBIAN_PACKAGE_ARCHITECTURE})
endif (UNIX)
if (WIN32)
SET (CPACK_GENERATOR NSIS)
set (CPACK_MONOLITHIC_INSTALL 1)
set (CPACK_SYSTEM_NAME win32)
set (CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_NAME} ${VERSION}")
set (CPACK_EXECUTABLES "Icomm" "marmeas")
endif (WIN32)
#------------------------------------------------------------------------------
# process the sub dirs
#------------------------------------------------------------------------------
add_subdirectory(plugins)
add_subdirectory(src)
add_subdirectory(doc)
add_subdirectory(tests)
include(CPack)