From 943eea81042fba0a4d22a59b60366273961405b5 Mon Sep 17 00:00:00 2001 From: Nikolay Kasyanov Date: Tue, 8 Mar 2011 22:27:57 +0300 Subject: [PATCH] .app bundle finally works --- CMakeLists.txt | 10 ++-------- apps/openmw/engine.cpp | 23 ++++++++++++++++++++++- files/mac/Info.plist | 2 +- 3 files changed, 25 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 108583273..bf0ed0dbd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -278,13 +278,6 @@ endif (APPLE) configure_file(${OpenMW_SOURCE_DIR}/files/openmw.cfg "${OpenMW_BINARY_DIR}/openmw.cfg") -#if (APPLE) -# set(APPLE_BUNDLE_RESOURCES -# ${OpenMW_BINARY_DIR}/openmw.cfg -# ${OpenMW_BINARY_DIR}/plugins.cfg -# ) -#endif (APPLE) - # Compiler settings if (CMAKE_COMPILER_IS_GNUCC) #add_definitions (-Wall -Werror) @@ -297,13 +290,14 @@ if (APPLE) ${OpenMW_BINARY_DIR}/openmw.cfg ${OpenMW_BINARY_DIR}/plugins.cfg) install(FILES ${MISC_FILES} DESTINATION ../MacOS) +install(DIRECTORY "${OpenMW_BINARY_DIR}/resources" DESTINATION ../Resources) set(CPACK_GENERATOR "Bundle") set(CPACK_BUNDLE_PLIST "${CMAKE_SOURCE_DIR}/files/mac/Info.plist") set(CPACK_BUNDLE_ICON "${CMAKE_SOURCE_DIR}/files/mac/openmw.icns") set(CPACK_BUNDLE_NAME "OpenMW") set(CPACK_PACKAGE_VERSION "0.10") set(CPACK_PACKAGE_VERSION_MAJOR "0") -set(CPACK_PACKAGE_VERSION_MINOR "09") +set(CPACK_PACKAGE_VERSION_MINOR "10") set(CPACK_PACKAGE_VERSION_PATCH "") include(CPack) diff --git a/apps/openmw/engine.cpp b/apps/openmw/engine.cpp index 9590968b5..7c289e435 100644 --- a/apps/openmw/engine.cpp +++ b/apps/openmw/engine.cpp @@ -39,6 +39,10 @@ #include +#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE +#include +#endif + #include #include "mwgui/class.hpp" #include "path.hpp" @@ -249,13 +253,30 @@ void OMW::Engine::addResourcesDirectory (const boost::filesystem::path& path) void OMW::Engine::setDataDir (const boost::filesystem::path& dataDir) { +#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE + // FIXME possibly hack, should use Carbon methods to get resource path + mDataDir = boost::filesystem::path(Ogre::macBundlePath() + "/Contents/Resources"); + mDataDir = mDataDir / dataDir; +#else mDataDir = boost::filesystem::system_complete (dataDir); +#endif + std::cout << "mDataDir: " << mDataDir << std::endl; + std::cout << "dataDir: " << dataDir << std::endl; + std::cout << "initial path: " << boost::filesystem::initial_path() << std::endl; + std::cout << "mac bundle path: " << Ogre::macBundlePath() << std::endl; } // Set resource dir void OMW::Engine::setResourceDir (const boost::filesystem::path& parResDir) { - mResDir = boost::filesystem::system_complete(parResDir); +#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE + // FIXME possibly hack, should use Carbon methods to get resource path + mResDir = boost::filesystem::path(Ogre::macBundlePath() + "/Contents/Resources"); + mResDir = mResDir / parResDir; +#else + mResDir = boost::filesystem::system_complete(parResDir); +#endif + } // Set start cell name (only interiors for now) diff --git a/files/mac/Info.plist b/files/mac/Info.plist index 77ec89618..6b350d250 100644 --- a/files/mac/Info.plist +++ b/files/mac/Info.plist @@ -19,7 +19,7 @@ CFBundleSignature ???? CFBundleVersion - 0.07 + 0.10 CSResourcesFileMapped LSRequiresCarbon