Open deranen opened 8 years ago
Which "GL context" library (GLUT/GLFW/GLFW3/SDL/...) do you use on Windows? Seems that one of them does include a version of GL.h
which is not compatible with Khronos' GLcorearb.h
.
One thing which might help is to use --use-glew
when invoking the configure script, or specifying -DFORCE_GL_API_LIB=GLEW
to cmake
.
I wasn't using any(!). Shouldn't cmake warn me about that before even trying to proceed and find OpenGL version?
Anyways, let's take a step back first. This is actually currently what cmake outputs as I configure it:
Generating fixes for std type_traits
Generating fix for std integer_sequence
Generating fix for std boolean constant ops
Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
Found GLEW: C:/Users/deranen/Programming/glew-1.13.0/include C:/Users/deranen/Programming/glew-1.13.0/lib/Release/x64/glew32.lib
Could NOT find GL3W (missing: GL3W_INCLUDE_DIRS GL3W_LIBRARIES)
Could NOT find GLFW (missing: GLFW_INCLUDE_DIRS GLFW_LIBRARIES)
Could NOT find GLFW3 (missing: GLFW3_INCLUDE_DIRS GLFW3_LIBRARIES)
Could NOT find GLUT (missing: GLUT_glut_LIBRARY GLUT_INCLUDE_DIR)
Could NOT find SDL (missing: SDL_INCLUDE_DIRS SDL_LIBRARIES)
Could NOT find wxWidgets (missing: wxWidgets_LIBRARIES wxWidgets_INCLUDE_DIRS)
GLM header files not found
Could NOT find PNG (missing: PNG_INCLUDE_DIRS PNG_LIBRARIES)
Could NOT find EGL (missing: EGL_INCLUDE_DIRS EGL_LIBRARIES)
CMake Error at config/ConfigGL.cmake:66 (message):
The 'GLUT' library requested but not found
Call Stack (most recent call first):
CMakeLists.txt:57 (include)
Configuring incomplete, errors occurred!
See also "C:/Users/deranen/Documents/Visual Studio 2015/Projects/oglplu2/CMakeFiles/CMakeOutput.log".
CMake's own FindGLUT can't seem to find it by itself, even though I have manually set the following variables in CMake:
GLEW_INCLUDE_DIRS = C:/Users/deranen/Programming/glew-1.13.0/include
GLEW_LIBRARIES = C:/Users/deranen/Programming/glew-1.13.0/lib/Release/x64/glew32.lib
GLUT_INCLUDE_DIRS = C:/Users/deranen/Programming/freeglut-3.0.0/include
GLUT_LIBRARIES = C:/Users/deranen/Programming/freeglut-3.0.0/lib/Debug/freeglutd.lib
But this doesn't seem to fix it. I edited config/FindGLUT.cmake since it looked like there was an error there in how it set the variables. That is how I got all the way to the OpenGL version check step. But maybe we should first try to find the issue with config/FindGLUT.cmake and correct that?
I could try to make a PR with my change to config/FindGLUT.cmake so that you can take a look at the change.
LGTM and it does not break anything on Linux. Merged.
Great!
As of latest, with the following symbols set:
GLEW_INCLUDE_DIRS = C:/Users/deranen/Programming/glew-1.13.0/include
GLEW_LIBRARIES = C:/Users/deranen/Programming/glew-1.13.0/lib/Release/x64/glew32.lib
GLUT_INCLUDE_DIRS = C:/Users/deranen/Programming/freeglut-3.0.0/include
GLUT_LIBRARIES = C:/Users/deranen/Programming/freeglut-3.0.0/lib/Debug/freeglutd.lib
CMake outputs the following:
Generating fixes for std type_traits
Generating fix for std integer_sequence
Generating fix for std boolean constant ops
Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
Found GLEW: C:/Users/deranen/Programming/glew-1.13.0/include C:/Users/deranen/Programming/glew-1.13.0/lib/Release/x64/glew32.lib
Could NOT find GL3W (missing: GL3W_INCLUDE_DIRS GL3W_LIBRARIES)
Could NOT find GLFW (missing: GLFW_INCLUDE_DIRS GLFW_LIBRARIES)
Could NOT find GLFW3 (missing: GLFW3_INCLUDE_DIRS GLFW3_LIBRARIES)
Could NOT find GLUT (missing: GLUT_glut_LIBRARY GLUT_INCLUDE_DIR)
Could NOT find SDL (missing: SDL_INCLUDE_DIRS SDL_LIBRARIES)
Could NOT find wxWidgets (missing: wxWidgets_LIBRARIES wxWidgets_INCLUDE_DIRS)
GLM header files not found
Could NOT find PNG (missing: PNG_INCLUDE_DIRS PNG_LIBRARIES)
Could NOT find EGL (missing: EGL_INCLUDE_DIRS EGL_LIBRARIES)
Using GLUT for GL context initialization.
Using GLEW as GL API library
Detecting OpenGL version
Could not detect GL version, assuming 3.0
Found GLEW extension: ARB_compatibility
Found GLEW extension: EXT_direct_state_access
Found GLEW extension: ARB_debug_output
Found GLEW extension: ATI_meminfo
Found GLEW extension: NV_path_rendering
Found GLEW extension: AMD_performance_monitor
Skipping '003_spectrum' because 'GL_ARB_compatibility' not implemented properly.
Skipping '005_path_nv_text' because 'GL_ARB_compatibility' not implemented properly.
Boost version: 1.60.0
Found the following Boost libraries:
unit_test_framework
Configuring done
Note that I still get Could NOT find GLUT (missing: GLUT_glut_LIBRARY GLUT_INCLUDE_DIR)
which is output from CMake's own FindGLUT. I guess we can ignore this since later we get Using GLUT for GL context initialization.
Here is the build error from the OpenGL version detection code:
Change Dir: C:/Users/deranen/Documents/Visual Studio 2015/Projects/oglplu2/gl/CMakeFiles/CMakeTmp
Run Build Command:"C:/Program Files (x86)/MSBuild/14.0/bin/MSBuild.exe" "cmTC_9275d.vcxproj" "/p:Configuration=Debug" "/p:VisualStudioVersion=14.0"
Microsoft (R) Build Engine version 14.0.24730.2
Copyright (C) Microsoft Corporation. All rights reserved.
Build started 5.3.2016 14:46:05.
The target "BeforeGenerateProjectPriFile" listed in a BeforeTargets attribute at "C:\Program Files (x86)\MSBuild\Microsoft\NuGet\Microsoft.NuGet.targets (186,61)" does not exist in the project, and will be ignored.
Project "C:\Users\deranen\Documents\Visual Studio 2015\Projects\oglplu2\gl\CMakeFiles\CMakeTmp\cmTC_9275d.vcxproj" on node 1 (default targets).
PrepareForBuild:
Creating directory "cmTC_9275d.dir\Debug\".
Creating directory "C:\Users\deranen\Documents\Visual Studio 2015\Projects\oglplu2\gl\CMakeFiles\CMakeTmp\Debug\".
Creating directory "cmTC_9275d.dir\Debug\cmTC_9275d.tlog\".
InitializeBuildStatus:
Creating "cmTC_9275d.dir\Debug\cmTC_9275d.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
ClCompile:
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\x86_amd64\CL.exe /c /I"C:\Users\deranen\Programming\glew-1.13.0\include" /I"C:\Users\deranen\Documents\Visual Studio 2015\Projects\oglplu2\include" /I"C:\Users\deranen\Documents\Visual Studio 2015\Projects\oglplu2\implement" /I"C:\Users\deranen\Documents\Visual Studio 2015\Projects\oglplu2\source\utils" /I"C:\Users\deranen\Programming\freeglut-3.0.0\include" /Zi /W3 /WX- /Od /Ob0 /D WIN32 /D _WINDOWS /D _DEBUG /D "CMAKE_INTDIR=\"Debug\"" /D _MBCS /Gm- /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /GR /Fo"cmTC_9275d.dir\Debug\\" /Fd"cmTC_9275d.dir\Debug\vc140.pdb" /Gd /TP /errorReport:queue "C:\Users\deranen\Documents\Visual Studio 2015\Projects\oglplu2\gl\has_GL_4_5.cpp"
Microsoft (R) C/C++ Optimizing Compiler Version 19.00.23506 for x64
Copyright (C) Microsoft Corporation. All rights reserved.
cl /c /I"C:\Users\deranen\Programming\glew-1.13.0\include" /I"C:\Users\deranen\Documents\Visual Studio 2015\Projects\oglplu2\include" /I"C:\Users\deranen\Documents\Visual Studio 2015\Projects\oglplu2\implement" /I"C:\Users\deranen\Documents\Visual Studio 2015\Projects\oglplu2\source\utils" /I"C:\Users\deranen\Programming\freeglut-3.0.0\include" /Zi /W3 /WX- /Od /Ob0 /D WIN32 /D _WINDOWS /D _DEBUG /D "CMAKE_INTDIR=\"Debug\"" /D _MBCS /Gm- /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /GR /Fo"cmTC_9275d.dir\Debug\\" /Fd"cmTC_9275d.dir\Debug\vc140.pdb" /Gd /TP /errorReport:queue "C:\Users\deranen\Documents\Visual Studio 2015\Projects\oglplu2\gl\has_GL_4_5.cpp"
has_GL_4_5.cpp
Link:
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\x86_amd64\link.exe /ERRORREPORT:QUEUE /OUT:"C:\Users\deranen\Documents\Visual Studio 2015\Projects\oglplu2\gl\CMakeFiles\CMakeTmp\Debug\cmTC_9275d.exe" /INCREMENTAL /NOLOGO /LIBPATH:"C:/Users/deranen/Documents/Visual Studio 2015/Projects/oglplu2/gl/CMakeFiles/CMakeTmp/" /LIBPATH:"C:/Users/deranen/Documents/Visual Studio 2015/Projects/oglplu2/gl/CMakeFiles/CMakeTmp/ /Debug" kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib "C:\Users\deranen\Programming\freeglut-3.0.0\lib\Debug\freeglutd.lib" /MANIFEST /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /manifest:embed /DEBUG /PDB:"C:/Users/deranen/Documents/Visual Studio 2015/Projects/oglplu2/gl/CMakeFiles/CMakeTmp/Debug/cmTC_9275d.pdb" /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:"C:/Users/deranen/Documents/Visual Studio 2015/Projects/oglplu2/gl/CMakeFiles/CMakeTmp/Debug/cmTC_9275d.lib" /MACHINE:X64 /machine:x64 cmTC_9275d.dir\Debug\has_GL_4_5.obj
has_GL_4_5.obj : error LNK2019: unresolved external symbol __imp_glewInit referenced in function "public: __cdecl oglplus::api_initializer::api_initializer(int,int)" (??0api_initializer@oglplus@@QEAA@HH@Z) [C:\Users\deranen\Documents\Visual Studio 2015\Projects\oglplu2\gl\CMakeFiles\CMakeTmp\cmTC_9275d.vcxproj]
has_GL_4_5.obj : error LNK2001: unresolved external symbol __imp_glewExperimental [C:\Users\deranen\Documents\Visual Studio 2015\Projects\oglplu2\gl\CMakeFiles\CMakeTmp\cmTC_9275d.vcxproj]
C:\Users\deranen\Documents\Visual Studio 2015\Projects\oglplu2\gl\CMakeFiles\CMakeTmp\Debug\cmTC_9275d.exe : fatal error LNK1120: 2 unresolved externals [C:\Users\deranen\Documents\Visual Studio 2015\Projects\oglplu2\gl\CMakeFiles\CMakeTmp\cmTC_9275d.vcxproj]
Done Building Project "C:\Users\deranen\Documents\Visual Studio 2015\Projects\oglplu2\gl\CMakeFiles\CMakeTmp\cmTC_9275d.vcxproj" (default targets) -- FAILED.
Build FAILED.
Any idea of what the root of the problem is here?
The link error with GLEW may be related to static vs. dynamic version of the library. I vaguely remember that on one of the Windows machines where I tested the original oglplus I had to use the glew32s.lib file.
Unfortunately, that didn't work.
Hmm, it actually seems that glut32.lib is not on the list of libs to link to.
Could you try adding message("${CONFIG_REQUIRED_LIBRARIES}") to
GLVerExt.cmakeline
72` and see what that prints out?
Here is the output:
;;C:/Users/deranen/Programming/freeglut-3.0.0/lib/Debug/freeglut_staticd.lib
As you can see I am using freeglut. Is that ok?
There is no problem with freeglut. However glew32.lib
should be listed there.
Could you try to trace how the following variables (OPENGL_LIBRARIES
, OGLPLUS_GL_LIBRARIES
, CONFIG_REQUIRED_LIBRARIES
) are set in the cmake files ?
The following line in ConfigGL.cmake
sets OGLPLUS_GL_LIBRARIES
:
set(OGLPLUS_GL_LIBRARIES ${GLEW_LIBRARIES} ${OPENGL_LIBRARIES})
What's interesting is that ${GLEW_LIBRARIES}
is empty, and ${OPENGL_LIBRARIES}
contains the glut32.lib
library. So when ${GLEW_LIBRARIES}
is queried in GLVerExt.cmake
it is empty.
I'll continue investigating why ${GLEW_LIBRARIES}
is empty.
EDIT: @matus-chochlik Never mind what I just said, ${GLEW_LIBRARIES}
is set at this point.
Ugh, I messed up and had by mistake commented out line 45 in GLVerExt.cmake
: set(CONFIG_REQUIRED_LIBRARIES "${OGLPLUS_GL_LIBRARIES}")
.
Yep, that happened.
However, I still get the same build error: has_GL_4_5.obj : error LNK2019: unresolved external symbol __imp_glewInit referenced in function "public: __cdecl oglplus::api_initializer::api_initializer(int,int)" (??0api_initializer@oglplus@@QEAA@HH@Z) [C:\Users\deranen\Documents\Visual Studio 2015\Projects\oglplu2\gl\CMakeFiles\CMakeTmp\cmTC_9275d.vcxproj]
I've verified that the library is included to the compiler.
Hmm, I still think that trying to link with the static version of GLEW might help, but you also need to define the GLEW_STATIC
preprocessor symbol, for that to work.
See http://glew.sourceforge.net/install.html
How do I feed that into the try_run
cmake function? Or do I set it somewhere else? cmake can be confusing!
IMO as one of the values after the COMPILE_DEFINITIONS
parameter of try_run
, should work.
I finally got it working! This is what I had to add after COMPILE_DEFINITIONS
: "-DGLEW_STATIC -DFREEGLUT_STATIC "
Something about the fact that you need static versions of these libraries in Windows should probably be mentioned in the README. Also, can these defines be added automatically if on Windows? I'd hate for someone to have to go through the same problems I had.
Thanks for the help!
Thanks for sticking with it! I will have to reinstall windows on one of my machines again and try to fix this so that it works automatically.
Hello. oglplu2 works on windows? Give me build instruction on windows.
There is a branch called backported-develop
where most of the things do build with MSVC 2015 update 1 (the rest of the issues are slowly being fixed).
My working setup: WIndows 10 + MSVC 15 Update 1 + GLFW3 and GLEW (both installed directly into MSVC's include and lib dirs) + cmake and ctest (for windows, added to PATH) + cygwin with python and git.
configure.py
script or do mkdir _build && cd _build && cmake -G "Visual Studio 14" ..
I tried all options in main version, but no possible... span.h, GSL, etc. Linux only feature...
I try in Visual Studio 2017...
Hi, let me know how that goes. Unfortunately at the moment MSVC still isn't supported since I don't have any windows development machine.
When configuring oglplu2 I get the following build error during OpenGL version detection:
I had to modify GLVerExt.cmake to output the build error. Ideas?