Please do post your info here as well.<div><br><br><div class="gmail_quote">On Wed, Nov 25, 2009 at 5:01 AM, Filip Wänström <span dir="ltr"><<a href="mailto:filip.wanstrom@tii.se">filip.wanstrom@tii.se</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Just wanted to add an update: I have managed to create a stand alone<br>
MacOSX OpenSceneGraph app that works. Basically it boils down to<br>
scripting the install_name_tool to create loader_paths that points<br>
correctly. I will create an example of this and will be posting that<br>
to the osg-users mailing list. I will post it here too if that's ok?<br>
<br>
Best regards<br>
<font color="#888888">/Filip<br>
</font><div><div></div><div class="h5"><br>
<br>
On Tue, Nov 24, 2009 at 3:23 PM, Filip Wänström <<a href="mailto:filip.wanstrom@tii.se">filip.wanstrom@tii.se</a>> wrote:<br>
> Hi my name is Filip Wänström and I'm new to this list.<br>
><br>
> I have recently(a few months) started to use CMake for all my<br>
> building. I find that it works well in most cases and probably is the<br>
> best alternative on the "market". Anyway, I like to stay cross<br>
> platform for my projects so I personally develop on a Mac but mostly<br>
> deliver on win32.<br>
><br>
> Building works fine for me (using Makefile gen for mac and VS for win)<br>
> but I have huge problems with the bundling process. On the Mac I want<br>
> to deliver an app using regular drag and drop as a self contained<br>
> bundle and on windows I want to deliver an installer.<br>
> I have managed to get a win32 installer working using the NSIS<br>
> facilities but it took a lot of extra scripting. On the Mac I have<br>
> been able to create the dragndrop bundle "installer" but it doesn't<br>
> really work. I assume there are some issues with<br>
> rpath/loader_path/executable_path.<br>
><br>
> For reference the app is an Openscenegraph app that is dependant on<br>
> quite a few libraries that need to be bundled as dll:s on win and<br>
> dylibs/.so on mac.<br>
><br>
> The question is: what is the current "best practices approaches" on<br>
> these platforms? I have found no complete examples.<br>
><br>
><br>
> Finally: parts of my cmake test case for win32: THis works fine and<br>
> creates a usable app that bundles the osg libs as well as a plugin and<br>
> data. It just doesn't feel very neat for being user code.<br>
><br>
><br>
> #Basic app test (packaging exercise)<br>
> SET(TARGET_BASIC_APP_SRC BasicApp.cpp BasicAppMain.cpp)<br>
> ADD_EXECUTABLE(BasicApp ${TARGET_BASIC_APP_SRC} )<br>
> TARGET_LINK_LIBRARIES(BasicApp ${MY_COMMON_LIBS})<br>
><br>
> IF(WIN32 AND NOT UNIX)<br>
> SET(CPACK_GENERATOR "NSIS")<br>
> INSTALL(<br>
> TARGETS BasicApp<br>
> DESTINATION bin<br>
> )<br>
><br>
> SET(OSG_DLL_DIR $ENV{OSG_ROOT}\\bin)<br>
> FILE(TO_CMAKE_PATH ${OSG_DLL_DIR} OSG_DLL_DIR_CPATH)<br>
> SET(CMAKE_INSTALL_DEBUG_LIBRARIES)<br>
> INCLUDE(InstallRequiredSystemLibraries)<br>
> SET(CPACK_PACKAGE_EXECUTABLES "BasicApp" "Basic App")<br>
><br>
> CONFIGURE_FILE(<br>
> "${CMAKE_MODULE_PATH}/<a href="http://dependencies.cmake.in" target="_blank">dependencies.cmake.in</a>"<br>
> "${CMAKE_CURRENT_BINARY_DIR}/dependencies.cmake"<br>
> @ONLY<br>
> )<br>
> INSTALL(CODE "set(input_file<br>
> \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/bin/BasicApp.exe \")")<br>
> INSTALL(SCRIPT "${CMAKE_CURRENT_BINARY_DIR}/dependencies.cmake")<br>
><br>
> SET(OSG_PLUGINS_DIR<br>
> "${OSG_DLL_DIR_CPATH}/osgPlugins-${OPENSCENEGRAPH_VERSION}")<br>
> MESSAGE("Installing plugins from: ${OSG_PLUGINS_DIR}")<br>
> # Extra plugin installs that the dependency checker can't find<br>
> INSTALL(<br>
> FILES "${OSG_PLUGINS_DIR}/osgdb_obj.dll"<br>
> DESTINATION bin)<br>
> # Install data that uses (at runtime) the plugin above<br>
> INSTALL(FILES<br>
> "${Dope_SOURCE_DIR}/data/models/clogo.obj"<br>
> "${Dope_SOURCE_DIR}/data/models/clogo.mtl"<br>
> DESTINATION data/models)<br>
><br>
> # Create shortcuts usin NSIS commands<br>
> SET(CPACK_NSIS_EXTRA_INSTALL_COMMANDS " CreateShortCut<br>
> '$INSTDIR\\\\shortcut.lnk' '$INSTDIR\\\\bin\\\\BasicApp.exe' ")<br>
><br>
> # Install vc90 sp1 redist<br>
> # windows update broke a lot of things so lets add an vcdist<br>
> dependant installer<br>
> INSTALL(FILES<br>
> "${Dope_SOURCE_DIR}/external/win32_vc9/win_extras/vcredist_x86.exe"<br>
> DESTINATION win32_extras/)<br>
><br>
> SET(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "ExecWait<br>
> '$INSTDIR\\\\win32_extras\\\\vcredist_x86.exe'")<br>
> ENDIF(WIN32 AND NOT UNIX)<br>
><br>
><br>
> # <a href="http://dependcies.cmake.in" target="_blank">dependcies.cmake.in</a> is:<br>
><br>
> if(NOT DEFINED input_file)<br>
> message(FATAL_ERROR "input file is not defined")<br>
> endif(NOT DEFINED input_file)<br>
> message("Using ${input_file}")<br>
> INCLUDE(GetPrerequisites)<br>
> GET_PREREQUISITES(${input_file} DEPENDENCIES 1 1 "" "")<br>
><br>
> FOREACH(DEPENDENCY ${DEPENDENCIES})<br>
> MESSAGE("DEPENDENCY: ${DEPENDENCY}")<br>
> GET_FILENAME_COMPONENT(DEPENDENCY_NAME "${DEPENDENCY}" NAME)<br>
> GET_FILENAME_COMPONENT(DEPENDENCY_ACTUAL "${DEPENDENCY}" REALPATH)<br>
> MESSAGE("DEPENDENCY_NAME: ${DEPENDENCY_NAME}")<br>
> MESSAGE("DEPENDENCY_ACTUAL: ${DEPENDENCY_ACTUAL}")<br>
> FIND_FILE(${DEPENDENCY_NAME}_REAL_PATH ${DEPENDENCY_NAME} )<br>
> MESSAGE("DEPENDENCY_REAL_PATH: ${${DEPENDENCY_NAME}_REAL_PATH}")<br>
><br>
> MESSAGE("installing into: ${CMAKE_INSTALL_PREFIX}/bin")<br>
> FILE(COPY ${${DEPENDENCY_NAME}_REAL_PATH} DESTINATION<br>
> "${CMAKE_INSTALL_PREFIX}/bin")<br>
> #INSTALL(FILES "${DEPENDENCY_REAL_PATH}" DESTINATION bin)<br>
> ENDFOREACH()<br>
><br>
> On the mac, I don't have any working code yet. I feel that I am close,<br>
> but as it is, the code cannot load the right plugin<br>
><br>
> IF (APPLE)<br>
> SET(MACOSX_BUNDLE_INFO_STRING "MACOSX_BUNDLE_INFO_STRING")<br>
> SET(MACOSX_BUNDLE_ICON_FILE "")<br>
> SET(MACOSX_BUNDLE_GUI_IDENTIFIER "BasicAppGuiId")<br>
> SET(MACOSX_BUNDLE_LONG_VERSION_STRING "long ver string")<br>
> SET(MACOSX_BUNDLE_BUNDLE_NAME "BasicAPpBundleName")<br>
> SET(MACOSX_BUNDLE_SHORT_VERSION_STRING "short ver")<br>
><br>
> # setup the bundle<br>
> SET(BasicApp_BUNDLE_NAME "BasicApp")<br>
> SET_TARGET_PROPERTIES(BasicApp PROPERTIES OUTPUT_NAME<br>
> ${BasicApp_BUNDLE_NAME})<br>
> SET(BasicApp_BUNDLE_LOCATION "${CMAKE_INSTALL_PREFIX}")<br>
> MESSAGE("ORIGINAL CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}")<br>
> # make sure CMAKE_INSTALL_PREFIX ends in /<br>
> STRING(LENGTH "${CMAKE_INSTALL_PREFIX}" LEN)<br>
> MATH(EXPR LEN "${LEN} -1" )<br>
> STRING(SUBSTRING "${CMAKE_INSTALL_PREFIX}" ${LEN} 1 ENDCH)<br>
> IF(NOT "${ENDCH}" STREQUAL "/")<br>
> SET(CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/")<br>
> ENDIF(NOT "${ENDCH}" STREQUAL "/")<br>
> SET(CMAKE_INSTALL_PREFIX<br>
> "${CMAKE_INSTALL_PREFIX}${BasicApp_BUNDLE_NAME}.app/Contents")<br>
><br>
> MESSAGE("CHANGED CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}")<br>
><br>
> INSTALL(<br>
> TARGETS BasicApp<br>
> RUNTIME DESTINATION bin<br>
> BUNDLE DESTINATION "." )<br>
><br>
> INSTALL(FILES ${Dope_SOURCE_DIR}/ReadMe.txt DESTINATION "." )<br>
><br>
> SET(BasicAppFullPath "${CMAKE_INSTALL_PREFIX}/MacOS/${BasicApp_BUNDLE_NAME}")<br>
> MESSAGE("BasicAppFullPath: ${BasicAppFullPath}")<br>
><br>
> # INSTALL(CODE "set(input_file \"/MacOS/${BasicApp_BUNDLE_NAME}\")")<br>
> MESSAGE("INSTALL CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}")<br>
> INSTALL(CODE "set(lib_path \"/usr/local/lib\")")<br>
> INSTALL(CODE "set(input_file<br>
> \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${BasicApp_BUNDLE_NAME}.app/Contents/MacOS/${BasicApp_BUNDLE_NAME}\")")<br>
> INSTALL(SCRIPT<br>
> "${Dope_SOURCE_DIR}/CMakeModules/CMakeIngestOSXBundleLibraries.cmake")<br>
><br>
> INSTALL(FILES<br>
> "${Dope_SOURCE_DIR}/data/models/clogo.obj"<br>
> "${Dope_SOURCE_DIR}/data/models/clogo.mtl"<br>
> DESTINATION<br>
> "./${BasicApp_BUNDLE_NAME}.app/Contents/Resources/data/models/")<br>
><br>
> MESSAGE("OSG VERSION: ${OPENSCENEGRAPH_VERSION}")<br>
><br>
> SET(OSG_PLUGINS_DIR<br>
> "/usr/local/lib/osgPlugins-${OPENSCENEGRAPH_VERSION}")<br>
> INSTALL(FILES<br>
> "${OSG_PLUGINS_DIR}/osgdb_obj.so"<br>
> DESTINATION<br>
> "./${BasicApp_BUNDLE_NAME}.app/Contents/PlugIns/osgPlugins-${OPENSCENEGRAPH_VERSION}/")<br>
><br>
> SET(CPACK_GENERATOR "DragNDrop")<br>
><br>
> ENDIF(APPLE)<br>
><br>
> I tried to use code from the cmake 2.8 qt dialog working example<br>
> (among other things, the CMakeIngestOSXBundleLibraries.cmake comes<br>
> from there)<br>
><br>
> Ok, first post over :)<br>
> /Filip<br>
><br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a><br>
</div></div></blockquote></div><br></div>