glslang icon indicating copy to clipboard operation
glslang copied to clipboard

Python: Building on Windows requires change to CMakeLists.txt

Open observant2 opened this issue 4 years ago • 4 comments

Hi! In order to not repeat myself I link to a different issue.

Basically "PythonInterp" in CMakeLists.txt found my Python 2 installation instead of my Python 3 installation. I had to change it to "Python" instead and then it found Python 3. I'm no CMake expert, so I don't know if this is intended to work like this.

observant2 avatar Jan 07 '21 22:01 observant2

I am able to reproduce the problem.

I think the ultimate solution is a little trickier than just changing PythonInterp to Python. The reason is because the Python keyword was not introduced to CMake until 3.12, but some of the glslang CI testing is done on a platform that only supports CMake 3.7.

Still, I think I have a fairly easy coding solution. Should have some status shortly.

greg-lunarg avatar Jan 12 '21 23:01 greg-lunarg

Sorry, my fix is taking longer than I expected. It passes CI on every platform except MacOS. So I can't check it in.

FWIW, I believe a possible workaround is to remove Python2X from your path, at least temporarily. It is not a great workaround, but its better than completely de-installing it.

I will continue to push forward for a true solution here.

greg-lunarg avatar Jan 15 '21 17:01 greg-lunarg

It seems the problem is that SPIRV-Tools has a similar problem. When SPIRV-Tools is built with glslang on MacOS, the difference between the two is causing a problem. We will likely need to fix this problem on SPIRV-Tools as well before we can land this PR.

I will push in that direction.

greg-lunarg avatar Jan 15 '21 18:01 greg-lunarg

Sorry, my fix is taking longer than I expected. It passes CI on every platform except MacOS. So I can't check it in.

FWIW, I believe a possible workaround is to remove Python2X from your path, at least temporarily. It is not a great workaround, but its better than completely de-installing it.

I will continue to push forward for a true solution here.

Hello, I tried to compile glslang on Windows 10 (20H2 - 9042.746) and I encountered the same issue with the Python Interpreter. One solution that I found, which seems cleaner than removing Python2X from my path, was to add -DPYTHON_EXECUTABLE=C:\Python38 as a cmake argument.

Thus, the whole command is cmake $SOURCE_DIR -DCMAKE_INSTALL_PREFIX="$(pwd)/install" -DPYTHON_EXECUTABLE=$PYTHON_DIR with $SOURCE_DIR being .. and $PYTHON_DIR being C:\Python38 (i.e. the installation path of Python 3.8) in my case. CMake version is 3.19.4.

Nevertheless, I just stepped into another problem, and I don't know how to solve it, maybe you'll have an idea:

-- Selecting Windows SDK version 10.0.18362.0 to target Windows 10.0.19042.
-- No build type selected, default to Debug
-- Using Debug VC++ CRT: MDd
-- Using Release VC++ CRT: MD
-- Using MinSizeRel VC++ CRT: MD
-- Using RelWithDebInfo VC++ CRT: MD
-- Using Debug VC++ CRT: MDd
CMake Error at CMakeLists.txt:274 (list):
  list GET given empty list


CMake Error at CMakeLists.txt:275 (list):
  list GET given empty list


CMake Error at CMakeLists.txt:276 (list):
  list GET given empty list


CMake Error at CMakeLists.txt:277 (list):
  list GET given empty list


CMake Error at CMakeLists.txt:278 (list):
  list GET given empty list


-- Google Mock was not found - tests based on that will not build
-- spirv-tools not linked - illegal SPIRV may be generated for HLSL
-- Configuring incomplete, errors occurred!
See also ``"C:/Users/Utilisateur.PC-Utilisateur/source/repos/Armillus/NAlamo/DiligentEngine/DiligentCore/ThirdParty/glslang/CMakeFiles/CMakeOutput.log".

Thanks in advance for your help.

Armillus avatar Feb 15 '21 17:02 Armillus

PR https://github.com/KhronosGroup/glslang/pull/3241 updated the cmake files to use Python instead of PythonInterp, so this should be fixed now. Feel free to reopen if it is not in fact fixed.

arcady-lunarg avatar Jun 16 '23 20:06 arcady-lunarg