Forwarded to the PLplot-devel mailing list...

---------- Forwarded message ----------
Date: Tue, 1 Jul 2014 21:35:49 -0700
From: Greg Jung <gvj...@gmail.com>
To: Alan W. Irwin <ir...@beluga.phys.uvic.ca>
Subject: Re: [cmake-developers] FreeType headers almost there but not quite ...

    (SUMMARY Problem: I use PKG-CONFIG and get CAIRO_INCLUDE_DIRS, etc. as
needed for downstream
   processing, but I never set the key variable FREETYPE_INCLUDE_DIR which
is treated as special-case
   animal.)

Hi again,
    I went back and was able to run cmake without my modifications, and the
build proceeded fine ... oh but
with_freetype was set to off, so that doesn't count.  The same problem that
bothered me when I first dove into
the CMAKE system is still pestering me: Freetype library.  The module in
the plplot distribution works fine for
only linux/unix hosts:

FIND_PATH(FREETYPE_INCLUDE_DIR freetype/config/ftheader.h
/usr/local/include/freetype2
/usr/include/freetype2
)
In MSYS case, /usr/local means nothing to CMAKE.  The cmake distribution
has a (more inclusive, shotgun)
approach and I originally modified some (cmake-2.8).cmake modules to
a) find the /MSYS and /mingw anchors and set appropriate values for
CMAKE_SYSTEM_PREFIX_PATH, CMAKE _SYSTEM_LIBRARY_PATH, etc. in the MSYS case,
b) parse environment variable PKG_CONFIG_PATH and use pkg-config afcilities
in cmake to hook libraries in.
Of course that [b)] is what plplot/pkg-config.cmake does so I use that, and
I'm trying to incorprate the freetype library using it. But pkg-config
gives me a list of libraries
("_DIRS") and the scripting downstream wants the singular
FREETYPE_INCLUDE_DIR for compilation of plfreetype.c and wingcc.c;

I use a macro for generic library searches, BOILER_SEARCH which will
populate ${${xx}}_LIBRARY_ etc all of those names which are
(usually) the "same" for reading in a package.  so I substitute, in plplot,
a call to boiler-plate just prior  to freetype, and freetype is in turn
changed a little: if the boiler_plate routine didn't succeed a
findPackage(Freetype) call is made(so that older builds work without
pkg-config.)
Boiler_plate sets FREETYPE_INCLUDE_DIRS and FREETYPE_CFLAGS as it does for
every other library, but freetype wants to use
FREETYPE_INCLUDE_DIR, directly in some cases (wingcc.cmake), which is never
set right.  Since the other libraries are using the
${XXXX}_INCLUDE_DIRS names provided, they include freetype2 as indicated
from pkg-config.

plplot.cmake:  where my modification goes: (ALL ELSE IS THE SAME)
include(shapelib)
BOILER_SEARCH(FREETYPE freetype2 Freetype
  " we are gonna quit here, 'cause I have freetype all over the place")
include(freetype)

On Tue, Jul 1, 2014 at 1:35 PM, Alan W. Irwin <ir...@beluga.phys.uvic.ca>
wrote:

> On 2014-07-01 00:41-0700 Greg Jung wrote:
>
> Hi Greg:
>
> Thanks for your interest in PLplot.
>
> I suspect this is either an issue concerning how you are using the
> PLplot build system or an issue with that system itself so I plan to
> follow up on this question on the appropriate list (plplot-devel) for
> discussing such issues.
>
> Alan
>


macro(BOILER_SEARCH _ROOT _LIB _FINDPKG)

     set(CMAKE_PREFIX_PATH ${${_ROOT}DIR})
pkg_check_modules(${_ROOT} ${_LIB})  # goes directly for the package
if(${_ROOT}_FOUND)
display_config_result(${_ROOT})
else()
find_package(${_FINDPKG} QUIET)
if(${_ROOT}_FOUND)
message(STATUS
" ${_ROOT} library picked up via Module Find${_FINDPKG}()")
else()
message(" Use -D${_ROOT}DIR= to  specify the directory tree.")
if(${ARGC} GREATER 3)
message(FATAL_ERROR "\n${ARGN}\n"
"${_ROOT} library not found >${_LIB}<? ?>Find${_FINDPKG}.cmake<? \n"
"  CMAKE_SYSTEM_LIBRARY_PATH= \n"
" ${CMAKE_SYSTEM_LIBRARY_PATH}"
"\n CMAKE_SYSTEM_INCLUDE_PATH= \n"
" ${CMAKE_SYSTEM_INCLUDE_PATH}"
)
else()
message(STATUS
"${_ROOT} library not found >${_LIB}<? ?>Find${_FINDPKG}.cmake<? \n"
" Proceeding nevertheless .... \n"
" CMAKE_SYSTEM_LIBRARY_PATH= \n"
" ${CMAKE_SYSTEM_LIBRARY_PATH}"
"\n CMAKE_SYSTEM_INCLUDE_PATH= \n"
" ${CMAKE_SYSTEM_INCLUDE_PATH}"
)
endif()
endif()
endif()
set(HAVE_LIB${_ROOT} ${_ROOT}_FOUND)
if(${_ROOT}_FOUND)
set(LIBRARIES ${LIBRARIES} ${${_ROOT}_LIBRARIES})
include_directories(${${_ROOT}_INCLUDE_DIR})
endif()
mark_as_advanced(${_ROOT}_LIBRARY
${_ROOT}_LIBRARIES ${_ROOT}_INCLUDE_DIR )
endmacro(BOILER_SEARCH)
message(STATUS "BOILER_SEARCH macro is compiled")
return()

with boiler_search(Freetype) acting, then, then logic in freetype goes:

# Look for freetype libraries
if (WITH_FREETYPE)
     if( NOT FREETYPE_FOUND) # try harder this time: pkg-config didn't do it.
find_package(Freetype)
if (FREETYPE_FOUND)
     message(STATUS "FREETYPE_INCLUDE_DIRS = ${FREETYPE_INCLUDE_DIRS}")  ##
<<<=== DIRS (a list) but compiles need _DIR!
     message(STATUS "FREETYPE_LIBRARIES = ${FREETYPE_LIBRARIES}")
endif(FREETYPE_FOUND)
     endif(NOT FREETYPE_FOUND)
     if( NOT FREETYPE_FOUND)
set(WITH_FREETYPE OFF
CACHE BOOL "Enable driver options for using freetype library for fonts"
FORCE
)
     endif (NOT FREETYPE_FOUND)
endif (WITH_FREETYPE)

OK, so I can patch this by running the configuration and then setting
FREETYPE_INCLUDE_DIR manually.

------------------------------------------------------------------------------
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft
_______________________________________________
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel

Reply via email to