[CMake] OS X, SDL, Frameworks and Libraries
Michael Jackson
mike.jackson at bluequartz.net
Fri Mar 5 09:45:08 EST 2010
This is actually ironic. The SDL.framework is actually ready to be
used in a bundle in its default state which seems to be the exception
to the rule. Typically the install_path embedded in the dylib or
framework is either just the name of the library OR the complete path
to the library/framework. So basically there needs to be an additional
check in the BundleUtilities.cmake file to look for an install_path
that begins with @executable_path or @loader_path and basically ignore
the next few steps where the install_path is fixed up and copied into
the bundle location. So look in the BundleUtilities.cmake file and see
if you can patch it up.
___________________________________________________________
Mike Jackson www.bluequartz.net
Principal Software Engineer mike.jackson at bluequartz.net
BlueQuartz Software Dayton, Ohio
On Mar 5, 2010, at 8:39 AM, Francisco Requena wrote:
> As on my previous my post, I got a bundle with SDL.framework embeeded.
> On OS X, you can either use .framework and .dylib binaries. So, I
> got to use the BundleUtilities macro.
>
> If CMake doesn't find the .framework, all works ok: I get 3
> libraries (libSDL..) on Content/MacOS folder.
> If CMake finds the .framework, it just doesn't know (or it seems)
> how to handle it. What can I do?
>
> Here's the CMakeLists.txt:
>
> cmake_minimum_required(VERSION 2.8)
>
> project(openvolt)
>
> set(APP_NAME OpenVolt)
>
> include(FindSDL)
> include(FindOpenGL)
>
> include_directories(${SDL_INCLUDE_DIR})
>
> add_executable(${APP_NAME} MACOSX_BUNDLE main.cpp)
>
> target_link_libraries(${APP_NAME} ${SDL_LIBRARY} ${OPENGL_LIBRARIES})
>
> string(REPLACE "-framework Cocoa" "" DIRS ${SDL_LIBRARY})
> install(CODE "
> include(BundleUtilities)
> fixup_bundle(\"${openvolt_BINARY_DIR}/${APP_NAME}.app\" \"\" \"$
> {DIRS}\")
> " COMPONENT Runtime)
>
>
> And here's the output when I do 'make install':
>
> [100%] Built target OpenVolt
> Install the project...
> -- Install configuration: ""
> -- fixup_bundle
> -- app='/Users/frarees/openvolt/build/OpenVolt.app'
> -- libs=''
> -- dirs='/Library/Frameworks/SDL.framework'
> -- fixup_bundle: preparing...
> -- warning: embedded item does not exist '/Users/frarees/openvolt/
> build/OpenVolt.app/Contents/Frameworks/SDL.framework/Versions/1.3/SDL'
> --
> warning: cannot resolve item '@executable_path/../Frameworks/
> SDL.framework/Versions/1.3/SDL'
>
> possible problems:
> need more directories?
> need to use InstallRequiredSystemLibraries?
> run in install tree instead of build tree?
>
> -- warning: embedded item does not exist '/Users/frarees/openvolt/
> build/OpenVolt.app/Contents/Frameworks/SDL.framework/Versions/1.3/SDL'
> --
> warning: cannot resolve item '@executable_path/../Frameworks/
> SDL.framework/Versions/1.3/SDL'
>
> possible problems:
> need more directories?
> need to use InstallRequiredSystemLibraries?
> run in install tree instead of build tree?
>
> -- fixup_bundle: copying...
> -- 1/4: *NOT* copying '/Users/frarees/openvolt/build/OpenVolt.app/
> Contents/MacOS/OpenVolt'
> -- 2/4: copying '@executable_path/../Frameworks/SDL.framework/
> Versions/1.3/SDL'
> -- fixup_bundle: fixing...
> -- 3/4: fixing up '/Users/frarees/openvolt/build/OpenVolt.app/
> Contents/MacOS/OpenVolt'
> -- 4/4: fixing up '/Users/frarees/openvolt/build/OpenVolt.app/
> Contents/Frameworks/SDL.framework/Versions/1.3/SDL'
> -- fixup_bundle: cleaning up...
> -- fixup_bundle: verifying...
> --
> =
> =
> =
> =
> =
> ======================================================================
> -- Analyzing app='/Users/frarees/openvolt/build/OpenVolt.app'
> -- bundle='/Users/frarees/openvolt/build/OpenVolt.app'
> -- executable='/Users/frarees/openvolt/build/OpenVolt.app/Contents/
> MacOS/OpenVolt'
> -- valid='1'
> -- executable file 1: /Users/frarees/openvolt/build/OpenVolt.app/
> Contents/MacOS/OpenVolt
> -- warning: embedded item does not exist '/Users/frarees/openvolt/
> build/OpenVolt.app/Contents/Frameworks/SDL.framework/Versions/1.3/SDL'
> --
> warning: cannot resolve item '@executable_path/../Frameworks/
> SDL.framework/Versions/1.3/SDL'
>
> possible problems:
> need more directories?
> need to use InstallRequiredSystemLibraries?
> run in install tree instead of build tree?
>
> -- verified='1'
> -- info='Verified 1 executable files in '/Users/frarees/openvolt/
> build/OpenVolt.app''
> --
> -- verified='1'
> -- info=''
> --
> -- fixup_bundle: done
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
More information about the CMake
mailing list