<div dir="ltr">Doesn't this regress building with the VS generator? Was that already broken? It seems like this should've been sent to Zach, who added this logic, for review.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, May 28, 2019 at 7:23 PM Saleem Abdulrasool via lldb-commits <<a href="mailto:lldb-commits@lists.llvm.org" target="_blank">lldb-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Author: compnerd<br>
Date: Tue May 28 19:26:29 2019<br>
New Revision: 361915<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=361915&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=361915&view=rev</a><br>
Log:<br>
build: only search for the needed python type<br>
<br>
Windows has different types of runtime libraries which are ABI<br>
incompatible with one another. This requires that the debug build of<br>
lldb link against the debug build of python. Adjust the python search<br>
to search for only the required type of python. This permits building a<br>
release build of lldb against just the release build of python.<br>
<br>
Modified:<br>
lldb/trunk/cmake/modules/LLDBConfig.cmake<br>
<br>
Modified: lldb/trunk/cmake/modules/LLDBConfig.cmake<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/modules/LLDBConfig.cmake?rev=361915&r1=361914&r2=361915&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/modules/LLDBConfig.cmake?rev=361915&r1=361914&r2=361915&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/cmake/modules/LLDBConfig.cmake (original)<br>
+++ lldb/trunk/cmake/modules/LLDBConfig.cmake Tue May 28 19:26:29 2019<br>
@@ -153,83 +153,39 @@ function(find_python_libs_windows)<br>
endif()<br>
<br>
file(TO_CMAKE_PATH "${PYTHON_HOME}" PYTHON_HOME)<br>
- file(TO_CMAKE_PATH "${PYTHON_HOME}/python_d.exe" PYTHON_DEBUG_EXE)<br>
- file(TO_CMAKE_PATH "${PYTHON_HOME}/libs/${PYTHONLIBS_BASE_NAME}_d.lib" PYTHON_DEBUG_LIB)<br>
- file(TO_CMAKE_PATH "${PYTHON_HOME}/${PYTHONLIBS_BASE_NAME}_d.dll" PYTHON_DEBUG_DLL)<br>
-<br>
- file(TO_CMAKE_PATH "${PYTHON_HOME}/python.exe" PYTHON_RELEASE_EXE)<br>
- file(TO_CMAKE_PATH "${PYTHON_HOME}/libs/${PYTHONLIBS_BASE_NAME}.lib" PYTHON_RELEASE_LIB)<br>
- file(TO_CMAKE_PATH "${PYTHON_HOME}/${PYTHONLIBS_BASE_NAME}.dll" PYTHON_RELEASE_DLL)<br>
-<br>
- if (NOT EXISTS ${PYTHON_DEBUG_EXE})<br>
- message("Unable to find ${PYTHON_DEBUG_EXE}")<br>
- unset(PYTHON_DEBUG_EXE)<br>
- endif()<br>
-<br>
- if (NOT EXISTS ${PYTHON_RELEASE_EXE})<br>
- message("Unable to find ${PYTHON_RELEASE_EXE}")<br>
- unset(PYTHON_RELEASE_EXE)<br>
- endif()<br>
-<br>
- if (NOT EXISTS ${PYTHON_DEBUG_LIB})<br>
- message("Unable to find ${PYTHON_DEBUG_LIB}")<br>
- unset(PYTHON_DEBUG_LIB)<br>
- endif()<br>
-<br>
- if (NOT EXISTS ${PYTHON_RELEASE_LIB})<br>
- message("Unable to find ${PYTHON_RELEASE_LIB}")<br>
- unset(PYTHON_RELEASE_LIB)<br>
- endif()<br>
-<br>
- if (NOT EXISTS ${PYTHON_DEBUG_DLL})<br>
- message("Unable to find ${PYTHON_DEBUG_DLL}")<br>
- unset(PYTHON_DEBUG_DLL)<br>
- endif()<br>
+ # TODO(compnerd) when CMake Policy `CMP0091` is set to NEW, we should use<br>
+ # if(CMAKE_MSVC_RUNTIME_LIBRARY MATCHES MultiThreadedDebug)<br>
+ if(CMAKE_BUILD_TYPE STREQUAL Debug)<br>
+ file(TO_CMAKE_PATH "${PYTHON_HOME}/python_d.exe" PYTHON_EXE)<br>
+ file(TO_CMAKE_PATH "${PYTHON_HOME}/libs/${PYTHONLIBS_BASE_NAME}_d.lib" PYTHON_LIB)<br>
+ file(TO_CMAKE_PATH "${PYTHON_HOME}/${PYTHONLIBS_BASE_NAME}_d.dll" PYTHON_DLL)<br>
+ else()<br>
+ file(TO_CMAKE_PATH "${PYTHON_HOME}/python.exe" PYTHON_EXE)<br>
+ file(TO_CMAKE_PATH "${PYTHON_HOME}/libs/${PYTHONLIBS_BASE_NAME}.lib" PYTHON_LIB)<br>
+ file(TO_CMAKE_PATH "${PYTHON_HOME}/${PYTHONLIBS_BASE_NAME}.dll" PYTHON_DLL)<br>
+ endif()<br>
+<br>
+ foreach(component PYTHON_EXE;PYTHON_LIB;PYTHON_DLL)<br>
+ if(NOT EXISTS ${${component}})<br>
+ message("unable to find ${component}")<br>
+ unset(${component})<br>
+ endif()<br>
+ endforeach()<br>
<br>
- if (NOT EXISTS ${PYTHON_RELEASE_DLL})<br>
- message("Unable to find ${PYTHON_RELEASE_DLL}")<br>
- unset(PYTHON_RELEASE_DLL)<br>
- endif()<br>
-<br>
- if (NOT (PYTHON_DEBUG_EXE AND PYTHON_RELEASE_EXE AND PYTHON_DEBUG_LIB AND PYTHON_RELEASE_LIB AND PYTHON_DEBUG_DLL AND PYTHON_RELEASE_DLL))<br>
- message("Python installation is corrupt. Python support will be disabled for this build.")<br>
+ if (NOT PYTHON_EXE OR NOT PYTHON_LIB OR NOT PYTHON_DLL)<br>
+ message("Unable to find all Python components. Python support will be disabled for this build.")<br>
set(LLDB_DISABLE_PYTHON 1 PARENT_SCOPE)<br>
return()<br>
endif()<br>
<br>
- # Generator expressions are evaluated in the context of each build configuration generated<br>
- # by CMake. Here we use the $<CONFIG:Debug>:VALUE logical generator expression to ensure<br>
- # that the debug Python library, DLL, and executable are used in the Debug build configuration.<br>
- #<br>
- # Generator expressions can be difficult to grok at first so here's a breakdown of the one<br>
- # used for PYTHON_LIBRARY:<br>
- #<br>
- # 1. $<CONFIG:Debug> evaluates to 1 when the Debug configuration is being generated,<br>
- # or 0 in all other cases.<br>
- # 2. $<$<CONFIG:Debug>:${PYTHON_DEBUG_LIB}> expands to ${PYTHON_DEBUG_LIB} when the Debug<br>
- # configuration is being generated, or nothing (literally) in all other cases.<br>
- # 3. $<$<NOT:$<CONFIG:Debug>>:${PYTHON_RELEASE_LIB}> expands to ${PYTHON_RELEASE_LIB} when<br>
- # any configuration other than Debug is being generated, or nothing in all other cases.<br>
- # 4. The conditionals in 2 & 3 are mutually exclusive.<br>
- # 5. A logical expression with a conditional that evaluates to 0 yields no value at all.<br>
- #<br>
- # Due to 4 & 5 it's possible to concatenate 2 & 3 to obtain a single value specific to each<br>
- # build configuration. In this example the value will be ${PYTHON_DEBUG_LIB} when generating the<br>
- # Debug configuration, or ${PYTHON_RELEASE_LIB} when generating any other configuration.<br>
- # Note that it's imperative that there is no whitespace between the two expressions, otherwise<br>
- # CMake will insert a semicolon between the two.<br>
- set (PYTHON_EXECUTABLE $<$<CONFIG:Debug>:${PYTHON_DEBUG_EXE}>$<$<NOT:$<CONFIG:Debug>>:${PYTHON_RELEASE_EXE}>)<br>
- set (PYTHON_LIBRARY $<$<CONFIG:Debug>:${PYTHON_DEBUG_LIB}>$<$<NOT:$<CONFIG:Debug>>:${PYTHON_RELEASE_LIB}>)<br>
- set (PYTHON_DLL $<$<CONFIG:Debug>:${PYTHON_DEBUG_DLL}>$<$<NOT:$<CONFIG:Debug>>:${PYTHON_RELEASE_DLL}>)<br>
-<br>
- set (PYTHON_EXECUTABLE ${PYTHON_EXECUTABLE} PARENT_SCOPE)<br>
- set (PYTHON_LIBRARY ${PYTHON_LIBRARY} PARENT_SCOPE)<br>
+ set (PYTHON_EXECUTABLE ${PYTHON_EXE} PARENT_SCOPE)<br>
+ set (PYTHON_LIBRARY ${PYTHON_LIB} PARENT_SCOPE)<br>
set (PYTHON_DLL ${PYTHON_DLL} PARENT_SCOPE)<br>
set (PYTHON_INCLUDE_DIR ${PYTHON_INCLUDE_DIR} PARENT_SCOPE)<br>
<br>
- message("-- LLDB Found PythonExecutable: ${PYTHON_RELEASE_EXE} and ${PYTHON_DEBUG_EXE}")<br>
- message("-- LLDB Found PythonLibs: ${PYTHON_RELEASE_LIB} and ${PYTHON_DEBUG_LIB}")<br>
- message("-- LLDB Found PythonDLL: ${PYTHON_RELEASE_DLL} and ${PYTHON_DEBUG_DLL}")<br>
+ message("-- LLDB Found PythonExecutable: ${PYTHON_EXE}}")<br>
+ message("-- LLDB Found PythonLibs: ${PYTHON_LIB}")<br>
+ message("-- LLDB Found PythonDLL: ${PYTHON_DLL}")<br>
message("-- LLDB Found PythonIncludeDirs: ${PYTHON_INCLUDE_DIR}")<br>
endfunction(find_python_libs_windows)<br>
<br>
<br>
<br>
_______________________________________________<br>
lldb-commits mailing list<br>
<a href="mailto:lldb-commits@lists.llvm.org" target="_blank">lldb-commits@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits</a><br>
</blockquote></div>