diff options
| author | Sebastian Faubel <sebastian@semiodesk.com> | 2016-07-02 17:15:39 +0000 |
|---|---|---|
| committer | Sebastian Faubel <sebastian@semiodesk.com> | 2016-07-02 17:15:39 +0000 |
| commit | 495ac0773c4341589f1cd9108c9de3daf5b78c2c (patch) | |
| tree | 7198d6f9c4cd251ed2ae6598b1d1805c2909193b | |
| parent | Fix bug#168286 also opem regression on bug#1594565 (diff) | |
| download | inkscape-495ac0773c4341589f1cd9108c9de3daf5b78c2c.tar.gz inkscape-495ac0773c4341589f1cd9108c9de3daf5b78c2c.zip | |
Merge with trunk.
(bzr r15002.1.1)
| -rw-r--r-- | CMakeLists.txt | 290 | ||||
| -rw-r--r-- | CMakeScripts/ConfigPaths.cmake | 150 | ||||
| -rw-r--r-- | CMakeScripts/DefineDependsandFlags.cmake | 88 | ||||
| -rw-r--r-- | config.h.cmake | 8 | ||||
| -rw-r--r-- | src/CMakeLists.txt | 64 |
5 files changed, 465 insertions, 135 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 94dbf60df..74aa54214 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,6 +7,59 @@ message("Source Dir: ${CMAKE_CURRENT_SOURCE_DIR}") message("Binary Dir: ${CMAKE_CURRENT_BINARY_DIR}") # ----------------------------------------------------------------------------- +# Set platform defaults (originally copied from darktable) +# ----------------------------------------------------------------------------- +include(CMakeScripts/ConfigPaths.cmake) + +if(WIN32) + message("-- Windows build detected, setting default features") + + list(INSERT CMAKE_SYSTEM_INCLUDE_PATH 0 ${DEVLIBS_PATH}) + list(INSERT CMAKE_SYSTEM_LIBRARY_PATH 0 ${DEVLIBS_PATH}) + + set(CMAKE_C_COMPILER "${MINGW_BIN}/gcc.exe") + set(CMAKE_C_LINK_EXECUTABLE "${MINGW_BIN}/gcc.exe") + set(CMAKE_CXX_COMPILER "${MINGW_BIN}/g++.exe") + set(CMAKE_CXX_LINK_EXECUTABLE "${MINGW_BIN}/g++.exe") + set(CMAKE_CXX_STANDARD 11) + + # Setup Windows resource files compiler. + set(CMAKE_RC_COMPILER "${MINGW_BIN}/windres.exe") + set(CMAKE_RC_COMPILER_INIT windres) + enable_language(RC) + set(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> -O coff -i <SOURCE> -o <OBJECT>") + + # These options are required for having i18n support on Windows. + option(ENABLE_NLS "Compile with Native Language Support (using gettext)" ON) + option(HAVE_BIND_TEXTDOMAIN_CODESET "Compile with 'bind_textdomain_codeset' function" ON) + + # Does not compile on Windows with these options. + option(BR_PTHREADS "Use binreloc thread support" OFF) + option(ENABLE_BINRELOC "Use AutoPackage" OFF) +endif(WIN32) + +if(APPLE) + message("-- Mac OS X build detected, setting default features") + + # prefer macports and/or user-installed libraries over system ones + #LIST(APPEND CMAKE_PREFIX_PATH /opt/local /usr/local) + set(CMAKE_FIND_FRAMEWORK "LAST") + + # test and display relevant env variables + if(DEFINED ENV{CMAKE_PREFIX_PATH}) + message("CMAKE_PREFIX_PATH: $ENV{CMAKE_PREFIX_PATH}") + endif() + + if(DEFINED ENV{GTKMM_BASEPATH}) + message("GTKMM_BASEPATH: $ENV{GTKMM_BASEPATH}") + endif() + + # detect current GTK+ backend + pkg_check_variable(gtk+-2.0 target) + message("GTK2 backend: ${GTK+_2.0_TARGET}") +endif(APPLE) + +# ----------------------------------------------------------------------------- # CMake Configuration # ----------------------------------------------------------------------------- list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMakeScripts/Modules") @@ -19,6 +72,7 @@ project(inkscape) set(INKSCAPE_VERSION 0.92pre1) set(PROJECT_NAME inkscape) set(CMAKE_INCLUDE_CURRENT_DIR TRUE) + if(APPLE) SET(CMAKE_MACOSX_RPATH TRUE) SET(CMAKE_INSTALL_RPATH "@loader_path/../lib/inkscape") @@ -41,29 +95,6 @@ endif() include(CMakeScripts/HelperFunctions.cmake) # ----------------------------------------------------------------------------- -# Set platform defaults (originally copied from darktable) -# ----------------------------------------------------------------------------- -if(APPLE) - message("-- Mac OS X build detected, setting default features") - # prefer macports and/or user-installed libraries over system ones - #LIST(APPEND CMAKE_PREFIX_PATH /opt/local /usr/local) - set(CMAKE_FIND_FRAMEWORK "LAST") - - # test and display relevant env variables - if(DEFINED ENV{CMAKE_PREFIX_PATH}) - message("CMAKE_PREFIX_PATH: $ENV{CMAKE_PREFIX_PATH}") - endif() - if(DEFINED ENV{GTKMM_BASEPATH}) - message("GTKMM_BASEPATH: $ENV{GTKMM_BASEPATH}") - endif() - - # detect current GTK+ backend - pkg_check_variable(gtk+-2.0 target) - message("GTK2 backend: ${GTK+_2.0_TARGET}") - -endif(APPLE) - -# ----------------------------------------------------------------------------- # Redirect output files # ----------------------------------------------------------------------------- set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin CACHE INTERNAL "" ) @@ -104,7 +135,6 @@ else() message("No gmock/gtest found! Perhaps you wish to run 'bash download-gtest.sh' to download it.") endif() -include(CMakeScripts/ConfigPaths.cmake) # Installation Paths include(CMakeScripts/DefineDependsandFlags.cmake) # Includes, Compiler Flags, and Link Libraries include(CMakeScripts/HelperMacros.cmake) # Misc Utility Macros @@ -182,8 +212,15 @@ endforeach() # Installation # ----------------------------------------------------------------------------- if(UNIX) + #Define the installation + install( + TARGETS inkscape_base inkscape inkview + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib/inkscape + ARCHIVE DESTINATION lib/inkscape + ) + #The install directive for the binaries and libraries are found in src/CMakeList.txt - install( FILES ${CMAKE_BINARY_DIR}/inkscape.desktop DESTINATION ${CMAKE_INSTALL_PREFIX}/${SHARE_INSTALL}/applications @@ -191,10 +228,179 @@ if(UNIX) # this should probably be done no matter what the platform is, just set SHARE_INSTALL first add_subdirectory(share) - -else() - # TODO, WIN32, APPLE/OSX, MinGW - +elseif(WIN32) + set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/inkscape) + + install(PROGRAMS + ${EXECUTABLE_OUTPUT_PATH}/inkscape.exe + ${EXECUTABLE_OUTPUT_PATH}/inkview.exe + DESTINATION ${CMAKE_INSTALL_PREFIX} + ) + + install(FILES + ${LIBRARY_OUTPUT_PATH}/libinkscape_base.dll + ${LIBRARY_OUTPUT_PATH}/libgrid2.dll + DESTINATION ${CMAKE_INSTALL_PREFIX} + ) + + # devlibs and mingw dlls + install(FILES + AUTHORS + COPYING + NEWS + README + TRANSLATORS + ${DEVLIBS_BIN}/libatkmm-1.6-1.dll + ${DEVLIBS_BIN}/libglibmm-2.4-1.dll + ${DEVLIBS_BIN}/libgiomm-2.4-1.dll + ${DEVLIBS_BIN}/libgtkmm-2.4-1.dll + ${DEVLIBS_BIN}/libgdkmm-2.4-1.dll + ${DEVLIBS_BIN}/libpangomm-1.4-1.dll + ${DEVLIBS_BIN}/libcairomm-1.0-1.dll + ${DEVLIBS_BIN}/libsigc-2.0-0.dll + ${DEVLIBS_BIN}/libfreetype-6.dll + ${DEVLIBS_BIN}/libffi-6.dll + ${DEVLIBS_BIN}/libgc-1.dll + ${DEVLIBS_BIN}/libgsl-19.dll + ${DEVLIBS_BIN}/libgslcblas-0.dll + ${DEVLIBS_BIN}/libharfbuzz-0.dll + ${DEVLIBS_BIN}/liblzma-5.dll + ${DEVLIBS_BIN}/libaspell-15.dll + ${DEVLIBS_BIN}/libatk-1.0-0.dll + ${DEVLIBS_BIN}/libgdk-win32-2.0-0.dll + ${DEVLIBS_BIN}/libgdk_pixbuf-2.0-0.dll + ${DEVLIBS_BIN}/libglib-2.0-0.dll + ${DEVLIBS_BIN}/libgmodule-2.0-0.dll + ${DEVLIBS_BIN}/libgobject-2.0-0.dll + ${DEVLIBS_BIN}/libgtk-win32-2.0-0.dll + ${DEVLIBS_BIN}/libgthread-2.0-0.dll + ${DEVLIBS_BIN}/libgio-2.0-0.dll + ${DEVLIBS_BIN}/libcairo-2.dll + ${DEVLIBS_BIN}/libpixman-1-0.dll + ${DEVLIBS_BIN}/libpoppler-58.dll + ${DEVLIBS_BIN}/libpoppler-glib-8.dll + ${DEVLIBS_BIN}/libpangocairo-1.0-0.dll + ${DEVLIBS_BIN}/libpango-1.0-0.dll + ${DEVLIBS_BIN}/libpangoft2-1.0-0.dll + ${DEVLIBS_BIN}/libpangowin32-1.0-0.dll + ${DEVLIBS_BIN}/libfontconfig-1.dll + ${DEVLIBS_BIN}/libxml2-2.dll + ${DEVLIBS_BIN}/libxslt-1.dll + ${DEVLIBS_BIN}/libexslt-0.dll + ${DEVLIBS_BIN}/libexpat-1.dll + ${DEVLIBS_BIN}/librevenge-0.0.dll + ${DEVLIBS_BIN}/librevenge-stream-0.0.dll + ${DEVLIBS_BIN}/libwpg-0.3.dll + ${DEVLIBS_BIN}/libwpd-0.10.dll + ${DEVLIBS_BIN}/libvisio-0.1.dll + ${DEVLIBS_BIN}/libcdr-0.1.dll + ${DEVLIBS_BIN}/icuin56.dll + ${DEVLIBS_BIN}/icudt56.dll + ${DEVLIBS_BIN}/icuuc56.dll + ${DEVLIBS_BIN}/libjpeg-9.dll + ${DEVLIBS_BIN}/libpng16-16.dll + ${DEVLIBS_BIN}/libtiff-5.dll + ${DEVLIBS_BIN}/libexif-12.dll + ${DEVLIBS_BIN}/libcurl-4.dll + ${DEVLIBS_BIN}/zlib1.dll + ${DEVLIBS_BIN}/bz2-1.dll + ${DEVLIBS_BIN}/libiconv-2.dll + ${DEVLIBS_BIN}/libpopt-0.dll + ${DEVLIBS_BIN}/liblcms2-2.dll + ${DEVLIBS_BIN}/libMagick++-6.Q16-6.dll + ${DEVLIBS_BIN}/libMagickCore-6.Q16-2.dll + ${DEVLIBS_BIN}/libMagickWand-6.Q16-2.dll + ${DEVLIBS_BIN}/libintl-8.dll + ${DEVLIBS_BIN}/libpotrace-0.dll + ${MINGW_BIN}/libstdc++-6.dll + ${MINGW_BIN}/libwinpthread-1.dll + ${MINGW_BIN}/libgcc_s_seh-1.dll + ${MINGW_BIN}/libgomp-1.dll + DESTINATION ${CMAKE_INSTALL_PREFIX}) + + # Setup application data directories, poppler files, locales, icons and themes + file(MAKE_DIRECTORY + data + doc + modules + plugins) + + install(DIRECTORY + data + doc + modules + plugins + share + DESTINATION ${CMAKE_INSTALL_PREFIX} + PATTERN Adwaita EXCLUDE # NOTE: The theme is not used on Windows. + PATTERN hicolor/index.theme EXCLUDE # NOTE: Empty index.theme in hicolor icon theme causes SIGSEGV. + PATTERN CMakeLists.txt EXCLUDE + PATTERN *.am EXCLUDE) + + install(DIRECTORY ${DEVLIBS_PATH}/share/themes + DESTINATION ${CMAKE_INSTALL_PREFIX}/share) + + install(DIRECTORY ${DEVLIBS_PATH}/share/poppler + DESTINATION ${CMAKE_INSTALL_PREFIX}/share) + + install(DIRECTORY ${DEVLIBS_PATH}/etc/fonts + DESTINATION ${CMAKE_INSTALL_PREFIX}/etc) + + install(DIRECTORY ${DEVLIBS_PATH}/share/locale + DESTINATION ${CMAKE_INSTALL_PREFIX}) + + install(DIRECTORY ${DEVLIBS_PATH}/etc/gtk-2.0 + DESTINATION ${CMAKE_INSTALL_PREFIX}/etc) + + # GTK 2.0 + install(DIRECTORY ${DEVLIBS_LIB}/gtk-2.0 + DESTINATION ${CMAKE_INSTALL_PREFIX}/lib + FILES_MATCHING + PATTERN "*.dll" + PATTERN "*.cache") + + install(DIRECTORY ${DEVLIBS_LIB}/gdk-pixbuf-2.0 + DESTINATION ${CMAKE_INSTALL_PREFIX}/lib + FILES_MATCHING + PATTERN "*.dll" + PATTERN "*.cache") + + # Aspell dictionaries + install(DIRECTORY ${DEVLIBS_LIB}/aspell-0.60 + DESTINATION ${CMAKE_INSTALL_PREFIX}/lib) + + # Necessary to run extensions on windows if it is not in the path + if (CMAKE_SYSTEM_PROCESSOR MATCHES "AMD64") + install(FILES + ${DEVLIBS_BIN}/gspawn-win64-helper.exe + ${DEVLIBS_BIN}/gspawn-win64-helper-console.exe + DESTINATION ${CMAKE_INSTALL_PREFIX}) + else() + install(FILES + ${DEVLIBS_BIN}/gspawn-win32-helper.exe + ${DEVLIBS_BIN}/gspawn-win32-helper-console.exe + DESTINATION ${CMAKE_INSTALL_PREFIX}) + endif() + + # Perl + install(FILES + ${DEVLIBS_PATH}/perl/bin/perl58.dll + DESTINATION ${CMAKE_INSTALL_PREFIX}) + + # Python + install(FILES + ${DEVLIBS_PATH}/python/python.exe + ${DEVLIBS_PATH}/python/pythonw.exe + ${DEVLIBS_PATH}/python/python27.dll + DESTINATION ${CMAKE_INSTALL_PREFIX}/python) + + install(DIRECTORY ${DEVLIBS_PATH}/python/lib + DESTINATION ${CMAKE_INSTALL_PREFIX}/python) + + install(DIRECTORY ${DEVLIBS_PATH}/python/dlls + DESTINATION ${CMAKE_INSTALL_PREFIX}/python) +elseif(APPLE) + # TODO endif() # ----------------------------------------------------------------------------- @@ -239,6 +445,7 @@ message("") # cmake info message("CMAKE_BINARY_DIR: ${CMAKE_BINARY_DIR}") +message("CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}") message("CMAKE_SYSTEM_NAME: ${CMAKE_SYSTEM_NAME}") message("CMAKE_SYSTEM_VERSION: ${CMAKE_SYSTEM_VERSION}") message("CMAKE_SYSTEM_PROCESSOR: ${CMAKE_SYSTEM_PROCESSOR}") @@ -247,6 +454,13 @@ message("CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER}") message("CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}") message("") +if(WIN32) +message("CMAKE_PREFIX_PATH: ${CMAKE_PREFIX_PATH}") +message("CMAKE_FIND_LIBRARY_PREFIXES: ${CMAKE_FIND_LIBRARY_PREFIXES}") +message("CMAKE_FIND_LIBRARY_SUFFIXES: ${CMAKE_FIND_LIBRARY_SUFFIXES}") +message("") +endif() + # dependency info message("ENABLE_LCMS: ${ENABLE_LCMS}") message("ENABLE_POPPLER: ${ENABLE_POPPLER}") @@ -263,4 +477,22 @@ message("WITH_LIBWPG: ${WITH_LIBWPG}") message("WITH_NLS: ${WITH_NLS}") message("WITH_OPENMP: ${WITH_OPENMP}") message("WITH_PROFILING: ${WITH_PROFILING}") + +if(WIN32) +message("") +message("HAVE_MINGW: ${HAVE_MINGW}") +message("HAVE_MINGW64: ${HAVE_MINGW64}") +message("MINGW_PATH: ${MINGW_PATH}") +message("MINGW_ARCH: ${MINGW_ARCH}") +message("MINGW_ARCH_PATH: ${MINGW_ARCH_PATH}") +message("MINGW64_INCLUDE: ${MINGW64_INCLUDE}") +message("MINGW64_LIB: ${MINGW64_LIB}") +message("DEVLIBS_PATH: ${DEVLIBS_PATH}") +message("DEVLIBS_LIB: ${DEVLIBS_LIB}") +message("DEVLIBS_BIN: ${DEVLIBS_BIN}") +message("PKG_CONFIG_PATH: ${PKG_CONFIG_PATH}") +message("GS_PATH ${GS_PATH}") +message("GS_BIN ${GS_BIN}") +endif() + message("------------------------------------------------------------------------") diff --git a/CMakeScripts/ConfigPaths.cmake b/CMakeScripts/ConfigPaths.cmake index 3b13a7734..09cd96df0 100644 --- a/CMakeScripts/ConfigPaths.cmake +++ b/CMakeScripts/ConfigPaths.cmake @@ -1,6 +1,156 @@ message(STATUS "Creating build files in: ${CMAKE_CURRENT_BINARY_DIR}") if(WIN32) +# Directory containing the precompiled Inkscape libraries. Usually c:\devlibs or c:\devlibs64 + set(DEVLIBS_PATH C:/devlibs64) + + # Directory containing the MinGW instance used for compilation. Usually c:\mingw or c:\mingw64 + set(MINGW_PATH C:/mingw64) + + # Directory containing the Ghostscript installation. + set(GS_PATH C:/latex/gs/gs8.61) + + # Normalize directory separator slashes. + string(REGEX REPLACE "\\\\" "/" DEVLIBS_PATH ${DEVLIBS_PATH}) + string(REGEX REPLACE "\\\\" "/" MINGW_PATH ${MINGW_PATH}) + string(REGEX REPLACE "\\\\" "/" GS_PATH ${GS_PATH}) + + # =============== DEVLIBS CHECKS =============== + + # Directory containing the compile time .dll.a and .a files. + set(DEVLIBS_LIB "${DEVLIBS_PATH}/lib") + + if(NOT EXISTS "${DEVLIBS_LIB}") + message(FATAL_ERROR "Inkscape development libraries directory does not exist: ${DEVLIBS_LIB}") + endif() + + # Add devlibs libraries to linker path. + link_directories(${DEVLIBS_LIB}) + + set(DEVLIBS_INCLUDE ${DEVLIBS_PATH}/include) + + if(NOT EXISTS ${DEVLIBS_INCLUDE}) + message(FATAL_ERROR "Inkscape development libraries directory does not exist: ${DEVLIBS_INCLUDE}") + endif() + + # Add general MinGW headers to compiler include path. + #include_directories(${DEVLIBS_INCLUDE}) + + # Directory containing the precompiled .dll files. + set(DEVLIBS_BIN ${DEVLIBS_PATH}/bin) + + if(NOT EXISTS ${DEVLIBS_BIN}) + message(FATAL_ERROR "Inkscape development binaries directory does not exist: ${DEVLIBS_BIN}") + endif() + + # Directory containing the pkgconfig .pc files. + set(PKG_CONFIG_PATH "${DEVLIBS_PATH}/lib/pkgconfig") + + if(NOT EXISTS "${PKG_CONFIG_PATH}") + message(FATAL_ERROR "pkgconfig directory does not exist: ${PKG_CONFIG_PATH}") + endif() + + # Add the devlibs directories to the paths used to find libraries and programs. + list(APPEND CMAKE_PREFIX_PATH ${DEVLIBS_PATH}) + + # Eliminate error messages when not having mingw in the environment path variable. + list(APPEND CMAKE_PROGRAM_PATH ${DEVLIBS_BIN}) + + # =============== MINGW CHECKS =============== + + # We are in a MinGW environment. + set(HAVE_MINGW ON) + + # Try to determine the MinGW processor architecture. + if(EXISTS ${MINGW_PATH}/mingw32) + set(HAVE_MINGW64 OFF) + set(MINGW_ARCH mingw32) + elseif(EXISTS ${MINGW_PATH}/x86_64-w64-mingw32) + set(HAVE_MINGW64 ON) + set(MINGW_ARCH x86_64-w64-mingw32) + else() + message(FATAL_ERROR "Unable to determine MinGW processor architecture. Are you using an unsupported MinGW version?") + endif() + + # Path to processor architecture specific binaries and libs. + set(MINGW_ARCH_PATH ${MINGW_PATH}/${MINGW_ARCH}) + + set(MINGW_BIN ${MINGW_PATH}/bin) + + if(NOT EXISTS ${MINGW_BIN}) + message(FATAL_ERROR "MinGW binary directory does not exist: ${MINGW_BIN}") + endif() + + # Eliminate error messages when not having mingw in the environment path variable. + list(APPEND CMAKE_PROGRAM_PATH ${MINGW_BIN}) + + set(MINGW_LIB ${MINGW_PATH}/lib) + + if(NOT EXISTS ${MINGW_LIB}) + message(FATAL_ERROR "MinGW library directory does not exist: ${MINGW_LIB}") + endif() + + # Add MinGW libraries to linker path. + link_directories(${MINGW_LIB}) + + set(MINGW_INCLUDE ${MINGW_PATH}/include) + + if(NOT EXISTS ${MINGW_INCLUDE}) + message(FATAL_ERROR "MinGW include directory does not exist: ${MINGW_INCLUDE}") + endif() + + # Add general MinGW headers to compiler include path. + include_directories(${MINGW_INCLUDE}) + + if(HAVE_MINGW64) + set(MINGW64_LIB ${MINGW_ARCH_PATH}/lib) + + if(NOT EXISTS ${MINGW64_LIB}) + message(FATAL_ERROR "MinGW 64-Bit libraries directory does not exist: ${MINGW64_LIB}") + endif() + + # Add 64-Bit libraries to linker path. + link_directories(${MINGW64_LIB}) + + set(MINGW64_INCLUDE ${MINGW_ARCH_PATH}/include) + + if(NOT EXISTS ${MINGW64_INCLUDE}) + message(FATAL_ERROR "MinGW 64-Bit include directory does not exist: ${MINGW64_INCLUDE}") + endif() + + set(MINGW64_INCLUDE_SDL ${MINGW64_INCLUDE}/c++) + + if(NOT EXISTS ${MINGW64_INCLUDE_SDL}) + message(FATAL_ERROR "MinGW 64-Bit SDL include directory does not exist: ${MINGW64_INCLUDE_SDL}") + endif() + + # Add 64-Bit MinGW headers to compiler include path. + include_directories(${MINGW64_INCLUDE}) + #include_directories(${MINGW64_INCLUDE_SDL}) + endif() + + # =============== GHOSTSCRIPT CHECKS =============== + + # Check for Ghostscript. + set(GS_BIN "${GS_PATH}/bin") + + if(EXISTS "${GS_BIN}") + set(HAVE_GS_BIN ON) + else() + set(HAVE_GS_BIN OFF) + endif() + + # =============== LIBRARY AND LINKER =============== + + # Tweak CMake into using Unix-style library names. + set(CMAKE_FIND_LIBRARY_PREFIXES "lib") + set(CMAKE_FIND_LIBRARY_SUFFIXES ".dll.a" ".dll") + + if(NOT HAVE_MINGW64) + list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES ".a") + endif() + + # Directory containing the current locale (translations). set(PACKAGE_LOCALE_DIR "locale") set(SHARE_INSTALL "share" CACHE STRING "Data file install path. Must be a relative path (from CMAKE_INSTALL_PREFIX), with no trailing slash.") else(WIN32) diff --git a/CMakeScripts/DefineDependsandFlags.cmake b/CMakeScripts/DefineDependsandFlags.cmake index 706860a00..b708484af 100644 --- a/CMakeScripts/DefineDependsandFlags.cmake +++ b/CMakeScripts/DefineDependsandFlags.cmake @@ -15,75 +15,31 @@ list(APPEND INKSCAPE_INCS ${PROJECT_SOURCE_DIR} # Files we include # ---------------------------------------------------------------------------- if(WIN32) -message("---------------- BEGIN: Win32 ----------------") - - # The name of the target operating system - set(CMAKE_SYSTEM_NAME Windows) - - message("CMAKE_SYSTEM_NAME: " ${CMAKE_SYSTEM_NAME}) - - set(CMAKE_C_COMPILER gcc) - set(CMAKE_CXX_COMPILER g++) - set(CMAKE_RC_COMPILER windres) - - # Adjust the command line parameters for windres to the verion of MinGW. - set(CMAKE_RC_COMPILER_INIT windres) - enable_language(RC) - set(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> -O coff -i <SOURCE> -o <OBJECT>") - - # Here is the target environment located - set(CMAKE_FIND_ROOT_PATH $ENV{MINGW_PATH}/) - - message("CMAKE_FIND_ROOT_PATH: " ${CMAKE_FIND_ROOT_PATH}) - - # Tweak CMake into using Unix-style library names. - set(CMAKE_FIND_LIBRARY_PREFIXES "lib") - set(CMAKE_FIND_LIBRARY_SUFFIXES ".dll.a" ".dll") - - message("CMAKE_FIND_LIBRARY_PREFIXES: " ${CMAKE_FIND_LIBRARY_PREFIXES}) - message("CMAKE_FIND_LIBRARY_SUFFIXES: " ${CMAKE_FIND_LIBRARY_SUFFIXES}) - - set(SDL_INCLUDE_DIR ${CMAKE_FIND_ROOT_PATH}x86_64-w64-mingw32/include/c++) - - message("SDL_INCLUDE_DIR: " ${SDL_INCLUDE_DIR}) - - #if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "^amd64") - link_directories($ENV{MINGW_PATH}/lib) - link_directories($ENV{DEVLIBS_PATH}/lib) - link_directories($ENV{MINGW_PATH}/x86_64-w64-mingw32/lib) - link_directories($ENV{WINDIR}/system32) - - include_directories($ENV{MINGW_PATH}/include) - - include_directories($ENV{MINGW_PATH}/x86_64-w64-mingw32/include) - include_directories($ENV{MINGW_PATH}/x86_64-w64-mingw32/include/c++) - #endif () - - get_property(dirs DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES) - - foreach(dir ${dirs}) - message("CMAKE_INCLUDE_DIR:" ${dir}) - endforeach() - - add_definitions(-DFLT_EPSILON=1e-9) - add_definitions(-DFLT_MAX=1e+37) - add_definitions(-DFLT_MIN=1e-37) - - list(APPEND INKSCAPE_LIBS "-lgomp") - list(APPEND INKSCAPE_LIBS "-lwinpthread") - list(APPEND INKSCAPE_LIBS "-lmscms") - - list(APPEND INKSCAPE_CXX_FLAGS "-mwindows") - list(APPEND INKSCAPE_CXX_FLAGS "-mthreads") - list(APPEND INKSCAPE_CXX_FLAGS "-m64") - - # Try to compile using C++ 11. - set(CMAKE_CXX_STANDARD 11) - - message("---------------- END: Win32 ----------------") + # Set the link and include directories + get_property(dirs DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES) + + # MinGW supplied STL does not define these floating point constants.. :/ + add_definitions(-DFLT_EPSILON=1e-9) + add_definitions(-DFLT_MAX=1e+37) + add_definitions(-DFLT_MIN=1e-37) + + list(APPEND INKSCAPE_LIBS "-lmscms") + + list(APPEND INKSCAPE_CXX_FLAGS "-mwindows") + list(APPEND INKSCAPE_CXX_FLAGS "-mthreads") + + if(HAVE_MINGW64) + list(APPEND INKSCAPE_LIBS "-lgomp") + list(APPEND INKSCAPE_LIBS "-lwinpthread") + + list(APPEND INKSCAPE_CXX_FLAGS "-m64") + else() + list(APPEND INKSCAPE_CXX_FLAGS "-m32") + endif() endif() pkg_check_modules(INKSCAPE_DEP REQUIRED pangocairo pangoft2 fontconfig gthread-2.0 gsl gmodule-2.0) + list(APPEND INKSCAPE_LIBS ${INKSCAPE_DEP_LDFLAGS}) list(APPEND INKSCAPE_INCS_SYS ${INKSCAPE_DEP_INCLUDE_DIRS}) list(APPEND INKSCAPE_LIBS ${INKSCAPE_DEP_LIBRARIES}) diff --git a/config.h.cmake b/config.h.cmake index eae54fd03..b30002622 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -232,10 +232,18 @@ #cmakedefine HAVE_ZLIB_H 1 /* Base data directory -- only path-prefix.h should use it! */ +#ifdef WIN32 +#define INKSCAPE_DATADIR "" +#else #define INKSCAPE_DATADIR "${CMAKE_INSTALL_PREFIX}/share" +#endif /* Base library directory -- only path-prefix.h should use it! */ +#ifdef WIN32 +#define INKSCAPE_LIBDIR "\\lib" +#else #define INKSCAPE_LIBDIR "${CMAKE_INSTALL_PREFIX}/lib" +#endif /* Define to 1 if `lstat' dereferences a symlink specified with a trailing slash. */ diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 66f16b7fb..d979d7c13 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -2,10 +2,6 @@ # Define the main source # ----------------------------------------------------------------------------- -set(main_SRC - main.cpp -) - set(sp_SRC attribute-rel-css.cpp attribute-rel-svg.cpp @@ -423,21 +419,6 @@ set(inkscape_SRC version.h ) -if(WIN32) - list(APPEND inkscape_SRC - inkscape.rc - registrytool.cpp - #deptool.cpp - winconsole.cpp - winmain.cpp - - # ------- - # Headers - registrytool.h - ) -endif() - - # ----------------------------------------------------------------------------- # Generate version file # ----------------------------------------------------------------------------- @@ -481,7 +462,6 @@ add_subdirectory(widgets) add_subdirectory(xml) add_subdirectory(2geom) - # Directories containing lists files that describe building internal libraries add_subdirectory(libavoid) add_subdirectory(libcola) @@ -494,7 +474,6 @@ add_subdirectory(livarot) add_subdirectory(libnrtype) add_subdirectory(libdepixelize) - get_property(inkscape_global_SRC GLOBAL PROPERTY inkscape_global_SRC) set(inkscape_SRC @@ -508,12 +487,32 @@ set(inkscape_SRC #add_inkscape_lib(sp_LIB "${sp_SRC}") #add_inkscape_lib(inkscape_LIB "${inkscape_SRC}") +if(WIN32) + # Sources for the inkscape executable on Windows. + set(main_SRC + registrytool.h + registrytool.cpp + main.cpp + winmain.cpp + #winconsole.cpp + ) + + # Add the platform specific resource files (enabling the app icon). + if(${HAVE_MINGW64}) + list(APPEND main_SRC inkscape-x64.rc) + else() + list(APPEND main_SRC inkscape.rc) + endif() +else() + set(main_SRC main.cpp) +endif() + # Build everything except main and inkview.c in a shared library. add_library(inkscape_base SHARED ${inkscape_SRC} ${sp_SRC}) # make executables for inkscape and inkview -add_executable(inkscape ${main_SRC} ) -add_executable(inkview inkview.cpp ) +add_executable(inkscape ${main_SRC}) +add_executable(inkview inkview.cpp) add_dependencies(inkscape inkscape_version) @@ -525,11 +524,9 @@ set(INKSCAPE_TARGET_LIBS # order from automake #sp_LIB #nrtype_LIB - #inkscape_LIB #sp_LIB # annoying, we need both! nrtype_LIB # annoying, we need both! - croco_LIB avoid_LIB cola_LIB @@ -548,22 +545,9 @@ if (NOT "${WITH_EXT_GDL}") list (INSERT INKSCAPE_TARGET_LIBS 0 "gdl_LIB") endif() - - - # Link the inkscape_base library against all external dependencies target_link_libraries(inkscape_base ${INKSCAPE_TARGET_LIBS}) # Link inkscape and inkview against inkscape_base -target_link_libraries(inkscape inkscape_base ) -target_link_libraries(inkview inkscape_base) - -#Define the installation -install( - TARGETS inkscape_base inkscape inkview - RUNTIME DESTINATION bin - LIBRARY DESTINATION lib/inkscape - ARCHIVE DESTINATION lib/inkscape - ) - - +target_link_libraries(inkscape inkscape_base) +target_link_libraries(inkview inkscape_base)
\ No newline at end of file |
