windows

What to do when CMake can't find your Python files

I've been using Vim for some time, and I really like YouCompleteMe, an autocompletion programming engine. Unfortunately, while the author is always working towards making installation quick and painless, there is always something that breaks in the process. For me, a consistent issue I've had is CMake being able to detect my Python installation. I still can't figure out why CMake has so much trouble detecting it, but until it is fixed, here's a quick solution if you find yourself in the same situation.

For reference, I am running Windows 10 64 bit, and all the software packages (CMake, Vim, Python, LLVM) I am using are x64 builds.

Ususally, what I run into is this:

CMake can't find the Python libraries and include directories

To fix it, simply add:

-DPYTHON_LIBRARY="C:\Program Files\Python35\libs\python35.lib"
-DPYTHON_INCLUDE_DIR="C:\Program Files\Python35\include"

As command line arguments (the path to your python35.lib and include directory might be different, especially if you use the 32 bit version on a 64 bit machine).

I'm hoping this is eventually fixed or improved, because it's not very user friendly.

References:
https://cmake.org/cmake/help/v3.7/module/FindPythonLibs.html?highlight=findpython#module:FindPythonLibs

 

Reminder Post: How to Generate WGL Extension Files with glLoadGen

I always seem to forget how to do this, so I'm writing myself a reminder post of how to do this just so that I can refer to it and hopefully people can find it and do it for themselves.

If you don't know what glLoadGen is, glLoadGen is a more modern way to load OpenGL and related functions. The main difference with GLEW is that it creates only the definitions and declarations of the functions that are found within the spec and version you want. That is to say, if you only want the functions which work and are included in OpenGL 3.3 Core Profile, you only receive those, none of the deprecated or newer functions.

In general I have found this to be cleaner and easier to set up in Windows for my OpenGL applications. It's true that if you want fall-backs (as in, another version of OpenGL assuming the card you are running on doesn't support it), you would still want to use something like GLEW, but I have not found that to be the case yet.

glLoadGen includes files for non-core extensions that can build you source files that do the same thing. This includes WGL (Windows GL) which is necessary to setup an OpenGL context using Win32.

glLoadGen uses LUA, so you need at least LUA 5.1.

To generate the WGL extension source files:

*FileNameSuffix* can be changed for whatever you want the suffix of your files to be. You can also change the -style flag to whatever you prefer, pointer_c, pointer_cpp, func_cpp, etc.

In the same directory which you ran the LUA script you should find two files (the extensions could be hpp and cpp for other styles):

wgl_*FileNameSuffix*.h
wgl_*FileNameSuffix*.c

Include these in your project, and you should be able to use WGL functions.