Subversion Repositories Scribus

Rev

Rev 5144 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

#CMAKE SETUP
CMAKE_MINIMUM_REQUIRED(VERSION 2.3.4)
SET(CMAKE_COLOR_MAKEFILE ON)
SET(CMAKE_VERBOSE_MAKEFILE ON)
SET(CMAKE_INCLUDE_CURRENT_DIR TRUE)
SET(CMAKE_BUILD_WITH_INSTALL_RPATH ON)
SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules")
# SET(CMAKE_SHARED_MODULE_LINK_FLAGS "${CMAKE_SHARED_MODULE_LINK_FLAGS} -export-dynamic")
# SET(CMAKE_SHARED_MODULE_LINK_CXX_FLAGS "${CMAKE_SHARED_MODULE_LINK_CXX_FLAGS} -export-dynamic")
# SET(CMAKE_SHARED_LIBRARY_C_FLAGS "${CMAKE_SHARED_LIBRARY_C_FLAGS} -export-dynamic")
# SET(CMAKE_SHARED_LIBRARY_CXX_FLAGS "${CMAKE_SHARED_LIBRARY_CXX_FLAGS} -export-dynamic")
# MESSAGE(STATUS ${CMAKE_SHARED_MODULE_LINK_FLAGS})
# MESSAGE(STATUS ${CMAKE_SHARED_MODULE_LINK_CXX_FLAGS})
# MESSAGE(STATUS ${CMAKE_SHARED_LIBRARY_C_FLAGS})
# MESSAGE(STATUS ${CMAKE_SHARED_LIBRARY_CXX_FLAGS})
# MESSAGE(STATUS ${CMAKE_CXX_CREATE_SHARED_MODULE})
# MESSAGE(STATUS ${CMAKE_CXX_CREATE_SHARED_LIBRARY})

#IMPORT FROM COMMANDLINE
# SET with cmake -DWANT_CAIRO=1, etc
# MESSAGE(STATUS ${WANT_CAIRO})
# MESSAGE(STATUS ${WANT_LIBART})
# MESSAGE(STATUS ${WANT_LCMS})
# MESSAGE(STATUS ${WANT_DEBUG})
#NO CAIRO SUPPORT YET
SET(MAIN_DIR_NAME "scribus")
SET(WANT_CAIRO 0)
SET(WANT_LIBART 1)

#PROJECT SETUP
PROJECT(scribus)
SET (VERSION 1.3.4cvs)
MESSAGE(STATUS "Scribus will be built to install into ${CMAKE_INSTALL_PREFIX}")

SET(PLUGIN_PERMISSIONS WORLD_EXECUTE GROUP_EXECUTE OWNER_EXECUTE WORLD_READ GROUP_READ OWNER_READ OWNER_WRITE)

SET(MANDIR "man/")
SET(SHAREDIR "share/${MAIN_DIR_NAME}/")
ADD_DEFINITIONS("-DSHAREDIR=\\\"${CMAKE_INSTALL_PREFIX}/${SHAREDIR}\\\"")
SET(DOCDIR "share/${MAIN_DIR_NAME}/doc/")
ADD_DEFINITIONS("-DDOCDIR=\\\"${CMAKE_INSTALL_PREFIX}/${DOCDIR}\\\"")
SET(ICONDIR "share/${MAIN_DIR_NAME}/icons/")
ADD_DEFINITIONS("-DICONDIR=\\\"${CMAKE_INSTALL_PREFIX}/${ICONDIR}\\\"")
SET(SAMPLESDIR "share/${MAIN_DIR_NAME}/samples/")
ADD_DEFINITIONS("-DSAMPLESDIR=\\\"${CMAKE_INSTALL_PREFIX}/${SAMPLESDIR}\\\"")
SET(SCRIPTSDIR "share/${MAIN_DIR_NAME}/scripts/")
ADD_DEFINITIONS("-DSCRIPTSDIR=\\\"${CMAKE_INSTALL_PREFIX}/${SCRIPTSDIR}\\\"")
SET(TEMPLATEDIR "share/${MAIN_DIR_NAME}/templates/")
ADD_DEFINITIONS("-DTEMPLATEDIR=\\\"${CMAKE_INSTALL_PREFIX}/${TEMPLATEDIR}\\\"")
SET(LIBDIR "lib/${MAIN_DIR_NAME}/")
ADD_DEFINITIONS("-DLIBDIR=\\\"${CMAKE_INSTALL_PREFIX}/${LIBDIR}\\\"")
SET(PLUGINDIR "lib/${MAIN_DIR_NAME}/plugins/")
ADD_DEFINITIONS("-DPLUGINDIR=\\\"${CMAKE_INSTALL_PREFIX}/${PLUGINDIR}\\\"")
set(CMAKE_INSTALL_RPATH ${PLUGINDIR})

#BUILD SETUP
#None, Debug, Release, .. or custom ones
SET(WANT_DEBUG 1)
IF(WANT_DEBUG)
  SET(CMAKE_BUILD_TYPE Debug)
ELSE(WANT_DEBUG)
  SET(CMAKE_BUILD_TYPE RELEASE)
ENDIF(WANT_DEBUG)

SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g3")
SET(CMAKE_C_FLAGS_DEBUG "-O0 -g3")
SET(CMAKE_CXX_FLAGS_RELEASE "-O2")
SET(CMAKE_C_FLAGS_RELEASE "-O2")

#FIND DEPENDENCIES
# START QT
SET (QT_MT_REQUIRED true)
FIND_PACKAGE(Qt3 REQUIRED)
IF (QT_FOUND)
  MESSAGE("Qt3 Found OK")
#  MESSAGE($ENV{QTDIR})
#  MESSAGE(${QT_MOC_EXECUTABLE})
#  MESSAGE(${QT_UIC_EXECUTABLE})
#  MESSAGE(${QT_QT_LIBRARY})
#  MESSAGE(${QT_INCLUDE_DIR})
ELSE(QT_FOUND)
  MESSAGE(FATAL_ERROR "No Qt3")
ENDIF(QT_FOUND)
# END QT
# START PNG, JPEG, TIFF
FIND_PACKAGE(PNG REQUIRED)
IF (PNG_FOUND)
  MESSAGE("PNG Library Found OK")
ENDIF(PNG_FOUND)
FIND_PACKAGE(JPEG REQUIRED)
IF (JPEG_FOUND)
  MESSAGE("JPEG Library Found OK")
ENDIF(JPEG_FOUND)
FIND_PACKAGE(TIFF REQUIRED)
IF (TIFF_FOUND)
  MESSAGE("TIFF Library Found OK")
  SET(HAVE_TIFF 1)
ENDIF(TIFF_FOUND)
FIND_PACKAGE(ZLIB REQUIRED)
IF (ZLIB_FOUND)
  MESSAGE("ZLIB Library Found OK")
  SET(HAVE_LIBZ 1)
ENDIF(ZLIB_FOUND)
FIND_PACKAGE(PythonLibs REQUIRED)
IF (PYTHON_LIBRARY)
  MESSAGE("Python Library Found OK")
  SET(HAVE_PYTHON 1)
  SET(COMPILE_PYTHON 1)
ENDIF(PYTHON_LIBRARY)

# START FREETYPE
SET(FREETYPE_DIR ${CMAKE_MODULE_PATH})
FIND_PACKAGE(FREETYPE REQUIRED)
IF (FREETYPE_FOUND)
  MESSAGE("FreeType2 Library Found OK")
ENDIF(FREETYPE_FOUND)
FIND_PROGRAM(FREETYPE_CONFIG NAMES freetype-config PATHS ${prefix}/bin ${exec_prefix}/bin /usr/local/bin /opt/local/bin /usr/bin /usr/nekoware/bin /usr/X11/bin)
EXEC_PROGRAM(${FREETYPE_CONFIG} ARGS --libs OUTPUT_VARIABLE LIBFREETYPE_LIBS)
EXEC_PROGRAM(${FREETYPE_CONFIG} ARGS --cflags OUTPUT_VARIABLE LIBFREETYPE_CFLAGS)
CHECK_LIBRARY_EXISTS(libfreetype.so FT_Get_First_Char "" HAVE_FREETYPE_FIRST)
CHECK_LIBRARY_EXISTS(libfreetype.so FT_Get_Next_Char "" HAVE_FREETYPE_NEXT)
#FIXME: if cflags empty add, otherwise replace as now
SET(CFLAGS "${LIBFREETYPE_CFLAGS}")
# END FREETYPE

# START LIBART_LGPL
IF (WANT_LIBART OR NOT WANT_CAIRO)
  SET(LIBART_LGPL_DIR ${CMAKE_MODULE_PATH})
  FIND_PACKAGE(LIBART_LGPL REQUIRED)
  SET(USE_LIBART 1)
  IF(LIBART_LGPL_FOUND)
    MESSAGE("Libart_LGPL Library Found OK")
  ENDIF(LIBART_LGPL_FOUND)
ELSE (WANT_LIBART OR NOT WANT_CAIRO)
  # START CAIRO
  IF(CAIRO_FOUND)
    MESSAGE("CAIRO Library Found OK")
  ELSE(CAIRO_FOUND)
    SET(USE_LIBART 0)
  ENDIF(CAIRO_FOUND)
  # END CAIRO
ENDIF (WANT_LIBART OR NOT WANT_CAIRO)
# END LIBART_LGPL

# START CUPS
SET(CUPS_DIR ${CMAKE_MODULE_PATH})
FIND_PACKAGE(CUPS REQUIRED)
IF(CUPS_FOUND)
  SET(HAVE_CUPS 1)
  MESSAGE("CUPS Library Found OK")
#   MESSAGE(STATUS ${CUPS_INCLUDE_DIR})
#   MESSAGE(STATUS ${CUPS_LIBRARIES})
ENDIF(CUPS_FOUND)
# END CUPS

# START LIBXML2
SET(LIBXML2_DIR ${CMAKE_MODULE_PATH})
FIND_PACKAGE(LIBXML2 REQUIRED)
IF(LIBXML2_FOUND)
  SET(HAVE_XML 1)
  MESSAGE("LIBXML2 Library Found OK")
ENDIF(LIBXML2_FOUND)
# END LIBXML2

# START LCMS
SET(LCMS_DIR ${CMAKE_MODULE_PATH})
FIND_PACKAGE(LCMS REQUIRED)
IF(LCMS_FOUND)
  SET(HAVE_CMS 1)
  SET(CMS_INC "lcms.h")
  MESSAGE("LittleCMS Library Found OK")
ENDIF(LCMS_FOUND)
# END LCMS

# START FONTCONFIG
SET(FONTCONFIG_DIR ${CMAKE_MODULE_PATH})
FIND_PACKAGE(FONTCONFIG)
IF(FONTCONFIG_FOUND)
        MESSAGE("FontConfig Found OK")
        SET(HAVE_FONTCONFIG 1)
ENDIF(FONTCONFIG_FOUND)
# END FONTCONFIG

ADD_DEFINITIONS(${QT_DEFINITIONS})

CHECK_INCLUDE_FILE("dlfcn.h" HAVE_DLFCN_H)
IF(HAVE_DLFCN_H)
  ADD_DEFINITIONS(-DHAVE_DLFCN_H)
ENDIF(HAVE_DLFCN_H)

CHECK_INCLUDE_FILE("unistd.h" HAVE_UNISTD_H)
IF(HAVE_UNISTD_H)
  ADD_DEFINITIONS(-DHAVE_UNISTD_H)
ENDIF(HAVE_UNISTD_H)

CHECK_INCLUDE_FILE("sys/types.h" HAVE_SYS_TYPES_H)
# IF(HAVE_SYS_TYPES_H)
#   ADD_DEFINITIONS(-DHAVE_SYS_TYPES_H)
# ENDIF(HAVE_SYS_TYPES_H)

CHECK_INCLUDE_FILE("sys/stat.h" HAVE_SYS_STAT_H)
# IF(HAVE_SYS_STAT_H)
#   ADD_DEFINITIONS(-DHAVE_SYS_STAT_H)
# ENDIF(HAVE_SYS_STAT_H)


INCLUDE (ConfigureChecks.cmake)
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h)
ADD_DEFINITIONS("-DHAVE_CONFIG_H")

SET(SCRIBUSQT_DIR ${CMAKE_MODULE_PATH})
FIND_PACKAGE(SCRIBUSQT)

INCLUDE_DIRECTORIES(
${QT_INCLUDE_DIR}
${QT_INCLUDE_PATH}
${CUPS_INCLUDE_DIR}
${FREETYPE_INCLUDE_DIR}
${FONTCONFIG_INCLUDE_DIR}
${LCMS_INCLUDE_DIR}
${LIBART_LGPL_INCLUDE_DIR}
${LIBXML2_INCLUDE_DIR}
${PYTHON_INCLUDE_PATH}
${TIFF_INCLUDE_DIR}
${ZLIB_INCLUDE_DIR}
)

LINK_LIBRARIES (
${QT_QT_LIBRARY}
${CUPS_LIBRARIES}
${FREETYPE_LIBRARIES}
${FONTCONFIG_LIBRARIES}
${LCMS_LIBRARIES}
${LIBART_LGPL_LIBRARIES}
${LIBXML2_LIBRARIES}
${PYTHON_LIBRARIES}
${TIFF_LIBRARIES}
${ZLIB_LIBRARIES}
)

IF(WIN32)
  LINK_LIBRARIES(
    ${QT_QTMAIN_LIBRARY}
  )
ENDIF(WIN32)

IF(WIN32)
  ADD_DEFINITIONS(-DQT_DLL)
ENDIF(WIN32)

ADD_SUBDIRECTORY(scribus)

INSTALL(FILES
AUTHORS
BUILDING
ChangeLog
ChangeLogCVS
COPYING
INSTALL
NEWS
PACKAGING
README
README.MacOSX
TODO
scribus.xml
  DESTINATION ${DOCDIR}
)