Subversion Repositories Scribus

Rev

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