I've started building pySide on OSX, and while I'm not finished yet, I
figured it would be good to share what I have so far and maybe others can
help.  I am very new to OSX development and to CMake (I'll hold back my
feelings on that one), so my solutions may not be (and probably aren't) the
best way to do it.

So far I've managed to build apiextractor, boostpythongenerator, and
Shiboken.  PySide is still giving me some trouble.

My system has installed:
OS X 10.6 Snow Leopard
Boost 1.40.0
Qt 4.5.2
CMake 2.6

====================================================================
apiextractor
====================================================================
A few modifications are needed to the CMakeList.txt file for apiextractor to
build on OSX.

1)
If you trying building apiextractor, cmake complains it can't find modules
libxslt and libxml2.
These libraries are system libraries in OSX and can be found in /usr/include
and /usr/lib.
libxslt 1.1.22 (>= 1.1.19 needed by apiextractor)
libxml2 2.7.3 (>= 2.6.32 needed by apiextractor)

I don't know how to get cmake to recognize the system version of these
libraries, so I just
commented out the requires from the CMake file.  E

Edit CMakeLists.txt and comment out the pkg_check_modules lines for those
libraries:
#pkg_check_modules(LIBXML2 REQUIRED libxml-2.0>=2.6.32)
#pkg_check_modules(LIBXSLT REQUIRED libxslt>=1.1.19)

2)
The makefiles can now be built by cmake, but trying to run make to compile
complains because it can't find the Qt headers in "Qt/...".  When I built
Qt, it put the headers and libraries in
their Framework install directories, but it also put the headers in
/usr/local/Trolltech/Qt-4.5.2/include
These are the headers apiextractor is expecting to find, so we need to add
that path to the
header search path.

I don't know the official place to add extra include paths to CMake, so I
added it to the
CMAKE_CXX_FLAGS variable.

Modify the CMAKE_CXX_FLAGS line to include the Qt include directory:
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall
-DAPIEXTRACTOR_ENABLE_DUPLICATE_ENUM_VALUES
-I/usr/local/Trolltech/Qt-4.5.2/include")

3)
It'll compile, but it won't link because it's missing symbols from libxslt
and libxml2.

Add the line (just after CMAKE_CXX_FLAGS):
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -lxml2 -lxslt")

4)
Now apiextractor will build.

mkdir build
cd build
cmake ..
make
sudo make install

The install will copy files to /usr/local/[include,lib,share].


====================================================================
boostpythongenerator
====================================================================
It doesn't take much to get boostpythongenerator to build.
1)
If you try running cmake, it will complain about not being able to find
FindApiExtractor.cmake.
This was installed in /usr/local/share/cmake-2.6/Modules by the build for
apiextractor.
We can add that path to cmake from the command line.

mkdir build
cd build
cmake -DCMAKE_MODULE_PATH=/usr/local/share/cmake-2.6/Modules ..

2)
Now boostpythongenerator will build.

make
sudo make install

The install will copy files to /usr/local/[include,lib,bin,share].


====================================================================
shiboken
====================================================================
There's probably a much better way to get shiboken to build, but my first
attempt was just to get it to build and worry about the "better way" later.
1)
If you try building, the compiler will complain with the error:
shiboken/libshiboken/basewrapper.h:51: error: ‘uint’ does not name a type

Apparently OSX doesn't acknowledge the type uint (lazy way of writing
"unsigned int").

I'm not sure what the best way to solve this is yet, so my "just make it
work" solution was:
edit libshiboken/basewrapper.cpp and libshiboken/basewrapper.h:
Replace all:
uint
with:
unsigned int

2)
Like boostpythongenerator, cmake needs to know where the other modules it
has built are.

mkdir build
cd build
cmake -DCMAKE_MODULE_PATH=/usr/local/share/cmake-2.6/Modules ..
make
sudo make install



====================================================================
PySide
====================================================================
I still haven't gotten very far with this one yet, but I'll add an update
when I get a chance.


I would also be interested in hearing other peoples tips on building on OSX,
especially if there are better ways to do things.
_______________________________________________
PySide mailing list
PySide@lists.openbossa.org
http://lists.openbossa.org/listinfo/pyside

Reply via email to