Saturday 16 March 2013

CMake+ MinGW + freeglut + Qt Creator

After a couple of days of studying by reading from various sources and hours of trial and errors, I just figured out how to set cmake, mingw, freeglut and qt creator to work as a single piece on my Windows Vista. The procedure is:


1. installing cmake
2. modifying FindGLUT.cmake
    C:\Program Files\CMake 2.8\share\cmake-2.8\Modules\FindGLUT.cmake
    replacing the old code in [if] by this
    -----------------------------
    IF (WIN32)
          FIND_PATH( GLUT_INCLUDE_DIR NAMES GL/glut.h
            PATHS ENV GLUT_ROOT_PATH
            PATH_SUFFIXES include
            )
          FIND_LIBRARY( GLUT_glut_LIBRARY NAMES glut glut32 freeglut
            PATHS ENV OPENGL_LIBRARY_DIR GLUT_ROOT_PATH
            PATH_SUFFIXES Release lib
            )
    ELSE (WIN32)
    -----------------------------
3. installing minGW and msys
4. download freeglut source files and make by using msys
    ./configure --with-x=no
    make
    make install
5. The output header library and dll files are in the folder [local]
6. Copy them to C:/MinGW/include, C:/MinGW/lib and Windows/system32
7. Add path into the CMakeLists.txt
    set(CMAKE_INCLUDE_PATH C:/MinGW)
    set(CMAKE_LIBRARY_PATH C:/MinGW)
8. Open the CMakeLists.txt with Qt creator
9. Build and run...job done!

References

http://public.kitware.com/Bug/view.php?id=13306
http://www.transmissionzero.co.uk/software/freeglut-devel/
http://www.mingw.org/category/wiki/glut
http://freeglut.sourceforge.net/
http://www.transmissionzero.co.uk/software/freeglut-devel/


No comments:

Post a Comment