Subversion Repositories Scribus

Compare Revisions

Ignore whitespace Rev 23125 → Rev 23128

/trunk/Scribus/CMakeLists.txt
279,232 → 279,8
 
##############################################################################################################
########## Install/Directory Setup ##########
include (CMakeLists_Directories.cmake)
 
if (APPLEBUNDLE)
set (APPLE_APP_DIR "${CMAKE_INSTALL_PREFIX}")
if ("${CMAKE_INSTALL_PREFIX}" MATCHES "[.]app/Contents/?$")
# all ok
else()
if ("${CMAKE_INSTALL_PREFIX}" MATCHES "[.]app/?$")
# add "/Contents" subpath
set(CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/Contents")
else()
# no bundle name spcified, use appname and version
set(CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/Scribus${VERSION}.app/Contents")
endif()
endif()
message(STATUS "APPLEBUNDLE install prefix: ${APPLE_APP_DIR}")
endif()
 
 
#Setup all the directories we will use
#cmake_policy(SET CMP0005 OLD)
#SHARE
if(WANT_VERSIONING)
set(SHAREDIR "${CMAKE_INSTALL_DATAROOTDIR}/${MAIN_DIR_NAME}${TAG_VERSION}/")
else()
set(SHAREDIR "${CMAKE_INSTALL_DATAROOTDIR}/${MAIN_DIR_NAME}/")
endif()
 
if(IS_ABSOLUTE ${SHAREDIR} AND WANT_RELOCATABLE)
message(FATAL_ERROR "ERROR: SHAREDIR must be relative when using WANT_RELOCATABLE option")
elseif(NOT IS_ABSOLUTE ${SHAREDIR} AND NOT WANT_RELOCATABLE)
add_definitions(-DSHAREDIR="${CMAKE_INSTALL_PREFIX}/${SHAREDIR}")
else()
add_definitions(-DSHAREDIR="${SHAREDIR}")
endif()
 
#SHARE - use the default on Apple as TAG_VERSION is empty
if(WIN32 OR OS2)
set(DOCDIR "${CMAKE_INSTALL_DATAROOTDIR}/doc/")
elseif(TAG_VERSION OR BUILD_OSX_BUNDLE)
set(DOCDIR "${CMAKE_INSTALL_DATAROOTDIR}/doc/${MAIN_DIR_NAME}${TAG_VERSION}/")
elseif(NOT WANT_VERSIONING)
set(DOCDIR "${CMAKE_INSTALL_DATAROOTDIR}/doc/${MAIN_DIR_NAME}/")
else()
set(DOCDIR "${CMAKE_INSTALL_DATAROOTDIR}/doc/${MAIN_DIR_NAME}-${VERSION}/")
endif()
 
if(IS_ABSOLUTE ${DOCDIR} AND WANT_RELOCATABLE)
message(FATAL_ERROR "ERROR: DOCDIR must be relative when using WANT_RELOCATABLE option")
elseif(NOT IS_ABSOLUTE ${DOCDIR} AND NOT WANT_RELOCATABLE)
add_definitions(-DDOCDIR="${CMAKE_INSTALL_PREFIX}/${DOCDIR}")
else()
add_definitions(-DDOCDIR="${DOCDIR}")
endif()
 
#ICONS
if(WIN32)
set(ICONDIR "${CMAKE_INSTALL_DATAROOTDIR}/icons/")
else()
set(ICONDIR "${CMAKE_INSTALL_DATAROOTDIR}/${MAIN_DIR_NAME}${TAG_VERSION}/icons/")
endif()
 
if(IS_ABSOLUTE ${ICONDIR} AND WANT_RELOCATABLE)
message(FATAL_ERROR "ERROR: ICONDIR must be relative when using WANT_RELOCATABLE option")
elseif(NOT IS_ABSOLUTE ${ICONDIR} AND NOT WANT_RELOCATABLE)
add_definitions(-DICONDIR="${CMAKE_INSTALL_PREFIX}/${ICONDIR}")
else()
add_definitions(-DICONDIR="${ICONDIR}")
endif()
 
#SAMPLES
if(WIN32)
set(SAMPLESDIR "${CMAKE_INSTALL_DATAROOTDIR}/samples/")
else()
set(SAMPLESDIR "${CMAKE_INSTALL_DATAROOTDIR}/${MAIN_DIR_NAME}${TAG_VERSION}/samples/")
endif()
 
if(IS_ABSOLUTE ${SAMPLESDIR} AND WANT_RELOCATABLE)
message(FATAL_ERROR "ERROR: SAMPLESDIR must be relative when using WANT_RELOCATABLE option")
elseif(NOT IS_ABSOLUTE ${SAMPLESDIR} AND NOT WANT_RELOCATABLE)
add_definitions(-DSAMPLESDIR="${CMAKE_INSTALL_PREFIX}/${SAMPLESDIR}")
else()
add_definitions(-DSAMPLESDIR="${SAMPLESDIR}")
endif()
 
#SCRIPTS
if(WIN32)
set(SCRIPTSDIR "${CMAKE_INSTALL_DATAROOTDIR}/scripts/")
else()
set(SCRIPTSDIR "${CMAKE_INSTALL_DATAROOTDIR}/${MAIN_DIR_NAME}${TAG_VERSION}/scripts/")
endif()
 
if(IS_ABSOLUTE ${SCRIPTSDIR} AND WANT_RELOCATABLE)
message(FATAL_ERROR "ERROR: SCRIPTSDIR must be relative when using WANT_RELOCATABLE option")
elseif(NOT IS_ABSOLUTE ${SCRIPTSDIR} AND NOT WANT_RELOCATABLE)
add_definitions(-DSCRIPTSDIR="${CMAKE_INSTALL_PREFIX}/${SCRIPTSDIR}")
else()
add_definitions(-DSCRIPTSDIR="${SCRIPTSDIR}")
endif()
 
#TEMPLATES
if(WIN32)
set(TEMPLATEDIR "${CMAKE_INSTALL_DATAROOTDIR}/templates/")
else()
set(TEMPLATEDIR "${CMAKE_INSTALL_DATAROOTDIR}/${MAIN_DIR_NAME}${TAG_VERSION}/templates/")
endif()
 
if(IS_ABSOLUTE ${TEMPLATEDIR} AND WANT_RELOCATABLE)
message(FATAL_ERROR "ERROR: TEMPLATEDIR must be relative when using WANT_RELOCATABLE option")
elseif(NOT IS_ABSOLUTE ${TEMPLATEDIR} AND NOT WANT_RELOCATABLE)
add_definitions(-DTEMPLATEDIR="${CMAKE_INSTALL_PREFIX}/${TEMPLATEDIR}")
else()
add_definitions(-DTEMPLATEDIR="${TEMPLATEDIR}")
endif()
 
#QML
if(WIN32)
set(QMLDIR "${CMAKE_INSTALL_DATAROOTDIR}/qml/")
else()
set(QMLDIR "${CMAKE_INSTALL_DATAROOTDIR}/${MAIN_DIR_NAME}${TAG_VERSION}/qml/")
endif()
 
if(IS_ABSOLUTE ${QMLDIR} AND WANT_RELOCATABLE)
message(FATAL_ERROR "ERROR: QMLDIR must be relative when using WANT_RELOCATABLE option")
elseif(NOT IS_ABSOLUTE ${QMLDIR} AND NOT WANT_RELOCATABLE)
add_definitions(-DQMLDIR="${CMAKE_INSTALL_PREFIX}/${QMLDIR}")
else()
add_definitions(-DQMLDIR="${QMLDIR}")
endif()
 
#DESKTOP
set(DESKTOPDIR "${CMAKE_INSTALL_DATAROOTDIR}/applications/")
 
if(IS_ABSOLUTE ${DESKTOPDIR} AND WANT_RELOCATABLE)
message(FATAL_ERROR "ERROR: DESKTOPDIR must be relative when using WANT_RELOCATABLE option")
elseif(NOT IS_ABSOLUTE ${DESKTOPDIR} AND NOT WANT_RELOCATABLE)
add_definitions(-DDESKTOPDIR="${CMAKE_INSTALL_PREFIX}/${DESKTOPDIR}")
else()
add_definitions(-DDESKTOPDIR="${DESKTOPDIR}")
endif()
 
#APPDATA
set(APPDATADIR "${CMAKE_INSTALL_DATAROOTDIR}/metainfo/")
 
if(IS_ABSOLUTE ${APPDATADIR} AND WANT_RELOCATABLE)
message(FATAL_ERROR "ERROR: APPDATADIR must be relative when using WANT_RELOCATABLE option")
elseif(NOT IS_ABSOLUTE ${APPDATADIR} AND NOT WANT_RELOCATABLE)
add_definitions(-DAPPDATADIR="${CMAKE_INSTALL_PREFIX}/${APPDATADIR}")
else()
add_definitions(-DAPPDATADIR="${APPDATADIR}")
endif()
 
 
# APPLICATION_DATA_DIR
# It allows specify the user configuration directory in the compile time.
# Example: I want to use special ~/.scribus135svn config directory for my trunk
# cmake -DAPPLICATION_DATA_DIR=.scribus135svn ...
if (APPLICATION_DATA_DIR)
message(STATUS "Using ApplicationDataDir ${APPLICATION_DATA_DIR} instead of the platform default.")
add_definitions(-DAPPLICATION_DATA_DIR="${APPLICATION_DATA_DIR}")
else()
message(STATUS "Using standard ApplicationDataDir. You can change it with -DAPPLICATION_DATA_DIR")
endif()
 
if (APPLICATION_CONFIG_DIR)
message(STATUS "Using ApplicationConfigDir ${APPLICATION_CONFIG_DIR} instead of the platform default.")
add_definitions(-DAPPLICATION_CONFIG_DIR="${APPLICATION_CONFIG_DIR}")
else()
message(STATUS "Using standard ApplicationConfigDir. You can change it with -DAPPLICATION_CONFIG_DIR")
endif()
 
#LIB LOCATION - lib or lib64 normally
#LIB
if(WANT_LIB64)
if(NOT ARCH_X86_64)
message(STATUS "WARNING: BUILDING 64 Bit build on non 64 bit architecture")
endif()
set(LIB_SUFFIX "64" CACHE STRING "Library directory suffix")
endif()
 
set(LIB_DIR_NAME "lib${LIB_SUFFIX}")
if (APPLEBUNDLE)
set(LIBDIR "lib/")
else()
set(LIBDIR "${LIB_DIR_NAME}/${MAIN_DIR_NAME}${TAG_VERSION}/")
endif()
 
if(IS_ABSOLUTE ${LIBDIR} AND WANT_RELOCATABLE)
message(FATAL_ERROR "ERROR: LIBDIR must be relative when using WANT_RELOCATABLE option")
elseif(NOT IS_ABSOLUTE ${LIBDIR} AND NOT WANT_RELOCATABLE)
add_definitions(-DLIBDIR="${CMAKE_INSTALL_PREFIX}/${LIBDIR}")
else()
add_definitions(-DLIBDIR="${LIBDIR}")
endif()
 
#PLUGINS
if(WIN32)
set(PLUGINDIR "plugins")
elseif (APPLEBUNDLE)
set(PLUGINDIR "${LIBDIR}")
else()
set(PLUGINDIR "${LIB_DIR_NAME}/${MAIN_DIR_NAME}${TAG_VERSION}/plugins/")
endif()
 
if(IS_ABSOLUTE ${PLUGINDIR} AND WANT_RELOCATABLE)
message(FATAL_ERROR "ERROR: PLUGINDIR must be relative when using WANT_RELOCATABLE option")
elseif(NOT IS_ABSOLUTE ${PLUGINDIR} AND NOT WANT_RELOCATABLE)
add_definitions(-DPLUGINDIR="${CMAKE_INSTALL_PREFIX}/${PLUGINDIR}")
else()
add_definitions(-DPLUGINDIR="${PLUGINDIR}")
endif()
 
 
#INCLUDE
set(INCLUDEDIR "include/${MAIN_DIR_NAME}${TAG_VERSION}/")
#NO ADD DEFINITIONS, WE ONLY INSTALL WITH IT
 
#RPATH
if (WANT_NORPATH OR WANT_DISTROBUILD)
set(CMAKE_INSTALL_RPATH "")
else()
set(CMAKE_INSTALL_RPATH ${PLUGINDIR})
endif()
 
# Set the XDG mime stuff
set(MIMEDIR "${CMAKE_INSTALL_DATAROOTDIR}/mime/packages/")
 
##############################################################################################################
########## Build Setup ##########
 
525,143 → 301,8
 
#Based on our build type, setup our build options
if(APPLE)
if(APPLE_10_15_X)
set(OSXMINVER "10.15" CACHE STRING "OSX 10.15")
if (WANT_OSX_SDK)
if(EXISTS("/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk"))
set(CMAKE_OSX_SYSROOT "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk")
elseif(EXISTS("/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk"))
set(CMAKE_OSX_SYSROOT "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk")
endif()
endif()
endif()
if(APPLE_10_14_X)
set(OSXMINVER "10.14" CACHE STRING "OSX 10.14")
if (WANT_OSX_SDK)
if(EXISTS("/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk"))
set(CMAKE_OSX_SYSROOT "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk")
elseif(EXISTS("/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk"))
set(CMAKE_OSX_SYSROOT "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk")
endif()
endif()
endif()
if(APPLE_10_13_X)
set(OSXMINVER "10.13" CACHE STRING "OSX 10.13")
if (WANT_OSX_SDK)
if(EXISTS("/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk"))
set(CMAKE_OSX_SYSROOT "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk")
elseif(EXISTS("/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk"))
set(CMAKE_OSX_SYSROOT "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk")
endif()
endif()
endif()
if(APPLE_10_12_X)
set(OSXMINVER "10.12" CACHE STRING "OSX 10.12")
if (WANT_OSX_SDK)
if(EXISTS("/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk"))
set(CMAKE_OSX_SYSROOT "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk")
elseif(EXISTS("/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk"))
set(CMAKE_OSX_SYSROOT "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk")
endif()
endif()
endif()
if(APPLE_10_11_X)
set(OSXMINVER "10.11" CACHE STRING "OSX 10.11")
if (WANT_OSX_SDK)
set(CMAKE_OSX_SYSROOT "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk")
endif()
endif()
if(APPLE_10_10_X)
set(OSXMINVER "10.10" CACHE STRING "OSX 10.10")
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.10")
if (WANT_OSX_SDK)
if(EXISTS("/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk"))
set(CMAKE_OSX_SYSROOT "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk")
elseif(EXISTS("/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk"))
set(CMAKE_OSX_SYSROOT "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk")
endif()
endif()
endif()
if(APPLE_10_9_X)
set(OSXMINVER "10.9" CACHE STRING "OSX 10.9")
if (WANT_OSX_SDK)
set(CMAKE_OSX_SYSROOT "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk")
endif()
endif()
if(APPLE_10_8_X)
set(OSXMINVER "10.8" CACHE STRING "OSX 10.8")
if (WANT_OSX_SDK)
set(CMAKE_OSX_SYSROOT "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk")
endif()
endif()
if(APPLE_10_7_X)
set(OSXMINVER "10.7" CACHE STRING "OSX 10.7")
if (WANT_OSX_SDK)
set(CMAKE_OSX_SYSROOT "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk")
endif()
endif()
if(APPLE_10_6_X)
set(OSXMINVER "10.6" CACHE STRING "OSX 10.6")
if (WANT_OSX_SDK)
set(CMAKE_OSX_SYSROOT "/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk")
endif()
endif()
if(APPLE_10_5_X)
set(OSXMINVER "10.5" CACHE STRING "OSX 10.5")
if (WANT_OSX_SDK)
set(CMAKE_OSX_SYSROOT "/Developer/SDKs/MacOSX10.5.sdk")
endif()
endif()
if(APPLE_10_4_X)
set(OSXMINVER "10.4" CACHE STRING "OSX 10.4")
if (WANT_OSX_SDK)
set(CMAKE_OSX_SYSROOT "/Developer/SDKs/MacOSX10.4u.sdk")
endif()
endif()
# gcc/mac
if(WANT_UNIVERSAL_BUNDLE)
message("Setting Universal (PPC/i386) Architecture for OSX Build/Bundle")
set(CMAKE_OSX_ARCHITECTURES "ppc;i386" )
set(CMAKE_TRY_COMPILE_OSX_ARCHITECTURES "ppc;i386" )
if (WANT_OSX_SDK)
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.4")
endif()
else()
if(ARCH_PPC OR ARCH_PPC_64)
message("Setting PPC Architecture for OSX Build/Bundle")
set(CMAKE_OSX_ARCHITECTURES "ppc" )
set(CMAKE_TRY_COMPILE_OSX_ARCHITECTURES "ppc" )
else()
if (WANT_OSX_SDK)
set(CMAKE_OSX_DEPLOYMENT_TARGET "${OSXMINVER}")
endif()
if(APPLE_10_6_X OR APPLE_10_7_X OR APPLE_10_8_X OR APPLE_10_9_X OR APPLE_10_10_X OR APPLE_10_11_X OR APPLE_10_12_X OR APPLE_10_13_X OR APPLE_10_14_X OR APPLE_10_15_X)
message("Setting x86_64 Architecture for OSX Build/Bundle")
set(CMAKE_OSX_ARCHITECTURES "x86_64" )
set(CMAKE_TRY_COMPILE_OSX_ARCHITECTURES "x86_64" )
else()
message("Setting i386 Architecture for OSX Build/Bundle")
set(CMAKE_OSX_ARCHITECTURES "i386" )
set(CMAKE_TRY_COMPILE_OSX_ARCHITECTURES "i386" )
endif()
endif()
endif()
message(STATUS "${CMAKE_OSX_ARCHITECTURES} ${CMAKE_OSX_SYSROOT}")
set(ENV{MACOSX_DEPLOYMENT_TARGET} ${OSXMINVER} )
set(ENV{LD_PREBIND} 1 )
set(ENV{LD_PREBIND_ALLOW_OVERLAP} 1 )
if (WANT_DEBUG)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 -g -fno-inline-functions -Wall -mmacosx-version-min=${OSXMINVER}")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O0 -g -fno-inline-functions -Wall -mmacosx-version-min=${OSXMINVER}")
endif()
if (WANT_RELEASEWITHDEBUG)
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -O2 -g -fno-inline-functions -Wall -mmacosx-version-min=${OSXMINVER}")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -O2 -g -fno-inline-functions -Wall -mmacosx-version-min=${OSXMINVER}")
endif()
if (NOT WANT_DEBUG AND NOT WANT_RELEASEWITHDEBUG)
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2 -fno-inline-functions -Wall -mmacosx-version-min=${OSXMINVER}")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O2 -fno-inline-functions -Wall -mmacosx-version-min=${OSXMINVER}")
endif()
### Include our Apple configure commands
include(CMakeLists_Apple.cmake)
else()
if(${CMAKE_GENERATOR} MATCHES "^(Visual Studio|NMake).*")
# Windows build with Visual Studio
697,92 → 338,6
set(DLL_USE_NATIVE_API ON)
endif()
 
##############################################################################################################
########## Find Dependencies ##########
 
#<< Qt
set(QT_MIN_VERSION "5.7.0")
set(CMAKE_PREFIX_PATH "${QT_PREFIX}/lib/cmake")
set(CMAKE_INCLUDE_CURRENT_DIR ON)
find_package(Qt5Core ${QT_MIN_VERSION} REQUIRED)
if(Qt5Core_FOUND)
message(STATUS "----- USE QT 5-----")
else()
message(FATAL_ERROR "ERROR: No QT 5 found")
endif()
find_package(Qt5Widgets ${QT_MIN_VERSION} REQUIRED)
if(Qt5Widgets_FOUND)
message(STATUS "----- USE QT Widgets-----")
else()
message(FATAL_ERROR "ERROR: No QT Widgets found")
endif()
find_package(Qt5Gui ${QT_MIN_VERSION} REQUIRED)
if(Qt5Gui_FOUND)
message(STATUS "----- USE Qt5Gui -----")
else()
message(FATAL_ERROR "ERROR: Qt5Gui found")
endif()
find_package(Qt5Xml ${QT_MIN_VERSION} REQUIRED)
if(Qt5Xml_FOUND)
message(STATUS "----- USE QT 5 XML -----")
else()
message(FATAL_ERROR "ERROR: No QT 5 XML found")
endif()
find_package(Qt5Network ${QT_MIN_VERSION} REQUIRED)
if(Qt5Network_FOUND)
message(STATUS "----- USE Qt5Network -----")
else()
message(FATAL_ERROR "ERROR: No Qt5Network found")
endif()
find_package(Qt5OpenGL ${QT_MIN_VERSION} REQUIRED)
if(Qt5OpenGL_FOUND)
message(STATUS "----- USE Qt5OpenGL -----")
else()
message(FATAL_ERROR "ERROR: No Qt5OpenGL found")
endif()
find_package(Qt5LinguistTools ${QT_MIN_VERSION} REQUIRED)
if(Qt5LinguistTools_FOUND)
message(STATUS "----- USE Qt5LinguistTools -----")
else()
message(FATAL_ERROR "ERROR: No Qt5LinguistTools found")
endif()
#find_package(Qt5Quick ${QT_MIN_VERSION} REQUIRED)
#if(Qt5Quick_FOUND)
# message(STATUS "----- USE Qt5Quick -----")
#else()
# message(FATAL_ERROR "ERROR: No Qt5Quick found")
#endif()
find_package(Qt5PrintSupport ${QT_MIN_VERSION} REQUIRED)
if(Qt5PrintSupport_FOUND)
message(STATUS "----- USE Qt5PrintSupport -----")
else()
message(FATAL_ERROR "ERROR: No Qt5PrintSupport found")
endif()
include_directories(${Qt5Core_INCLUDE_DIRS})
add_definitions(${Qt5Core_DEFINITIONS})
include_directories(${Qt5Widgets_INCLUDE_DIRS})
add_definitions(${Qt5Widgets_DEFINITIONS})
include_directories(${Qt5Gui_INCLUDE_DIRS})
add_definitions(${Qt5Gui_DEFINITIONS})
include_directories(${Qt5Xml_INCLUDE_DIRS})
add_definitions(${Qt5Xml_DEFINITIONS})
include_directories(${Qt5Network_INCLUDE_DIRS})
add_definitions(${Qt5Network_DEFINITIONS})
include_directories(${Qt5OpenGL_INCLUDE_DIRS})
add_definitions(${Qt5OpenGL_DEFINITIONS})
#include_directories(${Qt5Quick_INCLUDE_DIRS})
#add_definitions(${Qt5Quick_DEFINITIONS})
include_directories(${Qt5PrintSupport_INCLUDE_DIRS})
add_definitions(${Qt5PrintSupport_DEFINITIONS})
 
message(STATUS "Qt VERSION: ${Qt5Widgets_VERSION}")
#if (NOT WANT_CPP11 AND Qt5Widgets_VERSION_MAJOR EQUAL 5 AND Qt5Widgets_VERSION_MINOR GREATER 6)
# message(STATUS "Your Qt version is 5.7.0 or superior, enabling C++11 compiler features")
# set(WANT_CPP11 ON)
#endif()
#>> Qt
 
 
#C++11 Support
#as of 1.5.5.svn, require C++11
#if(WANT_CPP11)
797,240 → 352,12
set(CMAKE_CXX_STANDARD 17)
endif()
 
#<< ZLIB, PNG
if (WIN32)
# On win32 we can use Qt's zlib and libpng, so we use some
# custom cmake includes. This permits us to honour the
# USE_QT_ZLIB_PNGLIB flag if passed.
set(PNG_DIR ${CMAKE_MODULE_PATH})
set(ZLIB_DIR ${CMAKE_MODULE_PATH})
endif()
find_package(ZLIB REQUIRED)
if (ZLIB_FOUND)
message("ZLIB Library Found OK")
set(HAVE_LIBZ ON)
endif()
#find_package(PNG REQUIRED)
#if (PNG_FOUND)
# message("PNG Library Found OK")
#endif()
#>> ZLIB, PNG
##############################################################################################################
########## Find Dependencies ##########
### Include our Dependency finding commands
include(CMakeLists_Dependencies.cmake)
 
if (WANT_NOOSG)
message("Building without 3D Extension")
else()
find_package(OSG)
if(OSG_FOUND)
message("OSG found OK")
set(HAVE_OSG ON)
find_package(OpenGL)
include(CheckFunctionExists)
CHECK_FUNCTION_EXISTS(memrchr HAVE_MEMRCHR)
else()
message("No OSG found, building without 3D Extension")
endif()
endif()
 
#<< JPEG, TIFF
find_package(JPEG REQUIRED)
if (JPEG_FOUND)
message("JPEG Library Found OK")
endif()
find_package(TIFF REQUIRED)
if (TIFF_FOUND)
message("TIFF Library Found OK")
set(HAVE_TIFF ON)
else()
message(FATAL_ERROR "Could not find the TIFF Library")
endif()
#<< JPEG, TIFF
 
#<< PYTHON
#
#find_package(PythonInterp 2)
#find_package(PythonLibs 2 REQUIRED)
#if (PYTHON_LIBRARY)
# message("Python Library Found OK")
# set(HAVE_PYTHON ON)
# set(COMPILE_PYTHON ON)
#endif()
#
find_package (Python2 REQUIRED COMPONENTS Interpreter Development)
if (Python2_Development_FOUND)
message("Python Library Found OK")
set(HAVE_PYTHON ON)
set(COMPILE_PYTHON ON)
endif()
#>> PYTHON
 
#<< FreeType2
find_package(Freetype REQUIRED)
if (FREETYPE_FOUND)
message(STATUS "FreeType2 Library Found OK")
include(CheckLibraryExists)
CHECK_LIBRARY_EXISTS(${FREETYPE_LIBRARY} FT_Get_First_Char "" HAVE_FREETYPE_FIRST)
CHECK_LIBRARY_EXISTS(${FREETYPE_LIBRARY} FT_Get_Next_Char "" HAVE_FREETYPE_NEXT)
# here we have an alternative
# a) Setup CFLAGS with the FREETYPE_INCLUDE_DIR_freetype2 provided by cmake
# b) Insert ${FREETYPE_INCLUDE_DIRS} in include sections of CMakeLists that need it
# I prefer (b) and at some point & from my opinion it should be just needed in scribus/fonts/CmakeLists.txt - pm
else()
message(FATAL_ERROR "No Freetype Found")
endif()
#>> FreeType2
 
#<<Render Library
if (WANT_PRIVATE_CAIRO)
message("We no longer support the private cairo library as the latest public release is more up to date, setting WANT_SYSTEM_CAIRO=1")
endif()
 
if (RENDER_LIB)
if (RENDER_LIB STREQUAL "QTARTHUR")
message("Qt4's Arthur as renderer is not supported anymore, performing renderer detection again")
endif()
endif()
 
set(CAIRO_DIR ${CMAKE_MODULE_PATH})
find_package(CAIRO REQUIRED)
if(CAIRO_FOUND)
message("CAIRO Library Found OK")
set(RENDER_LIB "CAIRO_SYSTEM" CACHE STRING "Set render library to cairo")
else()
message(FATAL_ERROR "No Cairo Found")
endif()
#>>Render Library
 
#<<CUPS
if(NOT WIN32 AND NOT HAIKU)
find_package(Cups REQUIRED)
if(CUPS_FOUND)
set(HAVE_CUPS ON)
message("CUPS Library Found OK")
endif()
else()
# Windows doesn't use CUPS
set(CUPS_INCLUDE_DIR)
endif()
#>>CUPS
 
#<<LibXML2
find_package(LibXml2 REQUIRED)
if(LIBXML2_FOUND)
set(HAVE_XML ON)
message("LIBXML2 Library Found OK")
endif()
#>>LibXML2
 
#<<LittleCMS
set(LCMS_DIR ${CMAKE_MODULE_PATH})
find_package(LCMS2 REQUIRED)
if(LCMS2_FOUND)
set(HAVE_LCMS2 ON)
set(HAVE_CMS ON)
set(CMS_INC "\"lcms2.h\"")
message("LittleCMS-2 Library Found OK")
else()
message(FATAL_ERROR "Could not find the LittleCMS 2 Library")
endif()
#>>LittleCMS
 
#<<FontConfig
if(NOT WIN32)
set(FONTCONFIG_DIR ${CMAKE_MODULE_PATH})
find_package(FONTCONFIG)
if(FONTCONFIG_FOUND)
message("FontConfig Found OK")
set(HAVE_FONTCONFIG ON)
endif()
else()
# Windows builds neither use nor require fontconfig
set(FONTCONFIG_INCLUDE_DIR)
endif()
#>>FontConfig
 
#<<HUNSPELL for Speelling support
option(WANT_HUNSPELL "Enable support for spell checking with hunspell" ON)
if (WANT_HUNSPELL)
find_package(HUNSPELL)
if (HUNSPELL_FOUND)
message("Hunspell Found OK")
set(HAVE_HUNSPELL ON)
else()
message("Hunspell or its developer libraries NOT found - Disabling support for spell checking")
endif()
endif()
#>>HUNSPELL for Speelling support
 
#<<PoDoFo for AI PDF import
option(WITH_PODOFO "Enable support for PDF embedded in AI" ON)
if (WITH_PODOFO)
find_package(LIBPODOFO)
if (LIBPODOFO_FOUND)
message("PoDoFo found OK")
set(HAVE_PODOFO ON)
else()
message("PoDoFo NOT found - Disabling support for PDF embedded in AI")
endif()
endif()
#>>PoDoFo for AI PDF import
 
#<<Boost for 2Geom Tools
option(WITH_BOOST "Enable support for Boost based enhancements" ON)
if (WITH_BOOST)
find_package(Boost)
if (Boost_FOUND)
message("Boost Library Found OK")
set(HAVE_BOOST ON)
else()
message("Boost: NOT FOUND, not building 2geomtools")
endif()
endif()
#>>Boost for 2Geom Tools
 
#<< GraphicsMagick for image import
if (WANT_GRAPHICSMAGICK)
set(GMAGICK_DIR ${CMAKE_MODULE_PATH})
pkg_check_modules(GMAGICK GraphicsMagick)
# find_package(GMAGICK)
if(GMAGICK_FOUND)
message(" GraphicsMagick Found OK")
else()
message(" GraphicsMagick NOT found! Building without additional image format support!")
endif()
else()
message("Building without GraphicsMagick (use -DWANT_GRAPHICSMAGICK=1 to enable)")
endif()
#>> GraphicsMagick for image import
 
#<<Poppler for PDF import
find_package(POPPLER REQUIRED)
if (POPPLER_FOUND)
set(HAVE_POPPLER ON)
message(STATUS "Found poppler")
message(STATUS "Found poppler libs: ${POPPLER_LIBRARY}")
message(STATUS "Found poppler includes: ${POPPLER_INCLUDE_DIR}")
else()
message(FATAL_ERROR "Could not find poppler library")
endif()
#>>Poppler for PDF import
 
# librevenge for MsPub import
pkg_check_modules(LIBREVENGE librevenge-0.0)
if (LIBREVENGE_FOUND)
pkg_check_modules(LIBREVENGE_STREAM librevenge-stream-0.0)
if (LIBREVENGE_STREAM_FOUND)
pkg_check_modules(LIBREVENGE_GENERATORS librevenge-generators-0.0)
if (LIBREVENGE_GENERATORS_FOUND)
set(HAVE_REVENGE ON)
endif()
endif()
endif()
 
# CTL support
pkg_check_modules(HARFBUZZ REQUIRED harfbuzz>=0.9.42 harfbuzz-icu)
pkg_check_modules(ICU REQUIRED icu-uc)
 
 
##############################################################################################################
########## Include Setup ##########