From 31749fc97b048af6f1abc5652ec673e301f20d1f Mon Sep 17 00:00:00 2001 From: Nikolay Kasyanov Date: Sat, 25 Jun 2011 19:29:11 +0400 Subject: [PATCH 1/4] Added include for Ogre::macBundlePath to main.cpp and removed such include from engine.cpp (no longer needed there). --- apps/openmw/engine.cpp | 4 ---- apps/openmw/main.cpp | 5 +++++ 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/apps/openmw/engine.cpp b/apps/openmw/engine.cpp index 709b21fc84..0d688a9f67 100644 --- a/apps/openmw/engine.cpp +++ b/apps/openmw/engine.cpp @@ -44,10 +44,6 @@ #include -#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE -#include -#endif - #include #include "mwgui/class.hpp" diff --git a/apps/openmw/main.cpp b/apps/openmw/main.cpp index 56f78afe32..81fbff2f2d 100644 --- a/apps/openmw/main.cpp +++ b/apps/openmw/main.cpp @@ -26,6 +26,11 @@ #endif +// for Ogre::macBundlePath +#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE +#include +#endif + using namespace std; /// Parse command line options and openmw.cfg file (if one exists). Results are directly From e48d265b5df4b2c223802f3125f6a0a96c78e5f3 Mon Sep 17 00:00:00 2001 From: Nikolay Kasyanov Date: Sun, 26 Jun 2011 20:15:42 +0400 Subject: [PATCH 2/4] Mac fix: added local config dir support, app root dir is dir where bundle located --- CMakeLists.txt | 11 ++++------- apps/openmw/main.cpp | 2 +- components/files/path.cpp | 11 ++++++----- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8e0c0c463a..58c4ebae0b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,9 +17,8 @@ if(DPKG_PROGRAM) set(MORROWIND_RESOURCE_FILES "/usr/share/games/openmw/resources/" CACHE PATH "location of OpenMW resources files") else() if (APPLE) - # set path inside bundle - set(MORROWIND_DATA_FILES "../data" CACHE PATH "location of Morrowind data files") - set(MORROWIND_RESOURCE_FILES "Contents/Resources/resources" CACHE PATH "location of OpenMW resources files") + set(MORROWIND_DATA_FILES "./data" CACHE PATH "location of Morrowind data files") + set(MORROWIND_RESOURCE_FILES "./resources" CACHE PATH "location of OpenMW resources files") else() set(MORROWIND_DATA_FILES "data" CACHE PATH "location of Morrowind data files") set(MORROWIND_RESOURCE_FILES "resources" CACHE PATH "location of OpenMW resources files") @@ -366,7 +365,7 @@ endif() if (APPLE) configure_file(${OpenMW_SOURCE_DIR}/files/plugins.cfg.mac - "${APP_BUNDLE_DIR}/Contents/MacOS/plugins.cfg") + "${OpenMW_BINARY_DIR}/plugins.cfg") configure_file(${OpenMW_SOURCE_DIR}/files/mac/Info.plist "${APP_BUNDLE_DIR}/Contents/Info.plist" COPYONLY) @@ -385,9 +384,6 @@ if (APPLE) configure_file(${OGRE_PLUGIN_DIR}/Plugin_ParticleFX.dylib "${APP_BUNDLE_DIR}/Contents/Plugins/Plugin_ParticleFX.dylib" COPYONLY) - configure_file(${OpenMW_SOURCE_DIR}/files/openmw.cfg - "${APP_BUNDLE_DIR}/Contents/MacOS/openmw.cfg") - endif (APPLE) @@ -398,6 +394,7 @@ if (CMAKE_COMPILER_IS_GNUCC) endif (CMAKE_COMPILER_IS_GNUCC) # Apple bundling +# TODO REWRITE! if (APPLE) set(MISC_FILES ${APP_BUNDLE_DIR}/Contents/MacOS/openmw.cfg diff --git a/apps/openmw/main.cpp b/apps/openmw/main.cpp index 81fbff2f2d..4df5111735 100644 --- a/apps/openmw/main.cpp +++ b/apps/openmw/main.cpp @@ -182,7 +182,7 @@ int main(int argc, char**argv) { #if OGRE_PLATFORM == OGRE_PLATFORM_APPLE // set current dir to bundle path - boost::filesystem::path bundlePath = boost::filesystem::path(Ogre::macBundlePath()); + boost::filesystem::path bundlePath = boost::filesystem::path(Ogre::macBundlePath()).parent_path(); boost::filesystem::current_path(bundlePath); #endif diff --git a/components/files/path.cpp b/components/files/path.cpp index a7b66822fd..4191c6014b 100644 --- a/components/files/path.cpp +++ b/components/files/path.cpp @@ -9,7 +9,7 @@ #include #endif -#if OGRE_PLATFORM == OGRE_PLATFORM_LINUX +#if OGRE_PLATFORM == OGRE_PLATFORM_LINUX || OGRE_PLATFORM == OGRE_PLATFORM_APPLE #include //getenv #endif @@ -19,7 +19,9 @@ std::string Files::getPath (PathTypeEnum parType, const std::string parApp, cons if (parType==Path_ConfigGlobal) { #if OGRE_PLATFORM == OGRE_PLATFORM_APPLE - theBasePath = Ogre::macBundlePath() + "/Contents/MacOS/"; //FIXME do we have global/local with OSX? + boost::filesystem::path path(Ogre::macBundlePath()); + path = path.parent_path(); + theBasePath = path.string() + "/"; #elif OGRE_PLATFORM == OGRE_PLATFORM_LINUX theBasePath = "/etc/"+parApp+"/"; #else @@ -29,9 +31,7 @@ std::string Files::getPath (PathTypeEnum parType, const std::string parApp, cons } else if (parType==Path_ConfigUser) { -#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE - theBasePath = Ogre::macBundlePath() + "/Contents/MacOS/"; //FIXME do we have global/local with OSX? -#elif OGRE_PLATFORM == OGRE_PLATFORM_LINUX +#if OGRE_PLATFORM == OGRE_PLATFORM_LINUX || OGRE_PLATFORM == OGRE_PLATFORM_APPLE const char* theDir; if ((theDir = getenv("OPENMW_HOME")) != NULL) { @@ -57,5 +57,6 @@ std::string Files::getPath (PathTypeEnum parType, const std::string parApp, cons } theBasePath.append(parFile); + std::cout << "theBasePath is " << theBasePath << std::endl; return theBasePath; } From b7c006b898ba93388742f053a3ffb39039525a94 Mon Sep 17 00:00:00 2001 From: Nikolay Kasyanov Date: Sun, 26 Jun 2011 21:15:29 +0400 Subject: [PATCH 3/4] Mac: further fixes for new resource folder location --- extern/caelum/CMakeLists.txt | 6 +----- extern/mygui_3.0.1/CMakeLists.txt | 6 +----- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/extern/caelum/CMakeLists.txt b/extern/caelum/CMakeLists.txt index 88ed51fad4..b747fefc8e 100755 --- a/extern/caelum/CMakeLists.txt +++ b/extern/caelum/CMakeLists.txt @@ -19,11 +19,7 @@ add_library(caelum STATIC ${SOURCES}) # # Resources # -if (APPLE) - SET(CAELUM_RES_DEST "${APP_BUNDLE_DIR}/Contents/Resources") -else (APPLE) - SET(CAELUM_RES_DEST "${OpenMW_BINARY_DIR}") -endif (APPLE) +SET(CAELUM_RES_DEST "${OpenMW_BINARY_DIR}") configure_file(${CMAKE_CURRENT_SOURCE_DIR}/resources/AtmosphereDepth.png "${CAELUM_RES_DEST}/resources/caelum/AtmosphereDepth.png" COPYONLY) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/resources/CaelumGroundFog.cg "${CAELUM_RES_DEST}/resources/caelum/CaelumGroundFog.cg" COPYONLY) diff --git a/extern/mygui_3.0.1/CMakeLists.txt b/extern/mygui_3.0.1/CMakeLists.txt index 8101ad91a7..d7e0bd4832 100644 --- a/extern/mygui_3.0.1/CMakeLists.txt +++ b/extern/mygui_3.0.1/CMakeLists.txt @@ -22,11 +22,7 @@ add_subdirectory(OgrePlatform) # Copy resource files into the build directory set(SDIR ${CMAKE_CURRENT_SOURCE_DIR}/openmw_resources) -if (APPLE) - set(DDIR ${APP_BUNDLE_DIR}/Contents/Resources/resources/mygui) -else (APPLE) - set(DDIR ${OpenMW_BINARY_DIR}/resources/mygui) -endif (APPLE) +set(DDIR ${OpenMW_BINARY_DIR}/resources/mygui) configure_file("${SDIR}/bigbars.png" "${DDIR}/bigbars.png" COPYONLY) configure_file("${SDIR}/black.png" "${DDIR}/black.png" COPYONLY) From ba55b51627d2f4b1fc7bfaee8b2c993f73422c15 Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Sun, 26 Jun 2011 21:29:22 +0200 Subject: [PATCH 4/4] removed a leftover debug message --- components/files/path.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/components/files/path.cpp b/components/files/path.cpp index 4191c6014b..d540f1c141 100644 --- a/components/files/path.cpp +++ b/components/files/path.cpp @@ -57,6 +57,5 @@ std::string Files::getPath (PathTypeEnum parType, const std::string parApp, cons } theBasePath.append(parFile); - std::cout << "theBasePath is " << theBasePath << std::endl; return theBasePath; }