CMakeLists.txt revision 09d4368364c2e5a7f7ccae9392ca6275d6516e6c
2N/Acmake_minimum_required(VERSION 2.8.0)
2N/A
2N/Amessage("------------------------------")
2N/Amessage("Building Makefile for Inkscape")
2N/Amessage("------------------------------")
2N/Amessage("Source Dir: ${CMAKE_CURRENT_SOURCE_DIR}")
2N/Amessage("Binary Dir: ${CMAKE_CURRENT_BINARY_DIR}")
2N/A
2N/A# -----------------------------------------------------------------------------
2N/A# CMake Configuration
2N/A# -----------------------------------------------------------------------------
2N/Alist(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMakeScripts/Modules")
2N/A
2N/A# avoid having empty buildtype
2N/Aset(CMAKE_BUILD_TYPE_INIT "Release")
2N/A
2N/Aproject(inkscape)
2N/A
2N/Aset(INKSCAPE_VERSION 0.91+devel)
2N/Aset(PROJECT_NAME inkscape)
2N/Aset(CMAKE_INCLUDE_CURRENT_DIR TRUE)
2N/A
2N/Acmake_policy(SET CMP0003 NEW) # don't be prolific with library paths
2N/Acmake_policy(SET CMP0005 NEW) # proper define quoting
2N/Acmake_policy(SET CMP0009 NEW) # don't follow symbolic links when using GLOB
2N/A
2N/A# workaround for omission in cmake 2.8.4's GNU.cmake, fixed in 2.8.5
2N/Aif(CMAKE_COMPILER_IS_GNUCC)
2N/A if(NOT DARWIN)
2N/A set(CMAKE_INCLUDE_SYSTEM_FLAG_C "-isystem ")
2N/A endif()
2N/Aendif()
2N/A
2N/Ainclude(CMakeScripts/HelperFunctions.cmake)
2N/A
2N/A# -----------------------------------------------------------------------------
2N/A# Set platform defaults (originally copied from darktable)
2N/A# -----------------------------------------------------------------------------
2N/Aif(APPLE)
2N/A message("-- Mac OS X build detected, setting default features")
2N/A # prefer macports and/or user-installed libraries over system ones
2N/A #LIST(APPEND CMAKE_PREFIX_PATH /opt/local /usr/local)
2N/A set(CMAKE_FIND_FRAMEWORK "LAST")
2N/A
2N/A # test and display relevant env variables
2N/A if(DEFINED ENV{CMAKE_PREFIX_PATH})
2N/A message("CMAKE_PREFIX_PATH: $ENV{CMAKE_PREFIX_PATH}")
2N/A endif()
2N/A if(DEFINED ENV{GTKMM_BASEPATH})
2N/A message("GTKMM_BASEPATH: $ENV{GTKMM_BASEPATH}")
2N/A endif()
2N/A
2N/A # detect current GTK+ backend
2N/A pkg_check_variable(gtk+-2.0 target)
2N/A message("GTK2 backend: ${GTK+_2.0_TARGET}")
2N/A
2N/Aendif(APPLE)
2N/A
2N/A# -----------------------------------------------------------------------------
2N/A# Redirect output files
2N/A# -----------------------------------------------------------------------------
2N/Aset(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin CACHE INTERNAL "" )
2N/Aset(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib CACHE INTERNAL "" )
2N/A
2N/A# -----------------------------------------------------------------------------
2N/A# Test Harness
2N/A# -----------------------------------------------------------------------------
2N/Aset(GMOCK_DIR "${CMAKE_SOURCE_DIR}/gtest/gmock-1.7.0"
2N/A CACHE PATH "The path to the GoogleMock test framework.")
2N/A
2N/Aif(EXISTS "${GMOCK_DIR}" AND IS_DIRECTORY "${GMOCK_DIR}")
2N/A set(GMOCK_PRESENT ON)
2N/Aelse()
2N/A message("No gmock/gtest found! Perhaps you wish to run 'bash download-gtest.sh' to download it.")
2N/Aendif()
2N/A
2N/A# -----------------------------------------------------------------------------
2N/A# Options
2N/A# -----------------------------------------------------------------------------
2N/Aoption(WITH_DBUS "Compile with support for DBus interface" OFF)
2N/Aoption(ENABLE_LCMS "Compile with LCMS support" ON)
2N/Aoption(WITH_GNOME_VFS "Compile with support for Gnome VFS" ON)
2N/A#option(WITH_INKJAR "Enable support for openoffice files (SVG jars)" ON)
2N/Aoption(WITH_GTEST "Compile with Google Test support" ${GMOCK_PRESENT})
2N/Aoption(WITH_OPENMP "Compile with OpenMP support" ON)
2N/A
2N/Aoption(WITH_PROFILING "Turn on profiling" OFF) # Set to true if compiler/linker should enable profiling
2N/A
2N/Aoption(ENABLE_POPPLER "Compile with support of libpoppler" ON)
2N/Aoption(ENABLE_POPPLER_CAIRO "Compile with support of libpoppler-cairo for rendering PDF preview (depends on ENABLE_POPPLER)" ON)
2N/Aoption(WITH_IMAGE_MAGICK "Compile with support of ImageMagick for raster extensions and image import resolution" ON)
2N/Aoption(WITH_LIBCDR "Compile with support of libcdr for CorelDRAW Diagrams" ON)
2N/Aoption(WITH_LIBVISIO "Compile with support of libvisio for Microsoft Visio Diagrams" ON)
2N/Aoption(WITH_LIBWPG "Compile with support of libwpg for WordPerfect Graphics" ON)
2N/Aoption(WITH_NLS "Compile with Native Language Support (using gettext)" ON)
2N/Aoption(WITH_GTK3_EXPERIMENTAL "Enable compilation with GTK+3 (EXPERIMENTAL!)" OFF)
2N/A
2N/Ainclude(CMakeScripts/ConfigPaths.cmake) # Installation Paths
2N/Ainclude(CMakeScripts/DefineDependsandFlags.cmake) # Includes, Compiler Flags, and Link Libraries
2N/Ainclude(CMakeScripts/HelperMacros.cmake) # Misc Utility Macros
2N/A
2N/A
2N/A# -----------------------------------------------------------------------------
2N/A# BAD HACKS, NEED TO INVESTIGATE MAKING THESE LESS BAD
2N/Aadd_definitions(-D_FORTIFY_SOURCE=2)
2N/Aadd_definitions(-DORBIT2=1)
2N/Aadd_definitions(-DHAVE_CONFIG_H)
2N/Aadd_definitions(-DHAVE_CAIRO_PDF=1) # needed for src/libnrtype/Layout-TNG.h
2N/Aadd_definitions(-DHAVE_TR1_UNORDERED_SET) # XXX make an option!
2N/A#
2N/A# end badness
2N/A# -----------------------------------------------------------------------------
2N/A
2N/A# -----------------------------------------------------------------------------
2N/A# Dist Target
2N/A# -----------------------------------------------------------------------------
2N/Aset(INKSCAPE_DIST_PREFIX "${PROJECT_NAME}-${INKSCAPE_VERSION}")
2N/Aadd_custom_target(dist
2N/A COMMAND bzr export --root=${INKSCAPE_DIST_PREFIX}
2N/A "${CMAKE_BINARY_DIR}/${INKSCAPE_DIST_PREFIX}.tar.bz2"
2N/A WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}")
2N/A
2N/A# -----------------------------------------------------------------------------
2N/A# Uninstall Target
2N/A# -----------------------------------------------------------------------------
2N/Aconfigure_file(
2N/A "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
2N/A "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
2N/A IMMEDIATE @ONLY)
2N/A
2N/Aadd_custom_target(uninstall
2N/A "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
2N/A
2N/A
2N/A# -----------------------------------------------------------------------------
2N/A# Subdirs (on only 1 atm), but a lot happens here
2N/A# -----------------------------------------------------------------------------
2N/Aadd_subdirectory(src)
2N/Aif(ENABLE_NLS)
2N/A add_subdirectory(po)
2N/Aendif(ENABLE_NLS)
2N/A
2N/A
2N/A# -----------------------------------------------------------------------------
2N/A# Man pages
2N/A# -----------------------------------------------------------------------------
2N/Ainclude("CMakeScripts/Pod2man.cmake")
2N/A
2N/A# Load AUTHORS file contents into $INKSCAPE_AUTHORS
2N/Afile(READ ${CMAKE_CURRENT_SOURCE_DIR}/AUTHORS content)
2N/Astring(REGEX REPLACE "^([^\n#]+)\n" "\\1;\n" content_list "${content}")
2N/Ajoin(INKSCAPE_AUTHORS "," "${content_list}")
2N/A
2N/Aforeach(podfile
2N/A man/inkscape.pod
2N/A man/inkscape.de.pod
2N/A man/inkscape.el.pod
2N/A man/inkscape.fr.pod
2N/A man/inkscape.ja.pod
2N/A man/inkscape.sk.pod
2N/A man/inkscape.zh_TW.pod
2N/A man/inkview.pod)
2N/A set(POD_IN ${CMAKE_CURRENT_SOURCE_DIR}/${podfile}.in)
2N/A set(POD_OUT ${CMAKE_CURRENT_BINARY_DIR}/${podfile})
2N/A configure_file(${POD_IN} ${POD_OUT})
2N/A pod2man(${POD_OUT} ${INKSCAPE_VERSION} 1 "Inkscape Commands Manual")
2N/Aendforeach()
2N/A
2N/A# -----------------------------------------------------------------------------
2N/A# Installation
2N/A# -----------------------------------------------------------------------------
2N/Aif(UNIX)
2N/A install(
2N/A PROGRAMS ${EXECUTABLE_OUTPUT_PATH}/inkscape ${EXECUTABLE_OUTPUT_PATH}/inkview
2N/A DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
2N/A )
2N/A
2N/A install(
2N/A FILES ${CMAKE_BINARY_DIR}/inkscape.desktop
2N/A DESTINATION ${CMAKE_INSTALL_PREFIX}/${SHARE_INSTALL}/applications
2N/A )
2N/A
2N/A # this should probably be done no matter what the platform is, just set SHARE_INSTALL first
2N/A add_subdirectory(share)
2N/A
2N/Aelse()
2N/A # TODO, WIN32, APPLE/OSX, MinGW
2N/Aendif()
2N/A
2N/A# -----------------------------------------------------------------------------
2N/A# Clean
2N/A# -----------------------------------------------------------------------------
2N/Aadd_custom_target(clean-cmake-files
2N/A COMMAND "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_SOURCE_DIR}/CMakeScripts/CleanAll.cmake"
2N/A)
2N/A
2N/Aadd_custom_target(clean-all
2N/A COMMAND ${CMAKE_BUILD_TOOL} clean
2N/A COMMAND "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_SOURCE_DIR}/CMakeScripts/CleanAll.cmake"
2N/A)
2N/A
2N/A#-----------------------------------------------------------------------------
2N/A
2N/Aadd_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND})
2N/A
2N/Aif(WITH_GTEST)
2N/A enable_testing()
2N/A add_subdirectory(test EXCLUDE_FROM_ALL)
2N/Aendif()
2N/A
2N/A# ----------------------------------------------------------------------
2N/A# Information Summary
2N/A# ----------------------------------------------------------------------
2N/Amessage("------------------------------------------------------------------------")
2N/Amessage("Configuration Summary")
2N/Amessage("------------------------------------------------------------------------")
2N/A# project info
2N/Amessage("PROJECT_NAME: ${PROJECT_NAME}")
2N/Amessage("INKSCAPE_VERSION: ${INKSCAPE_VERSION}")
2N/Amessage("INKSCAPE_DIST_PREFIX: ${INKSCAPE_DIST_PREFIX}")
2N/Amessage("")
2N/A
2N/A# cmake info
2N/Amessage("CMAKE_BINARY_DIR: ${CMAKE_BINARY_DIR}")
2N/Amessage("CMAKE_SYSTEM_NAME: ${CMAKE_SYSTEM_NAME}")
2N/Amessage("CMAKE_SYSTEM_VERSION: ${CMAKE_SYSTEM_VERSION}")
2N/Amessage("CMAKE_SYSTEM_PROCESSOR: ${CMAKE_SYSTEM_PROCESSOR}")
2N/Amessage("CMAKE_C_COMPILER: ${CMAKE_C_COMPILER}")
2N/Amessage("CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER}")
2N/Amessage("CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
2N/Amessage("")
2N/A
2N/A# dependency info
2N/Amessage("ENABLE_LCMS: ${ENABLE_LCMS}")
2N/Amessage("ENABLE_POPPLER: ${ENABLE_POPPLER}")
2N/Amessage("ENABLE_POPPLER_CAIRO: ${ENABLE_POPPLER_CAIRO}")
2N/Amessage("GMOCK_PRESENT: ${GMOCK_PRESENT}")
2N/Amessage("WITH_DBUS: ${WITH_DBUS}")
2N/Amessage("WITH_GNOME_VFS: ${WITH_GNOME_VFS}")
2N/Amessage("WITH_GTEST: ${WITH_GTEST}")
2N/Amessage("WITH_GTK3_EXPERIMENTAL: ${WITH_GTK3_EXPERIMENTAL}")
2N/Amessage("WITH_GTKSPELL: ${WITH_GTKSPELL}")
2N/Amessage("WITH_IMAGE_MAGICK: ${WITH_IMAGE_MAGICK}")
2N/Amessage("WITH_LIBCDR: ${WITH_LIBCDR}")
2N/Amessage("WITH_LIBVISIO: ${WITH_LIBVISIO}")
2N/Amessage("WITH_LIBWPG: ${WITH_LIBWPG}")
2N/Amessage("WITH_NLS: ${WITH_NLS}")
2N/Amessage("WITH_OPENMP: ${WITH_OPENMP}")
2N/Amessage("WITH_PROFILING: ${WITH_PROFILING}")
2N/Amessage("------------------------------------------------------------------------")
2N/A