summaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
blob: d858e2f9a9e6c9f4ef6464a6061edb8e50b089fc (plain)
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
############################################
#                                          #
#  Improvements and feedbacks are welcome  #
#                                          #
#  This file is released under GPL >= 3    #
#                                          #
############################################


cmake_minimum_required( VERSION 3.5 )


#### general package setup

project( tqt3 )

set( PACKAGE ${PROJECT_NAME} )
set( PACKAGE_VERSION 3.5.0   )


#### include essential cmake modules

include( FindPkgConfig           )
include( CheckFunctionExists     )
include( CheckIncludeFile        )
include( CheckLibraryExists      )
include( CheckCSourceCompiles    )
include( CheckCXXSourceCompiles  )
include( GNUInstallDirs OPTIONAL )


#### include our cmake modules

include( TDEMacros )
include( TQtMacros.cmake )


##### set version number ########################

tde_set_project_version()


##### setup install paths

include( TDESetupPaths )
tde_setup_paths( )

if( CMAKE_INSTALL_LIBDIR )
    set( SYSTEM_LIBDIR "${CMAKE_INSTALL_LIBDIR}" )
else()
    set( SYSTEM_LIBDIR "lib${LIB_SUFFIX}" )
endif()

set( QT_INSTALL_PREFIX       "${CMAKE_INSTALL_PREFIX}"                      CACHE PATH "install path"           )
set( QT_INSTALL_BINS         "${QT_INSTALL_PREFIX}/bin"                     CACHE PATH "executables path (bin)" )
set( QT_INSTALL_LIBS         "${QT_INSTALL_PREFIX}/${SYSTEM_LIBDIR}"        CACHE PATH "libraries path (lib)"   )
set( QT_INSTALL_PLUGINS      "${QT_INSTALL_LIBS}/${PROJECT_NAME}/plugins"   CACHE PATH "plugins path"           )
set( QT_INSTALL_HEADERS      "${QT_INSTALL_PREFIX}/include/${PROJECT_NAME}" CACHE PATH "headers path"           )
set( QT_INSTALL_SHARE        "${QT_INSTALL_PREFIX}/share"                   CACHE PATH "data root path"         )
set( QT_INSTALL_DATA         "${QT_INSTALL_SHARE}/${PROJECT_NAME}"          CACHE PATH "data path"              )
set( QT_INSTALL_DOCS         "${QT_INSTALL_DATA}/doc"                       CACHE PATH "documentation path"     )
set( QT_INSTALL_TRANSLATIONS "${QT_INSTALL_DATA}/translations"              CACHE PATH "translations path"      )
set( QT_INSTALL_SYSCONF      "/etc/${PROJECT_NAME}"                         CACHE PATH "config path"            )


##### optional stuff

option( WITH_ALL_OPTIONS         "Enable all optional support" ON )
option( WITH_GCC_VISIBILITY      "Enable fvisibility and fvisibility-inlines-hidden" OFF )
option( WITH_IMMODULE_EXTENSIONS "Enable immodule extensions support" OFF ) # break ABI
option( WITH_STL                 "Enable c++ stl support"             ${WITH_ALL_OPTIONS}  )
option( WITH_IPV6                "Enable IPv6 support"                ${WITH_ALL_OPTIONS}  )
option( WITH_CUPS                "Enable cups support"                ${WITH_ALL_OPTIONS}  )
option( WITH_SOUND               "Enable sound support with Nas"      ${WITH_ALL_OPTIONS}  )
option( WITH_GLIBMAINLOOP        "Enable Glib support"                ${WITH_ALL_OPTIONS}  )
option( WITH_XFT                 "Enable Xft support"                 ${WITH_ALL_OPTIONS}  )
option( WITH_XSHAPE              "Enable XShape support"              ${WITH_ALL_OPTIONS}  )
option( WITH_TABLET              "Enable tablet support"              ${WITH_ALL_OPTIONS}  )
option( WITH_XINERAMA            "Enable Xinerame support"            ${WITH_ALL_OPTIONS}  )
option( WITH_XRANDR              "Enable Xrandr support"              ${WITH_ALL_OPTIONS}  )
option( WITH_XRENDER             "Enable XRender support"             ${WITH_ALL_OPTIONS}  )
option( WITH_XSYNC               "Enable Xsync support"               ${WITH_ALL_OPTIONS}  )
option( WITH_XKB                 "Enable X KeyBoard support"          ${WITH_ALL_OPTIONS}  )
option( WITH_SM                  "Enable Session management support"  ${WITH_ALL_OPTIONS}  )
option( WITH_XCURSOR             "Enable XCursor support"             ${WITH_ALL_OPTIONS}  )
option( WITH_LIBMNG              "Enable libmng support"              ${WITH_ALL_OPTIONS}  )
option( WITH_JPEG                "Enable jpeg support"                ${WITH_ALL_OPTIONS}  )
option( WITH_PNG                 "Enable libpng support"              ${WITH_ALL_OPTIONS}  )
option( WITH_TQTGIF              "Enable TQT gif support"             ${WITH_ALL_OPTIONS}  )


##### user requested build

set( TQT_CONFIG "full-config" CACHE STRING "Enable tqt fonctionalities" ) #choices: minimal-config|small-config|medium-config|large-config|full-config

option( BUILD_ALL           "Build all"                        ON )
option( BUILD_LIB           "Build the tqt library itself"     ${BUILD_ALL} )
option( BUILD_TQMAKE        "Build the tqmake executable"      ${BUILD_ALL} )
option( BUILD_TMOC          "Build the tmoc executable"        ${BUILD_ALL} )
option( BUILD_TOOLS         "Build various other tools"        ${BUILD_ALL} )
option( BUILD_TUTORIAL      "Build the tutorials"              ${BUILD_ALL} )
option( BUILD_EXAMPLE       "Build the examples"               ${BUILD_ALL} )
option( BUILD_TRANSLATIONS  "Build translations"               ${BUILD_ALL} )


##### user requested tqt modules

option( WITH_MODULE_ALL         "Build all modules"             ON )
option( WITH_MODULE_TOOLS       "Build the tools module"        ${WITH_MODULE_ALL} )
option( WITH_MODULE_KERNEL      "Build the kernel module"       ${WITH_MODULE_ALL} )
option( WITH_MODULE_WIDGETS     "Build the widgets module"      ${WITH_MODULE_ALL} )
option( WITH_MODULE_DIALOGS     "Build the dialog module"       ${WITH_MODULE_ALL} )
option( WITH_MODULE_WORKSPACE   "Build the worspace module"     ${WITH_MODULE_ALL} )
option( WITH_MODULE_INPUTMETHOD "Build the inputmethode module" ${WITH_MODULE_ALL} )
option( WITH_MODULE_NETWORK     "Build the network module"      ${WITH_MODULE_ALL} )
option( WITH_MODULE_CANVAS      "Build the canvas module"       ${WITH_MODULE_ALL} )
option( WITH_MODULE_TABLE       "Build the table module"        ${WITH_MODULE_ALL} )
option( WITH_MODULE_XML         "Build the xml module"          ${WITH_MODULE_ALL} )
option( WITH_MODULE_OPENGL      "Build the OpenGL module"       ${WITH_MODULE_ALL} )
option( WITH_MODULE_STYLES      "Build the styles module"       ${WITH_MODULE_ALL} )
option( WITH_MODULE_SQL         "Build the SQL module"          ${WITH_MODULE_ALL} )


##### user requested styles:

## Motif style is mandatory for CDE, MotifPlus and SGI builds
## Windows style is mandatory for Platinum and Interlace (experimental, OFF by default) builds

option( WITH_STYLE_ALL       "Build tqt3 styles"      ${WITH_MODULE_STYLES} )
option( WITH_STYLE_MOTIF     "Build Motif style"      ${WITH_STYLE_ALL} )
option( WITH_STYLE_CDE       "Build CDE style"        ${WITH_STYLE_ALL} )
option( WITH_STYLE_MOTIFPLUS "Build Motif plus style" ${WITH_STYLE_ALL} )
option( WITH_STYLE_SGI       "Build SGI style"        ${WITH_STYLE_ALL} )
option( WITH_STYLE_WINDOWS   "Build Windows style"    ${WITH_STYLE_ALL} )
option( WITH_STYLE_PLATINIUM "Build platinium style"  ${WITH_STYLE_ALL} )
option( WITH_STYLE_INTERLACE "Build interlace style"  OFF )


##### user requested sql modules

option( BUILD_SQL_PLUGIN_ALL     "Build all sql plugins"       ${WITH_MODULE_SQL} )
option( BUILD_SQL_PLUGIN_PSQL    "Build plugin for PostgreSQL" ${BUILD_SQL_PLUGIN_ALL} )
option( BUILD_SQL_PLUGIN_MYSQL   "Build plugin for MySQL"      ${BUILD_SQL_PLUGIN_ALL} )
option( BUILD_SQL_PLUGIN_ODBC    "Build plugin for ODBC"       ${BUILD_SQL_PLUGIN_ALL} )
option( BUILD_SQL_PLUGIN_IBASE   "Build plugin for Firebird"   ${BUILD_SQL_PLUGIN_ALL} )
#option( BUILD_SQL_PLUGIN_SQLITE  "Build plugin for SQLite"     ${BUILD_SQL_PLUGIN_ALL} )
option( BUILD_SQL_PLUGIN_SQLITE3 "Build plugin for SQLite3"    ${BUILD_SQL_PLUGIN_ALL} )


option( WITH_SQL_DRIVER_ALL      "Build all sql drivers"        OFF )
option( WITH_SQL_DRIVER_PSQL     "Build support for PostgreSQL" ${WITH_SQL_DRIVER_ALL} )
option( WITH_SQL_DRIVER_MYSQL    "Build support for MySQL"      ${WITH_SQL_DRIVER_ALL} )
option( WITH_SQL_DRIVER_ODBC     "Build support for ODBC"       ${WITH_SQL_DRIVER_ALL} )
option( WITH_SQL_DRIVER_IBASE    "Build support for Firebird"   ${WITH_SQL_DRIVER_ALL} )
#option( WITH_SQL_DRIVER_SQLITE   "Build support for SQLite"     ${WITH_SQL_DRIVER_ALL} )
option( WITH_SQL_DRIVER_SQLITE3  "Build support for SQLite3"    ${WITH_SQL_DRIVER_ALL} )


##### tutorials

option( BUILD_TUTORIAL_ALL "Build all tutorials" ${BUILD_TUTORIAL}     )
option( BUILD_TUTORIAL_1   "Build tutorial t1"   ${BUILD_TUTORIAL_ALL} )
option( BUILD_TUTORIAL_2   "Build tutorial t2"   ${BUILD_TUTORIAL_ALL} )
option( BUILD_TUTORIAL_3   "Build tutorial t3"   ${BUILD_TUTORIAL_ALL} )
option( BUILD_TUTORIAL_4   "Build tutorial t4"   ${BUILD_TUTORIAL_ALL} )
option( BUILD_TUTORIAL_5   "Build tutorial t5"   ${BUILD_TUTORIAL_ALL} )
option( BUILD_TUTORIAL_6   "Build tutorial t6"   ${BUILD_TUTORIAL_ALL} )
option( BUILD_TUTORIAL_7   "Build tutorial t7"   ${BUILD_TUTORIAL_ALL} )
option( BUILD_TUTORIAL_8   "Build tutorial t8"   ${BUILD_TUTORIAL_ALL} )
option( BUILD_TUTORIAL_9   "Build tutorial t9"   ${BUILD_TUTORIAL_ALL} )
option( BUILD_TUTORIAL_10  "Build tutorial t10"  ${BUILD_TUTORIAL_ALL} )
option( BUILD_TUTORIAL_11  "Build tutorial t11"  ${BUILD_TUTORIAL_ALL} )
option( BUILD_TUTORIAL_12  "Build tutorial t12"  ${BUILD_TUTORIAL_ALL} )
option( BUILD_TUTORIAL_13  "Build tutorial t13"  ${BUILD_TUTORIAL_ALL} )
option( BUILD_TUTORIAL_14  "Build tutorial t14"  ${BUILD_TUTORIAL_ALL} )
option( BUILD_TUTORIAL_15  "Build tutorial t15"  ${BUILD_TUTORIAL_ALL} )


###### examples

option( BUILD_EXAMPLE_ALL          "Build the examples"         ${BUILD_EXAMPLE}     )
option( BUILD_EXAMPLE_ACLOCK       "Build example aclock"       ${BUILD_EXAMPLE_ALL} )
option( BUILD_EXAMPLE_ACTION       "Build example action"       ${BUILD_EXAMPLE_ALL} )
option( BUILD_EXAMPLE_ADDRESSBOOK  "Build example addressbook"  ${BUILD_EXAMPLE_ALL} )
option( BUILD_EXAMPLE_APPLICATION  "Build example application"  ${BUILD_EXAMPLE_ALL} )
option( BUILD_EXAMPLE_BIFF         "Build example biff"         ${BUILD_EXAMPLE_ALL} )
option( BUILD_EXAMPLE_BUTTONGROUPS "Build example buttongroups" ${BUILD_EXAMPLE_ALL} )
#option( BUILD_EXAMPLE_CANVAS       "Build example canvas"       ${BUILD_EXAMPLE_ALL} )
option( BUILD_EXAMPLE_CHECKLISTS   "Build example checklists"   ${BUILD_EXAMPLE_ALL} )
option( BUILD_EXAMPLE_CURSOR       "Build example cursor"       ${BUILD_EXAMPLE_ALL} )
option( BUILD_EXAMPLE_CUSTOMLAYOUT "Build example customlayout" ${BUILD_EXAMPLE_ALL} )
option( BUILD_EXAMPLE_DCLOCK       "Build example dclock"       ${BUILD_EXAMPLE_ALL} )
#option( BUILD_EXAMPLE_DEMO         "Build example demo"         ${BUILD_EXAMPLE_ALL} )


##### configure checks

include( ConfigureChecks.cmake )
include( config.tests/unix/endian/ConfigureChecks.cmake )       # test: little/big endian
include( config.tests/unix/largefile/ConfigureChecks.cmake )    # test: large lifes
include( config.tests/unix/stl/ConfigureChecks.cmake )          # test: stl supported
include( config.tests/unix/ipv6/ConfigureChecks.cmake )         # test: IPv6 network


###### global compiler settings

add_definitions( -DHAVE_CONFIG_H )

set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TQT_CXX_FLAGS}" )
set( CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined" )
set( CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,--no-undefined" )


##### directories

add_subdirectory( src )
tde_conditional_add_subdirectory( BUILD_TQMAKE       qmake        )
tde_conditional_add_subdirectory( BUILD_TMOC         src/moc      )
tde_conditional_add_subdirectory( BUILD_TOOLS        tools        )
tde_conditional_add_subdirectory( BUILD_TUTORIAL     tutorial     )
tde_conditional_add_subdirectory( BUILD_EXAMPLE      examples     )
tde_conditional_add_subdirectory( BUILD_TRANSLATIONS translations )


##### write configure files

configure_file( config.h.cmake config.h @ONLY )
configure_file( src/tools/qconfig.cpp.cmake src/tools/qconfig.cpp @ONLY )
configure_file( include/ntqconfig.h.cmake   include/ntqconfig.h   @ONLY )
configure_file( include/ntqmodules.h.cmake  include/ntqmodules.h  @ONLY )