Subversion Repositories Scribus

Rev

Rev 24704 | Rev 24823 | 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
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
 
24775 craig 191
string(REGEX MATCH "(arm64+)" _machine_arm "${MACHINE}")
192
if (_machine_arm)
193
	message(STATUS "Found target arm64")
194
	set(ARCH_ARM_64 ON)
195
endif()
196
 
20469 craig 197
# We need to pass -fPIC to lib2geom on amd64, mips, mipsel, and hppa. See:
198
# http://www.gentoo.org/proj/en/base/amd64/howtos/index.xml?part=1&chap=3 and
199
# http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=559133
200
 
22412 jghali 201
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
20469 craig 202
 
20014 craig 203
## Do our Apple OSX version setup
23908 craig 204
if (APPLE)
205
	if ((CMAKE_SIZEOF_VOID_P EQUAL 8) AND (ARCH_ARM))
206
		string(REGEX REPLACE ".*-darwin([0-9]+).*" "\\1" _apple_ver "${MACHINE}")
24775 craig 207
		if (_apple_ver EQUAL "21")
208
			message(STATUS "Found macOS Monterey Target: Apple, 64 bit, ARM")
209
			set(APPLE_12_00_X ON CACHE BOOL "Found macOS Monterey Target: Apple, 64 bit, ARM")
210
		endif()
23908 craig 211
		if (_apple_ver EQUAL "20")
212
			message(STATUS "Found macOS Big Sur Target: Apple, 64 bit, ARM")
213
			set(APPLE_11_00_X ON CACHE BOOL "Found macOS Big Sur Target: Apple, 64 bit, ARM")
214
		endif()
23013 craig 215
	endif()
23908 craig 216
	if ((CMAKE_SIZEOF_VOID_P EQUAL 8) AND (ARCH_X86 OR ARCH_X86_64))
217
		string(REGEX REPLACE ".*-darwin([0-9]+).*" "\\1" _apple_ver "${MACHINE}")
24775 craig 218
		if (_apple_ver EQUAL "21")
219
			message(STATUS "Found macOS Monterey Target: Apple, 64 bit, X86")
220
			set(APPLE_12_00_X ON CACHE BOOL "Found macOS Monterey Target: Apple, 64 bit, X86")
221
		endif()
23908 craig 222
		if (_apple_ver EQUAL "20")
223
			message(STATUS "Found macOS Big Sur Target: Apple, 64 bit, X86")
224
			set(APPLE_11_00_X ON CACHE BOOL "Found macOS Big Sur Target: Apple, 64 bit, X86")
225
		endif()
226
		if (_apple_ver EQUAL "19")
227
			message(STATUS "Found macOS Catalina Target: Apple, 64 bit, X86")
228
			set(APPLE_10_15_X ON CACHE BOOL "Found macOS Catalina Target: Apple, 64 bit, X86")
229
		endif()
230
		if (_apple_ver EQUAL "18")
231
			message(STATUS "Found macOS Mojave Target: Apple, 64 bit, X86")
232
			set(APPLE_10_14_X ON CACHE BOOL "Found macOS Mojave Target: Apple, 64 bit, X86")
233
		endif()
234
		if (_apple_ver EQUAL "17")
235
			message(STATUS "Found macOS High Sierra Target: Apple, 64 bit, X86")
236
			set(APPLE_10_13_X ON CACHE BOOL "Found macOS High Sierra Target: Apple, 64 bit, X86")
237
		endif()
238
		if (_apple_ver EQUAL "16")
239
			message(STATUS "Found macOS Sierra Target: Apple, 64 bit, X86")
240
			set(APPLE_10_12_X ON CACHE BOOL "Found macOS Sierra Target: Apple, 64 bit, X86")
241
		endif()
242
		if (_apple_ver EQUAL "15")
243
			message(STATUS "Found OSX El Capitan Target: Apple, 64 bit, X86")
244
			set(APPLE_10_11_X ON CACHE BOOL "Found OSX El Capitan Target: Apple, 64 bit, X86")
245
		endif()
246
		if (_apple_ver EQUAL "14")
247
			message(STATUS "Found OSX Yosemite Target: Apple, 64 bit, X86")
248
			set(APPLE_10_10_X ON CACHE BOOL "Found OSX Yosemite Target: Apple, 64 bit, X86")
249
		endif()
250
		if (_apple_ver EQUAL "13")
251
			message(STATUS "Found OSX Mavericks Target: Apple, 64 bit, X86")
252
			set(APPLE_10_9_X ON CACHE BOOL "Found OSX Mavericks Target: Apple, 64 bit, X86")
253
		endif()
254
		if (_apple_ver EQUAL "12")
255
			message(STATUS "Found OSX Mountain Lion Target: Apple, 64 bit, X86")
256
			set(APPLE_10_8_X ON CACHE BOOL "Found OSX Mountain Lion Target: Apple, 64 bit, X86")
257
		endif()
258
		if (_apple_ver EQUAL "11")
259
			message(STATUS "Found OSX Lion Target: Apple, 64 bit, X86")
260
			set(APPLE_10_7_X ON CACHE BOOL "Found OSX Lion Target: Apple, 64 bit, X86")
261
		endif()
262
		if (_apple_ver EQUAL "10")
263
			message(STATUS "Found OSX Snow Leopard Target: Apple, 64 bit, X86")
264
			set(APPLE_10_6_X ON CACHE BOOL "Found OSX Snow Leopard Target: Apple, 64 bit, X86")
265
		endif()
266
		if (_apple_ver EQUAL "9")
267
			message(STATUS "Found OSX Leopard Target: Apple, 32 bit, X86")
268
			set(APPLE_10_5_X ON CACHE BOOL "Found OSX Leopard Target: Apple, 32 bit, X86")
269
		endif()
270
		unset(ARCH_X86)
22697 craig 271
	endif()
21543 craig 272
endif()
19233 craig 273
 
274
 
11407 cbradney 275
#convert any 64 bit build into generic 64 tag for below
24775 craig 276
if (ARCH_X86_64 OR ARCH_SPARC_64 OR ARCH_MIPS_64 OR ARCH_PPC_64 OR ARCH_ARM_64)
23013 craig 277
	set(ARCH64BIT ON)
21543 craig 278
endif()
11407 cbradney 279
 
21543 craig 280
message(STATUS "Building for target ${MACHINE}")
11407 cbradney 281
 
10238 cbradney 282
##############################################################################################################
23028 jghali 283
########## Relocatability                                                                           ##########
284
 
285
if (APPLEBUNDLE OR WIN32)
286
	if (WANT_RELOCATABLE)
287
		message(STATUS "Ignoring relocatable option on Win32 or OSX when building bundle")
23029 jghali 288
		set(WANT_RELOCATABLE OFF)
23028 jghali 289
	endif()
290
endif()
291
 
292
if (WANT_RELOCATABLE)
23029 jghali 293
	message(STATUS "Enabling relocatable binaries")
294
	set(WANT_RELOCATABLE ON CACHE BOOL "Enable relocatable binaries")
23028 jghali 295
	add_definitions(-DWANT_RELOCATABLE)
296
endif()
297
 
298
##############################################################################################################
10215 cbradney 299
########## Versioning Setup                                                                         ##########
300
 
9409 cbradney 301
#On Apple, we ignore the versioning tag so all items are "scribus" not "scribus-version"
21543 craig 302
if (NOT BUILD_OSX_BUNDLE)
23022 jghali 303
	set(BUILD_OSX_BUNDLE ${APPLE} CACHE BOOL "Building MacOS X Bundle")
21543 craig 304
endif()
9508 cbradney 305
 
9680 cbradney 306
#Simplify future conditionals for Apple
21543 craig 307
if (APPLE AND BUILD_OSX_BUNDLE)
23020 craig 308
	set(APPLEBUNDLE ON CACHE BOOL "Building Apple Bundle")
21543 craig 309
endif()
9680 cbradney 310
 
311
#Announce we cached a version request before, overridden below for OSX
21543 craig 312
if(TAG_VERSION)
313
	if (NOT APPLEBUNDLE)
314
		message(STATUS "Previously selected version tag: ${TAG_VERSION}")
315
	endif()
23013 craig 316
	set(WANT_VERSIONING ON)
317
	set(CACHED_VERSIONING ON)
21543 craig 318
endif()
9508 cbradney 319
 
9680 cbradney 320
#Remove version tags on OSX so our bundle is Scribus.app
21543 craig 321
if (APPLEBUNDLE OR WIN32)
322
	if (WANT_VERSIONING OR CACHED_VERSIONING)
323
		message(STATUS "Ignoring version tag on Win32 or OSX when building bundle")
23013 craig 324
		set(WANT_VERSIONING OFF)
325
		set(CACHED_VERSIONING OFF)
21543 craig 326
	endif()
327
endif()
9508 cbradney 328
 
20014 craig 329
#Store our version string if required
21543 craig 330
if (WANT_VERSIONING AND NOT CACHED_VERSIONING)
331
	if (NOT CUSTOM_VERSIONTAG)
23030 jghali 332
		set(TAG_VERSION "-${VERSION}" CACHE STRING "Version string")
21543 craig 333
	else()
23030 jghali 334
		set(TAG_VERSION ${CUSTOM_VERSIONTAG} CACHE STRING "Version string")
21543 craig 335
	endif()
336
endif()
5379 cbradney 337
 
10215 cbradney 338
##############################################################################################################
339
########## Install/Directory Setup                                                                  ##########
23128 craig 340
include (CMakeLists_Directories.cmake)
10215 cbradney 341
 
342
##############################################################################################################
343
########## Build Setup                                                                              ##########
6319 mrdocs 344
 
9680 cbradney 345
#Convert our simpler command line option to the CMake style
5142 cbradney 346
#None, Debug, Release, .. or custom ones
21543 craig 347
if(WANT_DEBUG)
23122 craig 348
	set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Set Debug Build Type" FORCE)
21543 craig 349
endif()
350
if (WANT_RELEASEWITHDEBUG)
23122 craig 351
	set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "Set Release with Debug Info Build Type" FORCE)
21543 craig 352
endif()
353
if(NOT WANT_DEBUG AND NOT WANT_RELEASEWITHDEBUG)
23122 craig 354
	set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Set Release Build Type" FORCE)
21543 craig 355
endif()
5142 cbradney 356
 
24704 craig 357
set(CMAKE_ENABLE_EXPORTS ON)
358
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
359
set(CMAKE_VISIBILITY_INLINES_HIDDEN ON)
13238 cbradney 360
 
9680 cbradney 361
#Based on our build type, setup our build options
21543 craig 362
if(APPLE)
23128 craig 363
	### Include our Apple configure commands
364
	include(CMakeLists_Apple.cmake)
21543 craig 365
else()
366
	if(${CMAKE_GENERATOR} MATCHES "^(Visual Studio|NMake).*")
19233 craig 367
		# Windows build with Visual Studio
368
		# Surely there's a better way to identify the compiler?
21543 craig 369
		set(CMAKE_CXX_FLAGS_DEBUG)
370
		set(CMAKE_C_FLAGS_DEBUG)
371
	else()
19233 craig 372
		# vanilla gcc
24704 craig 373
		set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 -g -Wall -fstrict-aliasing")
374
		set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O0 -g -Wall -fstrict-aliasing")
21543 craig 375
	endif()
23124 craig 376
	if(${CMAKE_GENERATOR} MATCHES "^(Visual Studio|NMake).*")
377
		set(CMAKE_CXX_FLAGS_RELEASE)
378
		set(CMAKE_C_FLAGS_RELEASE)
379
	else()
24704 craig 380
		set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2 -Wall")
381
		set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O2 -Wall")
23124 craig 382
	#	add_definitions(-DNDEBUG)
383
	endif()
21543 craig 384
endif()
385
if(WIN32)
386
	add_definitions(-DWIN32_LEAN_AND_MEAN
20014 craig 387
					-DAVOID_WIN32_FILEIO
388
					-D_CRT_SECURE_NO_DEPRECATE
389
					-D_USE_MATH_DEFINES
390
					-DCOMPILE_PLUGIN_AS_DLL
391
					)
23013 craig 392
	set(BUILD_WINDOWS_VERSION ON)
393
	set(DLL_USE_NATIVE_API ON)
21543 craig 394
endif()
10750 craig 395
 
21469 craig 396
#C++11 Support
22503 craig 397
#as of 1.5.5.svn, require C++11
24314 craig 398
if (WANT_QT6)
399
	set (WANT_CPP17 ON)
400
endif()
24017 craig 401
if(NOT WANT_CPP14 AND NOT WANT_CPP17)
21543 craig 402
	message(STATUS "Enabling C++11 compiler features")
21469 craig 403
	set(CMAKE_CXX_STANDARD 11)
24017 craig 404
endif()
23013 craig 405
if (WANT_CPP14)
22505 craig 406
	message(STATUS "Enabling C++14 compiler features")
407
	set(CMAKE_CXX_STANDARD 14)
408
elseif(WANT_CPP17)
23013 craig 409
		message(STATUS "Enabling C++17 compiler features")
22505 craig 410
		set(CMAKE_CXX_STANDARD 17)
411
endif()
24314 craig 412
set (CMAKE_CXX_STANDARD_REQUIRED ON)
24704 craig 413
set (CMAKE_CXX_EXTENSIONS OFF)
21469 craig 414
 
23128 craig 415
##############################################################################################################
416
########## Find Dependencies                                                                        ##########
417
### Include our Dependency finding commands
418
include(CMakeLists_Dependencies.cmake)
10818 craig 419
 
13839 fschmid 420
 
10215 cbradney 421
##############################################################################################################
422
########## Include Setup                                                                            ##########
8499 cbradney 423
 
10215 cbradney 424
TEST_BIG_ENDIAN(WORDS_BIGENDIAN)
19222 fschmid 425
 
5142 cbradney 426
CHECK_INCLUDE_FILE("dlfcn.h" HAVE_DLFCN_H)
21543 craig 427
if(HAVE_DLFCN_H)
428
	add_definitions(-DHAVE_DLFCN_H)
429
endif()
5142 cbradney 430
 
431
CHECK_INCLUDE_FILE("unistd.h" HAVE_UNISTD_H)
21543 craig 432
if(HAVE_UNISTD_H)
433
	add_definitions(-DHAVE_UNISTD_H)
434
endif()
5142 cbradney 435
 
436
CHECK_INCLUDE_FILE("sys/types.h" HAVE_SYS_TYPES_H)
21543 craig 437
# if(HAVE_SYS_TYPES_H)
438
#   add_definitions(-DHAVE_SYS_TYPES_H)
439
# endif()
5142 cbradney 440
 
441
CHECK_INCLUDE_FILE("sys/stat.h" HAVE_SYS_STAT_H)
21543 craig 442
# if(HAVE_SYS_STAT_H)
443
#   add_definitions(-DHAVE_SYS_STAT_H)
444
# endif()
9680 cbradney 445
#>>Test for existing include files
5142 cbradney 446
 
447
 
5150 cbradney 448
#Create configure files.. config.h and uninstall
449
#config.h
21543 craig 450
include (ConfigureChecks.cmake)
451
	if(WIN32)
452
		set(CONFIG_NAME win-config.h)
453
	else()
454
		set(CONFIG_NAME config.h)
455
	endif()
456
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME})
22126 craig 457
add_definitions(-DHAVE_CONFIG_H)
9680 cbradney 458
 
5142 cbradney 459
 
5150 cbradney 460
 
5157 cbradney 461
#Set up include dirs with all found packages
21543 craig 462
include_directories(
20014 craig 463
	${CMAKE_BINARY_DIR}
464
	${CMAKE_BINARY_DIR}/scribus
465
	${QT_INCLUDES}
466
	${FREETYPE_INCLUDE_DIR}
23419 craig 467
#	${FONTCONFIG_INCLUDE_DIR}
20014 craig 468
	${JPEG_INCLUDE_DIR}
469
	${LCMS2_INCLUDE_DIR}
470
	${LIBXML2_INCLUDE_DIR}
23489 jghali 471
	${PNG_INCLUDE_DIR}
20014 craig 472
	${TIFF_INCLUDE_DIR}
473
	${ZLIB_INCLUDE_DIR}
474
	${OPENGL_INCLUDE_DIR}
475
	${OSG_INCLUDE_DIR}
476
	${GSL_INCLUDE_DIR}
5142 cbradney 477
)
478
 
21543 craig 479
if (NOT WIN32 AND NOT HAIKU)
480
include_directories(
20014 craig 481
	${CUPS_INCLUDE_DIR}
18186 craig 482
)
21543 craig 483
endif()
18186 craig 484
 
10215 cbradney 485
##############################################################################################################
486
########## Uninstall Setup                                                                          ##########
487
 
21543 craig 488
configure_file(
20014 craig 489
	"${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
490
	"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
491
	IMMEDIATE @ONLY
10215 cbradney 492
)
493
 
21543 craig 494
add_custom_target(uninstall
20014 craig 495
	"${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
496
)
19222 fschmid 497
 
498
 
10215 cbradney 499
##############################################################################################################
500
########## Add our subdirs                                                                          ##########
501
 
5157 cbradney 502
#Add our source subdirs
21543 craig 503
add_subdirectory(scribus)
504
add_subdirectory(doc)
505
add_subdirectory(resources/dicts)
506
add_subdirectory(resources/editorconfig)
507
add_subdirectory(resources/iconsets)
508
add_subdirectory(resources/keysets)
509
add_subdirectory(resources/loremipsum)
510
add_subdirectory(resources/manpages)
511
add_subdirectory(resources/profiles)
512
add_subdirectory(resources/swatches)
513
add_subdirectory(resources/templates)
514
add_subdirectory(resources/translations)
22575 jghali 515
add_subdirectory(resources/unicodemap)
5142 cbradney 516
 
5157 cbradney 517
#Install our READMEs etc.
21543 craig 518
install(FILES
19171 craig 519
	AUTHORS
520
	ChangeLog
521
	COPYING
522
	LINKS
523
	README
524
	TRANSLATION
525
	DESTINATION ${DOCDIR}
5142 cbradney 526
)
9386 cbradney 527
 
21543 craig 528
if (APPLE)
529
	install(FILES
20014 craig 530
		README.MacOSX
531
		DESTINATION ${DOCDIR}
532
	)
18763 craig 533
 
21543 craig 534
	#	execute_process (COMMAND mkdir -p "${CMAKE_INSTALL_PREFIX}/PlugIns/imageformats")
535
	#	if (NOT EXISTS "${CMAKE_INSTALL_PREFIX}/PlugIns/imageformats/libqjpeg.dylib")
536
	#message(STATUS ${QT_PREFIX})
537
	#message(STATUS "@QT_PREFIX@/plugins/imageformats/libqjpeg.dylib")
538
	#message(STATUS "${CMAKE_INSTALL_PREFIX}/PlugIns/imageformats/libqjpeg.dylib")
539
	#		execute_process (COMMAND ditto "@QT_PREFIX@/plugins/imageformats/libqjpeg.dylib" "${CMAKE_INSTALL_PREFIX}/PlugIns/imageformats/libqjpeg.dylib")
540
	#	endif()
18763 craig 541
 
21543 craig 542
endif()
17500 craig 543
 
21433 mrdocs 544
#Install the .desktop file
21543 craig 545
configure_file(
21481 craig 546
	${CMAKE_CURRENT_SOURCE_DIR}/scribus.desktop.in
547
	${CMAKE_CURRENT_SOURCE_DIR}/scribus.desktop
548
)
21543 craig 549
install(FILES
21433 mrdocs 550
	scribus.desktop
21481 craig 551
	RENAME scribus${TAG_VERSION}.desktop
21433 mrdocs 552
	DESTINATION ${DESKTOPDIR}
553
)
554
 
9680 cbradney 555
#Install our MIME data
21543 craig 556
install(FILES
20014 craig 557
	scribus.xml
21481 craig 558
	RENAME scribus${TAG_VERSION}.xml
20014 craig 559
	DESTINATION ${MIMEDIR}
6319 mrdocs 560
)
5396 cbradney 561
 
21230 mrdocs 562
 
563
#Install the appdata file
21543 craig 564
configure_file(
21481 craig 565
	${CMAKE_CURRENT_SOURCE_DIR}/scribus.appdata.xml.in
566
	${CMAKE_CURRENT_SOURCE_DIR}/scribus.appdata.xml
567
)
21543 craig 568
install(FILES
21481 craig 569
	scribus.appdata.xml
570
	RENAME scribus${TAG_VERSION}.appdata.xml
571
	DESTINATION ${APPDATADIR}
21230 mrdocs 572
)
573
 
574
 
9680 cbradney 575
#If building an Apple bundle, install these specific files
21543 craig 576
if(APPLEBUNDLE)
577
	install(FILES
20014 craig 578
		Scribus.app/Contents/Info.plist
579
		DESTINATION ${CMAKE_INSTALL_PREFIX}
580
	)
21543 craig 581
	install(FILES
20014 craig 582
		Scribus.app/Contents/Resources/Scribus.icns
583
		Scribus.app/Contents/Resources/Scribus-doc.icns
584
		DESTINATION ${CMAKE_INSTALL_PREFIX}/Resources
585
	)
21543 craig 586
endif()
9386 cbradney 587
 
10215 cbradney 588
##############################################################################################################
589
########## Install/CPack Setup                                                                      ##########
590
 
9680 cbradney 591
# If the cmake version includes cpack, use it for tarball building
21543 craig 592
if(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
593
	set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Scribus is an open source publishing application for Linux, Mac OSX and Windows")
594
	set(CPACK_PACKAGE_VENDOR "Scribus Team")
595
	set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README")
596
	set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/README")
597
	set(CPACK_PACKAGE_VERSION_MAJOR "${VERSION_MAJOR}")
598
	set(CPACK_PACKAGE_VERSION_MINOR "${VERSION_MINOR}")
599
	set(CPACK_PACKAGE_VERSION_PATCH "${VERSION_PATCH}")
600
	set(CPACK_PACKAGE_INSTALL_DIRECTORY "Scribus ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")
601
	set(CPACK_PACKAGE_EXECUTABLES "scribus${TAG_VERSION}")
602
	set(CPACK_SOURCE_PACKAGE_FILE_NAME "scribus-${VERSION}${VERSION_SUFFIX}")
603
	set(CPACK_SOURCE_GENERATOR TBZ2)
604
	set(CPACK_SYSTEM_NAME "")
605
	set(CPACK_TOPLEVEL_TAG "")
606
	set(CPACK_SOURCE_IGNORE_FILES
20014 craig 607
		CMakeCache.txt
24641 craig 608
		scribus-1.5.8.tar.bz2
609
		scribus-1.5.8.tar.7z
610
		scribus-1.5.8.tar.gz
611
		scribus-1.5.8.svn.tar.bz2
612
		scribus-1.5.8.svn.tar.7z
613
		scribus-1.5.8.svn.tar.gz
20014 craig 614
		"~$"
615
		"\\\\.cvsignore$"
616
		"\\\\.o$"
617
		"\\\\.svn-base$"
618
		"\\\\.svn$"
619
		"^${PROJECT_SOURCE_DIR}.*/CVS/"
620
		"^${PROJECT_SOURCE_DIR}/debian/"
621
		"^${PROJECT_SOURCE_DIR}/old/"
622
		"^${PROJECT_SOURCE_DIR}.*/CVSROOT/"
623
		"^${PROJECT_SOURCE_DIR}/admin/"
624
	)
21543 craig 625
	include(CPack)
626
endif()
14097 cbradney 627
 
20014 craig 628
#include (cmakeconfigreport optional)
21325 craig 629
 
630
# Output everything we've found
631
#feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES)