On Tuesday 08 September 2009 01:28:36 Brendan Duncan wrote: > 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)
The link errors you found later are due to this two lines comented out. You
need to find why these libs were not found by cmake. pkg_check_module uses
pkg_config, so check if pkg_config is installed in your system.
I dont remenber why we are using pkg_check_modules to find libXSLT and libXML
instead of using the usual cmake commands to find libXML and libXSLT.
> 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.
Nice workaround ;-), the official place is using the include_directories
command. But the better way to solve this is find why Qt can't be foudn on
your system or why cmake found Qt in a wrong directory.
> 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 ..
cmake search for their modules just under /usr/share/cmake..., to install a
cmake project under the /usr prefix instead fo /usr/local you can use -
DCMAKE_INSTALL_PREFIX=/usr, but this can do some mess with your package system
or whatever mac osx uses.
> 2)
> Now boostpythongenerator will build.
>
> make
> sudo make install
>
> The install will copy files to /usr/local/[include,lib,bin,share].
>
>
> ====================================================================
> shiboken
> ====================================================================
You can skip shiboken, it's an experimental stuff.
> 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.
>
--
Hugo Parente Lima
INdT - Instituto Nokia de Tecnologia
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ PySide mailing list [email protected] http://lists.openbossa.org/listinfo/pyside
