Subversion Repositories Scribus

Rev

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