diff options
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/CMakeFortranCompiler.cmake.in | 1 | ||||
-rw-r--r-- | Modules/CMakeParseImplicitIncludeInfo.cmake | 109 | ||||
-rw-r--r-- | Modules/CPack.background.png.in | bin | 47076 -> 44108 bytes | |||
-rw-r--r-- | Modules/Compiler/Intel-CXX-FeatureTests.cmake | 2 | ||||
-rw-r--r-- | Modules/FindDoxygen.cmake | 4 | ||||
-rw-r--r-- | Modules/FindICU.cmake | 12 | ||||
-rw-r--r-- | Modules/FindPython.cmake | 13 | ||||
-rw-r--r-- | Modules/FindPython/Support.cmake | 47 | ||||
-rw-r--r-- | Modules/FindPython2.cmake | 13 | ||||
-rw-r--r-- | Modules/FindPython3.cmake | 13 | ||||
-rw-r--r-- | Modules/FindPythonInterp.cmake | 14 |
11 files changed, 198 insertions, 30 deletions
diff --git a/Modules/CMakeFortranCompiler.cmake.in b/Modules/CMakeFortranCompiler.cmake.in index 9b951fc..ae7b73a 100644 --- a/Modules/CMakeFortranCompiler.cmake.in +++ b/Modules/CMakeFortranCompiler.cmake.in @@ -61,6 +61,7 @@ endif() @CMAKE_Fortran_SYSROOT_FLAG_CODE@ @CMAKE_Fortran_OSX_DEPLOYMENT_TARGET_FLAG_CODE@ +set(CMAKE_Fortran_IMPLICIT_INCLUDE_DIRECTORIES "@CMAKE_Fortran_IMPLICIT_INCLUDE_DIRECTORIES@") set(CMAKE_Fortran_IMPLICIT_LINK_LIBRARIES "@CMAKE_Fortran_IMPLICIT_LINK_LIBRARIES@") set(CMAKE_Fortran_IMPLICIT_LINK_DIRECTORIES "@CMAKE_Fortran_IMPLICIT_LINK_DIRECTORIES@") set(CMAKE_Fortran_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "@CMAKE_Fortran_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES@") diff --git a/Modules/CMakeParseImplicitIncludeInfo.cmake b/Modules/CMakeParseImplicitIncludeInfo.cmake index 9901fea..211406d 100644 --- a/Modules/CMakeParseImplicitIncludeInfo.cmake +++ b/Modules/CMakeParseImplicitIncludeInfo.cmake @@ -11,9 +11,10 @@ function(cmake_parse_implicit_include_line line lang id_var log_var state_var) unset(rv) set(log "") - # ccfe: cray compiler front end (PrgEnv-cray) + # Cray compiler (from cray wrapper, via PrgEnv-cray) if("${CMAKE_${lang}_COMPILER_ID}" STREQUAL "Cray" AND - "${line}" MATCHES "-isystem") + "${line}" MATCHES "^/" AND "${line}" MATCHES "/ccfe |/ftnfe " AND + "${line}" MATCHES " -isystem| -I") string(REGEX MATCHALL " (-I ?|-isystem )([^ ]*)" incs "${line}") foreach(inc IN LISTS incs) string(REGEX REPLACE " (-I ?|-isystem )([^ ]*)" "\\2" idir "${inc}") @@ -26,10 +27,84 @@ function(cmake_parse_implicit_include_line line lang id_var log_var state_var) endif() endif() + # SunPro compiler + if("${CMAKE_${lang}_COMPILER_ID}" STREQUAL "SunPro" AND + "${line}" MATCHES "-D__SUNPRO_C") + string(REGEX MATCHALL " (-I ?)([^ ]*)" incs "${line}") + foreach(inc IN LISTS incs) + string(REGEX REPLACE " (-I ?)([^ ]*)" "\\2" idir "${inc}") + if(NOT "${idir}" STREQUAL "-xbuiltin") + list(APPEND rv "${idir}") + endif() + endforeach() + if(rv) + # /usr/include appears to be hardwired in + list(APPEND rv "/usr/include") + string(APPEND log " got implicit includes via sunpro parser!\n") + else() + string(APPEND log " warning: sunpro parse failed!\n") + endif() + endif() + + # XL compiler + if("${CMAKE_${lang}_COMPILER_ID}" STREQUAL "XL" AND "${line}" MATCHES "^/" + AND ( ("${lang}" STREQUAL "Fortran" AND + "${line}" MATCHES "/xl[fF]entry " AND + "${line}" MATCHES "OSVAR\\([^ ]+\\)") + OR + ( ("${lang}" STREQUAL "C" OR "${lang}" STREQUAL "CXX") AND + "${line}" MATCHES "/xl[cC]entry " AND + "${line}" MATCHES " -qosvar=") + ) ) + # -qnostdinc cancels other stdinc flags, even if present + string(FIND "${line}" " -qnostdinc" nostd) + if(NOT ${nostd} EQUAL -1) + set(rv "") # defined but empty + string(APPEND log " got implicit includes via XL parser (nostdinc)\n") + else() + if("${lang}" STREQUAL "CXX") + string(REGEX MATCHALL " -qcpp_stdinc=([^ ]*)" std "${line}") + string(REGEX MATCHALL " -qgcc_cpp_stdinc=([^ ]*)" gcc_std "${line}") + else() + string(REGEX MATCHALL " -qc_stdinc=([^ ]*)" std "${line}") + string(REGEX MATCHALL " -qgcc_c_stdinc=([^ ]*)" gcc_std "${line}") + endif() + set(xlstd ${std} ${gcc_std}) + foreach(inc IN LISTS xlstd) + string(REGEX REPLACE " -q(cpp|gcc_cpp|c|gcc_c)_stdinc=([^ ]*)" "\\2" + ipath "${inc}") + string(REPLACE ":" ";" ipath "${ipath}") + list(APPEND rv ${ipath}) + endforeach() + endif() + # user can add -I flags via CMAKE_{C,CXX}_FLAGS, look for that too + string(REGEX MATCHALL " (-I ?)([^ ]*)" incs "${line}") + unset(urv) + foreach(inc IN LISTS incs) + string(REGEX REPLACE " (-I ?)([^ ]*)" "\\2" idir "${inc}") + list(APPEND urv "${idir}") + endforeach() + if(urv) + if ("${rv}" STREQUAL "") + set(rv ${urv}) + else() + list(APPEND rv ${urv}) + endif() + endif() + + if(DEFINED rv) + string(APPEND log " got implicit includes via XL parser!\n") + else() + string(APPEND log " warning: XL parse failed!\n") + endif() + endif() + if(log) set(${log_var} "${log}" PARENT_SCOPE) + else() + unset(${log_var} PARENT_SCOPE) endif() - if(rv) + if(DEFINED rv) set(${id_var} "${rv}" PARENT_SCOPE) set(${state_var} "done" PARENT_SCOPE) endif() @@ -48,10 +123,11 @@ function(cmake_parse_implicit_include_info text lang dir_var log_var state_var) string(REGEX REPLACE "\r?\n" ";" output_lines "${text}") foreach(line IN LISTS output_lines) if(state STREQUAL start) - string(FIND "${line}" "#include <...> search starts here:" rv) + string(FIND "${line}" "#include \"...\" search starts here:" rv) if(rv GREATER -1) set(state loading) - string(APPEND log " found start of implicit include info\n") + set(preload 1) # looking for include <...> now + string(APPEND log " found start of include info\n") else() cmake_parse_implicit_include_line("${line}" "${lang}" implicit_dirs_tmp linelog state) @@ -68,15 +144,24 @@ function(cmake_parse_implicit_include_info text lang dir_var log_var state_var) set(state done) string(APPEND log " end of search list found\n") break() - else() - string(STRIP "${line}" path) # remove leading/trailing spaces - if ("${path}" MATCHES " \\(framework directory\\)$") - continue() # frameworks are handled elsewhere, ignore them here + endif() + if(preload) + string(FIND "${line}" "#include <...> search starts here:" rv) + if(rv GREATER -1) + set(preload 0) + string(APPEND log " found start of implicit include info\n") endif() - string(REPLACE "\\" "/" path "${path}") - list(APPEND implicit_dirs_tmp "${path}") - string(APPEND log " add: [${path}]\n") + continue() + endif() + if("${line}" MATCHES "^ ") + string(SUBSTRING "${line}" 1 -1 line) # remove leading space + endif() + if ("${line}" MATCHES " \\(framework directory\\)$") + continue() # frameworks are handled elsewhere, ignore them here endif() + string(REPLACE "\\" "/" path "${line}") + list(APPEND implicit_dirs_tmp "${path}") + string(APPEND log " add: [${path}]\n") endif() endforeach() diff --git a/Modules/CPack.background.png.in b/Modules/CPack.background.png.in Binary files differindex 9339e7c..a32ab37 100644 --- a/Modules/CPack.background.png.in +++ b/Modules/CPack.background.png.in diff --git a/Modules/Compiler/Intel-CXX-FeatureTests.cmake b/Modules/Compiler/Intel-CXX-FeatureTests.cmake index 0df6c0f..aa35b97 100644 --- a/Modules/Compiler/Intel-CXX-FeatureTests.cmake +++ b/Modules/Compiler/Intel-CXX-FeatureTests.cmake @@ -24,7 +24,7 @@ set(DETECT_CXX14 "((__cplusplus >= 201300L) || ((__cplusplus == 201103L) && !def unset(DETECT_BUGGY_ICC15) set(Intel17_CXX14 "__INTEL_COMPILER >= 1700 && ${DETECT_CXX14}") -set(_cmake_feature_test_cxx_relaxed_constexpr "__cpp_constexpr >= 201304 || (${Intel17_CXX14} && __INTEL_COMPILER != 1800 && !defined(_MSC_VER))") +set(_cmake_feature_test_cxx_relaxed_constexpr "__cpp_constexpr >= 201304 || (${Intel17_CXX14} && !(__INTEL_COMPILER == 1800 && __INTEL_COMPILER_UPDATE < 5) && !defined(_MSC_VER))") set(Intel16_CXX14 "__INTEL_COMPILER >= 1600 && ${DETECT_CXX14}") set(_cmake_feature_test_cxx_aggregate_default_initializers "${Intel16_CXX14}") diff --git a/Modules/FindDoxygen.cmake b/Modules/FindDoxygen.cmake index fdd3a92..32b4aa2 100644 --- a/Modules/FindDoxygen.cmake +++ b/Modules/FindDoxygen.cmake @@ -713,7 +713,9 @@ if(TARGET Doxygen::doxygen) if(_line MATCHES "([A-Z][A-Z0-9_]+)( *=)(.*)") set(_key "${CMAKE_MATCH_1}") set(_eql "${CMAKE_MATCH_2}") - string(REPLACE ";" "\\\n" _value "${CMAKE_MATCH_3}") + set(_value "${CMAKE_MATCH_3}") + string(REPLACE "\\" "\\\\" _value "${_value}") + string(REPLACE ";" "\\\n" _value "${_value}") list(APPEND _Doxygen_tpl_params "${_key}${_eql}${_value}") endif() endforeach() diff --git a/Modules/FindICU.cmake b/Modules/FindICU.cmake index 70e10f5..e4b4909 100644 --- a/Modules/FindICU.cmake +++ b/Modules/FindICU.cmake @@ -165,7 +165,9 @@ function(_ICU_FIND) find_program("${cache_var}" "${program}" HINTS ${icu_roots} PATH_SUFFIXES ${icu_binary_suffixes} - DOC "ICU ${program} executable") + DOC "ICU ${program} executable" + NO_PACKAGE_ROOT_PATH + ) mark_as_advanced(cache_var) set("${program_var}" "${${cache_var}}" PARENT_SCOPE) endforeach() @@ -229,11 +231,15 @@ function(_ICU_FIND) find_library("${component_cache_release}" ${component_libnames} HINTS ${icu_roots} PATH_SUFFIXES ${icu_library_suffixes} - DOC "ICU ${component} library (release)") + DOC "ICU ${component} library (release)" + NO_PACKAGE_ROOT_PATH + ) find_library("${component_cache_debug}" ${component_debug_libnames} HINTS ${icu_roots} PATH_SUFFIXES ${icu_library_suffixes} - DOC "ICU ${component} library (debug)") + DOC "ICU ${component} library (debug)" + NO_PACKAGE_ROOT_PATH + ) include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake) select_library_configurations(ICU_${component_upcase}) mark_as_advanced("${component_cache_release}" "${component_cache_debug}") diff --git a/Modules/FindPython.cmake b/Modules/FindPython.cmake index f5fb0ab..f014916 100644 --- a/Modules/FindPython.cmake +++ b/Modules/FindPython.cmake @@ -14,11 +14,12 @@ Three components are supported: * ``Compiler``: search for Python compiler. Only offered by IronPython. * ``Development``: search for development artifacts (include directories and libraries). +* ``NumPy``: search for NumPy include directories. If no ``COMPONENTS`` is specified, ``Interpreter`` is assumed. -To ensure consistent versions between components ``Interpreter``, ``Compiler`` -and ``Development``, specify all components at the same time:: +To ensure consistent versions between components ``Interpreter``, ``Compiler``, +``Development`` and ``NumPy``, specify all components at the same time:: find_package (Python COMPONENTS Interpreter Development) @@ -39,6 +40,8 @@ This module defines the following :ref:`Imported Targets <Imported Targets>` Python compiler. Target defined if component ``Compiler`` is found. ``Python::Python`` Python library. Target defined if component ``Development`` is found. +``Python::NumPy`` + NumPy Python library. Target defined if component ``NumPy`` is found. Result Variables ^^^^^^^^^^^^^^^^ @@ -104,6 +107,12 @@ This module will set the following variables in your project Python minor version. ``Python_VERSION_PATCH`` Python patch version. +``Python_NumPy_FOUND`` + System has the NumPy. +``Python_NumPy_INCLUDE_DIRS`` + The NumPy include directries. +``Python_NumPy_VERSION`` + The NumPy version. Hints ^^^^^ diff --git a/Modules/FindPython/Support.cmake b/Modules/FindPython/Support.cmake index fd429e2..0138b04 100644 --- a/Modules/FindPython/Support.cmake +++ b/Modules/FindPython/Support.cmake @@ -209,6 +209,10 @@ if (NOT ${_PYTHON_PREFIX}_FIND_COMPONENTS) set (${_PYTHON_PREFIX}_FIND_COMPONENTS Interpreter) set (${_PYTHON_PREFIX}_FIND_REQUIRED_Interpreter TRUE) endif() +if ("NumPy" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS) + list (APPEND ${_PYTHON_PREFIX}_FIND_COMPONENTS "Interpreter" "Development") + list (REMOVE_DUPLICATES ${_PYTHON_PREFIX}_FIND_COMPONENTS) +endif() foreach (_${_PYTHON_PREFIX}_COMPONENT IN LISTS ${_PYTHON_PREFIX}_FIND_COMPONENTS) set (${_PYTHON_PREFIX}_${_${_PYTHON_PREFIX}_COMPONENT}_FOUND FALSE) endforeach() @@ -1122,6 +1126,41 @@ if ("Development" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS endif() endif() +if ("NumPy" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS AND ${_PYTHON_PREFIX}_Interpreter_FOUND) + if (${_PYTHON_PREFIX}_FIND_REQUIRED_NumPy) + list (APPEND _${_PYTHON_PREFIX}_REQUIRED_VARS ${_PYTHON_PREFIX}_NumPy_INCLUDE_DIR) + list (APPEND _${_PYTHON_PREFIX}_CACHED_VARS ${_PYTHON_PREFIX}_NumPy_INCLUDE_DIR) + endif() + execute_process( + COMMAND "${${_PYTHON_PREFIX}_EXECUTABLE}" -c + "from __future__ import print_function\ntry: import numpy; print(numpy.get_include(), end='')\nexcept:pass\n" + RESULT_VARIABLE _${_PYTHON_PREFIX}_RESULT + OUTPUT_VARIABLE _${_PYTHON_PREFIX}_NumPy_PATH + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + if (NOT _${_PYTHON_PREFIX}_RESULT) + find_path(${_PYTHON_PREFIX}_NumPy_INCLUDE_DIR + NAMES arrayobject.h numpyconfig.h + HINTS "${_${_PYTHON_PREFIX}_NumPy_PATH}" + PATH_SUFFIXES numpy + NO_DEFAULT_PATH) + endif() + if(${_PYTHON_PREFIX}_NumPy_INCLUDE_DIR) + set(${_PYTHON_PREFIX}_NumPy_INCLUDE_DIRS "${${_PYTHON_PREFIX}_NumPy_INCLUDE_DIR}") + set(${_PYTHON_PREFIX}_NumPy_FOUND TRUE) + endif() + if(${_PYTHON_PREFIX}_NumPy_FOUND) + execute_process( + COMMAND "${${_PYTHON_PREFIX}_EXECUTABLE}" -c + "from __future__ import print_function\ntry: import numpy; print(numpy.__version__, end='')\nexcept:pass\n" + RESULT_VARIABLE _${_PYTHON_PREFIX}_RESULT + OUTPUT_VARIABLE _${_PYTHON_PREFIX}_NumPy_VERSION) + if (NOT _${_PYTHON_PREFIX}_RESULT) + set(${_PYTHON_PREFIX}_NumPy_VERSION "${_${_PYTHON_PREFIX}_NumPy_VERSION}") + endif() + endif() +endif() + # final validation if (${_PYTHON_PREFIX}_VERSION_MAJOR AND NOT ${_PYTHON_PREFIX}_VERSION_MAJOR VERSION_EQUAL _${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR) @@ -1249,6 +1288,14 @@ if(_${_PYTHON_PREFIX}_CMAKE_ROLE STREQUAL "PROJECT") endif() endfunction() endif() + + if ("NumPy" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS AND ${_PYTHON_PREFIX}_NumPy_FOUND + AND NOT TARGET ${_PYTHON_PREFIX}::NumPy AND TARGET ${_PYTHON_PREFIX}::Python) + add_library (${_PYTHON_PREFIX}::NumPy INTERFACE IMPORTED) + set_property (TARGET ${_PYTHON_PREFIX}::NumPy + PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${${_PYTHON_PREFIX}_NumPy_INCLUDE_DIR}") + target_link_libraries (${_PYTHON_PREFIX}::NumPy INTERFACE ${_PYTHON_PREFIX}::Python) + endif() endif() # final clean-up diff --git a/Modules/FindPython2.cmake b/Modules/FindPython2.cmake index b770708..0bb7b28 100644 --- a/Modules/FindPython2.cmake +++ b/Modules/FindPython2.cmake @@ -14,11 +14,12 @@ Three components are supported: * ``Compiler``: search for Python 2 compiler. Only offered by IronPython. * ``Development``: search for development artifacts (include directories and libraries) +* ``NumPy``: search for NumPy include directories. If no ``COMPONENTS`` is specified, ``Interpreter`` is assumed. -To ensure consistent versions between components ``Interpreter``, ``Compiler`` -and ``Development``, specify all components at the same time:: +To ensure consistent versions between components ``Interpreter``, ``Compiler``, +``Development`` and ``NumPy``, specify all components at the same time:: find_package (Python2 COMPONENTS Interpreter Development) @@ -40,6 +41,8 @@ This module defines the following :ref:`Imported Targets <Imported Targets>` Python 2 compiler. Target defined if component ``Compiler`` is found. ``Python2::Python`` Python 2 library. Target defined if component ``Development`` is found. +``Python2::NumPy`` + NumPy library for Python 2. Target defined if component ``NumPy`` is found. Result Variables ^^^^^^^^^^^^^^^^ @@ -105,6 +108,12 @@ This module will set the following variables in your project Python 2 minor version. ``Python2_VERSION_PATCH`` Python 2 patch version. +``Python2_NumPy_FOUND`` + System has the NumPy. +``Python2_NumPy_INCLUDE_DIRS`` + The NumPy include directries. +``Python2_NumPy_VERSION`` + The NumPy version. Hints ^^^^^ diff --git a/Modules/FindPython3.cmake b/Modules/FindPython3.cmake index 17f1e56..b3dfff3 100644 --- a/Modules/FindPython3.cmake +++ b/Modules/FindPython3.cmake @@ -14,11 +14,12 @@ Three components are supported: * ``Compiler``: search for Python 3 compiler. Only offered by IronPython. * ``Development``: search for development artifacts (include directories and libraries) +* ``NumPy``: search for NumPy include directories. If no ``COMPONENTS`` is specified, ``Interpreter`` is assumed. -To ensure consistent versions between components ``Interpreter``, ``Compiler`` -and ``Development``, specify all components at the same time:: +To ensure consistent versions between components ``Interpreter``, ``Compiler``, +``Development`` and ``NumPy``, specify all components at the same time:: find_package (Python3 COMPONENTS Interpreter Development) @@ -40,6 +41,8 @@ This module defines the following :ref:`Imported Targets <Imported Targets>` Python 3 compiler. Target defined if component ``Compiler`` is found. ``Python3::Python`` Python 3 library. Target defined if component ``Development`` is found. +``Python3::NumPy`` + NumPy library for Python 3. Target defined if component ``NumPy`` is found. Result Variables ^^^^^^^^^^^^^^^^ @@ -105,6 +108,12 @@ This module will set the following variables in your project Python 3 minor version. ``Python3_VERSION_PATCH`` Python 3 patch version. +``Python3_NumPy_FOUND`` + System has the NumPy. +``Python3_NumPy_INCLUDE_DIRS`` + The NumPy include directries. +``Python3_NumPy_VERSION`` + The NumPy version. Hints ^^^^^ diff --git a/Modules/FindPythonInterp.cmake b/Modules/FindPythonInterp.cmake index d1f7b31..da33301 100644 --- a/Modules/FindPythonInterp.cmake +++ b/Modules/FindPythonInterp.cmake @@ -130,7 +130,9 @@ if(PYTHON_EXECUTABLE) endif() else() # sys.version predates sys.version_info, so use that - execute_process(COMMAND "${PYTHON_EXECUTABLE}" -c "import sys; sys.stdout.write(sys.version)" + # sys.version was first documented for Python 1.5, so assume version 1.4 + # if retrieving sys.version fails. + execute_process(COMMAND "${PYTHON_EXECUTABLE}" -c "try: import sys; sys.stdout.write(sys.version)\nexcept: sys.stdout.write(\"1.4.0\")" OUTPUT_VARIABLE _VERSION RESULT_VARIABLE _PYTHON_VERSION_RESULT ERROR_QUIET) @@ -144,12 +146,10 @@ if(PYTHON_EXECUTABLE) set(PYTHON_VERSION_PATCH "0") endif() else() - # sys.version was first documented for Python 1.5, so assume - # this is older. - set(PYTHON_VERSION_STRING "1.4") - set(PYTHON_VERSION_MAJOR "1") - set(PYTHON_VERSION_MINOR "4") - set(PYTHON_VERSION_PATCH "0") + unset(PYTHON_VERSION_STRING) + unset(PYTHON_VERSION_MAJOR) + unset(PYTHON_VERSION_MINOR) + unset(PYTHON_VERSION_PATCH) endif() endif() unset(_PYTHON_VERSION_RESULT) |