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 /CMakeScripts | |
| 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)
Diffstat (limited to 'CMakeScripts')
| -rw-r--r-- | CMakeScripts/ConfigPaths.cmake | 150 | ||||
| -rw-r--r-- | CMakeScripts/DefineDependsandFlags.cmake | 88 |
2 files changed, 172 insertions, 66 deletions
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}) |
