forked from trufanov-nok/scantailor-universal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
585 lines (499 loc) · 18.4 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
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
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.11)
IF(POLICY CMP0043)
# Don't ignore COMPILE_DEFINITIONS_{CONFIG} directives, as these are used
# by Qt.
CMAKE_POLICY(SET CMP0043 OLD)
ENDIF()
IF (POLICY CMP0071)
CMAKE_POLICY(SET CMP0071 OLD)
ENDIF()
IF (POLICY CMP0072)
CMAKE_POLICY(SET CMP0072 OLD)
ENDIF()
SET(
CMAKE_USER_MAKE_RULES_OVERRIDE
"${CMAKE_SOURCE_DIR}/cmake/default_cflags.cmake"
)
SET(
CMAKE_USER_MAKE_RULES_OVERRIDE_CXX
"${CMAKE_SOURCE_DIR}/cmake/default_cxxflags.cmake"
)
PROJECT("Scan Tailor Universal")
IF(MSVC)
# Disable checked iterators for extra performance.
ADD_DEFINITIONS(-D_SECURE_SCL=0)
ENDIF()
IF(DEBUG_CLI)
ADD_DEFINITIONS(-DDEBUG_CLI)
ENDIF(DEBUG_CLI)
ENABLE_TESTING()
# An undocumented side-effect of CONFIGURE_FILE() is that it makes
# the whole project depend on the file we are parsing / copying.
CONFIGURE_FILE(
"${PROJECT_SOURCE_DIR}/version.h"
"${PROJECT_BINARY_DIR}/.version.h" COPYONLY
)
# Prevent this leftover from old builds to be used in favour
# of the one in ${PROJECT_SOURCE_DIR}
IF(NOT "${PROJECT_BINARY_DIR}" STREQUAL "${PROJECT_SOURCE_DIR}")
FILE(REMOVE "${PROJECT_BINARY_DIR}/version.h")
ENDIF()
# Extract VERSION and VERSION_QUAD from version.h
FILE(READ "${PROJECT_SOURCE_DIR}/version.h" version_h_contents)
STRING(
REGEX REPLACE
".*#define[ \\t]+VERSION[ \\t]+\"([^\"]*)\".*"
"\\1" VERSION "${version_h_contents}"
)
IF("${VERSION}" STREQUAL "${version_h_contents}")
MESSAGE(FATAL_ERROR "Failed to extract VERSION from version.h")
ENDIF()
# VERSION_QUAD must be either empty or be in the form of X.Y.Z.Y
STRING(
REGEX REPLACE
".*#define[ \\t]+VERSION_QUAD[ \\t]+\"(([0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+)?)\".*"
"\\1" VERSION_QUAD "${version_h_contents}"
)
IF("${VERSION_QUAD}" STREQUAL "${version_h_contents}")
MESSAGE(FATAL_ERROR "Failed to extract VERSION_QUAD from version.h")
ENDIF()
# For config.h
INCLUDE_DIRECTORIES("${CMAKE_CURRENT_BINARY_DIR}")
INCLUDE(CheckIncludeFile)
INCLUDE(CheckIncludeFileCXX)
INCLUDE(TestCXXAcceptsFlag)
INCLUDE(cmake/FindPthreads.cmake)
IF(UNIX AND NOT APPLE)
INCLUDE(cmake/FindCanberra.cmake)
ENDIF(UNIX AND NOT APPLE)
INCLUDE(cmake/FindEXIV2.cmake)
INCLUDE(cmake/SetDefaultBuildType.cmake)
INCLUDE(cmake/SetDefaultGccFlags.cmake)
INCLUDE(cmake/ToNativePath.cmake)
INCLUDE(cmake/UpdateTranslations.cmake)
INCLUDE(cmake/CopyToBuildDir.cmake)
INCLUDE(cmake/LibToDLL.cmake)
ST_SET_DEFAULT_BUILD_TYPE(Release)
IF(CMAKE_COMPILER_IS_GNUCC)
ST_SET_DEFAULT_GCC_FLAGS()
ENDIF(CMAKE_COMPILER_IS_GNUCC)
GET_FILENAME_COMPONENT(source_outer_dir "${PROJECT_SOURCE_DIR}/.." ABSOLUTE)
GET_FILENAME_COMPONENT(build_outer_dir "${PROJECT_BINARY_DIR}/.." ABSOLUTE)
SET(STAGING_LIBS_DIR "")
INCLUDE(FindOpenGL)
SET(use_opengl OFF)
IF(OPENGL_FOUND AND QT_QTOPENGL_FOUND)
# Disabled for now due to various problems associated with it.
# SET(use_opengl ON)
ENDIF()
OPTION(ENABLE_OPENGL "OpenGL may be used for UI acceleration" ${use_opengl})
IF(WIN32)
FIND_PATH(
DEPS_BUILD_DIR build-qt.bat
HINTS "${build_outer_dir}/scantailor-universal-deps-build"
DOC "Build directory for Scan Tailor dependencies."
)
IF(NOT DEPS_BUILD_DIR)
MESSAGE(
FATAL_ERROR "The build directory for Scan Tailor dependencies could not be found! "
"You can specify it manually in DEPS_BUILD_DIR variable. Make sure you build the dependencies first!"
)
ENDIF()
SET(STAGING_LIBS_DIR "${DEPS_BUILD_DIR}/staging/libs")
INCLUDE("${DEPS_BUILD_DIR}/export-vars.cmake")
IF (NOT QT_SRC_DIR OR NOT EXISTS "${QT_SRC_DIR}")
FILE(GLOB qt_dirs1 "${build_outer_dir}/qt-win-*-5.[0-9]*")
FILE(GLOB qt_dirs2 "${build_outer_dir}/qt-everywhere-*-5.[0-9]*")
FILE(GLOB qt_dirs3 "${source_outer_dir}/qt-win-*-5.[0-9]*")
FILE(GLOB qt_dirs4 "${source_outer_dir}/qt-everywhere-*-5.[0-9]*")
FILE(GLOB qt_dirs5 "C:/Qt/Qt5.*/*/Src")
FIND_PATH(
QT_SRC_DIR qtbase/qtbase.pro
HINTS ${qt_dirs1} ${qt_dirs2} ${qt_dirs3}
${qt_dirs4} ${qt_dirs5} dummy_dir
DOC "Path to top-level Qt5 source directory. If you installed a binary version, it will be something like C:\\Qt\\Qt5.0.2\\5.0.2\\Src"
)
ENDIF()
IF(NOT QT_SRC_DIR OR NOT EXISTS "${QT_SRC_DIR}")
MESSAGE(
FATAL_ERROR "Qt5 could not be found. "
"If it's installed in a non-standard location, specify it QT_SRC_DIR variable."
)
ENDIF()
FILE(GLOB qt_possible_prebuilt_dirs "${QT_SRC_DIR}/../*")
FIND_PATH(
QT_PREBUILT_DIR bin/qmake.exe HINTS ${qt_possible_prebuilt_dirs}
DOC "[optional] Installation path of a pre-built version of Qt5. If you installed a binary version, it will be something like C:\\Qt\\Qt5.0.2\\5.0.2\\msvc2012"
)
SET(Qt5Core_DIR "${QT_SRC_DIR}/qtbase/lib/cmake/Qt5Core")
SET(Qt5Gui_DIR "${QT_SRC_DIR}/qtbase/lib/cmake/Qt5Gui")
SET(Qt5Widgets_DIR "${QT_SRC_DIR}/qtbase/lib/cmake/Qt5Widgets")
SET(Qt5Xml_DIR "${QT_SRC_DIR}/qtbase/lib/cmake/Qt5Xml")
SET(Qt5Network_DIR "${QT_SRC_DIR}/qtbase/lib/cmake/Qt5Network")
SET(Qt5OpenGL_DIR "${QT_SRC_DIR}/qtbase/lib/cmake/Qt5OpenGL")
IF(QT_PREBUILT_DIR)
SET(Qt5LinguistTools_DIR "${QT_PREBUILT_DIR}/lib/cmake/Qt5LinguistTools")
ELSE()
SET(Qt5LinguistTools_DIR "${QT_SRC_DIR}/qtbase/lib/cmake/Qt5LinguistTools")
ENDIF()
ENDIF()
SET(CMAKE_AUTOMOC ON)
SET(Qt_MIN_VERSION 5.7.0)
IF(APPLE)
# hardcoded path to Qt5CoreConfig.cmake etc. [truf]
SET(CMAKE_PREFIX_PATH "/Users/robert/build/Qt/5.8/clang_64/")
ENDIF(APPLE)
FIND_PACKAGE(Qt5Core ${Qt_MIN_VERSION} REQUIRED)
FIND_PACKAGE(Qt5Gui ${Qt_MIN_VERSION} REQUIRED)
FIND_PACKAGE(Qt5Widgets ${Qt_MIN_VERSION} REQUIRED)
FIND_PACKAGE(Qt5Xml ${Qt_MIN_VERSION} REQUIRED)
FIND_PACKAGE(Qt5Network ${Qt_MIN_VERSION} REQUIRED)
FIND_PACKAGE(Qt5Svg ${Qt_MIN_VERSION} REQUIRED)
FIND_PACKAGE(Qt5LinguistTools ${Qt_MIN_VERSION} REQUIRED)
IF(ENABLE_OPENGL)
FIND_PACKAGE(Qt5OpenGL ${Qt_MIN_VERSION} REQUIRED)
ENDIF()
FIND_PATH(
JPEG_INCLUDE_DIR jpeglib.h
PATHS /usr/local/include /usr/include
HINTS ${JPEG_DIR} # JPEG_DIR may come from export-vars.cmake
DOC "Path to libjpeg headers."
)
IF(NOT JPEG_INCLUDE_DIR)
MESSAGE(
FATAL_ERROR
"Could not find jpeg headers.\n"
"You may need to install a package named libjpeg62-dev or similarly."
)
ENDIF()
INCLUDE_DIRECTORIES("${JPEG_INCLUDE_DIR}")
FIND_LIBRARY(
JPEG_LIBRARY NAMES jpeg libjpeg.lib
PATHS /usr/local/lib /usr/lib
HINTS ${STAGING_LIBS_DIR}
DOC "Path to jpeg library."
)
IF(NOT JPEG_LIBRARY)
MESSAGE(
FATAL_ERROR
"Could not find jpeg library.\n"
"You may need to install a package named libjpeg62-dev or similarly."
)
ENDIF()
SET (use_openjpeg ON)
OPTION(ENABLE_OPENJPEG "OpenJPEG library may be used to suppoet JPEG 2000 (.jp2) images." ${use_openjpeg})
IF (ENABLE_OPENJPEG)
IF(NOT WIN32)
FIND_PACKAGE(OpenJPEG QUIET)
ELSE(NOT WIN32)
FIND_PATH(
OPENJPEG_INCLUDE_DIRS openjpeg.h
PATHS /usr/local/include /usr/include
HINTS ${JPEG2000_DIR} # JPEG2000_DIR may come from export-vars.cmake
PATH_SUFFIXES src/lib/openjp2
DOC "Path to openjpeg headers."
)
IF(NOT OPENJPEG_INCLUDE_DIRS)
MESSAGE(
"Could not find openjpeg headers.\n"
"You may need to install a package openjpeg."
)
ENDIF()
INCLUDE_DIRECTORIES("${OPENJPEG_INCLUDE_DIRS}")
FIND_LIBRARY(
OPENJPEG_LIBRARIES openjp2 openjp2.lib
PATHS /usr/local/lib /usr/lib
HINTS ${STAGING_LIBS_DIR}
PATH_SUFFIXES openjp2
DOC "Path to openjpeg library."
)
IF(OPENJPEG_LIBRARIES AND OPENJPEG_INCLUDE_DIRS)
SET (OpenJPEG_FOUND YES)
SET (OPENJPEG_MAJOR_VERSION 2)
ENDIF(OPENJPEG_LIBRARIES AND OPENJPEG_INCLUDE_DIRS)
ENDIF(NOT WIN32)
IF(NOT OpenJPEG_FOUND OR OPENJPEG_MAJOR_VERSION VERSION_LESS 2)
message("warning: OpenJPEG library isn't found.\n"
"The JPEG 2000 (*.jp2) images support will be disabled.\n"
"You may install libopenjp2-7-dev to fix this.\n"
"Or disable this massege with -DENABLE_OPENJPEG=OFF")
SET(ENABLE_OPENJPEG OFF)
ENDIF()
ENDIF(ENABLE_OPENJPEG)
FIND_PATH(
ZLIB_INCLUDE_DIR zlib.h
PATHS /usr/local/include /usr/include
HINTS ${ZLIB_DIR} # ZLIB_DIR may come from export-vars.cmake
DOC "Path to zlib headers."
)
IF(NOT ZLIB_INCLUDE_DIR)
MESSAGE(
FATAL_ERROR
"Could not find zlib headers.\n"
"You may need to install a package named zlib1g-dev or similarly."
)
ENDIF()
INCLUDE_DIRECTORIES("${ZLIB_INCLUDE_DIR}")
FIND_LIBRARY(
ZLIB_LIBRARY NAMES z zdll.lib
PATHS /usr/local/lib /usr/lib
HINTS ${STAGING_LIBS_DIR}
DOC "Path to zlib library."
)
IF(NOT ZLIB_LIBRARY)
MESSAGE(
FATAL_ERROR
"Could not find zlib library.\n"
"You may need to install a package named zlib1g-dev or similarly."
)
ENDIF()
FIND_PATH(
PNG_INCLUDE_DIR png.h
PATHS /usr/local/include /usr/include
HINTS ${PNG_DIR} # PNG_DIR may come from export-vars.cmake
DOC "Path to libpng headers."
)
IF(NOT PNG_INCLUDE_DIR)
MESSAGE(
FATAL_ERROR
"Could not find libpng headers.\n"
"You may need to install a package named libpng12-dev or similarly."
)
ENDIF()
INCLUDE_DIRECTORIES("${PNG_INCLUDE_DIR}")
FIND_LIBRARY(
PNG_LIBRARY NAMES png libpng.lib
PATHS /usr/local/lib /usr/lib
HINTS ${STAGING_LIBS_DIR}
DOC "Path to png library."
)
IF(NOT PNG_LIBRARY)
MESSAGE(
FATAL_ERROR
"Could not find libpng library.\n"
"You may need to install a package named libpng12-dev or similarly."
)
ENDIF()
FIND_PATH(
TIFF_INCLUDE_DIR tiff.h
PATHS /usr/local/include /usr/include
HINTS ${TIFF_DIR} # TIFF_DIR may come from export-vars.cmake
PATH_SUFFIXES libtiff
DOC "Path to libtiff headers."
)
IF(NOT TIFF_INCLUDE_DIR)
MESSAGE(
FATAL_ERROR
"Could not find libtiff headers.\n"
"You may need to install a package named libtiff4-dev or similarly."
)
ENDIF()
INCLUDE_DIRECTORIES("${TIFF_INCLUDE_DIR}")
FIND_LIBRARY(
TIFF_LIBRARY tiff libtiff.lib
PATHS /usr/local/lib /usr/lib
HINTS ${STAGING_LIBS_DIR}
PATH_SUFFIXES libtiff
DOC "Path to tiff library."
)
IF(NOT TIFF_LIBRARY)
MESSAGE(
FATAL_ERROR
"Could not find libtiff library.\n"
"You may need to install a package named libtiff4-dev or similarly."
)
ENDIF()
IF(WIN32)
ADD_DEFINITIONS(-DUSE_LIBTIFF_DLL)
ENDIF()
IF(WIN32)
SET(Boost_USE_STATIC_LIBS ON)
ELSE(WIN32)
ADD_DEFINITIONS(-DBOOST_TEST_DYN_LINK)
ENDIF(WIN32)
SET(Boost_USE_MULTITHREADED ON)
FIND_PACKAGE(Boost 1.35.0 COMPONENTS unit_test_framework prg_exec_monitor)
IF(NOT Boost_FOUND)
MESSAGE(
FATAL_ERROR
"Could not find boost headers or libraries. "
"You may need to install a package named libboost1.35-dev or similarly. "
"Hint: create a Boost_DEBUG variable in cmake and set it to YES."
)
ENDIF(NOT Boost_FOUND)
INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS})
LINK_DIRECTORIES(${Boost_LIBRARY_DIRS})
find_package(OpenMP)
if (OPENMP_FOUND)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
endif()
IF (EXIV2_FOUND)
ADD_DEFINITIONS(-DHAVE_EXIV2)
INCLUDE_DIRECTORIES("${EXIV2_INCLUDE_DIR}")
ENDIF(EXIV2_FOUND)
SET(EXTRA_LIBS "")
IF(UNIX)
FindPthreads()
IF(PTHREADS_FOUND)
ADD_DEFINITIONS(${PTHREADS_CFLAGS})
LINK_LIBRARIES(${PTHREADS_LIBS})
ELSE(PTHREADS_FOUND)
MESSAGE(
FATAL_ERROR
"Could not detect threading flags.\n"
"Try specifying them manually in PTHREADS_CFLAGS and PTHREADS_LIBS."
)
ENDIF(PTHREADS_FOUND)
ELSEIF(WIN32)
ADD_DEFINITIONS(-DNOMINMAX)
ENDIF(UNIX)
IF(CANBERRA_FOUND)
ADD_DEFINITIONS(-DHAVE_CANBERRA)
INCLUDE_DIRECTORIES("${CANBERRA_INCLUDE_DIRS}")
ENDIF(CANBERRA_FOUND)
CHECK_INCLUDE_FILE(stdint.h HAVE_STDINT_H)
IF(NOT HAVE_STDINT_H)
CONFIGURE_FILE(compat/pstdint.h "${CMAKE_CURRENT_BINARY_DIR}/stdint.h" COPYONLY)
INCLUDE_DIRECTORIES("${CMAKE_CURRENT_BINARY_DIR}")
ELSE(NOT HAVE_STDINT_H)
FILE(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/stdint.h")
ENDIF(NOT HAVE_STDINT_H)
ADD_DEFINITIONS(-DBOOST_MULTI_INDEX_DISABLE_SERIALIZATION)
LIST(APPEND EXTRA_LIBS ${TIFF_LIBRARY} ${PNG_LIBRARY} ${ZLIB_LIBRARY} ${JPEG_LIBRARY} ${CANBERRA_LIBRARIES})
IF (EXIV2_FOUND)
LIST(APPEND EXTRA_LIBS ${EXIV2_LIBRARY})
ENDIF(EXIV2_FOUND)
IF(ENABLE_OPENJPEG AND OpenJPEG_FOUND)
INCLUDE_DIRECTORIES(${OPENJPEG_INCLUDE_DIRS})
LIST(APPEND EXTRA_LIBS ${OPENJPEG_LIBRARIES})
ENDIF()
IF(WIN32)
LIST(APPEND EXTRA_LIBS "ws2_32.lib")
ENDIF(WIN32)
SET(MAYBE_QT_OPENGL_MODULE "")
IF(ENABLE_OPENGL)
LIST(APPEND EXTRA_LIBS ${OPENGL_LIBRARIES})
SET(MAYBE_QT_OPENGL_MODULE OpenGL)
ENDIF()
# Prepare config.h
IF(WIN32)
SET(TRANSLATIONS_DIR_REL "translations")
SET(STYLESHEETS_DIR_REL "stylesheets")
ELSEIF(APPLE)
SET(TRANSLATIONS_DIR_REL "../Resources/translations")
SET(STYLESHEETS_DIR_REL "../Resources/stylesheets")
ELSE()
SET(TRANSLATIONS_DIR_REL "share/scantailor-universal/translations")
SET(STYLESHEETS_DIR_REL "share/scantailor-universal/stylesheets")
SET(PIXMAPS_DIR_ABS "${CMAKE_INSTALL_PREFIX}/share/pixmaps/scantailor-universal/stylesheets")
ENDIF()
SET(TRANSLATIONS_DIR_ABS "${CMAKE_INSTALL_PREFIX}/${TRANSLATIONS_DIR_REL}")
SET(STYLESHEETS_DIR_ABS "${CMAKE_INSTALL_PREFIX}/${STYLESHEETS_DIR_REL}")
CONFIGURE_FILE(config.h.in ${CMAKE_BINARY_DIR}/config.h @ONLY)
ADD_SUBDIRECTORY(src)
IF(NOT WIN32 AND NOT APPLE)
INSTALL(FILES debian/scantailor-universal.svg DESTINATION "${CMAKE_INSTALL_PREFIX}/share/pixmaps/")
INSTALL(FILES debian/scantailor-universal.desktop DESTINATION "${CMAKE_INSTALL_PREFIX}/share/applications/")
ENDIF(NOT WIN32 AND NOT APPLE)
# uninstall target
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake/cmake_uninstall.cmake"
IMMEDIATE @ONLY)
add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
# Source code packaging
SET(CPACK_CMAKE_GENERATOR "")
SET(CPACK_SOURCE_GENERATOR "TGZ")
SET(CPACK_SOURCE_PACKAGE_FILE_NAME "scantailor-universal-${VERSION}")
SET(
CPACK_SOURCE_IGNORE_FILES
"/\\\\.svn/"
"/\\\\.git/"
"~$"
"\\\\.pcs$"
"TODO.txt"
"CMakeLists.txt.user"
"/doxygen/"
"${CMAKE_BINARY_DIR}"
)
INCLUDE(CPack)
IF(WIN32)
# Copy some DLLs to the staging dir.
SET(
qt5_libs
${Qt5Widgets_LIBRARIES} ${Qt5Gui_LIBRARIES}
${Qt5Core_LIBRARIES} ${Qt5Xml_LIBRARIES} ${Qt5Svg_LIBRARIES}
)
IF(ENABLE_OPENGL)
LIST(APPEND qt5_libs ${Qt5OpenGL_LIBRARIES})
ENDIF()
FOREACH(target ${qt5_libs})
GET_TARGET_PROPERTY(debug_loc "${target}" LOCATION_DEBUG)
GET_TARGET_PROPERTY(release_loc "${target}" LOCATION_RELEASE)
COPY_TO_BUILD_DIR("${debug_loc}" CONFIGURATIONS Debug)
COPY_TO_BUILD_DIR("${release_loc}" CONFIGURATIONS Release MinSizeRel RelWithDebInfo)
ENDFOREACH()
SET(DLL_DIR "${QT_SRC_DIR}/qtbase/bin")
COPY_TO_BUILD_DIR(
"${DLL_DIR}/libpng.dll" "${DLL_DIR}/libjpeg.dll"
"${DLL_DIR}/libtiff.dll" "${DLL_DIR}/zdll.dll"
)
IF(ENABLE_OPENJPEG AND OpenJPEG_FOUND)
COPY_TO_BUILD_DIR( "${DLL_DIR}/openjp2.dll" )
ENDIF(ENABLE_OPENJPEG AND OpenJPEG_FOUND)
IF(EXIV2_FOUND)
COPY_TO_BUILD_DIR( "${DLL_DIR}/exiv2.dll" )
ENDIF(EXIV2_FOUND)
# Qt's plugins.
SET(PLUGINS_DIR "${QT_SRC_DIR}/qtbase/plugins")
COPY_TO_BUILD_DIR(
"${PLUGINS_DIR}/platforms/qwindows.dll" SUBDIR platforms
CONFIGURATIONS Release MinSizeRel RelWithDebInfo
)
COPY_TO_BUILD_DIR(
"${PLUGINS_DIR}/platforms/qwindowsd.dll" SUBDIR platforms
CONFIGURATIONS Debug
)
# required to display images in stylesheets
COPY_TO_BUILD_DIR(
"${PLUGINS_DIR}/imageformats/qico.dll" SUBDIR imageformats
CONFIGURATIONS Release MinSizeRel RelWithDebInfo
)
COPY_TO_BUILD_DIR(
"${PLUGINS_DIR}/imageformats/qicod.dll" SUBDIR imageformats
CONFIGURATIONS Debug
)
COPY_TO_BUILD_DIR(
"${PLUGINS_DIR}/imageformats/qsvg.dll" SUBDIR imageformats
CONFIGURATIONS Release MinSizeRel RelWithDebInfo
)
COPY_TO_BUILD_DIR(
"${PLUGINS_DIR}/imageformats/qsvgd.dll" SUBDIR imageformats
CONFIGURATIONS Debug
)
# COPY_TO_BUILD_DIR(
# "${PLUGINS_DIR}/iconengines/qsvgicon.dll" SUBDIR iconengines
# CONFIGURATIONS Release MinSizeRel RelWithDebInfo
# )
# COPY_TO_BUILD_DIR(
# "${PLUGINS_DIR}/iconengines/qsvgicond.dll" SUBDIR iconengines
# CONFIGURATIONS Debug
# )
if (Qt5Widgets_VERSION VERSION_LESS 5.4.0)
COPY_TO_BUILD_DIR(
"${PLUGINS_DIR}/accessible/qtaccessiblewidgets.dll" SUBDIR accessible
CONFIGURATIONS Release MinSizeRel RelWithDebInfo
)
COPY_TO_BUILD_DIR(
"${PLUGINS_DIR}/accessible/qtaccessiblewidgetsd.dll" SUBDIR accessible
CONFIGURATIONS Debug
)
endif()
# Generate the target that will actually do the copying.
GENERATE_COPY_TO_BUILD_DIR_TARGET(copy_to_build_dir)
# Installer for Windows. Must go last.
ADD_SUBDIRECTORY(src/packaging/windows)
ENDIF(WIN32)