taiit / freetype-gl

Automatically exported from code.google.com/p/freetype-gl
Other
0 stars 0 forks source link

Error in CMakeLists and some minor incompatibilites in Windows Build #51

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
See below for fixes!

What steps will reproduce the problem?
1. Configure and create using CMake on Windows (without installed glew32.lib in 
default paths)
2. Open sln in Visual Studio and build
3. glew32.lib can not be linked/found, missing header stdint.h, conflicting 
definitions of exit(), ; expected afert }}

What is the expected output? What do you see instead?
17 succeeded, 0 failed, 2 up-to-date, 1 skipped
0 succeeded, 17 failed, 2 up-to-date, 1 skipped

What version of the product are you using? On what operating system?
freetype-gl svn revision 199
Windows XP 32 bit, Visual Studio 8 2005
(no glew32.lib in default paths)

Please provide any additional information below:

FIX 1: correct glew for windows path in freetype-gl/CMakeLists.txt:
48 SET( GLEW_INCLUDE_DIR
49       ${CMAKE_CURRENT_SOURCE_DIR}/windows/glew/include )
50  SET( GLEW_LIBRARY
51       ${CMAKE_CURRENT_SOURCE_DIR}/windows/glew/lib/glew32.lib )

FIX2: add stdint.h 
(file NOT included in Visual Studio 7,8,9, but IS included again since 10)
add this file: http://msinttypes.googlecode.com/svn/trunk/stdint.h
to new directory: freetype-gl/windows/include/stdint.h

freetype-gl/CMakeLists.txt, add:
SET( VS789FIX_INCLUDE_DIR
         ${CMAKE_CURRENT_SOURCE_DIR}/windows/include )
...
INCLUDE_DIRECTORIES( ...
                     VS789FIX_INCLUDE_DIR

FIX3: VC cannot compile pen = {{x,y}} in demo-gamma.c
167  pen.x = 32;
168  pen.y = 252;

FIX4: VC error when building demo-gamma: 
exit() conflicting definitions in stdlib.h and glut.h because of leading 
_CRTIMP when using VC8 default stdlib.h and freetype-gl/windows/glut/glut.h
This one is mysterious to me, because i use the same two for other projects. I 
guess some defines or CRT settings are wrong/missing after CMake project 
generation.
Solved by replacing _CRTIMP by _declspec(noreturn) at definition of exit in 
glut.h:
146   extern __declspec(noreturn) void __cdecl exit(int);

Original issue reported on code.google.com by dse...@googlemail.com on 29 Mar 2013 at 12:23

GoogleCodeExporter commented 8 years ago
Thanks. I included your fixes 2 & 3.
For fix 1, it seems current cmakelist already get the fix.
For fix 4, it's also a mystery to me.

I Put your alias in the README as contributor. Just drop me an email if you 
prefer your real name to appear instead.

Original comment by Nicolas.Rougier@gmail.com on 29 Mar 2013 at 7:22

GoogleCodeExporter commented 8 years ago
You forgot to add the stdint.h-file :)

Also, you should change "pen = (vec2) {{32, 252}};" on line 170 in demo-gamma.c 
as well, since that is a syntax-error on (at least) VS2012.

Lastly, the final error (exluding the one about exit) I get is in demo-cube.c   
  "#include <GL/glut.h>" should be "#include <GLUT/glut.h>" on Windows. You can 
just update the whole include-bit to match the other demos and it'll work.

Cheers.

Original comment by cforf...@gmail.com on 29 Mar 2013 at 10:13

GoogleCodeExporter commented 8 years ago
Ooops, thanks, just did that.

Original comment by Nicolas.Rougier@gmail.com on 29 Mar 2013 at 10:17

GoogleCodeExporter commented 8 years ago
Hi, thanks for your quick responses!
I just tried to verify the fixes on svn revision 204 with a clean checkout.
@cforf...: Thanks for pointing out the include-bit - that also worked for my 
problem in demo-makefont.c

Remaining 2 issues with fixes:

Typo in demo-gamma.c 171: "pex.y = 252;"  should be "pen.y = 252;"

demo-makefont.c 43-41: Just include stdlib.h first:
34 #include <stdlib.h>
35 #if defined(__APPLE__)
36     #include <Glut/glut.h>
37 #elif defined(_WIN32) || defined(_WIN64)
38     #include <GLUT/glut.h>
39 #else
40     #include <GL/glut.h>
41 #endif
42 
43 #include <stdio.h>
44 #include <wchar.h>
45 #include "arial-16.h"

With these two changes, everything works, builds and runs now
(Windows XP 32 bit, VisualStudio 8 2005, CMake 2.8.10.2, libs and includes from 
repository)

Looking forward to rev. 205 ;-)
Thanks

Original comment by dse...@googlemail.com on 30 Mar 2013 at 10:31

GoogleCodeExporter commented 8 years ago
Thanks, jut committed.

Original comment by Nicolas.Rougier@gmail.com on 30 Mar 2013 at 12:15