Hi Robert,
Sorry for the delay -- it took a few go-rounds to get this in the shape that
CMake folks wanted it.
This is what I have submitted to CMake with a few necessary tweaks:
. Full copyright text that they require when not shipped with CMake
. include statement tweak to work when not within CMake
If you want this to go the osg-submissions let me know.
This missed the CMake 3.6 freeze so it probably won't be released for a bit but
this version should hold us until then. I'll try to remember to check for the
patch in future CMake releases and let you know when the custom version is no
longer required.
Wrt the freetype build, it seems they have already eliminated the build
modifying headers in the source tree (or the need to copy the changes into it)
and I confirmed that with freetype 2.6.3. So as long as we assume OSG 3rd party
lib builders are using fresh lib versions we don't need a wiki note about that
gotcha.
Cheers,
Stuart
On 6/5/2016 7:41 AM, Robert Osfield wrote:
HI Stuart,
It sounds like taking the CMake FindFreetype.cmake modifying to work
and then getting this checked over by the cmake community as being
suitable for them to merge and then sending the final rev along to me
to merge would enable us to roll out the improved support prior to the
next CMake release. If the CMake release is made before we push out
3.6 then we wouldn't need to add it locally.
With the freetype wiring to PNG+ZLIB, this sounds like the could
improve things with their own source/build system. I don't know
freetype well enough to know how easy it would be to fix things to
make it easier to switch. This type of issue is why the OSG has
plugins and NodeKits - the core libraries are kept with minimal
dependencies, this way the dependency chain doesn't pollute anything
more than it needs to.
Robert.
On 5 June 2016 at 02:35, Stuart Mentzer <[email protected]> wrote:
Hi Robert,
I have asked the CMake community about updating their FindFreetype.cmake to
support Windows debug library naming and I will follow up to try and get
that fixed in upcoming releases. I was pointed to how they do it correctly
for zlib so I could make a variant of their FindFreetype.cmake for OSG to
use until their fix is released. This would retain their support for the old
and new include structure. If you'd like me to submit that let me know.
Wrt the PNG on/off issue, I now understand the approach they use. The upshot
is that as long as you refresh the freetype source tree you are building
with from the original code before each build you can switch PNG support on
or off in the cmake command with -DWITH_PNG=ON or OFF and without manually
editing ftoption.h. (Same holds for ZLIB support.) The reason is that the
build goes in and modifies ftoption.h in the source tree (as well as making
a copy in the build tree) and the modification only uncomments those
defines, so you can't build with PNG enabled and then PNG disabled without
refreshing the source first. This is an unfortunate approach but that is
what we are stuck with. Most builders don't switch the PNG or ZLIB support
on and off so this probably doesn't often trip people up. The best we can
probably do is add a note on an appropriate wiki page. I added this refresh
step to my build scripts.
Stuart
On 6/4/2016 3:36 PM, Robert Osfield wrote:
Hi Stuart,
It sounds like the version of Freestyle is broken or it requires a tweak to
configuration. Have you approached the freetype community about these
issues.
The debug vs release issue is something that would be worth raising with the
cake community as it sounds like a revision to their Findfreetype.cmake.
Robert
On 3 Jun 2016 11:24 p.m., "Stuart Mentzer" <[email protected]> wrote:
Hi Robert,
Here's what I found doing release and debug builds from yersterday's git
master code with Visual C++ 2015:
freetype even using -DWITH_PNG=OFF will still try to include png.h and for
some reason requires ftoption.h (both copies) to be modified (or overridden)
to comment out the line:
#define FT_CONFIG_OPTION_USE_PNG
This is unfortunate and actually makes it easier to build freetype with
PNG support. With the freetype mods OSG builds including the freetype
plugin. Configuring freetype with or without PNG support is up to the
builder but it would be good if the CMakeLists.txt could handle both
situations without needing changes like I made.
The freetype build headers under include\freetype2\freetype even though
freetype doesn't use that freetype2 layer anymore. Not a big deal since OSG
doesn't really need to ship with freetype or other 3rd party lib headers.
The debug build is able to build freetype with the same mods but the OSG
build doesn't find it:
-- Could NOT find Freetype (missing: FREETYPE_LIBRARY) (found version
"2.6.3")
which I assume is due to not looking for the name freetyped, as I found
with my OSG 3.4.0 build. So the OSG build can complete but it won't build
the freetype plugin.
The debug build fails at "Installing the project..." because it appears
something is wrong with the new pdb installation support:
-- Installing: C:/OSG.VC.xd/bin/osgd.dll
CMake Error at src/osg/cmake_install.cmake:39 (file):
file INSTALL cannot find
"C:/Projects/OSG/VC.xd/OSG/src/osg/PREFIX-NOTFOUNDosgd.pdb".
Call Stack (most recent call first):
src/cmake_install.cmake:33 (include)
cmake_install.cmake:100 (include)
The osgd.pdb file is present and next to osgd.dll as expected.
I see that others are reporting success with the Visual C++ 2015 build but
I don't know how they are addressing the freetype PNG issues or if they
tried the debug build yet. It looks like there are still some issues but
maybe they will offer some input here. I'm happy to make another pass if
that helps.
Stuart
#.rst:
# FindFreetype
# ------------
#
# 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.
# FREETYPE_VERSION_STRING, the version of freetype found (since CMake 2.8.8)
# 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 2000-2016 Kitware, Inc.
# Copyright 2000-2011 Insight Software Consortium
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# * Neither the names of Kitware, Inc., the Insight Software Consortium,
# nor the names of their contributors may be used to endorse or promote
# products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#=============================================================================
# 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.
# Adapted for OpenSceneGraph until the updates here for finding the debug
Windows library freetyped are released with CMake
set(FREETYPE_FIND_ARGS
HINTS
ENV FREETYPE_DIR
PATHS
/usr/X11R6
/usr/local/X11R6
/usr/local/X11
/usr/freeware
ENV GTKMM_BASEPATH
[HKEY_CURRENT_USER\\SOFTWARE\\gtkmm\\2.4;Path]
[HKEY_LOCAL_MACHINE\\SOFTWARE\\gtkmm\\2.4;Path]
)
find_path(
FREETYPE_INCLUDE_DIR_ft2build
ft2build.h
${FREETYPE_FIND_ARGS}
PATH_SUFFIXES
include/freetype2
include
freetype2
)
find_path(
FREETYPE_INCLUDE_DIR_freetype2
NAMES
freetype/config/ftheader.h
config/ftheader.h
${FREETYPE_FIND_ARGS}
PATH_SUFFIXES
include/freetype2
include
freetype2
)
find_library(FREETYPE_LIBRARY
NAMES
freetype
libfreetype
freetype219
${FREETYPE_FIND_ARGS}
PATH_SUFFIXES
lib
)
find_library(FREETYPE_LIBRARY_DEBUG
NAMES
freetyped
libfreetyped
freetype219d
${FREETYPE_FIND_ARGS}
PATH_SUFFIXES
lib
)
include(SelectLibraryConfigurations)
select_library_configurations(FREETYPE)
unset(FREETYPE_FIND_ARGS)
# 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}")
list(REMOVE_DUPLICATES FREETYPE_INCLUDE_DIRS)
endif()
set(FREETYPE_LIBRARIES "${FREETYPE_LIBRARY}")
if(EXISTS "${FREETYPE_INCLUDE_DIR_freetype2}/freetype/freetype.h")
set(FREETYPE_H "${FREETYPE_INCLUDE_DIR_freetype2}/freetype/freetype.h")
elseif(EXISTS "${FREETYPE_INCLUDE_DIR_freetype2}/freetype.h")
set(FREETYPE_H "${FREETYPE_INCLUDE_DIR_freetype2}/freetype.h")
endif()
if(FREETYPE_INCLUDE_DIR_freetype2 AND FREETYPE_H)
file(STRINGS "${FREETYPE_H}" freetype_version_str
REGEX "^#[\t ]*define[\t ]+FREETYPE_(MAJOR|MINOR|PATCH)[\t ]+[0-9]+$")
unset(FREETYPE_VERSION_STRING)
foreach(VPART MAJOR MINOR PATCH)
foreach(VLINE ${freetype_version_str})
if(VLINE MATCHES "^#[\t ]*define[\t ]+FREETYPE_${VPART}[\t ]+([0-9]+)$")
set(FREETYPE_VERSION_PART "${CMAKE_MATCH_1}")
if(FREETYPE_VERSION_STRING)
set(FREETYPE_VERSION_STRING
"${FREETYPE_VERSION_STRING}.${FREETYPE_VERSION_PART}")
else()
set(FREETYPE_VERSION_STRING "${FREETYPE_VERSION_PART}")
endif()
unset(FREETYPE_VERSION_PART)
endif()
endforeach()
endforeach()
endif()
# handle the QUIETLY and REQUIRED arguments and set FREETYPE_FOUND to TRUE if
# all listed variables are TRUE
#include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
include(FindPackageHandleStandardArgs) #OSG Look in CMake Modules dir
find_package_handle_standard_args(
Freetype
REQUIRED_VARS
FREETYPE_LIBRARY
FREETYPE_INCLUDE_DIRS
VERSION_VAR
FREETYPE_VERSION_STRING
)
mark_as_advanced(
FREETYPE_LIBRARY
FREETYPE_LIBRARY_DEBUG
FREETYPE_INCLUDE_DIR_freetype2
FREETYPE_INCLUDE_DIR_ft2build
)
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org