Subversion Repositories Scribus

Rev

Rev 23125 | Rev 23419 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
10215 cbradney 1
##############################################################################################################
2
########## CMake Setup                                                                              ##########
3
 
9680 cbradney 4
#Set our CMake minimum version
22412 jghali 5
#Require 2.8.9 for Qt5 and CMAKE_POSITION_INDEPENDENT_CODE property
21377 craig 6
#Require 3.1.0 for Qt 5.7 C++ 11 easy support
20014 craig 7
#Require 3.2.0 for add_custom_target with byproducts
23103 craig 8
#Require 3.12 for new Find Python modules
9
cmake_minimum_required(VERSION 3.12.0 FATAL_ERROR)
5758 cbradney 10
 
23122 craig 11
message(STATUS "CMake Version: ${CMAKE_VERSION}")
21505 craig 12
 
13
# Configure CCache if available and wanted
21543 craig 14
if (WANT_CCACHE)
23029 jghali 15
	find_program(CCACHE_FOUND ccache)
21505 craig 16
	if(CCACHE_FOUND)
21543 craig 17
		message(STATUS "Enabling ccache")
18
		set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
19
		set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
20
	endif()
21
endif()
21505 craig 22
 
9680 cbradney 23
#Pretty colors
21543 craig 24
set(CMAKE_COLOR_MAKEFILE ON)
20014 craig 25
#Don't force verbose
21543 craig 26
set(CMAKE_VERBOSE_MAKEFILE OFF)
9680 cbradney 27
#Include current dir
23013 craig 28
set(CMAKE_INCLUDE_CURRENT_DIR ON)
21013 craig 29
#Don't allow in source builds
21543 craig 30
#set(CMAKE_DISABLE_SOURCE_CHANGES ON)
31
#set(CMAKE_DISABLE_IN_SOURCE_BUILD ON)
21013 craig 32
 
33
 
10459 cbradney 34
#RPATH setup - more below too
21543 craig 35
if (WANT_NORPATH OR WANT_DISTROBUILD)
36
	set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
37
else()
38
	set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
39
endif()
40
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
41
set(CMAKE_SKIP_RULE_DEPENDENCY TRUE)
42
set(CMAKE_SKIP_BUILD_RPATH TRUE)
8902 cbradney 43
 
21543 craig 44
include(CheckIncludeFile)
45
include(CheckCCompilerFlag)
46
include(CheckCXXCompilerFlag)
47
include(CheckTypeSize)
48
include(TestBigEndian)
49
include(GNUInstallDirs)
50
#include(FeatureSummary)
10215 cbradney 51
 
21543 craig 52
#enable_testing()
16856 craig 53
 
9680 cbradney 54
#Set the custom CMake module directory where our include/lib finders are
21543 craig 55
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules")
9680 cbradney 56
 
10215 cbradney 57
##############################################################################################################
58
########## toplevel compiler flags                                                                  ##########
21543 craig 59
message(STATUS "Shared Library Flags: ${CMAKE_SHARED_LIBRARY_C_FLAGS}")
10215 cbradney 60
 
9680 cbradney 61
#Project Setup
21543 craig 62
project(scribus)
9680 cbradney 63
#Set our version values
14911 cbradney 64
#Final version is ${VERSION} = ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}.${VERSION_SUFFIX}
14373 cbradney 65
#where VERSION_SUFFIX is of the form "", "svn" or "Nsvn" (N being the minor patch level)
21543 craig 66
set (VERSION_MAJOR "1")
67
set (VERSION_MINOR "5")
23097 craig 68
set (VERSION_PATCH "6")
69
set (VERSION_SUFFIX "svn")
21543 craig 70
set (VERSION ${VERSION_MAJOR})
71
if (VERSION_MINOR GREATER -1)
72
	set (VERSION ${VERSION}.${VERSION_MINOR})
73
endif()
74
if (VERSION_PATCH GREATER -1)
75
	set (VERSION ${VERSION}.${VERSION_PATCH})
76
endif()
77
if (VERSION_SUFFIX)
78
	set (VERSION ${VERSION}.${VERSION_SUFFIX})
79
endif()
80
message(STATUS "Scribus ${VERSION} will be built and installed into ${CMAKE_INSTALL_PREFIX}")
5142 cbradney 81
 
9680 cbradney 82
#Set the permissions to be used when installing plugins
21543 craig 83
set(PLUGIN_PERMISSIONS WORLD_EXECUTE GROUP_EXECUTE OWNER_EXECUTE WORLD_READ GROUP_READ OWNER_READ OWNER_WRITE)
5142 cbradney 84
 
9680 cbradney 85
#Our main directory is scribus
21543 craig 86
set(MAIN_DIR_NAME "scribus")
9680 cbradney 87
 
10215 cbradney 88
##############################################################################################################
10238 cbradney 89
########## check for the CPU we build for                                                           ##########
90
 
21543 craig 91
execute_process(
20014 craig 92
	COMMAND ${CMAKE_C_COMPILER} -dumpmachine
93
	OUTPUT_VARIABLE MACHINE
94
	OUTPUT_STRIP_TRAILING_WHITESPACE
10238 cbradney 95
)
20014 craig 96
 
97
## Find out what machine/cpu we are running on
21543 craig 98
message(STATUS  "Machine: ${MACHINE}, void pointer size: ${CMAKE_SIZEOF_VOID_P}")
99
string(REGEX MATCH "(i[0-9]86-*)|(athlon-*)|(pentium-*)" _machine_x86 "${MACHINE}")
100
if (_machine_x86)
101
	message(STATUS "Found target X86")
23013 craig 102
	set(ARCH_X86 ON)
21543 craig 103
endif()
10238 cbradney 104
 
21543 craig 105
string(REGEX MATCH "(x86_64-*)|(X86_64-*)|(AMD64-*)|(amd64-*)" _machine_x86_64 "${MACHINE}")
106
if (_machine_x86_64)
107
	message(STATUS "Found target X86_64")
23013 craig 108
	set(ARCH_X86_64 ON)
21543 craig 109
endif()
10238 cbradney 110
 
21543 craig 111
string(REGEX MATCH "(sparc64-*)|(SPARC64-*)" _machine_sparc_64 "${MACHINE}")
112
if (_machine_sparc_64)
113
	message(STATUS "Found target SPARC 64")
23013 craig 114
	set(ARCH_SPARC_64 ON)
21543 craig 115
endif()
20014 craig 116
 
21543 craig 117
string(REGEX MATCH "(mips64-*)|(MIPS64-*)" _machine_mips_64 "${MACHINE}")
118
if (_machine_mips_64)
119
	message(STATUS "Found target MIPS 64")
23013 craig 120
	set(ARCH_MIPS_64 ON)
21543 craig 121
endif()
20014 craig 122
 
21543 craig 123
string(REGEX MATCH "(ppc-*)|(powerpc-*)" _machine_ppc "${MACHINE}")
124
if (_machine_ppc)
125
	message(STATUS "Found target PPC")
23013 craig 126
	set(ARCH_PPC ON)
21543 craig 127
endif()
20014 craig 128
 
21543 craig 129
string(REGEX MATCH "(ppc64-*)|(PPC64-*)|(powerpc64-*)" _machine_ppc_64 "${MACHINE}")
130
if (_machine_ppc_64)
131
	message(STATUS "Found target PPC64")
23013 craig 132
	set(ARCH_PPC_64 ON)
21543 craig 133
endif()
20014 craig 134
 
21543 craig 135
string(REGEX MATCH "(sparc-*)" _machine_sparc "${MACHINE}")
136
if (_machine_sparc)
137
	message(STATUS "Found target Sparc")
23013 craig 138
	set(ARCH_SPARC ON)
21543 craig 139
endif()
20014 craig 140
 
21543 craig 141
string(REGEX MATCH "(sparcv9-*)" _machine_sparcv9 "${MACHINE}")
142
if (_machine_sparcv9)
143
	message(STATUS "Found target Sparc v9")
23013 craig 144
	set(ARCH_SPARCV9 ON)
21543 craig 145
endif()
20014 craig 146
 
21543 craig 147
string(REGEX MATCH "(sparc64-*)" _machine_sparc64 "${MACHINE}")
148
if (_machine_sparc64)
149
	message(STATUS "Found target Sparc64")
23013 craig 150
	set(ARCH_SPARC64 ON)
151
	set(ARCH64BIT ON)
21543 craig 152
endif()
20014 craig 153
 
21543 craig 154
string(REGEX MATCH "(hppa*)" _machine_hppa "${MACHINE}")
155
if (_machine_hppa)
156
	message(STATUS "Found target Hppa")
23013 craig 157
	set(ARCH_HPPA ON)
21543 craig 158
endif()
20469 craig 159
 
160
# We need to pass -fPIC to lib2geom on amd64, mips, mipsel, and hppa. See:
161
# http://www.gentoo.org/proj/en/base/amd64/howtos/index.xml?part=1&chap=3 and
162
# http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=559133
163
 
22412 jghali 164
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
20469 craig 165
 
20014 craig 166
## Do our Apple OSX version setup
23020 craig 167
if ((APPLE) AND (CMAKE_SIZEOF_VOID_P EQUAL 8) AND (ARCH_X86 OR ARCH_X86_64))
21543 craig 168
	string(REGEX REPLACE ".*-darwin([0-9]+).*" "\\1" _apple_ver "${MACHINE}")
23013 craig 169
	if (_apple_ver EQUAL "19")
170
		message(STATUS "Found macOS Catalina Target: Apple, 64 bit, X86")
23020 craig 171
		set(APPLE_10_15_X ON CACHE BOOL "Found macOS Catalina Target: Apple, 64 bit, X86")
23013 craig 172
	endif()
22697 craig 173
	if (_apple_ver EQUAL "18")
174
		message(STATUS "Found macOS Mojave Target: Apple, 64 bit, X86")
23020 craig 175
		set(APPLE_10_14_X ON CACHE BOOL "Found macOS Mojave Target: Apple, 64 bit, X86")
22697 craig 176
	endif()
22172 craig 177
	if (_apple_ver EQUAL "17")
178
		message(STATUS "Found macOS High Sierra Target: Apple, 64 bit, X86")
23020 craig 179
		set(APPLE_10_13_X ON CACHE BOOL "Found macOS High Sierra Target: Apple, 64 bit, X86")
22172 craig 180
	endif()
21543 craig 181
	if (_apple_ver EQUAL "16")
182
	    message(STATUS "Found macOS Sierra Target: Apple, 64 bit, X86")
23020 craig 183
		set(APPLE_10_12_X ON CACHE BOOL "Found macOS Sierra Target: Apple, 64 bit, X86")
21543 craig 184
	endif()
185
	if (_apple_ver EQUAL "15")
186
		message(STATUS "Found OSX El Capitan Target: Apple, 64 bit, X86")
23020 craig 187
		set(APPLE_10_11_X ON CACHE BOOL "Found OSX El Capitan Target: Apple, 64 bit, X86")
21543 craig 188
	endif()
189
	if (_apple_ver EQUAL "14")
190
		message(STATUS "Found OSX Yosemite Target: Apple, 64 bit, X86")
23020 craig 191
		set(APPLE_10_10_X ON CACHE BOOL "Found OSX Yosemite Target: Apple, 64 bit, X86")
21543 craig 192
	endif()
193
	if (_apple_ver EQUAL "13")
194
		message(STATUS "Found OSX Mavericks Target: Apple, 64 bit, X86")
23020 craig 195
		set(APPLE_10_9_X ON CACHE BOOL "Found OSX Mavericks Target: Apple, 64 bit, X86")
21543 craig 196
	endif()
197
	if (_apple_ver EQUAL "12")
198
		message(STATUS "Found OSX Mountain Lion Target: Apple, 64 bit, X86")
23020 craig 199
		set(APPLE_10_8_X ON CACHE BOOL "Found OSX Mountain Lion Target: Apple, 64 bit, X86")
21543 craig 200
	endif()
201
	if (_apple_ver EQUAL "11")
202
		message(STATUS "Found OSX Lion Target: Apple, 64 bit, X86")
23020 craig 203
		set(APPLE_10_7_X ON CACHE BOOL "Found OSX Lion Target: Apple, 64 bit, X86")
21543 craig 204
	endif()
205
	if (_apple_ver EQUAL "10")
206
		message(STATUS "Found OSX Snow Leopard Target: Apple, 64 bit, X86")
23020 craig 207
		set(APPLE_10_6_X ON CACHE BOOL "Found OSX Snow Leopard Target: Apple, 64 bit, X86")
21543 craig 208
	endif()
209
	if (_apple_ver EQUAL "9")
210
		message(STATUS "Found OSX Leopard Target: Apple, 32 bit, X86")
23020 craig 211
		set(APPLE_10_5_X ON CACHE BOOL "Found OSX Leopard Target: Apple, 32 bit, X86")
21543 craig 212
	endif()
213
	unset(ARCH_X86)
214
endif()
19233 craig 215
 
216
 
11407 cbradney 217
#convert any 64 bit build into generic 64 tag for below
21543 craig 218
if (ARCH_X86_64 OR ARCH_SPARC_64 OR ARCH_MIPS_64 OR ARCH_PPC_64)
23013 craig 219
	set(ARCH64BIT ON)
21543 craig 220
endif()
11407 cbradney 221
 
21543 craig 222
message(STATUS "Building for target ${MACHINE}")
11407 cbradney 223
 
10238 cbradney 224
##############################################################################################################
23028 jghali 225
########## Relocatability                                                                           ##########
226
 
227
if (APPLEBUNDLE OR WIN32)
228
	if (WANT_RELOCATABLE)
229
		message(STATUS "Ignoring relocatable option on Win32 or OSX when building bundle")
23029 jghali 230
		set(WANT_RELOCATABLE OFF)
23028 jghali 231
	endif()
232
endif()
233
 
234
if (WANT_RELOCATABLE)
23029 jghali 235
	message(STATUS "Enabling relocatable binaries")
236
	set(WANT_RELOCATABLE ON CACHE BOOL "Enable relocatable binaries")
23028 jghali 237
	add_definitions(-DWANT_RELOCATABLE)
238
endif()
239
 
240
##############################################################################################################
10215 cbradney 241
########## Versioning Setup                                                                         ##########
242
 
9409 cbradney 243
#On Apple, we ignore the versioning tag so all items are "scribus" not "scribus-version"
21543 craig 244
if (NOT BUILD_OSX_BUNDLE)
23022 jghali 245
	set(BUILD_OSX_BUNDLE ${APPLE} CACHE BOOL "Building MacOS X Bundle")
21543 craig 246
endif()
9508 cbradney 247
 
9680 cbradney 248
#Simplify future conditionals for Apple
21543 craig 249
if (APPLE AND BUILD_OSX_BUNDLE)
23020 craig 250
	set(APPLEBUNDLE ON CACHE BOOL "Building Apple Bundle")
21543 craig 251
endif()
9680 cbradney 252
 
253
#Announce we cached a version request before, overridden below for OSX
21543 craig 254
if(TAG_VERSION)
255
	if (NOT APPLEBUNDLE)
256
		message(STATUS "Previously selected version tag: ${TAG_VERSION}")
257
	endif()
23013 craig 258
	set(WANT_VERSIONING ON)
259
	set(CACHED_VERSIONING ON)
21543 craig 260
endif()
9508 cbradney 261
 
9680 cbradney 262
#Remove version tags on OSX so our bundle is Scribus.app
21543 craig 263
if (APPLEBUNDLE OR WIN32)
264
	if (WANT_VERSIONING OR CACHED_VERSIONING)
265
		message(STATUS "Ignoring version tag on Win32 or OSX when building bundle")
23013 craig 266
		set(WANT_VERSIONING OFF)
267
		set(CACHED_VERSIONING OFF)
21543 craig 268
	endif()
269
endif()
9508 cbradney 270
 
20014 craig 271
#Store our version string if required
21543 craig 272
if (WANT_VERSIONING AND NOT CACHED_VERSIONING)
273
	if (NOT CUSTOM_VERSIONTAG)
23030 jghali 274
		set(TAG_VERSION "-${VERSION}" CACHE STRING "Version string")
21543 craig 275
	else()
23030 jghali 276
		set(TAG_VERSION ${CUSTOM_VERSIONTAG} CACHE STRING "Version string")
21543 craig 277
	endif()
278
endif()
5379 cbradney 279
 
10215 cbradney 280
##############################################################################################################
281
########## Install/Directory Setup                                                                  ##########
23128 craig 282
include (CMakeLists_Directories.cmake)
10215 cbradney 283
 
284
##############################################################################################################
285
########## Build Setup                                                                              ##########
6319 mrdocs 286
 
9680 cbradney 287
#Convert our simpler command line option to the CMake style
5142 cbradney 288
#None, Debug, Release, .. or custom ones
23013 craig 289
# set(WANT_DEBUG ON)
21543 craig 290
if(WANT_DEBUG)
23122 craig 291
	set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Set Debug Build Type" FORCE)
21543 craig 292
endif()
293
if (WANT_RELEASEWITHDEBUG)
23122 craig 294
	set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "Set Release with Debug Info Build Type" FORCE)
21543 craig 295
endif()
296
if(NOT WANT_DEBUG AND NOT WANT_RELEASEWITHDEBUG)
23122 craig 297
	set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Set Release Build Type" FORCE)
21543 craig 298
endif()
5142 cbradney 299
 
13238 cbradney 300
 
301
 
9680 cbradney 302
#Based on our build type, setup our build options
21543 craig 303
if(APPLE)
23128 craig 304
	### Include our Apple configure commands
305
	include(CMakeLists_Apple.cmake)
21543 craig 306
else()
307
	if(${CMAKE_GENERATOR} MATCHES "^(Visual Studio|NMake).*")
19233 craig 308
		# Windows build with Visual Studio
309
		# Surely there's a better way to identify the compiler?
21543 craig 310
		set(CMAKE_CXX_FLAGS_DEBUG)
311
		set(CMAKE_C_FLAGS_DEBUG)
312
	else()
19233 craig 313
		# vanilla gcc
23125 craig 314
		set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 -g -Wall -fstrict-aliasing -Wl,-E")
315
		set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O0 -g -Wall -fstrict-aliasing -Wl,-E")
21543 craig 316
		if (_machine_x86 OR _machine_x86_64)
317
			set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fPIC")
318
			set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -fPIC")
319
		endif()
320
	endif()
23124 craig 321
	if(${CMAKE_GENERATOR} MATCHES "^(Visual Studio|NMake).*")
322
		set(CMAKE_CXX_FLAGS_RELEASE)
323
		set(CMAKE_C_FLAGS_RELEASE)
324
	else()
23125 craig 325
		set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2 -Wall -fPIC -Wl,-E")
326
		set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O2 -Wall -fPIC -Wl,-E")
23124 craig 327
	#	add_definitions(-DNDEBUG)
328
	endif()
21543 craig 329
endif()
330
if(WIN32)
331
	add_definitions(-DWIN32_LEAN_AND_MEAN
20014 craig 332
					-DAVOID_WIN32_FILEIO
333
					-D_CRT_SECURE_NO_DEPRECATE
334
					-D_USE_MATH_DEFINES
335
					-DCOMPILE_PLUGIN_AS_DLL
336
					)
23013 craig 337
	set(BUILD_WINDOWS_VERSION ON)
338
	set(DLL_USE_NATIVE_API ON)
21543 craig 339
endif()
10750 craig 340
 
21469 craig 341
#C++11 Support
22503 craig 342
#as of 1.5.5.svn, require C++11
343
#if(WANT_CPP11)
21543 craig 344
	message(STATUS "Enabling C++11 compiler features")
21469 craig 345
	set(CMAKE_CXX_STANDARD 11)
22503 craig 346
#endif()
23013 craig 347
if (WANT_CPP14)
22505 craig 348
	message(STATUS "Enabling C++14 compiler features")
349
	set(CMAKE_CXX_STANDARD 14)
350
elseif(WANT_CPP17)
23013 craig 351
		message(STATUS "Enabling C++17 compiler features")
22505 craig 352
		set(CMAKE_CXX_STANDARD 17)
353
endif()
21469 craig 354
 
23128 craig 355
##############################################################################################################
356
########## Find Dependencies                                                                        ##########
357
### Include our Dependency finding commands
358
include(CMakeLists_Dependencies.cmake)
10818 craig 359
 
13839 fschmid 360
 
10215 cbradney 361
##############################################################################################################
362
########## Include Setup                                                                            ##########
8499 cbradney 363
 
10215 cbradney 364
TEST_BIG_ENDIAN(WORDS_BIGENDIAN)
19222 fschmid 365
 
5142 cbradney 366
CHECK_INCLUDE_FILE("dlfcn.h" HAVE_DLFCN_H)
21543 craig 367
if(HAVE_DLFCN_H)
368
	add_definitions(-DHAVE_DLFCN_H)
369
endif()
5142 cbradney 370
 
371
CHECK_INCLUDE_FILE("unistd.h" HAVE_UNISTD_H)
21543 craig 372
if(HAVE_UNISTD_H)
373
	add_definitions(-DHAVE_UNISTD_H)
374
endif()
5142 cbradney 375
 
376
CHECK_INCLUDE_FILE("sys/types.h" HAVE_SYS_TYPES_H)
21543 craig 377
# if(HAVE_SYS_TYPES_H)
378
#   add_definitions(-DHAVE_SYS_TYPES_H)
379
# endif()
5142 cbradney 380
 
381
CHECK_INCLUDE_FILE("sys/stat.h" HAVE_SYS_STAT_H)
21543 craig 382
# if(HAVE_SYS_STAT_H)
383
#   add_definitions(-DHAVE_SYS_STAT_H)
384
# endif()
9680 cbradney 385
#>>Test for existing include files
5142 cbradney 386
 
387
 
5150 cbradney 388
#Create configure files.. config.h and uninstall
389
#config.h
21543 craig 390
include (ConfigureChecks.cmake)
391
	if(WIN32)
392
		set(CONFIG_NAME win-config.h)
393
	else()
394
		set(CONFIG_NAME config.h)
395
	endif()
396
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME})
22126 craig 397
add_definitions(-DHAVE_CONFIG_H)
9680 cbradney 398
 
5142 cbradney 399
 
5150 cbradney 400
 
5157 cbradney 401
#Set up include dirs with all found packages
21543 craig 402
include_directories(
20014 craig 403
	${CMAKE_BINARY_DIR}
404
	${CMAKE_BINARY_DIR}/scribus
405
	${QT_INCLUDES}
406
	${FREETYPE_INCLUDE_DIR}
407
	${FONTCONFIG_INCLUDE_DIR}
408
	${JPEG_INCLUDE_DIR}
409
	${LCMS2_INCLUDE_DIR}
410
	${LIBXML2_INCLUDE_DIR}
411
	${TIFF_INCLUDE_DIR}
412
	${ZLIB_INCLUDE_DIR}
413
	${OPENGL_INCLUDE_DIR}
414
	${OSG_INCLUDE_DIR}
415
	${GSL_INCLUDE_DIR}
5142 cbradney 416
)
417
 
21543 craig 418
if (NOT WIN32 AND NOT HAIKU)
419
include_directories(
20014 craig 420
	${CUPS_INCLUDE_DIR}
18186 craig 421
)
21543 craig 422
endif()
18186 craig 423
 
10215 cbradney 424
##############################################################################################################
425
########## Uninstall Setup                                                                          ##########
426
 
21543 craig 427
configure_file(
20014 craig 428
	"${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
429
	"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
430
	IMMEDIATE @ONLY
10215 cbradney 431
)
432
 
21543 craig 433
add_custom_target(uninstall
20014 craig 434
	"${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
435
)
19222 fschmid 436
 
437
 
10215 cbradney 438
##############################################################################################################
439
########## Add our subdirs                                                                          ##########
440
 
5157 cbradney 441
#Add our source subdirs
21543 craig 442
add_subdirectory(scribus)
443
add_subdirectory(doc)
444
add_subdirectory(resources/dicts)
445
add_subdirectory(resources/editorconfig)
446
add_subdirectory(resources/iconsets)
447
add_subdirectory(resources/keysets)
448
add_subdirectory(resources/loremipsum)
449
add_subdirectory(resources/manpages)
450
add_subdirectory(resources/profiles)
451
add_subdirectory(resources/swatches)
452
add_subdirectory(resources/templates)
453
add_subdirectory(resources/translations)
22575 jghali 454
add_subdirectory(resources/unicodemap)
5142 cbradney 455
 
5157 cbradney 456
#Install our READMEs etc.
21543 craig 457
install(FILES
19171 craig 458
	AUTHORS
459
	ChangeLog
460
	COPYING
461
	LINKS
462
	README
463
	TRANSLATION
464
	DESTINATION ${DOCDIR}
5142 cbradney 465
)
9386 cbradney 466
 
21543 craig 467
if (APPLE)
468
	install(FILES
20014 craig 469
		README.MacOSX
470
		DESTINATION ${DOCDIR}
471
	)
18763 craig 472
 
21543 craig 473
	#	execute_process (COMMAND mkdir -p "${CMAKE_INSTALL_PREFIX}/PlugIns/imageformats")
474
	#	if (NOT EXISTS "${CMAKE_INSTALL_PREFIX}/PlugIns/imageformats/libqjpeg.dylib")
475
	#message(STATUS ${QT_PREFIX})
476
	#message(STATUS "@QT_PREFIX@/plugins/imageformats/libqjpeg.dylib")
477
	#message(STATUS "${CMAKE_INSTALL_PREFIX}/PlugIns/imageformats/libqjpeg.dylib")
478
	#		execute_process (COMMAND ditto "@QT_PREFIX@/plugins/imageformats/libqjpeg.dylib" "${CMAKE_INSTALL_PREFIX}/PlugIns/imageformats/libqjpeg.dylib")
479
	#	endif()
18763 craig 480
 
21543 craig 481
endif()
17500 craig 482
 
21433 mrdocs 483
#Install the .desktop file
21543 craig 484
configure_file(
21481 craig 485
	${CMAKE_CURRENT_SOURCE_DIR}/scribus.desktop.in
486
	${CMAKE_CURRENT_SOURCE_DIR}/scribus.desktop
487
)
21543 craig 488
install(FILES
21433 mrdocs 489
	scribus.desktop
21481 craig 490
	RENAME scribus${TAG_VERSION}.desktop
21433 mrdocs 491
	DESTINATION ${DESKTOPDIR}
492
)
493
 
9680 cbradney 494
#Install our MIME data
21543 craig 495
install(FILES
20014 craig 496
	scribus.xml
21481 craig 497
	RENAME scribus${TAG_VERSION}.xml
20014 craig 498
	DESTINATION ${MIMEDIR}
6319 mrdocs 499
)
5396 cbradney 500
 
21230 mrdocs 501
 
502
#Install the appdata file
21543 craig 503
configure_file(
21481 craig 504
	${CMAKE_CURRENT_SOURCE_DIR}/scribus.appdata.xml.in
505
	${CMAKE_CURRENT_SOURCE_DIR}/scribus.appdata.xml
506
)
21543 craig 507
install(FILES
21481 craig 508
	scribus.appdata.xml
509
	RENAME scribus${TAG_VERSION}.appdata.xml
510
	DESTINATION ${APPDATADIR}
21230 mrdocs 511
)
512
 
513
 
9680 cbradney 514
#If building an Apple bundle, install these specific files
21543 craig 515
if(APPLEBUNDLE)
516
	install(FILES
20014 craig 517
		Scribus.app/Contents/Info.plist
518
		DESTINATION ${CMAKE_INSTALL_PREFIX}
519
	)
21543 craig 520
	install(FILES
20014 craig 521
		Scribus.app/Contents/Resources/Scribus.icns
522
		Scribus.app/Contents/Resources/Scribus-doc.icns
523
		DESTINATION ${CMAKE_INSTALL_PREFIX}/Resources
524
	)
21543 craig 525
endif()
9386 cbradney 526
 
10215 cbradney 527
##############################################################################################################
528
########## Install/CPack Setup                                                                      ##########
529
 
9680 cbradney 530
# If the cmake version includes cpack, use it for tarball building
21543 craig 531
if(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
532
	set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Scribus is an open source publishing application for Linux, Mac OSX and Windows")
533
	set(CPACK_PACKAGE_VENDOR "Scribus Team")
534
	set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README")
535
	set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/README")
536
	set(CPACK_PACKAGE_VERSION_MAJOR "${VERSION_MAJOR}")
537
	set(CPACK_PACKAGE_VERSION_MINOR "${VERSION_MINOR}")
538
	set(CPACK_PACKAGE_VERSION_PATCH "${VERSION_PATCH}")
539
	set(CPACK_PACKAGE_INSTALL_DIRECTORY "Scribus ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")
540
	set(CPACK_PACKAGE_EXECUTABLES "scribus${TAG_VERSION}")
541
	set(CPACK_SOURCE_PACKAGE_FILE_NAME "scribus-${VERSION}${VERSION_SUFFIX}")
542
	set(CPACK_SOURCE_GENERATOR TBZ2)
543
	set(CPACK_SYSTEM_NAME "")
544
	set(CPACK_TOPLEVEL_TAG "")
545
	set(CPACK_SOURCE_IGNORE_FILES
20014 craig 546
		CMakeCache.txt
23097 craig 547
		scribus-1.5.6.tar.bz2
548
		scribus-1.5.6.tar.7z
549
		scribus-1.5.6.tar.gz
550
		scribus-1.5.6.svn.tar.bz2
551
		scribus-1.5.6.svn.tar.7z
552
		scribus-1.5.6.svn.tar.gz
20014 craig 553
		"~$"
554
		"\\\\.cvsignore$"
555
		"\\\\.o$"
556
		"\\\\.svn-base$"
557
		"\\\\.svn$"
558
		"^${PROJECT_SOURCE_DIR}.*/CVS/"
559
		"^${PROJECT_SOURCE_DIR}/debian/"
560
		"^${PROJECT_SOURCE_DIR}/old/"
561
		"^${PROJECT_SOURCE_DIR}.*/CVSROOT/"
562
		"^${PROJECT_SOURCE_DIR}/admin/"
563
	)
21543 craig 564
	include(CPack)
565
endif()
14097 cbradney 566
 
20014 craig 567
#include (cmakeconfigreport optional)
21325 craig 568
 
569
# Output everything we've found
570
#feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES)