Changeset View
Changeset View
Standalone View
Standalone View
build_files/cmake/macros.cmake
| Show First 20 Lines • Show All 1,133 Lines • ▼ Show 20 Lines | add_custom_command( | ||||
| COMMAND "$<TARGET_FILE:msgfmt>" ${_file_from} ${_file_to} | COMMAND "$<TARGET_FILE:msgfmt>" ${_file_from} ${_file_to} | ||||
| DEPENDS msgfmt ${_file_from}) | DEPENDS msgfmt ${_file_from}) | ||||
| set_source_files_properties(${_file_to} PROPERTIES GENERATED TRUE) | set_source_files_properties(${_file_to} PROPERTIES GENERATED TRUE) | ||||
| endfunction() | endfunction() | ||||
| function(find_python_package | function(find_python_package | ||||
| package | package | ||||
| relative_include_dir | |||||
| ) | ) | ||||
| string(TOUPPER ${package} _upper_package) | string(TOUPPER ${package} _upper_package) | ||||
| # set but invalid | # set but invalid | ||||
| if((NOT ${PYTHON_${_upper_package}_PATH} STREQUAL "") AND | if((NOT ${PYTHON_${_upper_package}_PATH} STREQUAL "") AND | ||||
| (NOT ${PYTHON_${_upper_package}_PATH} MATCHES NOTFOUND)) | (NOT ${PYTHON_${_upper_package}_PATH} MATCHES NOTFOUND)) | ||||
| # if(NOT EXISTS "${PYTHON_${_upper_package}_PATH}/${package}") | # if(NOT EXISTS "${PYTHON_${_upper_package}_PATH}/${package}") | ||||
| Show All 15 Lines | find_path(PYTHON_${_upper_package}_PATH | ||||
| "${PYTHON_LIBPATH}/" | "${PYTHON_LIBPATH}/" | ||||
| "${PYTHON_LIBPATH}/python${PYTHON_VERSION}/" | "${PYTHON_LIBPATH}/python${PYTHON_VERSION}/" | ||||
| "${PYTHON_LIBPATH}/python${_PY_VER_MAJOR}/" | "${PYTHON_LIBPATH}/python${_PY_VER_MAJOR}/" | ||||
| PATH_SUFFIXES | PATH_SUFFIXES | ||||
| site-packages | site-packages | ||||
| dist-packages | dist-packages | ||||
| vendor-packages | vendor-packages | ||||
| NO_DEFAULT_PATH | NO_DEFAULT_PATH | ||||
| DOC | |||||
| "Path to python site-packages or dist-packages containing '${package}' module" | |||||
| ) | ) | ||||
| mark_as_advanced(PYTHON_${_upper_package}_PATH) | |||||
| if(NOT EXISTS "${PYTHON_${_upper_package}_PATH}") | if(NOT EXISTS "${PYTHON_${_upper_package}_PATH}") | ||||
| message(WARNING | message(WARNING | ||||
| "Python package '${package}' path could not be found in:\n" | "Python package '${package}' path could not be found in:\n" | ||||
| "'${PYTHON_LIBPATH}/python${PYTHON_VERSION}/site-packages/${package}', " | "'${PYTHON_LIBPATH}/python${PYTHON_VERSION}/site-packages/${package}', " | ||||
| "'${PYTHON_LIBPATH}/python${_PY_VER_MAJOR}/site-packages/${package}', " | "'${PYTHON_LIBPATH}/python${_PY_VER_MAJOR}/site-packages/${package}', " | ||||
| "'${PYTHON_LIBPATH}/python${PYTHON_VERSION}/dist-packages/${package}', " | "'${PYTHON_LIBPATH}/python${PYTHON_VERSION}/dist-packages/${package}', " | ||||
| "'${PYTHON_LIBPATH}/python${_PY_VER_MAJOR}/dist-packages/${package}', " | "'${PYTHON_LIBPATH}/python${_PY_VER_MAJOR}/dist-packages/${package}', " | ||||
| "'${PYTHON_LIBPATH}/python${PYTHON_VERSION}/vendor-packages/${package}', " | "'${PYTHON_LIBPATH}/python${PYTHON_VERSION}/vendor-packages/${package}', " | ||||
| "'${PYTHON_LIBPATH}/python${_PY_VER_MAJOR}/vendor-packages/${package}', " | "'${PYTHON_LIBPATH}/python${_PY_VER_MAJOR}/vendor-packages/${package}', " | ||||
| "\n" | "\n" | ||||
| "The 'WITH_PYTHON_INSTALL_${_upper_package}' option will be ignored when installing Python.\n" | "The 'WITH_PYTHON_INSTALL_${_upper_package}' option will be ignored when installing Python.\n" | ||||
| "The build will be usable, only add-ons that depend on this package won't be functional." | "The build will be usable, only add-ons that depend on this package won't be functional." | ||||
| ) | ) | ||||
| set(WITH_PYTHON_INSTALL_${_upper_package} OFF PARENT_SCOPE) | set(WITH_PYTHON_INSTALL_${_upper_package} OFF PARENT_SCOPE) | ||||
| else() | else() | ||||
| message(STATUS "${package} found at '${PYTHON_${_upper_package}_PATH}'") | message(STATUS "${package} found at '${PYTHON_${_upper_package}_PATH}'") | ||||
| if(NOT "${relative_include_dir}" STREQUAL "") | |||||
| unset(PYTHON_${_upper_package}_INCLUDE_DIRS CACHE) | |||||
| find_path(PYTHON_${_upper_package}_INCLUDE_DIRS | |||||
| NAMES | |||||
| "${package}/${relative_include_dir}" | |||||
| HINTS | |||||
| "${PYTHON_LIBPATH}/" | |||||
| "${PYTHON_LIBPATH}/python${PYTHON_VERSION}/" | |||||
| "${PYTHON_LIBPATH}/python${_PY_VER_MAJOR}/" | |||||
| PATH_SUFFIXES | |||||
| "site-packages/" | |||||
| "dist-packages/" | |||||
| "vendor-packages/" | |||||
| NO_DEFAULT_PATH | |||||
| DOC | |||||
| "Path to python site-packages or dist-packages containing '${package}' module header files" | |||||
| ) | |||||
| mark_as_advanced(PYTHON_${_upper_package}_INCLUDE_DIRS) | |||||
| if(NOT EXISTS "${PYTHON_${_upper_package}_INCLUDE_DIRS}") | |||||
| message(WARNING | |||||
| "Python package '${package}' include dir path could not be found in:\n" | |||||
| "'${PYTHON_LIBPATH}/python${PYTHON_VERSION}/site-packages/${package}/${relative_include_dir}', " | |||||
| "'${PYTHON_LIBPATH}/python${_PY_VER_MAJOR}/site-packages/${package}/${relative_include_dir}', " | |||||
| "'${PYTHON_LIBPATH}/python${PYTHON_VERSION}/dist-packages/${package}/${relative_include_dir}', " | |||||
| "'${PYTHON_LIBPATH}/python${_PY_VER_MAJOR}/dist-packages/${package}/${relative_include_dir}', " | |||||
| "'${PYTHON_LIBPATH}/python${PYTHON_VERSION}/vendor-packages/${package}/${relative_include_dir}', " | |||||
| "'${PYTHON_LIBPATH}/python${_PY_VER_MAJOR}/vendor-packages/${package}/${relative_include_dir}', " | |||||
sybren: This list is incomplete, `${PYTHON_LIBPATH}` is missing (the first path in `HINTS`). | |||||
mont29AuthorUnsubmitted Done Inline ActionsSame as above existing message for PYTHON_NUMPY_PATH... TBH I would just remove all those lists of tried paths (or if we really want to keep them generate them with some loops), don't see much of the point of having them in the error message anyway, But that would be outside of this patch in any case. mont29: Same as above existing message for `PYTHON_NUMPY_PATH`... TBH I would just remove all those… | |||||
sybrenUnsubmitted Not Done Inline ActionsYes, having them in some form that allows passing to find_path() and generating the errors would be nice. I think it's a nice touch to list which directories were searched, though, as that can really help in debugging build issues. I agree this is outside the scope of this patch. sybren: Yes, having them in some form that allows passing to `find_path()` and generating the errors… | |||||
| "\n" | |||||
| "The 'WITH_PYTHON_${_upper_package}' option will be disabled.\n" | |||||
| "The build will be usable, only add-ons that depend on this package won't be functional." | |||||
| ) | |||||
| set(WITH_PYTHON_${_upper_package} OFF PARENT_SCOPE) | |||||
| endif() | |||||
| endif() | |||||
| endif() | endif() | ||||
| endif() | endif() | ||||
| endfunction() | endfunction() | ||||
| # like Python's 'print(dir())' | # like Python's 'print(dir())' | ||||
| function(print_all_vars) | function(print_all_vars) | ||||
| get_cmake_property(_vars VARIABLES) | get_cmake_property(_vars VARIABLES) | ||||
| foreach(_var ${_vars}) | foreach(_var ${_vars}) | ||||
| ▲ Show 20 Lines • Show All 71 Lines • Show Last 20 Lines | |||||
This list is incomplete, ${PYTHON_LIBPATH} is missing (the first path in HINTS).