Boost.Python and Cmake on Mac

This may be more appropriate for the KDE lists, since we’re now using
their Cmake macro for Boost.Python.

I can’t get our Boost.Python code to work because Cmake can’t find it
anymore. I looked through the module and found several problems:

  1. On the Mac, you usually have to install Boost separately (e.g.,
    from source). At the moment, I have /usr/local/include/boost-1_34_1
    for headers. I do not see any sort of pkg-config file which would
    indicate how you would find this (other than looking in various
    include directories for names starting with boost*).

This prevents this line from working in FindBoostPython.cmake:
check_include_file_cxx(boost/shared_ptr.hpp HAVE_BOOST_SHARED_PTR_HPP)

Everything else in the Cmake module relies on this test.

  1. The Python include and library directories in
    FindBoostPython.cmake look Linux-only. I’m running Leopard, which
    does links in /usr/include where necessary. I don’t know if this is
    true of Tiger.

I have Python headers in /System/Library/Frameworks/Python.framework/
Headers and /usr/include/python2.5
I have Python libraries in /usr/lib/python.dylib (etc.)

  1. The PYTHON_LIBS variable is version and platform dependent.

I have /usr/local/lib/libboost_python-mt-1_34_1. (Note that there’s no
gcc in this, and the 1_34 and 1_35 releases are not listed in the
current FindBoostPython.cmake module.

I’d be happy to handle testing if there’s a fixed version of the Cmake
module – but am not familiar enough with Cmake to fix it myself.

Cheers,
-Geoff

Just a note.

I think there is a special macro in CMake to find Mac Frameworks. I
can’t tell you offhand what it is and I don’t have time to look it up
but I swear I saw something like that. This would most likely fix our
problems where you don’t install to /usr or /usr/local

The CMake should also have some -D defines which you can use in cases
where you don’t install to a normal directory.


Donald

(Fri, Apr 11, 2008 at 05:17:43PM -0400) Geoffrey Hutchison geoffh+@pitt.edu:

This may be more appropriate for the KDE lists, since we’re now using
their Cmake macro for Boost.Python.

I can’t get our Boost.Python code to work because Cmake can’t find it
anymore. I looked through the module and found several problems:

  1. On the Mac, you usually have to install Boost separately (e.g.,
    from source). At the moment, I have /usr/local/include/boost-1_34_1
    for headers. I do not see any sort of pkg-config file which would
    indicate how you would find this (other than looking in various
    include directories for names starting with boost*).

This prevents this line from working in FindBoostPython.cmake:
check_include_file_cxx(boost/shared_ptr.hpp HAVE_BOOST_SHARED_PTR_HPP)

Everything else in the Cmake module relies on this test.

  1. The Python include and library directories in
    FindBoostPython.cmake look Linux-only. I’m running Leopard, which
    does links in /usr/include where necessary. I don’t know if this is
    true of Tiger.

I have Python headers in /System/Library/Frameworks/Python.framework/
Headers and /usr/include/python2.5
I have Python libraries in /usr/lib/python.dylib (etc.)

  1. The PYTHON_LIBS variable is version and platform dependent.

I have /usr/local/lib/libboost_python-mt-1_34_1. (Note that there’s no
gcc in this, and the 1_34 and 1_35 releases are not listed in the
current FindBoostPython.cmake module.

I’d be happy to handle testing if there’s a fixed version of the Cmake
module – but am not familiar enough with Cmake to fix it myself.

Cheers,
-Geoff


This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don’t miss this year’s exciting event. There’s still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone


Avogadro-devel mailing list
Avogadro-devel@lists.sourceforge.net
avogadro-devel List Signup and Options

On Friday 11 April 2008 23:17:43 Geoffrey Hutchison wrote:

This may be more appropriate for the KDE lists, since we’re now using
their Cmake macro for Boost.Python.

In fact KDE even has a Mac-specific list:

http://lists.kde.org/?l=kde-mac&r=1&w=2

The recent archives show that it gets answers from the guys who are porting
KDE to Mac.

(other than looking in various
include directories for names starting with boost*).

Yes. From my understanding of CMake, this kind of search is really how you do
it. Except that I would rather look at a filename than at a directory name
(this is how one usually does).

A look through “man cmake” tells me that the appropriate command is FIND_PATH

grep -R FIND_PATH /trunk/kdelibs/cmake/modules/

gives many results. Here is one, from FindSoprano.cmake:

FIND_PATH(SOPRANO_INCLUDE_DIR
NAMES
soprano/soprano.h
PATHS
{KDE4_INCLUDE_DIR} {INCLUDE_INSTALL_DIR}
)

This has the effect of creating and caching a CMake variable
SOPRANO_INCLUDE_DIR with value a string containing the path to
soprano/soprano.h, searching in the directories {KDE4_INCLUDE_DIR} and {INCLUDE_INSTALL_DIR}.

Note that in the above example, NAMES and PATHS are not mandatory. They only
become in more complicated uses of FIND_PATHS.

I am not sure if FIND_PATHS will handle wildcards (boost*). One sure-fire way
to handle it is to use GLOB or GLOB_RECURSE: see “man cmake”. You can find
examples of how to use GLOB in libavogadro/src/CMakeLists.txt.

Cheers,

Benoit

This prevents this line from working in FindBoostPython.cmake:
check_include_file_cxx(boost/shared_ptr.hpp HAVE_BOOST_SHARED_PTR_HPP)

Everything else in the Cmake module relies on this test.

  1. The Python include and library directories in
    FindBoostPython.cmake look Linux-only. I’m running Leopard, which
    does links in /usr/include where necessary. I don’t know if this is
    true of Tiger.

I have Python headers in /System/Library/Frameworks/Python.framework/
Headers and /usr/include/python2.5
I have Python libraries in /usr/lib/python.dylib (etc.)

  1. The PYTHON_LIBS variable is version and platform dependent.

I have /usr/local/lib/libboost_python-mt-1_34_1. (Note that there’s no
gcc in this, and the 1_34 and 1_35 releases are not listed in the
current FindBoostPython.cmake module.

I’d be happy to handle testing if there’s a fixed version of the Cmake
module – but am not familiar enough with Cmake to fix it myself.

Cheers,
-Geoff


This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don’t miss this year’s exciting event. There’s still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/java
one _______________________________________________
Avogadro-devel mailing list
Avogadro-devel@lists.sourceforge.net
avogadro-devel List Signup and Options