Michaelangel007 / freetype-gl

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

Compile Under Windows Visual Studio #2

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I have some changes that may be of interest to you.

I created a CMake project to allow the project to be compiled under Visual 
Studio for Windows.

I am still creating a substitute for the fontconfig option, but if you are 
interested in these changes, let me know so I can get them to you.

Ryan

Original issue reported on code.google.com by Ryan.H.K...@gmail.com on 17 Aug 2011 at 12:04

GoogleCodeExporter commented 9 years ago
Great news !
And yes, I would be definitely interested in your CMake as well as the 
substitute for fontconfig.

Original comment by Nicolas.Rougier@gmail.com on 18 Aug 2011 at 8:05

GoogleCodeExporter commented 9 years ago
Here are the changes I have made so far for compiling under Visual Studio.

The changes are based on the latest as of r45 from the SVN repository.

There is no fontconfig substitute yet in this build.  Currently, under Windows, 
it will just return the same font file each time the font manager function is 
called.

I just want to reiterate that the CMake option currently only supports 
compiling under Windows Visual Studio and I have not tested any other platforms.

Enjoy!

Ryan

Original comment by Ryan.H.K...@gmail.com on 19 Aug 2011 at 4:08

Attachments:

GoogleCodeExporter commented 9 years ago
I'm not very familiar with CMake. Any help appreciated. 
http://i.imgur.com/D0hTl.png

Original comment by DannyFritz on 5 Dec 2011 at 3:26

GoogleCodeExporter commented 9 years ago
First, it has been awhile since I last came to this page, and I may be a little 
rusty on this.

Second, the changes were applied only to r45 of the source, and I believe, from 
the attached image you provided, that you were trying to use the version.  I'll 
go back and update the zip file so that it has the most recent changes that you 
can apply.

Third, I do most of my work through the command line interface.  I may have 
things incorrectly setup for use with CMake-GUI interface.  I should also add 
those items to the list.  Basically, GLUT_glew_LIBRARY could not be found, and 
since you have no way to change that value, it will never generate a solution.

Each package that is required through the find package interface:

FIND_PACKAGE(GLUT REQUIRED)
FIND_PACKAGE(GLEW REQUIRED)
FIND_PACKAGE(OpenGL REQUIRED)
FIND_PACKAGE(Freetype REQUIRED)

will be looked up in module files that will define the required script 
variables.  These variables are then used to setup the compiler for includes 
and linker settings.  You can see that GLEW's module look up script is defined 
by the project and that the rest are defined by modules that are installed by 
CMake.

To make it work in a pinch, you could do the following:

1) Point to the correct include locations for your build:
# add the project's includes
INCLUDE_DIRECTORIES(${GLUT_INCLUDE_DIR})
INCLUDE_DIRECTORIES(${GLEW_INCLUDE_PATH})
INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR})
INCLUDE_DIRECTORIES(${FREETYPE_INCLUDE_DIR_ft2build})
INCLUDE_DIRECTORIES(${FREETYPE_INCLUDE_DIR_freetype2})
2) Point to the correct library locations for your build:
# add the project's external dependencies
TARGET_LINK_LIBRARIES(${FREETYPE_GL_LIB} ${GLEW_LIBRARY})
TARGET_LINK_LIBRARIES(${FREETYPE_GL_LIB} ${FREETYPE_LIBRARY})
TARGET_LINK_LIBRARIES(${FREETYPE_GL_LIB} ${OPENGL_gl_LIBRARY})
3) Comment or remove the following:
# find required packages
FIND_PACKAGE(GLUT REQUIRED)
FIND_PACKAGE(GLEW REQUIRED)
FIND_PACKAGE(OpenGL REQUIRED)
FIND_PACKAGE(Freetype REQUIRED)
# some of the packages do not force an error if
# not found... force an error so it can be fixed...
VALIDATE_LIBRARY(GLEW_LIBRARY)
VALIDATE_LIBRARY(FREETYPE_LIBRARY)
VALIDATE_LIBRARY(GLUT_glut_LIBRARY)
VALIDATE_LIBRARY(OPENGL_gl_LIBRARY)
VALIDATE_LIBRARY(OPENGL_glu_LIBRARY)
4) Rerun the CMake-GUI process on the CMakeLists.txt file

Again, this will only work for one type of build, as you are forcing it to 
setup with one type or another (debug or release, regardless of what it shows 
from visual studio).

If you want to brave the command-line interface, here is what needs to be done.
1) Set environment paths to point to the base directory for each required 
library:
set GLEW_ROOT_DIR=C:\GLEW
set FREETYPE_DIR=C:\Freetype
set GLUT_ROOT_PATH=C:\GLUT
2) Rerun the cmake process on the current directory:
cmake -G "Visual Studio 10"

I hope I didn't miss anything for the command-line.  I currently don't have it 
in front of me and I am purely going on memory.

Again, the data was for r45, so if you try to apply it to the latest, you may 
not get the correct results.  Things I need to do are to move to the latest for 
this solution and to allow CMake-GUI the ability to manipulate required values.

If you have any questions, please feel free to ask.  Until then, enjoy!

-Ryan

Original comment by Ryan.H.K...@gmail.com on 7 Dec 2011 at 12:21

GoogleCodeExporter commented 9 years ago
I just tested this out and was able to get GLUT to be found.  If you click the 
grouped and advanced tabs at the top of CMake-GUI, you will be able to set the 
GLUT options up.  Click generate and the solution should be ready to go.

Original comment by Ryan.H.K...@gmail.com on 7 Dec 2011 at 1:20

Attachments:

GoogleCodeExporter commented 9 years ago
Here are the latest updates that I made off of r65 of the code.

There is still not fontconfig substitute, so if you would like to add the 
replacement, please feel free to do so.

Enjoy!

Original comment by Ryan.H.K...@gmail.com on 14 Dec 2011 at 2:59

Attachments:

GoogleCodeExporter commented 9 years ago

Hi Ryan,

Thanks for the CMake code. I included your last version into the trunk.
I made a cleaner API so I hope it did not break things.

Nicolas

Original comment by Nicolas.Rougier@gmail.com on 23 Dec 2011 at 6:21

GoogleCodeExporter commented 9 years ago
Excellent!  I just got from x-mas vacation, so I'll take a look within the next 
week or so.

Original comment by Ryan.H.K...@gmail.com on 2 Jan 2012 at 8:21

GoogleCodeExporter commented 9 years ago
Here are the latest changes based on r82.

The API cleanup didn't get in the way, other than the one file that was deleted.

Enjoy!

Original comment by Ryan.H.K...@gmail.com on 3 Jan 2012 at 7:50

Attachments:

GoogleCodeExporter commented 9 years ago
Forgot to mention that I still have no fontconfig substitute.

I am considering using the Win32 font enumeration callbacks, but they do not 
provide any way to get to the actual installed font file that freetype needs.  
I'll do some digging to see if there happens to be an undocumented function 
that can be called to get that information.

Original comment by Ryan.H.K...@gmail.com on 3 Jan 2012 at 7:54

GoogleCodeExporter commented 9 years ago
I cleaned up CMakeLists.txt, hope I did not break anything.
Windows DLL are not part of the project to ease build on windows.

No fontconfig substitute yet.

Original comment by Nicolas.Rougier@gmail.com on 15 Feb 2012 at 5:20