From 0e706b0714e86199b2024ddfecb22fcd386b79bc Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Sat, 15 Jul 2017 23:54:47 +0200 Subject: root dir tidying: move mingwenv.cmake -> CMakeScripts/ConfigEnvMinGW.cmake --- CMakeScripts/ConfigEnv.cmake | 2 +- CMakeScripts/ConfigEnvMinGW.cmake | 188 ++++++++++++++++++++++++++++++++++++++ mingwenv.cmake | 188 -------------------------------------- 3 files changed, 189 insertions(+), 189 deletions(-) create mode 100644 CMakeScripts/ConfigEnvMinGW.cmake delete mode 100644 mingwenv.cmake diff --git a/CMakeScripts/ConfigEnv.cmake b/CMakeScripts/ConfigEnv.cmake index 1c4a64b39..8ae55e89a 100644 --- a/CMakeScripts/ConfigEnv.cmake +++ b/CMakeScripts/ConfigEnv.cmake @@ -4,7 +4,7 @@ if(WIN32) message("-- Windows build detected, setting default features") - include(mingwenv.cmake) + include(CMakeScripts/ConfigEnvMinGW.cmake) if(NOT HAVE_MSYS2) list(INSERT CMAKE_SYSTEM_INCLUDE_PATH 0 ${DEVLIBS_PATH}) diff --git a/CMakeScripts/ConfigEnvMinGW.cmake b/CMakeScripts/ConfigEnvMinGW.cmake new file mode 100644 index 000000000..26cc04419 --- /dev/null +++ b/CMakeScripts/ConfigEnvMinGW.cmake @@ -0,0 +1,188 @@ +# ----------------------------------------------------------------------------- +# Set the paths in this file if you want to build Inkscape from a shell other than the +# Windows built-in command line (i.e. MSYS) or IDEs such as CodeLite. These variables +# will be used as default if no environment variables are set. +# ----------------------------------------------------------------------------- + +# Directory containing the precompiled Inkscape libraries. Usually c:\devlibs or c:\devlibs64 +set(ENV_DEVLIBS_PATH C:/devlibs64) + +# Directory containing the MinGW instance used for compilation. Usually c:\mingw or c:\mingw64 +set(ENV_MINGW_PATH C:/mingw64) + +# ----------------------------------------------------------------------------- +# MinGW Configuration +# ----------------------------------------------------------------------------- +message(STATUS "Configuring MinGW environment:") + +if("$ENV{MSYSTEM_CHOST}" STREQUAL "") + if("$ENV{DEVLIBS_PATH}" STREQUAL "") + message(STATUS " Setting path to development libraries from ConfigEnvMinGW.cmake: ${ENV_DEVLIBS_PATH}") + set(DEVLIBS_PATH ${ENV_DEVLIBS_PATH}) + else() + message(STATUS " Setting path to development libraries from environment: $ENV{DEVLIBS_PATH}") + set(DEVLIBS_PATH $ENV{DEVLIBS_PATH}) + endif() + + if("$ENV{MINGW_PATH}" STREQUAL "") + message(STATUS " Setting path to MinGW from ConfigEnvMinGW.cmake: ${ENV_MINGW_PATH}") + set(MINGW_PATH ${ENV_MINGW_PATH}) + else() + message(STATUS " Setting path to MinGW from environment: $ENV{MINGW_PATH}") + set(MINGW_PATH $ENV{MINGW_PATH}) + endif() + + # Normalize directory separator slashes. + string(REGEX REPLACE "\\\\" "/" DEVLIBS_PATH ${DEVLIBS_PATH}) + string(REGEX REPLACE "\\\\" "/" MINGW_PATH ${MINGW_PATH}) +else() + set(HAVE_MSYS2 ON) + message(STATUS " Detected MinGW environment provided by MSYS2") + set(MINGW_PATH $ENV{MINGW_PREFIX}) +endif() + +# ----------------------------------------------------------------------------- +# DEVLIBS CHECKS +# ----------------------------------------------------------------------------- +if(NOT HAVE_MSYS2) + # 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}) +endif() + +# ----------------------------------------------------------------------------- +# MINGW CHECKS +# ----------------------------------------------------------------------------- + +# We are in a MinGW environment. +set(HAVE_MINGW ON) + +# Try to determine the MinGW processor architecture. +if(EXISTS "${MINGW_PATH}/i686-w64-mingw32") + set(HAVE_MINGW64 OFF) + set(MINGW_ARCH i686-w64-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 MinGW headers to compiler include path. +include_directories(SYSTEM ${MINGW_INCLUDE}) + +set(MINGW_ARCH_LIB "${MINGW_ARCH_PATH}/lib") + +if(NOT EXISTS ${MINGW_ARCH_LIB}) + message(FATAL_ERROR "MinGW-w64 toolchain libraries directory does not exist: ${MINGW_ARCH_LIB}") +endif() + +# Add MinGW toolchain libraries to linker path. +link_directories(${MINGW_ARCH_LIB}) + +set(MINGW_ARCH_INCLUDE "${MINGW_ARCH_PATH}/include") + +if(NOT EXISTS ${MINGW_ARCH_INCLUDE}) + message(FATAL_ERROR "MinGW-w64 toolchain include directory does not exist: ${MINGW_ARCH_INCLUDE}") +endif() + +# Add MinGW toolchain headers to compiler include path. +include_directories(${MINGW_ARCH_INCLUDE}) + +# ----------------------------------------------------------------------------- +# MSYS CHECKS +# ----------------------------------------------------------------------------- + +# Somehow the MSYS variable does not work as documented.. +if("${CMAKE_GENERATOR}" STREQUAL "MSYS Makefiles") + set(HAVE_MSYS ON) +else() + set(HAVE_MSYS OFF) +endif() + +# Set the path to the 'ar' utility for the MSYS shell as it fails to detect it properly. +if(HAVE_MSYS) + message(STATUS "Configuring MSYS environment:") + + if(NOT EXISTS ${CMAKE_AR}) + set(MINGW_AR ${MINGW_BIN}/ar.exe) + + if(EXISTS ${MINGW_AR}) + set(CMAKE_AR ${MINGW_AR} CACHE FILEPATH "Archive Utility") + else() + message(FATAL_ERROR "ar.exe not found.") + endif() + + message(STATUS " Setting path to ar.exe: ${CMAKE_AR}") + endif() +endif() + +# ----------------------------------------------------------------------------- +# LIBRARY AND LINKER SETTINGS +# ----------------------------------------------------------------------------- + +# Tweak CMake into using Unix-style library names. +set(CMAKE_FIND_LIBRARY_PREFIXES "lib") +set(CMAKE_FIND_LIBRARY_SUFFIXES ".dll.a" ".dll") diff --git a/mingwenv.cmake b/mingwenv.cmake deleted file mode 100644 index 0ae4a47b1..000000000 --- a/mingwenv.cmake +++ /dev/null @@ -1,188 +0,0 @@ -# ----------------------------------------------------------------------------- -# Set the paths in this file if you want to build Inkscape from a shell other than the -# Windows built-in command line (i.e. MSYS) or IDEs such as CodeLite. These variables -# will be used as default if no environment variables are set. -# ----------------------------------------------------------------------------- - -# Directory containing the precompiled Inkscape libraries. Usually c:\devlibs or c:\devlibs64 -set(ENV_DEVLIBS_PATH C:/devlibs64) - -# Directory containing the MinGW instance used for compilation. Usually c:\mingw or c:\mingw64 -set(ENV_MINGW_PATH C:/mingw64) - -# ----------------------------------------------------------------------------- -# MinGW Configuration -# ----------------------------------------------------------------------------- -message(STATUS "Configuring MinGW environment:") - -if("$ENV{MSYSTEM_CHOST}" STREQUAL "") - if("$ENV{DEVLIBS_PATH}" STREQUAL "") - message(STATUS " Setting path to development libraries from mingwenv.cmake: ${ENV_DEVLIBS_PATH}") - set(DEVLIBS_PATH ${ENV_DEVLIBS_PATH}) - else() - message(STATUS " Setting path to development libraries from environment: $ENV{DEVLIBS_PATH}") - set(DEVLIBS_PATH $ENV{DEVLIBS_PATH}) - endif() - - if("$ENV{MINGW_PATH}" STREQUAL "") - message(STATUS " Setting path to MinGW from mingwenv.cmake: ${ENV_MINGW_PATH}") - set(MINGW_PATH ${ENV_MINGW_PATH}) - else() - message(STATUS " Setting path to MinGW from environment: $ENV{MINGW_PATH}") - set(MINGW_PATH $ENV{MINGW_PATH}) - endif() - - # Normalize directory separator slashes. - string(REGEX REPLACE "\\\\" "/" DEVLIBS_PATH ${DEVLIBS_PATH}) - string(REGEX REPLACE "\\\\" "/" MINGW_PATH ${MINGW_PATH}) -else() - set(HAVE_MSYS2 ON) - message(STATUS " Detected MinGW environment provided by MSYS2") - set(MINGW_PATH $ENV{MINGW_PREFIX}) -endif() - -# ----------------------------------------------------------------------------- -# DEVLIBS CHECKS -# ----------------------------------------------------------------------------- -if(NOT HAVE_MSYS2) - # 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}) -endif() - -# ----------------------------------------------------------------------------- -# MINGW CHECKS -# ----------------------------------------------------------------------------- - -# We are in a MinGW environment. -set(HAVE_MINGW ON) - -# Try to determine the MinGW processor architecture. -if(EXISTS "${MINGW_PATH}/i686-w64-mingw32") - set(HAVE_MINGW64 OFF) - set(MINGW_ARCH i686-w64-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 MinGW headers to compiler include path. -include_directories(SYSTEM ${MINGW_INCLUDE}) - -set(MINGW_ARCH_LIB "${MINGW_ARCH_PATH}/lib") - -if(NOT EXISTS ${MINGW_ARCH_LIB}) - message(FATAL_ERROR "MinGW-w64 toolchain libraries directory does not exist: ${MINGW_ARCH_LIB}") -endif() - -# Add MinGW toolchain libraries to linker path. -link_directories(${MINGW_ARCH_LIB}) - -set(MINGW_ARCH_INCLUDE "${MINGW_ARCH_PATH}/include") - -if(NOT EXISTS ${MINGW_ARCH_INCLUDE}) - message(FATAL_ERROR "MinGW-w64 toolchain include directory does not exist: ${MINGW_ARCH_INCLUDE}") -endif() - -# Add MinGW toolchain headers to compiler include path. -include_directories(${MINGW_ARCH_INCLUDE}) - -# ----------------------------------------------------------------------------- -# MSYS CHECKS -# ----------------------------------------------------------------------------- - -# Somehow the MSYS variable does not work as documented.. -if("${CMAKE_GENERATOR}" STREQUAL "MSYS Makefiles") - set(HAVE_MSYS ON) -else() - set(HAVE_MSYS OFF) -endif() - -# Set the path to the 'ar' utility for the MSYS shell as it fails to detect it properly. -if(HAVE_MSYS) - message(STATUS "Configuring MSYS environment:") - - if(NOT EXISTS ${CMAKE_AR}) - set(MINGW_AR ${MINGW_BIN}/ar.exe) - - if(EXISTS ${MINGW_AR}) - set(CMAKE_AR ${MINGW_AR} CACHE FILEPATH "Archive Utility") - else() - message(FATAL_ERROR "ar.exe not found.") - endif() - - message(STATUS " Setting path to ar.exe: ${CMAKE_AR}") - endif() -endif() - -# ----------------------------------------------------------------------------- -# LIBRARY AND LINKER SETTINGS -# ----------------------------------------------------------------------------- - -# Tweak CMake into using Unix-style library names. -set(CMAKE_FIND_LIBRARY_PREFIXES "lib") -set(CMAKE_FIND_LIBRARY_SUFFIXES ".dll.a" ".dll") -- cgit v1.2.3