Permalink
Browse files

Working Font, OpenGL

  • Loading branch information...
petrm committed May 11, 2010
1 parent 7cfa2dd commit ada6eeed915ead82a58f65a65c36c0f665c1f3c7
View
@@ -57,7 +57,7 @@ add_subdirectory(DistributedObjects)
add_subdirectory(EditLine)
add_subdirectory(Flux)
add_subdirectory(Fnmatch)
-#add_subdirectory(Font) # XXX: I can't meet the dependencies, someone?
+add_subdirectory(Font) # XXX: I can't meet the dependencies, someone?
#add_subdirectory(GLFW) # XXX: Depends on OpenGL
add_subdirectory(GoogleSearch)
add_subdirectory(HttpClient)
View
@@ -0,0 +1 @@
+Flux
View
@@ -0,0 +1,46 @@
+# Base Io build system
+# Written by Jeremy Tregunna <jeremy.tregunna@me.com>
+#
+# Builds the Font addon
+
+# Find Font
+find_package(GLUT)
+find_package(Freetype)
+
+# Create the _build bundle hierarchy if needed.
+make_build_bundle(_build)
+
+# Did we find Font? if so, set up the targets and all the support
+# variables.
+if(GLUT_FOUND)
+ # Output our dynamic library to the top-level _build hierarchy
+ set(LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/_build/dll)
+
+ # Additional include directories
+ include_directories(
+ ${GLUT_INCLUDE_DIR}
+ ${FREETYPE_INCLUDE_DIRS}
+ )
+
+ # Generate the IoFontInit.c file.
+ # Argument SHOULD ALWAYS be the exact name of the addon, case is
+ # important.
+ generate_ioinit(Font)
+
+ # Our library sources.
+ set(SRCS
+ "${CMAKE_CURRENT_SOURCE_DIR}/source/FreeTypeErrorCodes.c"
+ "${CMAKE_CURRENT_SOURCE_DIR}/source/GLFont.c"
+ "${CMAKE_CURRENT_SOURCE_DIR}/source/IoFont.c"
+ "${CMAKE_CURRENT_SOURCE_DIR}/source/IoFontInit.c"
+ )
+
+ # Now build the shared library
+ add_library(IoFont SHARED ${SRCS})
+ add_dependencies(IoFont iovmall)
+ target_link_libraries(IoFont iovmall ${GLUT_LIBRARIES} ${FREETYPE_LIBRARIES})
+
+ # Install the addon to our global addons hierarchy.
+ install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/io/addons)
+ install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/_build DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/io/addons/Font)
+endif(GLUT_FOUND)
View
@@ -0,0 +1 @@
+Font
@@ -5,19 +5,21 @@
# Find OpenGL
find_package(OpenGL)
+find_package(GLUT)
# Create the _build bundle hierarchy if needed.
make_build_bundle(_build)
# Did we find OpenGL? if so, set up the targets and all the support
# variables.
-if(OPENGL_FOUND AND OPENGL_GLU_FOUND)
+if(OPENGL_FOUND AND OPENGL_GLU_FOUND AND GLUT_FOUND)
# Output our dynamic library to the top-level _build hierarchy
set(LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/_build/dll)
# Additional include directories
include_directories(
${OPENGL_INCLUDE_DIR}
+ ${GLUT_INCLUDE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/../Box/source
${CMAKE_CURRENT_SOURCE_DIR}/../Image/source
)
@@ -42,9 +44,9 @@ if(OPENGL_FOUND AND OPENGL_GLU_FOUND)
# Now build the shared library
add_library(IoOpenGL SHARED ${SRCS})
add_dependencies(IoOpenGL iovmall)
- target_link_libraries(IoOpenGL iovmall ${OPENGL_LIBRARIES})
+ target_link_libraries(IoOpenGL iovmall ${OPENGL_LIBRARIES} ${GLUT_LIBRARIES})
# Install the addon to our global addons hierarchy.
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/io/addons)
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/_build DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/io/addons/OpenGL)
-endif(OPENGL_FOUND AND OPENGL_GLU_FOUND)
+endif(OPENGL_FOUND AND OPENGL_GLU_FOUND AND GLUT_FOUND)
View
@@ -0,0 +1,95 @@
+# - Locate FreeType library
+# This module defines
+# FREETYPE_LIBRARIES, the library to link against
+# FREETYPE_FOUND, if false, do not try to link to FREETYPE
+# FREETYPE_INCLUDE_DIRS, where to find headers.
+# This is the concatenation of the paths:
+# FREETYPE_INCLUDE_DIR_ft2build
+# FREETYPE_INCLUDE_DIR_freetype2
+#
+# $FREETYPE_DIR is an environment variable that would
+# correspond to the ./configure --prefix=$FREETYPE_DIR
+# used in building FREETYPE.
+
+#=============================================================================
+# Copyright 2007-2009 Kitware, Inc.
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distributed this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+# Created by Eric Wing.
+# Modifications by Alexander Neundorf.
+# This file has been renamed to "FindFreetype.cmake" instead of the correct
+# "FindFreeType.cmake" in order to be compatible with the one from KDE4, Alex.
+
+# Ugh, FreeType seems to use some #include trickery which
+# makes this harder than it should be. It looks like they
+# put ft2build.h in a common/easier-to-find location which
+# then contains a #include to a more specific header in a
+# more specific location (#include <freetype/config/ftheader.h>).
+# Then from there, they need to set a bunch of #define's
+# so you can do something like:
+# #include FT_FREETYPE_H
+# Unfortunately, using CMake's mechanisms like INCLUDE_DIRECTORIES()
+# wants explicit full paths and this trickery doesn't work too well.
+# I'm going to attempt to cut out the middleman and hope
+# everything still works.
+FIND_PATH(FREETYPE_INCLUDE_DIR_ft2build ft2build.h
+ HINTS
+ $ENV{FREETYPE_DIR}
+ PATH_SUFFIXES include
+ PATHS
+ /usr/local/X11R6/include
+ /usr/local/X11/include
+ /usr/X11/include
+ /sw/include
+ /opt/local/include
+ /usr/freeware/include
+)
+
+FIND_PATH(FREETYPE_INCLUDE_DIR_freetype2 freetype/config/ftheader.h
+ HINTS
+ $ENV{FREETYPE_DIR}/include/freetype2
+ PATHS
+ /usr/local/X11R6/include
+ /usr/local/X11/include
+ /usr/X11/include
+ /sw/include
+ /opt/local/include
+ /usr/freeware/include
+ PATH_SUFFIXES freetype2
+)
+
+FIND_LIBRARY(FREETYPE_LIBRARY
+ NAMES freetype libfreetype freetype219
+ HINTS
+ $ENV{FREETYPE_DIR}
+ PATH_SUFFIXES lib64 lib
+ PATHS
+ /usr/local/X11R6
+ /usr/local/X11
+ /usr/X11
+ /sw
+ /usr/freeware
+)
+
+# set the user variables
+IF(FREETYPE_INCLUDE_DIR_ft2build AND FREETYPE_INCLUDE_DIR_freetype2)
+ SET(FREETYPE_INCLUDE_DIRS "${FREETYPE_INCLUDE_DIR_ft2build};${FREETYPE_INCLUDE_DIR_freetype2}")
+ENDIF(FREETYPE_INCLUDE_DIR_ft2build AND FREETYPE_INCLUDE_DIR_freetype2)
+SET(FREETYPE_LIBRARIES "${FREETYPE_LIBRARY}")
+
+# handle the QUIETLY and REQUIRED arguments and set FREETYPE_FOUND to TRUE if
+# all listed variables are TRUE
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(Freetype DEFAULT_MSG FREETYPE_LIBRARY FREETYPE_INCLUDE_DIRS)
+
+
+MARK_AS_ADVANCED(FREETYPE_LIBRARY FREETYPE_INCLUDE_DIR_freetype2 FREETYPE_INCLUDE_DIR_ft2build)
View
@@ -0,0 +1,92 @@
+# - try to find glut library and include files
+# GLUT_INCLUDE_DIR, where to find GL/glut.h, etc.
+# GLUT_LIBRARIES, the libraries to link against
+# GLUT_FOUND, If false, do not try to use GLUT.
+# Also defined, but not for general use are:
+# GLUT_glut_LIBRARY = the full path to the glut library.
+# GLUT_Xmu_LIBRARY = the full path to the Xmu library.
+# GLUT_Xi_LIBRARY = the full path to the Xi Library.
+
+#=============================================================================
+# Copyright 2001-2009 Kitware, Inc.
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distributed this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+IF (WIN32)
+ FIND_PATH( GLUT_INCLUDE_DIR NAMES GL/glut.h
+ PATHS ${GLUT_ROOT_PATH}/include )
+ FIND_LIBRARY( GLUT_glut_LIBRARY NAMES glut glut32
+ PATHS
+ ${OPENGL_LIBRARY_DIR}
+ ${GLUT_ROOT_PATH}/Release
+ )
+ELSE (WIN32)
+
+ IF (APPLE)
+ # These values for Apple could probably do with improvement.
+ FIND_PATH( GLUT_INCLUDE_DIR glut.h
+ /System/Library/Frameworks/GLUT.framework/Versions/A/Headers
+ ${OPENGL_LIBRARY_DIR}
+ )
+ SET(GLUT_glut_LIBRARY "-framework GLUT" CACHE STRING "GLUT library for OSX")
+ SET(GLUT_cocoa_LIBRARY "-framework Cocoa" CACHE STRING "Cocoa framework for OSX")
+ ELSE (APPLE)
+
+ FIND_PATH( GLUT_INCLUDE_DIR GL/glut.h
+ /usr/include/GL
+ /usr/openwin/share/include
+ /usr/openwin/include
+ /opt/graphics/OpenGL/include
+ /opt/graphics/OpenGL/contrib/libglut
+ )
+
+ FIND_LIBRARY( GLUT_glut_LIBRARY glut
+ /usr/openwin/lib
+ )
+
+ FIND_LIBRARY( GLUT_Xi_LIBRARY Xi
+ /usr/openwin/lib
+ )
+
+ FIND_LIBRARY( GLUT_Xmu_LIBRARY Xmu
+ /usr/openwin/lib
+ )
+
+ ENDIF (APPLE)
+
+ENDIF (WIN32)
+
+SET( GLUT_FOUND "NO" )
+IF(GLUT_INCLUDE_DIR)
+ IF(GLUT_glut_LIBRARY)
+ # Is -lXi and -lXmu required on all platforms that have it?
+ # If not, we need some way to figure out what platform we are on.
+ SET( GLUT_LIBRARIES
+ ${GLUT_glut_LIBRARY}
+ ${GLUT_Xmu_LIBRARY}
+ ${GLUT_Xi_LIBRARY}
+ ${GLUT_cocoa_LIBRARY}
+ )
+ SET( GLUT_FOUND "YES" )
+
+ #The following deprecated settings are for backwards compatibility with CMake1.4
+ SET (GLUT_LIBRARY ${GLUT_LIBRARIES})
+ SET (GLUT_INCLUDE_PATH ${GLUT_INCLUDE_DIR})
+
+ ENDIF(GLUT_glut_LIBRARY)
+ENDIF(GLUT_INCLUDE_DIR)
+
+MARK_AS_ADVANCED(
+ GLUT_INCLUDE_DIR
+ GLUT_glut_LIBRARY
+ GLUT_Xmu_LIBRARY
+ GLUT_Xi_LIBRARY
+ )

0 comments on commit ada6eee

Please sign in to comment.